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>
typedef unsigned long long ll;

ll gcd(ll a, ll b){
        ll tmp;
        if(a<b){
                tmp = a;
                a = b;
                b = tmp;
        }
        while(b){
                tmp = a;
                a = b;
                b = tmp%b;
        }
        return a;
}

ll lcm(ll a, ll b){
        return a / gcd(a, b) * b;
}


ll main(void){
        ll n; scanf("%llu", &n);
        ll a[n], i;
        for(i=0; i<n; i++) scanf("%llu", &a[i]);

        ll ans = 0;
        for(i=1; i<(1<<n); i++){
                ll tmp=1, j;
                for(j=0; j<n; j++){
                        if((i>>j)&1) tmp = lcm(tmp, a[j]);
                }
                ll can = 1;
                for(j=0; j<n; j++){
                        if(((i>>j)&1)==0 && tmp%a[j]==0) can = 0;
                }
                ans += can;
        }

        printf("%llu\n", ans);
        return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd
	.type	gcd, @function
gcd:
.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
	jnb	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L3
.L4:
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-32(%rbp)
	movq	%rdx, -32(%rbp)
.L3:
	cmpq	$0, -32(%rbp)
	jne	.L4
	movq	-24(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd, .-gcd
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	imulq	-16(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%llu"
.LC1:
	.string	"%llu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-120(%rbp), %rax
	movq	%rax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %r14
	movl	$0, %r15d
	movq	%rax, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -64(%rbp)
	movq	$0, -112(%rbp)
	jmp	.L12
.L13:
	movq	-112(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -112(%rbp)
.L12:
	movq	-120(%rbp), %rax
	cmpq	%rax, -112(%rbp)
	jb	.L13
	movq	$0, -104(%rbp)
	movq	$1, -112(%rbp)
	jmp	.L14
.L21:
	movq	$1, -96(%rbp)
	movq	$0, -88(%rbp)
	jmp	.L15
.L17:
	movq	-88(%rbp), %rax
	movl	%eax, %edx
	movq	-112(%rbp), %rax
	movl	%edx, %ecx
	shrq	%cl, %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L16
	movq	-64(%rbp), %rax
	movq	-88(%rbp), %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-96(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, -96(%rbp)
.L16:
	addq	$1, -88(%rbp)
.L15:
	movq	-120(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jb	.L17
	movq	$1, -80(%rbp)
	movq	$0, -88(%rbp)
	jmp	.L18
.L20:
	movq	-88(%rbp), %rax
	movl	%eax, %edx
	movq	-112(%rbp), %rax
	movl	%edx, %ecx
	shrq	%cl, %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L19
	movq	-64(%rbp), %rax
	movq	-88(%rbp), %rdx
	movq	(%rax,%rdx,8), %rcx
	movq	-96(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L19
	movq	$0, -80(%rbp)
.L19:
	addq	$1, -88(%rbp)
.L18:
	movq	-120(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jb	.L20
	movq	-80(%rbp), %rax
	addq	%rax, -104(%rbp)
	addq	$1, -112(%rbp)
.L14:
	movq	-120(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	cmpq	%rax, -112(%rbp)
	jb	.L21
	movq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %rdx
	cmpq	%rsi, %rdi
	jnb	.L2
	movq	%rsi, %rax
	movq	%rdi, %rdx
.L2:
	testq	%rdx, %rdx
	je	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rdx, %r8
	xorl	%edx, %edx
	divq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L4
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rax, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.p2align 4
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB24:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	jnb	.L12
	movq	%rdi, %rdx
	movq	%rsi, %rax
	testq	%rdx, %rdx
	je	.L13
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %rcx
	xorl	%edx, %edx
	divq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L11
	movq	%rdi, %rax
	xorl	%edx, %edx
	divq	%rcx
	imulq	%rsi, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rsi, %rdx
	movq	%rdi, %rax
	testq	%rdx, %rdx
	jne	.L11
.L13:
	movq	%rax, %rcx
	xorl	%edx, %edx
	movq	%rdi, %rax
	divq	%rcx
	imulq	%rsi, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	lcm, .-lcm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%llu"
.LC1:
	.string	"%llu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	pushq	%r13
	leaq	-48(%rbp), %rsi
	movq	%r14, %rdi
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	-48(%rbp), %rdx
	movq	%rsp, %rcx
	leaq	15(,%rdx,8), %rax
	movq	%rax, %rsi
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rsi
	cmpq	%rcx, %rsp
	je	.L17
.L51:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L51
.L17:
	andl	$4095, %esi
	subq	%rsi, %rsp
	testq	%rsi, %rsi
	jne	.L52
.L18:
	movq	%rsp, %rbx
	testq	%rdx, %rdx
	je	.L19
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__isoc99_scanf@PLT
	movq	-48(%rbp), %rcx
	addq	$8, %r13
	cmpq	%r12, %rcx
	ja	.L20
	movl	$1, %r13d
	sall	%cl, %r13d
	movslq	%r13d, %r13
	cmpq	$1, %r13
	jbe	.L19
	xorl	%r12d, %r12d
	movl	$1, %r9d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L21:
	xorl	%edi, %edi
	movl	$1, %r8d
	testq	%rcx, %rcx
	jne	.L26
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$1, %rdi
	cmpq	%rdi, %rcx
	je	.L54
.L26:
	btq	%rdi, %r9
	jnc	.L22
	movq	(%rbx,%rdi,8), %r10
	cmpq	%r8, %r10
	jbe	.L33
	movq	%r8, %rdx
	movq	%r10, %rax
	testq	%rdx, %rdx
	je	.L34
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%rdx, %rsi
	xorl	%edx, %edx
	divq	%rsi
	movq	%rsi, %rax
	testq	%rdx, %rdx
	jne	.L25
	movq	%r8, %rax
	xorl	%edx, %edx
	divq	%rsi
	movq	%rax, %r8
	imulq	%r10, %r8
.L56:
	addq	$1, %rdi
	cmpq	%rdi, %rcx
	jne	.L26
.L54:
	movl	$1, %edi
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L28:
	btq	%rsi, %r9
	jc	.L27
	xorl	%edx, %edx
	movq	%r8, %rax
	divq	(%rbx,%rsi,8)
	testq	%rdx, %rdx
	cmove	%r11, %rdi
.L27:
	addq	$1, %rsi
	cmpq	%rsi, %rcx
	jne	.L28
	addq	$1, %r9
	addq	%rdi, %r12
	cmpq	%r13, %r9
	jne	.L21
.L29:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L55
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%r10, %rdx
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L25
.L34:
	movq	%rax, %rsi
	xorl	%edx, %edx
	movq	%r8, %rax
	divq	%rsi
	movq	%rax, %r8
	imulq	%r10, %r8
	jmp	.L56
.L53:
	movl	$1, %edi
	addq	$1, %r9
	addq	%rdi, %r12
	cmpq	%r13, %r9
	jne	.L21
	jmp	.L29
.L52:
	orq	$0, -8(%rsp,%rsi)
	jmp	.L18
.L19:
	xorl	%r12d, %r12d
	jmp	.L29
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %rdx
	cmpq	%rsi, %rdi
	jnb	.L2
	movq	%rsi, %rax
	movq	%rdi, %rdx
.L2:
	testq	%rdx, %rdx
	je	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rdx, %r8
	xorl	%edx, %edx
	divq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L4
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rax, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.p2align 4
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB24:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	jnb	.L12
	movq	%rdi, %rdx
	movq	%rsi, %rax
	testq	%rdx, %rdx
	je	.L13
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %rcx
	xorl	%edx, %edx
	divq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L11
	movq	%rdi, %rax
	xorl	%edx, %edx
	divq	%rcx
	imulq	%rsi, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rsi, %rdx
	movq	%rdi, %rax
	testq	%rdx, %rdx
	jne	.L11
.L13:
	movq	%rax, %rcx
	xorl	%edx, %edx
	movq	%rdi, %rax
	divq	%rcx
	imulq	%rsi, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	lcm, .-lcm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%llu"
.LC1:
	.string	"%llu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	pushq	%r13
	leaq	-48(%rbp), %rsi
	movq	%r14, %rdi
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	-48(%rbp), %rdx
	movq	%rsp, %rcx
	leaq	15(,%rdx,8), %rax
	movq	%rax, %rsi
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rsi
	cmpq	%rcx, %rsp
	je	.L17
.L51:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L51
.L17:
	andl	$4095, %esi
	subq	%rsi, %rsp
	testq	%rsi, %rsi
	jne	.L52
.L18:
	movq	%rsp, %rbx
	testq	%rdx, %rdx
	je	.L19
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__isoc99_scanf@PLT
	movq	-48(%rbp), %rcx
	addq	$8, %r13
	cmpq	%r12, %rcx
	ja	.L20
	movl	$1, %r13d
	sall	%cl, %r13d
	movslq	%r13d, %r13
	cmpq	$1, %r13
	jbe	.L19
	xorl	%r12d, %r12d
	movl	$1, %r9d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L21:
	xorl	%edi, %edi
	movl	$1, %r8d
	testq	%rcx, %rcx
	jne	.L26
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$1, %rdi
	cmpq	%rdi, %rcx
	je	.L54
.L26:
	btq	%rdi, %r9
	jnc	.L22
	movq	(%rbx,%rdi,8), %r10
	cmpq	%r8, %r10
	jbe	.L33
	movq	%r8, %rdx
	movq	%r10, %rax
	testq	%rdx, %rdx
	je	.L34
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%rdx, %rsi
	xorl	%edx, %edx
	divq	%rsi
	movq	%rsi, %rax
	testq	%rdx, %rdx
	jne	.L25
	movq	%r8, %rax
	xorl	%edx, %edx
	divq	%rsi
	movq	%rax, %r8
	imulq	%r10, %r8
.L56:
	addq	$1, %rdi
	cmpq	%rdi, %rcx
	jne	.L26
.L54:
	movl	$1, %edi
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L28:
	btq	%rsi, %r9
	jc	.L27
	xorl	%edx, %edx
	movq	%r8, %rax
	divq	(%rbx,%rsi,8)
	testq	%rdx, %rdx
	cmove	%r11, %rdi
.L27:
	addq	$1, %rsi
	cmpq	%rsi, %rcx
	jne	.L28
	addq	$1, %r9
	addq	%rdi, %r12
	cmpq	%r13, %r9
	jne	.L21
.L29:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L55
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%r10, %rdx
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L25
.L34:
	movq	%rax, %rsi
	xorl	%edx, %edx
	movq	%r8, %rax
	divq	%rsi
	movq	%rax, %r8
	imulq	%r10, %r8
	jmp	.L56
.L53:
	movl	$1, %edi
	addq	$1, %r9
	addq	%rdi, %r12
	cmpq	%r13, %r9
	jne	.L21
	jmp	.L29
.L52:
	orq	$0, -8(%rsp,%rsi)
	jmp	.L18
.L19:
	xorl	%r12d, %r12d
	jmp	.L29
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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>
typedef unsigned long long ll;

ll gcd(ll a, ll b){
        ll tmp;
        if(a<b){
                tmp = a;
                a = b;
                b = tmp;
        }
        while(b){
                tmp = a;
                a = b;
                b = tmp%b;
        }
        return a;
}

ll lcm(ll a, ll b){
        return a / gcd(a, b) * b;
}


ll main(void){
        ll n; scanf("%llu", &n);
        ll a[n], i;
        for(i=0; i<n; i++) scanf("%llu", &a[i]);

        ll ans = 0;
        for(i=1; i<(1<<n); i++){
                ll tmp=1, j;
                for(j=0; j<n; j++){
                        if((i>>j)&1) tmp = lcm(tmp, a[j]);
                }
                ll can = 1;
                for(j=0; j<n; j++){
                        if(((i>>j)&1)==0 && tmp%a[j]==0) can = 0;
                }
                ans += can;
        }

        printf("%llu\n", ans);
        return 0;
}


3
3 5 2

7

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>
typedef unsigned long long ll;

ll gcd(ll a, ll b){
        ll tmp;
        if(a<b){
                tmp = a;
                a = b;
                b = tmp;
        }
        while(b){
                tmp = a;
                a = b;
                b = tmp%b;
        }
        return a;
}

ll lcm(ll a, ll b){
        return a / gcd(a, b) * b;
}


ll main(void){
        ll n; scanf("%llu", &n);
        ll a[n], i;
        for(i=0; i<n; i++) scanf("%llu", &a[i]);

        ll ans = 0;
        for(i=1; i<(1<<n); i++){
                ll tmp=1, j;
                for(j=0; j<n; j++){
                        if((i>>j)&1) tmp = lcm(tmp, a[j]);
                }
                ll can = 1;
                for(j=0; j<n; j++){
                        if(((i>>j)&1)==0 && tmp%a[j]==0) can = 0;
                }
                ans += can;
        }

        printf("%llu\n", ans);
        return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd
	.type	gcd, @function
gcd:
.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
	jnb	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L3
.L4:
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-32(%rbp)
	movq	%rdx, -32(%rbp)
.L3:
	cmpq	$0, -32(%rbp)
	jne	.L4
	movq	-24(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd, .-gcd
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	imulq	-16(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%llu"
.LC1:
	.string	"%llu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-120(%rbp), %rax
	movq	%rax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %r14
	movl	$0, %r15d
	movq	%rax, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -64(%rbp)
	movq	$0, -112(%rbp)
	jmp	.L12
.L13:
	movq	-112(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -112(%rbp)
.L12:
	movq	-120(%rbp), %rax
	cmpq	%rax, -112(%rbp)
	jb	.L13
	movq	$0, -104(%rbp)
	movq	$1, -112(%rbp)
	jmp	.L14
.L21:
	movq	$1, -96(%rbp)
	movq	$0, -88(%rbp)
	jmp	.L15
.L17:
	movq	-88(%rbp), %rax
	movl	%eax, %edx
	movq	-112(%rbp), %rax
	movl	%edx, %ecx
	shrq	%cl, %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L16
	movq	-64(%rbp), %rax
	movq	-88(%rbp), %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-96(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, -96(%rbp)
.L16:
	addq	$1, -88(%rbp)
.L15:
	movq	-120(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jb	.L17
	movq	$1, -80(%rbp)
	movq	$0, -88(%rbp)
	jmp	.L18
.L20:
	movq	-88(%rbp), %rax
	movl	%eax, %edx
	movq	-112(%rbp), %rax
	movl	%edx, %ecx
	shrq	%cl, %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L19
	movq	-64(%rbp), %rax
	movq	-88(%rbp), %rdx
	movq	(%rax,%rdx,8), %rcx
	movq	-96(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L19
	movq	$0, -80(%rbp)
.L19:
	addq	$1, -88(%rbp)
.L18:
	movq	-120(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jb	.L20
	movq	-80(%rbp), %rax
	addq	%rax, -104(%rbp)
	addq	$1, -112(%rbp)
.L14:
	movq	-120(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	cmpq	%rax, -112(%rbp)
	jb	.L21
	movq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	gcd
	.type	gcd, @function
gcd:
.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
	jnb	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L3
.L4:
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	-32(%rbp)
	movq	%rdx, -32(%rbp)
.L3:
	cmpq	$0, -32(%rbp)
	jne	.L4
	movq	-24(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd, .-gcd
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	-8(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	imulq	-16(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%llu"
.LC1:
	.string	"%llu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-120(%rbp), %rax
	movq	%rax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %r14
	movl	$0, %r15d
	movq	%rax, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -64(%rbp)
	movq	$0, -112(%rbp)
	jmp	.L12
.L13:
	movq	-112(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -112(%rbp)
.L12:
	movq	-120(%rbp), %rax
	cmpq	%rax, -112(%rbp)
	jb	.L13
	movq	$0, -104(%rbp)
	movq	$1, -112(%rbp)
	jmp	.L14
.L21:
	movq	$1, -96(%rbp)
	movq	$0, -88(%rbp)
	jmp	.L15
.L17:
	movq	-88(%rbp), %rax
	movl	%eax, %edx
	movq	-112(%rbp), %rax
	movl	%edx, %ecx
	shrq	%cl, %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L16
	movq	-64(%rbp), %rax
	movq	-88(%rbp), %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-96(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, -96(%rbp)
.L16:
	addq	$1, -88(%rbp)
.L15:
	movq	-120(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jb	.L17
	movq	$1, -80(%rbp)
	movq	$0, -88(%rbp)
	jmp	.L18
.L20:
	movq	-88(%rbp), %rax
	movl	%eax, %edx
	movq	-112(%rbp), %rax
	movl	%edx, %ecx
	shrq	%cl, %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L19
	movq	-64(%rbp), %rax
	movq	-88(%rbp), %rdx
	movq	(%rax,%rdx,8), %rcx
	movq	-96(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L19
	movq	$0, -80(%rbp)
.L19:
	addq	$1, -88(%rbp)
.L18:
	movq	-120(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jb	.L20
	movq	-80(%rbp), %rax
	addq	%rax, -104(%rbp)
	addq	$1, -112(%rbp)
.L14:
	movq	-120(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	cmpq	%rax, -112(%rbp)
	jb	.L21
	movq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
