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 n;
	int t[1000] = {0}, a[1000] = {0};
	unsigned long x, y, p, q;

	scanf("%d", &n);
	for(int i=0; i < n; i++) {
		scanf("%d%d", &t[i], &a[i]);
	}

	x = y = 1;
	for(int i=0; i < n; i++) {
		if(x%t[i])
			x += t[i] - x%t[i];
		if(y%a[i])
			y += a[i] - y%a[i];
		p = x / t[i];
		q = y / a[i];
		if(p < q)
			p = q;

		x = p * t[i];
		y = p * a[i];
	}
	printf("%lu", x + y);

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3968, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-8016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-4016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-8060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8056(%rbp)
	jmp	.L2
.L3:
	leaq	-4016(%rbp), %rdx
	movl	-8056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-8016(%rbp), %rcx
	movl	-8056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8056(%rbp)
.L2:
	movl	-8060(%rbp), %eax
	cmpl	%eax, -8056(%rbp)
	jl	.L3
	movq	$1, -8040(%rbp)
	movq	-8040(%rbp), %rax
	movq	%rax, -8048(%rbp)
	movl	$0, -8052(%rbp)
	jmp	.L4
.L8:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L5
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	addq	%rax, -8048(%rbp)
.L5:
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L6
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	addq	%rax, -8040(%rbp)
.L6:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rax, -8032(%rbp)
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rdi
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rdi
	movq	%rax, -8024(%rbp)
	movq	-8032(%rbp), %rax
	cmpq	-8024(%rbp), %rax
	jnb	.L7
	movq	-8024(%rbp), %rax
	movq	%rax, -8032(%rbp)
.L7:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	cltq
	movq	-8032(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8048(%rbp)
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cltq
	movq	-8032(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8040(%rbp)
	addl	$1, -8052(%rbp)
.L4:
	movl	-8060(%rbp), %eax
	cmpl	%eax, -8052(%rbp)
	jl	.L8
	movq	-8048(%rbp), %rdx
	movq	-8040(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	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	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$3936, %rsp
	.cfi_def_cfa_offset 8080
	movl	$500, %ecx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	leaq	4016(%rsp), %rbx
	movq	%rbp, %r13
	rep stosq
	movl	$500, %ecx
	movq	%rbx, %rdi
	rep stosq
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rbx,%r12,4), %rdx
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	12(%rsp), %r9
	addq	$1, %r12
	addq	$4, %r13
	cmpl	%r12d, %r9d
	jg	.L4
	testl	%r9d, %r9d
	jle	.L5
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movl	$1, %r10d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L19:
	addq	%rsi, %rcx
	subq	%rdx, %rcx
	xorl	%edx, %edx
	movq	%rcx, %rax
	divq	%rsi
	xorl	%edx, %edx
	movq	%rax, %rcx
	movq	%r10, %rax
	divq	%rdi
	cmpq	%rax, %rcx
	cmovb	%rax, %rcx
.L17:
	imulq	%rcx, %rdi
	addq	$1, %r8
	imulq	%rsi, %rcx
	movq	%rdi, %r10
	cmpq	%r8, %r9
	je	.L3
.L9:
	movslq	0(%rbp,%r8,4), %rdi
	movq	%r10, %rax
	xorl	%edx, %edx
	divq	%rdi
	leaq	(%rdi,%r10), %rsi
	movq	%rcx, %rax
	subq	%rdx, %rsi
	testq	%rdx, %rdx
	cmovne	%rsi, %r10
	movslq	(%rbx,%r8,4), %rsi
	xorl	%edx, %edx
	divq	%rsi
	movq	%rax, %r11
	testq	%rdx, %rdx
	jne	.L19
	xorl	%edx, %edx
	movq	%r10, %rax
	movq	%r11, %rcx
	divq	%rdi
	cmpq	%r11, %rax
	cmovnb	%rax, %rcx
	jmp	.L17
.L5:
	movl	$1, %ecx
	movl	$1, %r10d
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	leaq	(%r10,%rcx), %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$8032, %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
.L20:
	.cfi_restore_state
	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"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	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	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$3936, %rsp
	.cfi_def_cfa_offset 8080
	movl	$500, %ecx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	leaq	4016(%rsp), %rbx
	movq	%rbp, %r13
	rep stosq
	movl	$500, %ecx
	movq	%rbx, %rdi
	rep stosq
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rbx,%r12,4), %rdx
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	12(%rsp), %r9
	addq	$1, %r12
	addq	$4, %r13
	cmpl	%r12d, %r9d
	jg	.L4
	testl	%r9d, %r9d
	jle	.L5
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movl	$1, %r10d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L19:
	addq	%rsi, %rcx
	subq	%rdx, %rcx
	xorl	%edx, %edx
	movq	%rcx, %rax
	divq	%rsi
	xorl	%edx, %edx
	movq	%rax, %rcx
	movq	%r10, %rax
	divq	%rdi
	cmpq	%rax, %rcx
	cmovb	%rax, %rcx
.L17:
	imulq	%rcx, %rdi
	addq	$1, %r8
	imulq	%rsi, %rcx
	movq	%rdi, %r10
	cmpq	%r8, %r9
	je	.L3
.L9:
	movslq	0(%rbp,%r8,4), %rdi
	movq	%r10, %rax
	xorl	%edx, %edx
	divq	%rdi
	leaq	(%rdi,%r10), %rsi
	movq	%rcx, %rax
	subq	%rdx, %rsi
	testq	%rdx, %rdx
	cmovne	%rsi, %r10
	movslq	(%rbx,%r8,4), %rsi
	xorl	%edx, %edx
	divq	%rsi
	movq	%rax, %r11
	testq	%rdx, %rdx
	jne	.L19
	xorl	%edx, %edx
	movq	%r10, %rax
	movq	%r11, %rcx
	divq	%rdi
	cmpq	%r11, %rax
	cmovnb	%rax, %rcx
	jmp	.L17
.L5:
	movl	$1, %ecx
	movl	$1, %r10d
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	leaq	(%r10,%rcx), %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$8032, %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
.L20:
	.cfi_restore_state
	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 n;
	int t[1000] = {0}, a[1000] = {0};
	unsigned long x, y, p, q;

	scanf("%d", &n);
	for(int i=0; i < n; i++) {
		scanf("%d%d", &t[i], &a[i]);
	}

	x = y = 1;
	for(int i=0; i < n; i++) {
		if(x%t[i])
			x += t[i] - x%t[i];
		if(y%a[i])
			y += a[i] - y%a[i];
		p = x / t[i];
		q = y / a[i];
		if(p < q)
			p = q;

		x = p * t[i];
		y = p * a[i];
	}
	printf("%lu", x + y);

	return 0;
}

