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>
long gcd2(long a, long b){
	long t;
	if(a<b){
		t = a;
		a = b;
		b = t;
	}
	t = a % b;
	while(t!=0){
		a = b;
		b = t;
		t = a % b;
	}
	return b;
}
long n, x;
int main(void){
  scanf("%ld%ld", &n, &x);
  printf("%ld\n", (n-gcd2(n,x))*3);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd2
	.type	gcd2, @function
gcd2:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jge	.L2
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
.L2:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	jmp	.L3
.L4:
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
.L3:
	cmpq	$0, -8(%rbp)
	jne	.L4
	movq	-32(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd2, .-gcd2
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	x
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%ld%ld"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$8, %rsp
	.cfi_offset 3, -24
	leaq	x(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rbx
	movq	x(%rip), %rdx
	movq	n(%rip), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd2
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.globl	gcd2
	.type	gcd2, @function
gcd2:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	cmpq	%rsi, %rdi
	jge	.L2
	movq	%rsi, %rax
	movq	%rdi, %rsi
.L2:
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rsi, %rax
	movq	%rdx, %r8
	cqto
	movq	%r8, %rsi
	idivq	%r8
	testq	%rdx, %rdx
	jne	.L4
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rsi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd2, .-gcd2
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	leaq	.LC0(%rip), %rdi
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	x(%rip), %rdx
	xorl	%eax, %eax
	leaq	n(%rip), %rsi
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rdi
	movq	x(%rip), %rcx
	movq	%rdi, %rax
	cmpq	%rcx, %rdi
	jge	.L9
	movq	%rcx, %rax
	movq	%rdi, %rcx
.L9:
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	je	.L13
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rdx, %rcx
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	jne	.L11
.L10:
	subq	%rsi, %rdi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	leaq	(%rdi,%rdi,2), %rdx
	movl	$1, %edi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	movq	%rcx, %rsi
	jmp	.L10
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	x
	.bss
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.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
	.p2align 4
	.globl	gcd2
	.type	gcd2, @function
gcd2:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	cmpq	%rsi, %rdi
	jge	.L2
	movq	%rsi, %rax
	movq	%rdi, %rsi
.L2:
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rsi, %rax
	movq	%rdx, %r8
	cqto
	movq	%r8, %rsi
	idivq	%r8
	testq	%rdx, %rdx
	jne	.L4
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rsi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd2, .-gcd2
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	leaq	.LC0(%rip), %rdi
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	x(%rip), %rdx
	xorl	%eax, %eax
	leaq	n(%rip), %rsi
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rdi
	movq	x(%rip), %rcx
	movq	%rdi, %rax
	cmpq	%rcx, %rdi
	jge	.L9
	movq	%rcx, %rax
	movq	%rdi, %rcx
.L9:
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	je	.L13
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rdx, %rcx
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	jne	.L11
.L10:
	subq	%rsi, %rdi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	leaq	(%rdi,%rdi,2), %rdx
	movl	$1, %edi
	call	__printf_chk@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	movq	%rcx, %rsi
	jmp	.L10
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	x
	.bss
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.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>
long gcd2(long a, long b){
	long t;
	if(a<b){
		t = a;
		a = b;
		b = t;
	}
	t = a % b;
	while(t!=0){
		a = b;
		b = t;
		t = a % b;
	}
	return b;
}
long n, x;
int main(void){
  scanf("%ld%ld", &n, &x);
  printf("%ld\n", (n-gcd2(n,x))*3);
}

5 4
 7 4
 6 1
 9 4
 6 3
 14 4
 8 1
 28 4
 15 2
 28 3

12
 18
 15
 24
 9
 36
 21
 72
 42
 81

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>
long gcd2(long a, long b){
	long t;
	if(a<b){
		t = a;
		a = b;
		b = t;
	}
	t = a % b;
	while(t!=0){
		a = b;
		b = t;
		t = a % b;
	}
	return b;
}
long n, x;
int main(void){
  scanf("%ld%ld", &n, &x);
  printf("%ld\n", (n-gcd2(n,x))*3);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd2
	.type	gcd2, @function
gcd2:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jge	.L2
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
.L2:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	jmp	.L3
.L4:
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
.L3:
	cmpq	$0, -8(%rbp)
	jne	.L4
	movq	-32(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd2, .-gcd2
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	x
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%ld%ld"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$8, %rsp
	.cfi_offset 3, -24
	leaq	x(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rbx
	movq	x(%rip), %rdx
	movq	n(%rip), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd2
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	gcd2
	.type	gcd2, @function
gcd2:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jge	.L2
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
.L2:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	jmp	.L3
.L4:
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
.L3:
	cmpq	$0, -8(%rbp)
	jne	.L4
	movq	-32(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd2, .-gcd2
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	x
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%ld%ld"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$8, %rsp
	.cfi_offset 3, -24
	leaq	x(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rbx
	movq	x(%rip), %rdx
	movq	n(%rip), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd2
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
