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(){
    int n,a[10001],b[10001],i,j,d;
    while(scanf("%d",&n),n){
        for(i=0;i<n;i++){
            a[i]=0;
            b[i]=0;
        }
        for(i=1;i<n;i++)
            a[i*i%n]=1;
        for(i=0;i<n;i++)
            for(j=0;j<n;j++)
                if(i!=j&&a[i]&&a[j]){
                    d=i-j;
                    if(d<0)d+=n;
                    if(d>(n-1)/2)d=n-d;
                    b[d]++;
                }
        for(i=1;i<=(n-1)/2;i++)
            printf("%d\n",b[i]);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.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
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2224, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	movl	$0, -80044(%rbp)
	jmp	.L3
.L4:
	movl	-80044(%rbp), %eax
	cltq
	movl	$0, -80032(%rbp,%rax,4)
	movl	-80044(%rbp), %eax
	cltq
	movl	$0, -40016(%rbp,%rax,4)
	addl	$1, -80044(%rbp)
.L3:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L4
	movl	$1, -80044(%rbp)
	jmp	.L5
.L6:
	movl	-80044(%rbp), %eax
	imull	%eax, %eax
	movl	-80048(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	$1, -80032(%rbp,%rax,4)
	addl	$1, -80044(%rbp)
.L5:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L6
	movl	$0, -80044(%rbp)
	jmp	.L7
.L13:
	movl	$0, -80040(%rbp)
	jmp	.L8
.L12:
	movl	-80044(%rbp), %eax
	cmpl	-80040(%rbp), %eax
	je	.L9
	movl	-80044(%rbp), %eax
	cltq
	movl	-80032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L9
	movl	-80040(%rbp), %eax
	cltq
	movl	-80032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L9
	movl	-80044(%rbp), %eax
	subl	-80040(%rbp), %eax
	movl	%eax, -80036(%rbp)
	cmpl	$0, -80036(%rbp)
	jns	.L10
	movl	-80048(%rbp), %eax
	addl	%eax, -80036(%rbp)
.L10:
	movl	-80048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -80036(%rbp)
	jle	.L11
	movl	-80048(%rbp), %eax
	subl	-80036(%rbp), %eax
	movl	%eax, -80036(%rbp)
.L11:
	movl	-80036(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-80036(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L9:
	addl	$1, -80040(%rbp)
.L8:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80040(%rbp)
	jl	.L12
	addl	$1, -80044(%rbp)
.L7:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L13
	movl	$1, -80044(%rbp)
	jmp	.L14
.L15:
	movl	-80044(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -80044(%rbp)
.L14:
	movl	-80048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -80044(%rbp)
	jle	.L15
.L2:
	leaq	-80048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-80048(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2248, %rsp
	.cfi_def_cfa_offset 80128
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 80056(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r13d
	testl	%r13d, %r13d
	je	.L13
	jle	.L10
	movslq	%r13d, %rdx
	leaq	32(%rsp), %r14
	xorl	%esi, %esi
	salq	$2, %rdx
	movq	%r14, %rdi
	leaq	40048(%rsp), %r15
	movq	%rdx, 8(%rsp)
	call	memset@PLT
	movq	8(%rsp), %rdx
	xorl	%esi, %esi
	movq	%r15, %rdi
	call	memset@PLT
	cmpl	$1, %r13d
	je	.L3
	movl	$1, %ecx
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%ecx, %eax
	imull	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%r13d
	movslq	%edx, %rdx
	movl	$1, 32(%rsp,%rdx,4)
	cmpl	%ecx, %r13d
	jg	.L4
.L3:
	leal	-1(%r13), %r9d
	movq	%r14, %rdi
	xorl	%esi, %esi
	sarl	%r9d
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%esi, %edx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	%eax, %esi
	je	.L5
	movl	(%rdi), %r8d
	testl	%r8d, %r8d
	je	.L5
	movl	(%r14,%rax,4), %ecx
	testl	%ecx, %ecx
	je	.L5
	testl	%edx, %edx
	leal	(%rdx,%r13), %ecx
	movl	%r13d, %r8d
	cmovns	%edx, %ecx
	subl	%ecx, %r8d
	cmpl	%ecx, %r9d
	cmovl	%r8d, %ecx
	movslq	%ecx, %rcx
	addl	$1, 40048(%rsp,%rcx,4)
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$1, %rax
	subl	$1, %edx
	cmpl	%eax, %r13d
	jg	.L8
	addl	$1, %esi
	addq	$4, %rdi
	cmpl	%esi, %r13d
	jg	.L9
.L10:
	cmpl	$2, %r13d
	jle	.L2
	movl	$1, %r13d
	leaq	40048(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%r15,%r13,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__printf_chk@PLT
	movl	28(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%r13d, %eax
	jge	.L12
	jmp	.L2
.L13:
	movq	80056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$80072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L25:
	.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\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2248, %rsp
	.cfi_def_cfa_offset 80128
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 80056(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r13d
	testl	%r13d, %r13d
	je	.L13
	jle	.L10
	movslq	%r13d, %rdx
	leaq	32(%rsp), %r14
	xorl	%esi, %esi
	salq	$2, %rdx
	movq	%r14, %rdi
	leaq	40048(%rsp), %r15
	movq	%rdx, 8(%rsp)
	call	memset@PLT
	movq	8(%rsp), %rdx
	xorl	%esi, %esi
	movq	%r15, %rdi
	call	memset@PLT
	cmpl	$1, %r13d
	je	.L3
	movl	$1, %ecx
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%ecx, %eax
	imull	%ecx, %eax
	addl	$1, %ecx
	cltd
	idivl	%r13d
	movslq	%edx, %rdx
	movl	$1, 32(%rsp,%rdx,4)
	cmpl	%ecx, %r13d
	jg	.L4
.L3:
	leal	-1(%r13), %r9d
	movq	%r14, %rdi
	xorl	%esi, %esi
	sarl	%r9d
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%esi, %edx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	%eax, %esi
	je	.L5
	movl	(%rdi), %r8d
	testl	%r8d, %r8d
	je	.L5
	movl	(%r14,%rax,4), %ecx
	testl	%ecx, %ecx
	je	.L5
	testl	%edx, %edx
	leal	(%rdx,%r13), %ecx
	movl	%r13d, %r8d
	cmovns	%edx, %ecx
	subl	%ecx, %r8d
	cmpl	%ecx, %r9d
	cmovl	%r8d, %ecx
	movslq	%ecx, %rcx
	addl	$1, 40048(%rsp,%rcx,4)
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$1, %rax
	subl	$1, %edx
	cmpl	%eax, %r13d
	jg	.L8
	addl	$1, %esi
	addq	$4, %rdi
	cmpl	%esi, %r13d
	jg	.L9
.L10:
	cmpl	$2, %r13d
	jle	.L2
	movl	$1, %r13d
	leaq	40048(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%r15,%r13,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__printf_chk@PLT
	movl	28(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cmpl	%r13d, %eax
	jge	.L12
	jmp	.L2
.L13:
	movq	80056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$80072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L25:
	.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(){
    int n,a[10001],b[10001],i,j,d;
    while(scanf("%d",&n),n){
        for(i=0;i<n;i++){
            a[i]=0;
            b[i]=0;
        }
        for(i=1;i<n;i++)
            a[i*i%n]=1;
        for(i=0;i<n;i++)
            for(j=0;j<n;j++)
                if(i!=j&&a[i]&&a[j]){
                    d=i-j;
                    if(d<0)d+=n;
                    if(d>(n-1)/2)d=n-d;
                    b[d]++;
                }
        for(i=1;i<=(n-1)/2;i++)
            printf("%d\n",b[i]);
    }
    return 0;
}
11
23
0
 11
45
0
 11
77
0
 11
13
0
 11
17
0
 11
25
0
 11
37
0
 11
5
0
 11
69
0
 11
19
0

4
4
4
4
4
10
10
10
10
10
10
10
10
10
10
10
 4
4
4
4
4
4
2
6
4
6
12
2
2
16
6
4
6
2
4
18
4
2
8
4
6
12
2
 4
4
4
4
4
10
12
12
10
12
10
22
12
10
10
22
12
10
22
10
10
10
12
10
12
22
22
10
10
10
12
12
22
12
12
12
12
22
12
22
10
10
12
 4
4
4
4
4
4
6
4
4
6
6
 4
4
4
4
4
6
6
8
6
8
8
8
6
 4
4
4
4
4
4
10
10
4
20
4
10
10
4
20
4
10
 4
4
4
4
4
16
18
16
16
18
18
16
18
16
16
16
16
18
18
18
16
18
18
 4
4
4
4
4
0
2
 4
4
4
4
4
10
12
22
10
10
22
12
12
22
12
10
22
10
10
22
10
10
22
12
10
22
12
22
22
10
12
22
12
12
22
10
12
22
12
 4
4
4
4
4
8
8
8
8
8
8
8
8
8

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(){
    int n,a[10001],b[10001],i,j,d;
    while(scanf("%d",&n),n){
        for(i=0;i<n;i++){
            a[i]=0;
            b[i]=0;
        }
        for(i=1;i<n;i++)
            a[i*i%n]=1;
        for(i=0;i<n;i++)
            for(j=0;j<n;j++)
                if(i!=j&&a[i]&&a[j]){
                    d=i-j;
                    if(d<0)d+=n;
                    if(d>(n-1)/2)d=n-d;
                    b[d]++;
                }
        for(i=1;i<=(n-1)/2;i++)
            printf("%d\n",b[i]);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.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
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2224, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	movl	$0, -80044(%rbp)
	jmp	.L3
.L4:
	movl	-80044(%rbp), %eax
	cltq
	movl	$0, -80032(%rbp,%rax,4)
	movl	-80044(%rbp), %eax
	cltq
	movl	$0, -40016(%rbp,%rax,4)
	addl	$1, -80044(%rbp)
.L3:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L4
	movl	$1, -80044(%rbp)
	jmp	.L5
.L6:
	movl	-80044(%rbp), %eax
	imull	%eax, %eax
	movl	-80048(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	$1, -80032(%rbp,%rax,4)
	addl	$1, -80044(%rbp)
.L5:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L6
	movl	$0, -80044(%rbp)
	jmp	.L7
.L13:
	movl	$0, -80040(%rbp)
	jmp	.L8
.L12:
	movl	-80044(%rbp), %eax
	cmpl	-80040(%rbp), %eax
	je	.L9
	movl	-80044(%rbp), %eax
	cltq
	movl	-80032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L9
	movl	-80040(%rbp), %eax
	cltq
	movl	-80032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L9
	movl	-80044(%rbp), %eax
	subl	-80040(%rbp), %eax
	movl	%eax, -80036(%rbp)
	cmpl	$0, -80036(%rbp)
	jns	.L10
	movl	-80048(%rbp), %eax
	addl	%eax, -80036(%rbp)
.L10:
	movl	-80048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -80036(%rbp)
	jle	.L11
	movl	-80048(%rbp), %eax
	subl	-80036(%rbp), %eax
	movl	%eax, -80036(%rbp)
.L11:
	movl	-80036(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-80036(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L9:
	addl	$1, -80040(%rbp)
.L8:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80040(%rbp)
	jl	.L12
	addl	$1, -80044(%rbp)
.L7:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L13
	movl	$1, -80044(%rbp)
	jmp	.L14
.L15:
	movl	-80044(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -80044(%rbp)
.L14:
	movl	-80048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -80044(%rbp)
	jle	.L15
.L2:
	leaq	-80048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-80048(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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\n"
.LC1:
	.string	"%d"
	.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
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2224, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	movl	$0, -80044(%rbp)
	jmp	.L3
.L4:
	movl	-80044(%rbp), %eax
	cltq
	movl	$0, -80032(%rbp,%rax,4)
	movl	-80044(%rbp), %eax
	cltq
	movl	$0, -40016(%rbp,%rax,4)
	addl	$1, -80044(%rbp)
.L3:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L4
	movl	$1, -80044(%rbp)
	jmp	.L5
.L6:
	movl	-80044(%rbp), %eax
	imull	%eax, %eax
	movl	-80048(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	$1, -80032(%rbp,%rax,4)
	addl	$1, -80044(%rbp)
.L5:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L6
	movl	$0, -80044(%rbp)
	jmp	.L7
.L13:
	movl	$0, -80040(%rbp)
	jmp	.L8
.L12:
	movl	-80044(%rbp), %eax
	cmpl	-80040(%rbp), %eax
	je	.L9
	movl	-80044(%rbp), %eax
	cltq
	movl	-80032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L9
	movl	-80040(%rbp), %eax
	cltq
	movl	-80032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L9
	movl	-80044(%rbp), %eax
	subl	-80040(%rbp), %eax
	movl	%eax, -80036(%rbp)
	cmpl	$0, -80036(%rbp)
	jns	.L10
	movl	-80048(%rbp), %eax
	addl	%eax, -80036(%rbp)
.L10:
	movl	-80048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -80036(%rbp)
	jle	.L11
	movl	-80048(%rbp), %eax
	subl	-80036(%rbp), %eax
	movl	%eax, -80036(%rbp)
.L11:
	movl	-80036(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-80036(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L9:
	addl	$1, -80040(%rbp)
.L8:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80040(%rbp)
	jl	.L12
	addl	$1, -80044(%rbp)
.L7:
	movl	-80048(%rbp), %eax
	cmpl	%eax, -80044(%rbp)
	jl	.L13
	movl	$1, -80044(%rbp)
	jmp	.L14
.L15:
	movl	-80044(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -80044(%rbp)
.L14:
	movl	-80048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -80044(%rbp)
	jle	.L15
.L2:
	leaq	-80048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-80048(%rbp), %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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:
