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

```c
#include <stdio.h>
#define ll int
ll exgcd(ll p,ll q,ll*x,ll*y){
	ll tx,ty,t,x2=0,y2=1;
	*x=1;*y=0;
	while(q){
		tx=*x-p/q*x2;*x=x2;x2=tx;
		ty=*y-p/q*y2;*y=y2;y2=ty;
		t=p%q;p=q;q=t;
	}
	return p;
}

int main(){
	int p,q;
	scanf("%d%d",&p,&q);
	ll a,b;
	exgcd(p,q,&a,&b);	
	printf("%d %d\n",a,b);
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	exgcd
	.type	exgcd, @function
exgcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, (%rdx)
	movl	%edi, %eax
	movq	%rdx, %r10
	movl	$0, (%rcx)
	testl	%esi, %esi
	je	.L2
	movl	$1, %r8d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L3:
	cltd
	movl	%edi, %r9d
	idivl	%esi
	movl	%eax, %r11d
	imull	%r8d, %eax
	imull	%edi, %r11d
	movl	(%r10), %edi
	movl	%r9d, (%r10)
	movl	%r8d, %r9d
	movl	(%rcx), %r8d
	movl	%r9d, (%rcx)
	subl	%eax, %r8d
	subl	%r11d, %edi
	movl	%esi, %eax
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L3
.L2:
	ret
	.cfi_endproc
.LFE23:
	.size	exgcd, .-exgcd
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	movl	(%rsp), %eax
	testl	%ecx, %ecx
	je	.L13
	xorl	%edi, %edi
	movl	$1, %esi
	movl	$1, %r9d
	xorl	%r8d, %r8d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%r10d, %r9d
	movl	%r11d, %r8d
.L11:
	cltd
	idivl	%ecx
	movl	%eax, %r10d
	imull	%r9d, %eax
	imull	%r8d, %r10d
	subl	%eax, %edi
	movl	%ecx, %eax
	movl	%edx, %ecx
	subl	%r10d, %esi
	movl	%edi, %r10d
	movl	%r9d, %edi
	movl	%esi, %r11d
	movl	%r8d, %esi
	testl	%edx, %edx
	jne	.L14
.L10:
	xorl	%eax, %eax
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r9d, %r9d
	movl	$1, %r8d
	jmp	.L10
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	exgcd
	.type	exgcd, @function
exgcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, (%rdx)
	movl	%edi, %eax
	movq	%rdx, %r10
	movl	$0, (%rcx)
	testl	%esi, %esi
	je	.L2
	movl	$1, %r8d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L3:
	cltd
	movl	%edi, %r9d
	idivl	%esi
	movl	%eax, %r11d
	imull	%r8d, %eax
	imull	%edi, %r11d
	movl	(%r10), %edi
	movl	%r9d, (%r10)
	movl	%r8d, %r9d
	movl	(%rcx), %r8d
	movl	%r9d, (%rcx)
	subl	%eax, %r8d
	subl	%r11d, %edi
	movl	%esi, %eax
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L3
.L2:
	ret
	.cfi_endproc
.LFE23:
	.size	exgcd, .-exgcd
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	movl	(%rsp), %eax
	testl	%ecx, %ecx
	je	.L13
	xorl	%edi, %edi
	movl	$1, %esi
	movl	$1, %r9d
	xorl	%r8d, %r8d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%r10d, %r9d
	movl	%r11d, %r8d
.L11:
	cltd
	idivl	%ecx
	movl	%eax, %r10d
	imull	%r9d, %eax
	imull	%r8d, %r10d
	subl	%eax, %edi
	movl	%ecx, %eax
	movl	%edx, %ecx
	subl	%r10d, %esi
	movl	%edi, %r10d
	movl	%r9d, %edi
	movl	%esi, %r11d
	movl	%r8d, %esi
	testl	%edx, %edx
	jne	.L14
.L10:
	xorl	%eax, %eax
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r9d, %r9d
	movl	$1, %r8d
	jmp	.L10
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	exgcd
	.type	exgcd, @function
exgcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, (%rdx)
	movl	%edi, %eax
	movq	%rdx, %r10
	movl	$0, (%rcx)
	testl	%esi, %esi
	je	.L2
	movl	$1, %r8d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L3:
	cltd
	movl	%edi, %r9d
	idivl	%esi
	movl	%eax, %r11d
	imull	%r8d, %eax
	imull	%edi, %r11d
	movl	(%r10), %edi
	movl	%r9d, (%r10)
	movl	%r8d, %r9d
	movl	(%rcx), %r8d
	movl	%r9d, (%rcx)
	subl	%eax, %r8d
	subl	%r11d, %edi
	movl	%esi, %eax
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L3
.L2:
	ret
	.cfi_endproc
.LFE23:
	.size	exgcd, .-exgcd
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	movl	(%rsp), %eax
	testl	%ecx, %ecx
	je	.L13
	xorl	%edi, %edi
	movl	$1, %esi
	movl	$1, %r9d
	xorl	%r8d, %r8d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%r10d, %r9d
	movl	%r11d, %r8d
.L11:
	cltd
	idivl	%ecx
	movl	%eax, %r10d
	imull	%r9d, %eax
	imull	%r8d, %r10d
	subl	%eax, %edi
	movl	%ecx, %eax
	movl	%edx, %ecx
	subl	%r10d, %esi
	movl	%edi, %r10d
	movl	%r9d, %edi
	movl	%esi, %r11d
	movl	%r8d, %esi
	testl	%edx, %edx
	jne	.L14
.L10:
	xorl	%eax, %eax
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r9d, %r9d
	movl	$1, %r8d
	jmp	.L10
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:
```
```c
#include <stdio.h>
#define ll int
ll exgcd(ll p,ll q,ll*x,ll*y){
	ll tx,ty,t,x2=0,y2=1;
	*x=1;*y=0;
	while(q){
		tx=*x-p/q*x2;*x=x2;x2=tx;
		ty=*y-p/q*y2;*y=y2;y2=ty;
		t=p%q;p=q;q=t;
	}
	return p;
}

int main(){
	int p,q;
	scanf("%d%d",&p,&q);
	ll a,b;
	exgcd(p,q,&a,&b);	
	printf("%d %d\n",a,b);
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define ll int
ll exgcd(ll p,ll q,ll*x,ll*y){
	ll tx,ty,t,x2=0,y2=1;
	*x=1;*y=0;
	while(q){
		tx=*x-p/q*x2;*x=x2;x2=tx;
		ty=*y-p/q*y2;*y=y2;y2=ty;
		t=p%q;p=q;q=t;
	}
	return p;
}

int main(){
	int p,q;
	scanf("%d%d",&p,&q);
	ll a,b;
	exgcd(p,q,&a,&b);	
	printf("%d %d\n",a,b);
}
```

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.
Optimized Assembly Code:

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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define ll int
ll exgcd(ll p,ll q,ll*x,ll*y){
	ll tx,ty,t,x2=0,y2=1;
	*x=1;*y=0;
	while(q){
		tx=*x-p/q*x2;*x=x2;x2=tx;
		ty=*y-p/q*y2;*y=y2;y2=ty;
		t=p%q;p=q;q=t;
	}
	return p;
}

int main(){
	int p,q;
	scanf("%d%d",&p,&q);
	ll a,b;
	exgcd(p,q,&a,&b);	
	printf("%d %d\n",a,b);
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	exgcd
	.type	exgcd, @function
exgcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, (%rdx)
	movl	%edi, %eax
	movq	%rdx, %r10
	movl	$0, (%rcx)
	testl	%esi, %esi
	je	.L2
	movl	$1, %r8d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L3:
	cltd
	movl	%edi, %r9d
	idivl	%esi
	movl	%eax, %r11d
	imull	%r8d, %eax
	imull	%edi, %r11d
	movl	(%r10), %edi
	movl	%r9d, (%r10)
	movl	%r8d, %r9d
	movl	(%rcx), %r8d
	movl	%r9d, (%rcx)
	subl	%eax, %r8d
	subl	%r11d, %edi
	movl	%esi, %eax
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L3
.L2:
	ret
	.cfi_endproc
.LFE23:
	.size	exgcd, .-exgcd
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	movl	(%rsp), %eax
	testl	%ecx, %ecx
	je	.L13
	xorl	%edi, %edi
	movl	$1, %esi
	movl	$1, %r9d
	xorl	%r8d, %r8d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%r10d, %r9d
	movl	%r11d, %r8d
.L11:
	cltd
	idivl	%ecx
	movl	%eax, %r10d
	imull	%r9d, %eax
	imull	%r8d, %r10d
	subl	%eax, %edi
	movl	%ecx, %eax
	movl	%edx, %ecx
	subl	%r10d, %esi
	movl	%edi, %r10d
	movl	%r9d, %edi
	movl	%esi, %r11d
	movl	%r8d, %esi
	testl	%edx, %edx
	jne	.L14
.L10:
	xorl	%eax, %eax
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r9d, %r9d
	movl	$1, %r8d
	jmp	.L10
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	exgcd
	.type	exgcd, @function
exgcd:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, (%rdx)
	movl	%edi, %eax
	movq	%rdx, %r10
	movl	$0, (%rcx)
	testl	%esi, %esi
	je	.L2
	movl	$1, %r8d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L3:
	cltd
	movl	%edi, %r9d
	idivl	%esi
	movl	%eax, %r11d
	imull	%r8d, %eax
	imull	%edi, %r11d
	movl	(%r10), %edi
	movl	%r9d, (%r10)
	movl	%r8d, %r9d
	movl	(%rcx), %r8d
	movl	%r9d, (%rcx)
	subl	%eax, %r8d
	subl	%r11d, %edi
	movl	%esi, %eax
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L3
.L2:
	ret
	.cfi_endproc
.LFE23:
	.size	exgcd, .-exgcd
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	movl	(%rsp), %eax
	testl	%ecx, %ecx
	je	.L13
	xorl	%edi, %edi
	movl	$1, %esi
	movl	$1, %r9d
	xorl	%r8d, %r8d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%r10d, %r9d
	movl	%r11d, %r8d
.L11:
	cltd
	idivl	%ecx
	movl	%eax, %r10d
	imull	%r9d, %eax
	imull	%r8d, %r10d
	subl	%eax, %edi
	movl	%ecx, %eax
	movl	%edx, %ecx
	subl	%r10d, %esi
	movl	%edi, %r10d
	movl	%r9d, %edi
	movl	%esi, %r11d
	movl	%r8d, %esi
	testl	%edx, %edx
	jne	.L14
.L10:
	xorl	%eax, %eax
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r9d, %r9d
	movl	$1, %r8d
	jmp	.L10
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:
```