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 main(void){
    int a,b,c,q;
    int x1,x2,y1,y2,z;
    int flg=0;
    scanf("%d %d",&a,&b);
    x1=1;x2=0;y1=0;y2=1;
    if(a<b){c=a;a=b;b=c;flg=1;}
    while(1){
        q=a/b;c=a%b;
        if(c==0){break;}
        z=x1-x2*q;x1=x2;x2=z;
        z=y1-y2*q;y1=y2;y2=z;
        a=b;b=c;
    }
    if(flg==1){c=x2;x2=y2;y2=c;}
    printf("%d %d\n",x2,y2);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -24(%rbp)
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$1, -28(%rbp)
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L5
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	$1, -24(%rbp)
.L5:
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%eax, -16(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -20(%rbp)
	cmpl	$0, -20(%rbp)
	je	.L10
	movl	-36(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L5
.L10:
	nop
	cmpl	$1, -24(%rbp)
	jne	.L6
	movl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -28(%rbp)
.L6:
	movl	-28(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	(%rsp), %ecx
	movl	4(%rsp), %esi
	cmpl	%esi, %ecx
	jge	.L2
	movl	%esi, %eax
	movl	%esi, (%rsp)
	cltd
	movl	%ecx, 4(%rsp)
	idivl	%ecx
	movl	%edx, %r8d
	testl	%edx, %edx
	je	.L7
	movl	$1, %ebx
	jmp	.L5
.L2:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %r8d
	testl	%edx, %edx
	je	.L10
	movl	%esi, %ecx
	xorl	%ebx, %ebx
.L5:
	movl	$1, %edi
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	movl	$1, %edx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%r11d, %edi
	movl	%ebp, %ecx
.L4:
	movl	%r9d, %r11d
	movl	%r9d, %esi
	movl	%r8d, %ebp
	imull	%eax, %r11d
	imull	%edi, %eax
	subl	%r11d, %edx
	subl	%eax, %r10d
	movl	%ecx, %eax
	movl	%edx, %r9d
	cltd
	movl	%r10d, %r11d
	movl	%edi, %r10d
	idivl	%r8d
	movl	%edx, %r8d
	movl	%esi, %edx
	testl	%r8d, %r8d
	jne	.L8
	movl	%ecx, (%rsp)
	movl	%r9d, %r8d
	movl	%ebp, 4(%rsp)
	cmpl	$1, %ebx
	je	.L14
.L3:
	xorl	%eax, %eax
	movl	%r11d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	movl	%r11d, %r8d
	movl	%r9d, %r11d
	jmp	.L3
.L10:
	movl	$1, %r11d
	jmp	.L3
.L7:
	xorl	%r11d, %r11d
	movl	$1, %r8d
	jmp	.L3
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	(%rsp), %ecx
	movl	4(%rsp), %esi
	cmpl	%esi, %ecx
	jge	.L2
	movl	%esi, %eax
	movl	%esi, (%rsp)
	cltd
	movl	%ecx, 4(%rsp)
	idivl	%ecx
	movl	%edx, %r8d
	testl	%edx, %edx
	je	.L7
	movl	$1, %ebx
	jmp	.L5
.L2:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %r8d
	testl	%edx, %edx
	je	.L10
	movl	%esi, %ecx
	xorl	%ebx, %ebx
.L5:
	movl	$1, %edi
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	movl	$1, %edx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%r11d, %edi
	movl	%ebp, %ecx
.L4:
	movl	%r9d, %r11d
	movl	%r9d, %esi
	movl	%r8d, %ebp
	imull	%eax, %r11d
	imull	%edi, %eax
	subl	%r11d, %edx
	subl	%eax, %r10d
	movl	%ecx, %eax
	movl	%edx, %r9d
	cltd
	movl	%r10d, %r11d
	movl	%edi, %r10d
	idivl	%r8d
	movl	%edx, %r8d
	movl	%esi, %edx
	testl	%r8d, %r8d
	jne	.L8
	movl	%ecx, (%rsp)
	movl	%r9d, %r8d
	movl	%ebp, 4(%rsp)
	cmpl	$1, %ebx
	je	.L14
.L3:
	xorl	%eax, %eax
	movl	%r11d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	movl	%r11d, %r8d
	movl	%r9d, %r11d
	jmp	.L3
.L10:
	movl	$1, %r11d
	jmp	.L3
.L7:
	xorl	%r11d, %r11d
	movl	$1, %r8d
	jmp	.L3
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include <stdio.h>

int main(void){
    int a,b,c,q;
    int x1,x2,y1,y2,z;
    int flg=0;
    scanf("%d %d",&a,&b);
    x1=1;x2=0;y1=0;y2=1;
    if(a<b){c=a;a=b;b=c;flg=1;}
    while(1){
        q=a/b;c=a%b;
        if(c==0){break;}
        z=x1-x2*q;x1=x2;x2=z;
        z=y1-y2*q;y1=y2;y2=z;
        a=b;b=c;
    }
    if(flg==1){c=x2;x2=y2;y2=c;}
    printf("%d %d\n",x2,y2);
}

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 main(void){
    int a,b,c,q;
    int x1,x2,y1,y2,z;
    int flg=0;
    scanf("%d %d",&a,&b);
    x1=1;x2=0;y1=0;y2=1;
    if(a<b){c=a;a=b;b=c;flg=1;}
    while(1){
        q=a/b;c=a%b;
        if(c==0){break;}
        z=x1-x2*q;x1=x2;x2=z;
        z=y1-y2*q;y1=y2;y2=z;
        a=b;b=c;
    }
    if(flg==1){c=x2;x2=y2;y2=c;}
    printf("%d %d\n",x2,y2);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -24(%rbp)
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$1, -28(%rbp)
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L5
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	$1, -24(%rbp)
.L5:
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%eax, -16(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -20(%rbp)
	cmpl	$0, -20(%rbp)
	je	.L10
	movl	-36(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L5
.L10:
	nop
	cmpl	$1, -24(%rbp)
	jne	.L6
	movl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -28(%rbp)
.L6:
	movl	-28(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.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
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -24(%rbp)
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$1, -28(%rbp)
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L5
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	$1, -24(%rbp)
.L5:
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%eax, -16(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -20(%rbp)
	cmpl	$0, -20(%rbp)
	je	.L10
	movl	-36(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -44(%rbp)
	jmp	.L5
.L10:
	nop
	cmpl	$1, -24(%rbp)
	jne	.L6
	movl	-36(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -28(%rbp)
.L6:
	movl	-28(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.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:
