Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int r0,r1,r2,a0=1,a1=0,a2,b0=0,b1=1,b2,q;
int main(void){
  scanf("%d %d", &r0, &r1);
  for(;r1>0;){
    q=r0/r1;
    r2=r0%r1;
    a2=a0-q*a1;
    b2=b0-q*b1;
    r0=r1,r1=r2;
    a0=a1,a1=a2;
    b0=b1,b1=b2;
  }
  printf("%d %d\n", a0, b0);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	r0
	.bss
	.align 4
	.type	r0, @object
	.size	r0, 4
r0:
	.zero	4
	.globl	r1
	.align 4
	.type	r1, @object
	.size	r1, 4
r1:
	.zero	4
	.globl	r2
	.align 4
	.type	r2, @object
	.size	r2, 4
r2:
	.zero	4
	.globl	a0
	.data
	.align 4
	.type	a0, @object
	.size	a0, 4
a0:
	.long	1
	.globl	a1
	.bss
	.align 4
	.type	a1, @object
	.size	a1, 4
a1:
	.zero	4
	.globl	a2
	.align 4
	.type	a2, @object
	.size	a2, 4
a2:
	.zero	4
	.globl	b0
	.align 4
	.type	b0, @object
	.size	b0, 4
b0:
	.zero	4
	.globl	b1
	.data
	.align 4
	.type	b1, @object
	.size	b1, 4
b1:
	.long	1
	.globl	b2
	.bss
	.align 4
	.type	b2, @object
	.size	b2, 4
b2:
	.zero	4
	.globl	q
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	r1(%rip), %rax
	movq	%rax, %rdx
	leaq	r0(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L3:
	movl	r0(%rip), %eax
	movl	r1(%rip), %esi
	cltd
	idivl	%esi
	movl	%eax, q(%rip)
	movl	r0(%rip), %eax
	movl	r1(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, r2(%rip)
	movl	a0(%rip), %eax
	movl	q(%rip), %ecx
	movl	a1(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, a2(%rip)
	movl	b0(%rip), %eax
	movl	q(%rip), %ecx
	movl	b1(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, b2(%rip)
	movl	r1(%rip), %eax
	movl	%eax, r0(%rip)
	movl	r2(%rip), %eax
	movl	%eax, r1(%rip)
	movl	a1(%rip), %eax
	movl	%eax, a0(%rip)
	movl	a2(%rip), %eax
	movl	%eax, a1(%rip)
	movl	b1(%rip), %eax
	movl	%eax, b0(%rip)
	movl	b2(%rip), %eax
	movl	%eax, b1(%rip)
.L2:
	movl	r1(%rip), %eax
	testl	%eax, %eax
	jg	.L3
	movl	b0(%rip), %edx
	movl	a0(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	r1(%rip), %rdx
	leaq	r0(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	r1(%rip), %ecx
	movl	b0(%rip), %r9d
	movl	a0(%rip), %r8d
	testl	%ecx, %ecx
	jle	.L3
	movl	r0(%rip), %eax
	movl	a0(%rip), %r10d
	movl	a1(%rip), %r8d
	movl	b0(%rip), %edi
	movl	b1(%rip), %r9d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%r11d, %r9d
	movl	%ebx, %r8d
	movl	%edx, %ecx
.L4:
	cltd
	movl	%r10d, %ebx
	movl	%r8d, %r10d
	idivl	%ecx
	movl	%eax, %esi
	imull	%r8d, %eax
	subl	%eax, %ebx
	movl	%esi, %eax
	imull	%r9d, %eax
	subl	%eax, %edi
	movl	%ecx, %eax
	movl	%edi, %r11d
	movl	%r9d, %edi
	testl	%edx, %edx
	jg	.L5
	movl	%esi, q(%rip)
	movl	%edx, r2(%rip)
	movl	%ebx, a2(%rip)
	movl	%r11d, b2(%rip)
	movl	%ecx, r0(%rip)
	movl	%edx, r1(%rip)
	movl	%r8d, a0(%rip)
	movl	%ebx, a1(%rip)
	movl	%r9d, b0(%rip)
	movl	%r11d, b1(%rip)
.L3:
	movl	%r9d, %ecx
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	b2
	.align 4
	.type	b2, @object
	.size	b2, 4
b2:
	.zero	4
	.globl	b1
	.data
	.align 4
	.type	b1, @object
	.size	b1, 4
b1:
	.long	1
	.globl	b0
	.bss
	.align 4
	.type	b0, @object
	.size	b0, 4
b0:
	.zero	4
	.globl	a2
	.align 4
	.type	a2, @object
	.size	a2, 4
a2:
	.zero	4
	.globl	a1
	.align 4
	.type	a1, @object
	.size	a1, 4
a1:
	.zero	4
	.globl	a0
	.data
	.align 4
	.type	a0, @object
	.size	a0, 4
a0:
	.long	1
	.globl	r2
	.bss
	.align 4
	.type	r2, @object
	.size	r2, 4
r2:
	.zero	4
	.globl	r1
	.align 4
	.type	r1, @object
	.size	r1, 4
r1:
	.zero	4
	.globl	r0
	.align 4
	.type	r0, @object
	.size	r0, 4
r0:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	r1(%rip), %rdx
	leaq	r0(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	r1(%rip), %ecx
	movl	b0(%rip), %r9d
	movl	a0(%rip), %r8d
	testl	%ecx, %ecx
	jle	.L3
	movl	r0(%rip), %eax
	movl	a0(%rip), %r10d
	movl	a1(%rip), %r8d
	movl	b0(%rip), %edi
	movl	b1(%rip), %r9d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%r11d, %r9d
	movl	%ebx, %r8d
	movl	%edx, %ecx
.L4:
	cltd
	movl	%r10d, %ebx
	movl	%r8d, %r10d
	idivl	%ecx
	movl	%eax, %esi
	imull	%r8d, %eax
	subl	%eax, %ebx
	movl	%esi, %eax
	imull	%r9d, %eax
	subl	%eax, %edi
	movl	%ecx, %eax
	movl	%edi, %r11d
	movl	%r9d, %edi
	testl	%edx, %edx
	jg	.L5
	movl	%esi, q(%rip)
	movl	%edx, r2(%rip)
	movl	%ebx, a2(%rip)
	movl	%r11d, b2(%rip)
	movl	%ecx, r0(%rip)
	movl	%edx, r1(%rip)
	movl	%r8d, a0(%rip)
	movl	%ebx, a1(%rip)
	movl	%r9d, b0(%rip)
	movl	%r11d, b1(%rip)
.L3:
	movl	%r9d, %ecx
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	b2
	.align 4
	.type	b2, @object
	.size	b2, 4
b2:
	.zero	4
	.globl	b1
	.data
	.align 4
	.type	b1, @object
	.size	b1, 4
b1:
	.long	1
	.globl	b0
	.bss
	.align 4
	.type	b0, @object
	.size	b0, 4
b0:
	.zero	4
	.globl	a2
	.align 4
	.type	a2, @object
	.size	a2, 4
a2:
	.zero	4
	.globl	a1
	.align 4
	.type	a1, @object
	.size	a1, 4
a1:
	.zero	4
	.globl	a0
	.data
	.align 4
	.type	a0, @object
	.size	a0, 4
a0:
	.long	1
	.globl	r2
	.bss
	.align 4
	.type	r2, @object
	.size	r2, 4
r2:
	.zero	4
	.globl	r1
	.align 4
	.type	r1, @object
	.size	r1, 4
r1:
	.zero	4
	.globl	r0
	.align 4
	.type	r0, @object
	.size	r0, 4
r0:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>

int r0,r1,r2,a0=1,a1=0,a2,b0=0,b1=1,b2,q;
int main(void){
  scanf("%d %d", &r0, &r1);
  for(;r1>0;){
    q=r0/r1;
    r2=r0%r1;
    a2=a0-q*a1;
    b2=b0-q*b1;
    r0=r1,r1=r2;
    a0=a1,a1=a2;
    b0=b1,b1=b2;
  }
  printf("%d %d\n", a0, b0);
  return 0;
}

5 8
 5 15
 5 1
 5 2
 15 2
 55 2
 61 2
 47 2
 11 2
 6 8

-3 2
 1 0
 0 1
 1 -2
 1 -7
 1 -27
 1 -30
 1 -23
 1 -5
 -1 1

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int r0,r1,r2,a0=1,a1=0,a2,b0=0,b1=1,b2,q;
int main(void){
  scanf("%d %d", &r0, &r1);
  for(;r1>0;){
    q=r0/r1;
    r2=r0%r1;
    a2=a0-q*a1;
    b2=b0-q*b1;
    r0=r1,r1=r2;
    a0=a1,a1=a2;
    b0=b1,b1=b2;
  }
  printf("%d %d\n", a0, b0);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	r0
	.bss
	.align 4
	.type	r0, @object
	.size	r0, 4
r0:
	.zero	4
	.globl	r1
	.align 4
	.type	r1, @object
	.size	r1, 4
r1:
	.zero	4
	.globl	r2
	.align 4
	.type	r2, @object
	.size	r2, 4
r2:
	.zero	4
	.globl	a0
	.data
	.align 4
	.type	a0, @object
	.size	a0, 4
a0:
	.long	1
	.globl	a1
	.bss
	.align 4
	.type	a1, @object
	.size	a1, 4
a1:
	.zero	4
	.globl	a2
	.align 4
	.type	a2, @object
	.size	a2, 4
a2:
	.zero	4
	.globl	b0
	.align 4
	.type	b0, @object
	.size	b0, 4
b0:
	.zero	4
	.globl	b1
	.data
	.align 4
	.type	b1, @object
	.size	b1, 4
b1:
	.long	1
	.globl	b2
	.bss
	.align 4
	.type	b2, @object
	.size	b2, 4
b2:
	.zero	4
	.globl	q
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	r1(%rip), %rax
	movq	%rax, %rdx
	leaq	r0(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L3:
	movl	r0(%rip), %eax
	movl	r1(%rip), %esi
	cltd
	idivl	%esi
	movl	%eax, q(%rip)
	movl	r0(%rip), %eax
	movl	r1(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, r2(%rip)
	movl	a0(%rip), %eax
	movl	q(%rip), %ecx
	movl	a1(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, a2(%rip)
	movl	b0(%rip), %eax
	movl	q(%rip), %ecx
	movl	b1(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, b2(%rip)
	movl	r1(%rip), %eax
	movl	%eax, r0(%rip)
	movl	r2(%rip), %eax
	movl	%eax, r1(%rip)
	movl	a1(%rip), %eax
	movl	%eax, a0(%rip)
	movl	a2(%rip), %eax
	movl	%eax, a1(%rip)
	movl	b1(%rip), %eax
	movl	%eax, b0(%rip)
	movl	b2(%rip), %eax
	movl	%eax, b1(%rip)
.L2:
	movl	r1(%rip), %eax
	testl	%eax, %eax
	jg	.L3
	movl	b0(%rip), %edx
	movl	a0(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	r0
	.bss
	.align 4
	.type	r0, @object
	.size	r0, 4
r0:
	.zero	4
	.globl	r1
	.align 4
	.type	r1, @object
	.size	r1, 4
r1:
	.zero	4
	.globl	r2
	.align 4
	.type	r2, @object
	.size	r2, 4
r2:
	.zero	4
	.globl	a0
	.data
	.align 4
	.type	a0, @object
	.size	a0, 4
a0:
	.long	1
	.globl	a1
	.bss
	.align 4
	.type	a1, @object
	.size	a1, 4
a1:
	.zero	4
	.globl	a2
	.align 4
	.type	a2, @object
	.size	a2, 4
a2:
	.zero	4
	.globl	b0
	.align 4
	.type	b0, @object
	.size	b0, 4
b0:
	.zero	4
	.globl	b1
	.data
	.align 4
	.type	b1, @object
	.size	b1, 4
b1:
	.long	1
	.globl	b2
	.bss
	.align 4
	.type	b2, @object
	.size	b2, 4
b2:
	.zero	4
	.globl	q
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	r1(%rip), %rax
	movq	%rax, %rdx
	leaq	r0(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L3:
	movl	r0(%rip), %eax
	movl	r1(%rip), %esi
	cltd
	idivl	%esi
	movl	%eax, q(%rip)
	movl	r0(%rip), %eax
	movl	r1(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, r2(%rip)
	movl	a0(%rip), %eax
	movl	q(%rip), %ecx
	movl	a1(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, a2(%rip)
	movl	b0(%rip), %eax
	movl	q(%rip), %ecx
	movl	b1(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, b2(%rip)
	movl	r1(%rip), %eax
	movl	%eax, r0(%rip)
	movl	r2(%rip), %eax
	movl	%eax, r1(%rip)
	movl	a1(%rip), %eax
	movl	%eax, a0(%rip)
	movl	a2(%rip), %eax
	movl	%eax, a1(%rip)
	movl	b1(%rip), %eax
	movl	%eax, b0(%rip)
	movl	b2(%rip), %eax
	movl	%eax, b1(%rip)
.L2:
	movl	r1(%rip), %eax
	testl	%eax, %eax
	jg	.L3
	movl	b0(%rip), %edx
	movl	a0(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