5
3 1
48 17
31 199
231 23
3 2
 4
1 1
1 1
1 9
1 100
 3
3 3
1 1
3 2
 3
4 3
1 1
3 1
 3
4 3
1 2
3 1
 3
2 3
1 1
1 2
 4
1 2
1 1
1 9
1 100
 5
3 10
48 28
31 199
319 23
3 2
 3
4 3
1 1
1 2
 5
3 10
48 28
31 199
300 23
3 2

6930 101 10 16 32 9 202 9570 12 9000
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 n;
	int t[1000] = {0}, a[1000] = {0};
	unsigned long x, y, p, q;

	scanf("%d", &n);
	for(int i=0; i < n; i++) {
		scanf("%d%d", &t[i], &a[i]);
	}

	x = y = 1;
	for(int i=0; i < n; i++) {
		if(x%t[i])
			x += t[i] - x%t[i];
		if(y%a[i])
			y += a[i] - y%a[i];
		p = x / t[i];
		q = y / a[i];
		if(p < q)
			p = q;

		x = p * t[i];
		y = p * a[i];
	}
	printf("%lu", x + y);

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3968, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-8016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-4016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-8060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8056(%rbp)
	jmp	.L2
.L3:
	leaq	-4016(%rbp), %rdx
	movl	-8056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-8016(%rbp), %rcx
	movl	-8056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8056(%rbp)
.L2:
	movl	-8060(%rbp), %eax
	cmpl	%eax, -8056(%rbp)
	jl	.L3
	movq	$1, -8040(%rbp)
	movq	-8040(%rbp), %rax
	movq	%rax, -8048(%rbp)
	movl	$0, -8052(%rbp)
	jmp	.L4
.L8:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L5
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	addq	%rax, -8048(%rbp)
.L5:
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L6
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	addq	%rax, -8040(%rbp)
.L6:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rax, -8032(%rbp)
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rdi
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rdi
	movq	%rax, -8024(%rbp)
	movq	-8032(%rbp), %rax
	cmpq	-8024(%rbp), %rax
	jnb	.L7
	movq	-8024(%rbp), %rax
	movq	%rax, -8032(%rbp)
.L7:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	cltq
	movq	-8032(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8048(%rbp)
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cltq
	movq	-8032(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8040(%rbp)
	addl	$1, -8052(%rbp)
.L4:
	movl	-8060(%rbp), %eax
	cmpl	%eax, -8052(%rbp)
	jl	.L8
	movq	-8048(%rbp), %rdx
	movq	-8040(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lu"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3968, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-8016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-4016(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-8060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8056(%rbp)
	jmp	.L2
.L3:
	leaq	-4016(%rbp), %rdx
	movl	-8056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-8016(%rbp), %rcx
	movl	-8056(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8056(%rbp)
.L2:
	movl	-8060(%rbp), %eax
	cmpl	%eax, -8056(%rbp)
	jl	.L3
	movq	$1, -8040(%rbp)
	movq	-8040(%rbp), %rax
	movq	%rax, -8048(%rbp)
	movl	$0, -8052(%rbp)
	jmp	.L4
.L8:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L5
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	addq	%rax, -8048(%rbp)
.L5:
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L6
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	addq	%rax, -8040(%rbp)
.L6:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movq	-8048(%rbp), %rax
	movl	$0, %edx
	divq	%rsi
	movq	%rax, -8032(%rbp)
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movslq	%eax, %rdi
	movq	-8040(%rbp), %rax
	movl	$0, %edx
	divq	%rdi
	movq	%rax, -8024(%rbp)
	movq	-8032(%rbp), %rax
	cmpq	-8024(%rbp), %rax
	jnb	.L7
	movq	-8024(%rbp), %rax
	movq	%rax, -8032(%rbp)
.L7:
	movl	-8052(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %eax
	cltq
	movq	-8032(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8048(%rbp)
	movl	-8052(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	cltq
	movq	-8032(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -8040(%rbp)
	addl	$1, -8052(%rbp)
.L4:
	movl	-8060(%rbp), %eax
	cmpl	%eax, -8052(%rbp)
	jl	.L8
	movq	-8048(%rbp), %rdx
	movq	-8040(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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:
