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>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

//最大公約数
long long gcd(long long a, long long b){
    //a>bになるように入れ替え
    if(a<b){
        long tmp=a;
        a=b;
        b=tmp;
    }

    //ユークリッドの互除法
    if(a%b==0) return b;
    return gcd(b,a%b);
}

//最小公倍数
long long lcm(long long a,long long b){
    return a*(b/gcd(a,b));
}

int main(void){
    int N;
    scanf("%d",&N);

    //A[0]~A[N-1]に格納する
    long long* T;
    NEW(T,N);
    for(int i=0;i<N;i++){
        scanf("%lld",&T[i]);
    }

    long long ans=1;
    for(int i=0;i<N;i++){
        ans=lcm(ans,T[i]);
    }
    printf("%lld\n",ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	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, %rax
	testq	%rax, %rax
	jne	.L3
	movq	-32(%rbp), %rax
	jmp	.L4
.L3:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB7:
	.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	-16(%rbp), %rax
	cqto
	idivq	%rcx
	imulq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%lld"
.LC3:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	movl	$0, -32(%rbp)
	jmp	.L9
.L10:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -32(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movq	$1, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L11
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L11:
	movl	-36(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L12
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
.LFB51:
	.cfi_startproc
	endbr64
	movq	%rdi, %r8
	.p2align 4,,10
	.p2align 3
.L3:
	cmpq	%r8, %rsi
	jg	.L2
	movq	%rsi, %rax
	movq	%r8, %rsi
	movq	%rax, %r8
.L2:
	movq	%rsi, %rax
	cqto
	idivq	%r8
	movq	%rdx, %rsi
	testq	%rdx, %rdx
	jne	.L3
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE51:
	.size	gcd, .-gcd
	.p2align 4
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB52:
	.cfi_startproc
	endbr64
	movq	%rsi, %rdx
	movq	%rdi, %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	cmpq	%rcx, %rdx
	jg	.L7
	movq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rcx
.L7:
	movq	%rdx, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	jne	.L8
	movq	%rsi, %rax
	cqto
	idivq	%rcx
	imulq	%rdi, %rax
	ret
	.cfi_endproc
.LFE52:
	.size	lcm, .-lcm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%lld"
.LC3:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %rbx
	salq	$3, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	testl	%ebx, %ebx
	jle	.L13
	movq	%rax, %r13
	movq	%rax, %rbx
	movq	%rax, %r12
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$8, %r12
	cmpl	%ebp, %eax
	jg	.L14
	testl	%eax, %eax
	jle	.L13
	leaq	0(%r13,%rax,8), %r9
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L17:
	movq	(%rbx), %rdi
	movq	%r8, %rcx
	movq	%rdi, %rdx
	.p2align 4,,10
	.p2align 3
.L16:
	cmpq	%rdx, %rcx
	jl	.L15
	movq	%rdx, %rsi
	movq	%rcx, %rdx
	movq	%rsi, %rcx
.L15:
	movq	%rdx, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	jne	.L16
	movq	%rdi, %rax
	addq	$8, %rbx
	cqto
	idivq	%rcx
	imulq	%rax, %r8
	cmpq	%rbx, %r9
	jne	.L17
.L18:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	movl	$1, %r8d
	jmp	.L18
.L24:
	call	__stack_chk_fail@PLT
.L11:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE53:
	.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:
.LFB51:
	.cfi_startproc
	endbr64
	movq	%rdi, %r8
	.p2align 4,,10
	.p2align 3
.L3:
	cmpq	%r8, %rsi
	jg	.L2
	movq	%rsi, %rax
	movq	%r8, %rsi
	movq	%rax, %r8
.L2:
	movq	%rsi, %rax
	cqto
	idivq	%r8
	movq	%rdx, %rsi
	testq	%rdx, %rdx
	jne	.L3
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE51:
	.size	gcd, .-gcd
	.p2align 4
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB52:
	.cfi_startproc
	endbr64
	movq	%rsi, %rdx
	movq	%rdi, %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	cmpq	%rcx, %rdx
	jg	.L7
	movq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rcx
.L7:
	movq	%rdx, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	jne	.L8
	movq	%rsi, %rax
	cqto
	idivq	%rcx
	imulq	%rdi, %rax
	ret
	.cfi_endproc
.LFE52:
	.size	lcm, .-lcm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%lld"
.LC3:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %rbx
	salq	$3, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	testl	%ebx, %ebx
	jle	.L13
	movq	%rax, %r13
	movq	%rax, %rbx
	movq	%rax, %r12
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$8, %r12
	cmpl	%ebp, %eax
	jg	.L14
	testl	%eax, %eax
	jle	.L13
	leaq	0(%r13,%rax,8), %r9
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L17:
	movq	(%rbx), %rdi
	movq	%r8, %rcx
	movq	%rdi, %rdx
	.p2align 4,,10
	.p2align 3
.L16:
	cmpq	%rdx, %rcx
	jl	.L15
	movq	%rdx, %rsi
	movq	%rcx, %rdx
	movq	%rsi, %rcx
.L15:
	movq	%rdx, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	jne	.L16
	movq	%rdi, %rax
	addq	$8, %rbx
	cqto
	idivq	%rcx
	imulq	%rax, %r8
	cmpq	%rbx, %r9
	jne	.L17
.L18:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	movl	$1, %r8d
	jmp	.L18
.L24:
	call	__stack_chk_fail@PLT
.L11:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
	.cfi_endproc
.LFE53:
	.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>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

//最大公約数
long long gcd(long long a, long long b){
    //a>bになるように入れ替え
    if(a<b){
        long tmp=a;
        a=b;
        b=tmp;
    }

    //ユークリッドの互除法
    if(a%b==0) return b;
    return gcd(b,a%b);
}

//最小公倍数
long long lcm(long long a,long long b){
    return a*(b/gcd(a,b));
}

int main(void){
    int N;
    scanf("%d",&N);

    //A[0]~A[N-1]に格納する
    long long* T;
    NEW(T,N);
    for(int i=0;i<N;i++){
        scanf("%lld",&T[i]);
    }

    long long ans=1;
    for(int i=0;i<N;i++){
        ans=lcm(ans,T[i]);
    }
    printf("%lld\n",ans);

    return 0;
}
5
2
5
10
1000000001000000000
1000000000000000000
 2
2
5
 5
2
6
10
1000000001000000000
1000000000000000000
 2
3
5
 5
2
6
10
1001000001000000000
1000000000000000000
 2
3
3
 5
2
6
10
1001000001000000000
1100000000000000000
 2
3
7
 2
3
9
 2
3
4

-5930898827444486144
 10
 654047591376093184
 15
 -3927134622237589504
 3
 -6164522491832303616
 21
 9
 12

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>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

//最大公約数
long long gcd(long long a, long long b){
    //a>bになるように入れ替え
    if(a<b){
        long tmp=a;
        a=b;
        b=tmp;
    }

    //ユークリッドの互除法
    if(a%b==0) return b;
    return gcd(b,a%b);
}

//最小公倍数
long long lcm(long long a,long long b){
    return a*(b/gcd(a,b));
}

int main(void){
    int N;
    scanf("%d",&N);

    //A[0]~A[N-1]に格納する
    long long* T;
    NEW(T,N);
    for(int i=0;i<N;i++){
        scanf("%lld",&T[i]);
    }

    long long ans=1;
    for(int i=0;i<N;i++){
        ans=lcm(ans,T[i]);
    }
    printf("%lld\n",ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	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, %rax
	testq	%rax, %rax
	jne	.L3
	movq	-32(%rbp), %rax
	jmp	.L4
.L3:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB7:
	.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	-16(%rbp), %rax
	cqto
	idivq	%rcx
	imulq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%lld"
.LC3:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	movl	$0, -32(%rbp)
	jmp	.L9
.L10:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -32(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movq	$1, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L11
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L11:
	movl	-36(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L12
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	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, %rax
	testq	%rax, %rax
	jne	.L3
	movq	-32(%rbp), %rax
	jmp	.L4
.L3:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB7:
	.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	-16(%rbp), %rax
	cqto
	idivq	%rcx
	imulq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"not enough memory"
.LC2:
	.string	"%lld"
.LC3:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	movl	$0, -32(%rbp)
	jmp	.L9
.L10:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -32(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movq	$1, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L11
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L11:
	movl	-36(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L12
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
