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>

#define MAX 500

int main(void){
  int i,j,x,y,num;

  int n;
  scanf("%d",&n);

  int arr[MAX][MAX]={};
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      x=i; y=j; num=1;
      while(1){
        if(x%2!=y%2){
          arr[i][j]=num;
          break;
        }else{
          x/=2; y/=2;
          num++;
        }
      }
    }
  }

  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      printf("%d ",arr[i][j]);
    }
    printf("\n");
  }

  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.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	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1000040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000016(%rbp), %rax
	movl	$1000000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1000036(%rbp)
	jmp	.L2
.L8:
	movl	-1000036(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1000032(%rbp)
	jmp	.L3
.L7:
	movl	-1000036(%rbp), %eax
	movl	%eax, -1000028(%rbp)
	movl	-1000032(%rbp), %eax
	movl	%eax, -1000024(%rbp)
	movl	$1, -1000020(%rbp)
.L6:
	movl	-1000028(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-1000024(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	%eax, %ecx
	je	.L4
	movl	-1000032(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rax, %rdx
	movl	-1000020(%rbp), %eax
	movl	%eax, -1000016(%rbp,%rdx,4)
	jmp	.L15
.L4:
	movl	-1000028(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000028(%rbp)
	movl	-1000024(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000024(%rbp)
	addl	$1, -1000020(%rbp)
	jmp	.L6
.L15:
	addl	$1, -1000032(%rbp)
.L3:
	movl	-1000040(%rbp), %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L7
	addl	$1, -1000036(%rbp)
.L2:
	movl	-1000040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000036(%rbp)
	jl	.L8
	movl	$0, -1000036(%rbp)
	jmp	.L9
.L12:
	movl	-1000036(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1000032(%rbp)
	jmp	.L10
.L11:
	movl	-1000032(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000032(%rbp)
.L10:
	movl	-1000040(%rbp), %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L11
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -1000036(%rbp)
.L9:
	movl	-1000040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000036(%rbp)
	jl	.L12
	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
.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 "
	.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
	leaq	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999472
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$608, %rsp
	.cfi_def_cfa_offset 1000080
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 1000024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movl	$1000000, %edx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	memset@PLT
	movl	12(%rsp), %r10d
	cmpl	$1, %r10d
	jle	.L11
	leal	-2(%r10), %r14d
	movq	%rbx, %r11
	movl	$1, %r13d
	addq	$2, %r14
	.p2align 4,,10
	.p2align 3
.L8:
	leal	-1(%r13), %r12d
	movq	%r13, %r9
	movl	%r12d, %ebp
	andl	$1, %ebp
	cmpl	%r13d, %r10d
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%r9d, %edx
	movl	%r9d, %ecx
	shrl	$31, %edx
	leal	(%rdx,%r9), %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	%eax, %ebp
	jne	.L14
	movl	%r12d, %esi
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ecx, %eax
	sarl	%esi
	addl	$1, %edi
	shrl	$31, %eax
	movl	%esi, %r8d
	addl	%ecx, %eax
	andl	$1, %r8d
	movl	%eax, %ecx
	shrl	$31, %eax
	sarl	%ecx
	leal	(%rcx,%rax), %edx
	andl	$1, %edx
	subl	%eax, %edx
	cmpl	%edx, %r8d
	je	.L7
	movl	%edi, (%r11,%r9,4)
	addq	$1, %r9
	cmpl	%r9d, %r10d
	jg	.L5
.L4:
	addq	$1, %r13
	addq	$2000, %r11
	cmpq	%r14, %r13
	jne	.L8
	movl	$1, %r13d
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r13, %rbp
	cmpl	%r13d, %r10d
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rbx,%rbp,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, 12(%rsp)
	jg	.L9
.L12:
	movl	$10, %edi
	addq	$1, %r13
	addq	$2000, %rbx
	call	putchar@PLT
	movl	12(%rsp), %r10d
	leal	-1(%r13), %eax
	leal	-1(%r10), %edx
	cmpl	%eax, %edx
	jg	.L10
.L11:
	movq	1000024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$1000032, %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
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	movl	$1, %edi
	movl	%edi, (%r11,%r9,4)
	addq	$1, %r9
	cmpl	%r9d, %r10d
	jg	.L5
	jmp	.L4
.L25:
	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 "
	.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
	leaq	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999472
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$608, %rsp
	.cfi_def_cfa_offset 1000080
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 1000024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movl	$1000000, %edx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	memset@PLT
	movl	12(%rsp), %r10d
	cmpl	$1, %r10d
	jle	.L11
	leal	-2(%r10), %r14d
	movq	%rbx, %r11
	movl	$1, %r13d
	addq	$2, %r14
	.p2align 4,,10
	.p2align 3
.L8:
	leal	-1(%r13), %r12d
	movq	%r13, %r9
	movl	%r12d, %ebp
	andl	$1, %ebp
	cmpl	%r13d, %r10d
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%r9d, %edx
	movl	%r9d, %ecx
	shrl	$31, %edx
	leal	(%rdx,%r9), %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	%eax, %ebp
	jne	.L14
	movl	%r12d, %esi
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ecx, %eax
	sarl	%esi
	addl	$1, %edi
	shrl	$31, %eax
	movl	%esi, %r8d
	addl	%ecx, %eax
	andl	$1, %r8d
	movl	%eax, %ecx
	shrl	$31, %eax
	sarl	%ecx
	leal	(%rcx,%rax), %edx
	andl	$1, %edx
	subl	%eax, %edx
	cmpl	%edx, %r8d
	je	.L7
	movl	%edi, (%r11,%r9,4)
	addq	$1, %r9
	cmpl	%r9d, %r10d
	jg	.L5
.L4:
	addq	$1, %r13
	addq	$2000, %r11
	cmpq	%r14, %r13
	jne	.L8
	movl	$1, %r13d
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r13, %rbp
	cmpl	%r13d, %r10d
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rbx,%rbp,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, 12(%rsp)
	jg	.L9
.L12:
	movl	$10, %edi
	addq	$1, %r13
	addq	$2000, %rbx
	call	putchar@PLT
	movl	12(%rsp), %r10d
	leal	-1(%r13), %eax
	leal	-1(%r10), %edx
	cmpl	%eax, %edx
	jg	.L10
.L11:
	movq	1000024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$1000032, %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
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	movl	$1, %edi
	movl	%edi, (%r11,%r9,4)
	addq	$1, %r9
	cmpl	%r9d, %r10d
	jg	.L5
	jmp	.L4
.L25:
	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>

#define MAX 500

int main(void){
  int i,j,x,y,num;

  int n;
  scanf("%d",&n);

  int arr[MAX][MAX]={};
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      x=i; y=j; num=1;
      while(1){
        if(x%2!=y%2){
          arr[i][j]=num;
          break;
        }else{
          x/=2; y/=2;
          num++;
        }
      }
    }
  }

  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      printf("%d ",arr[i][j]);
    }
    printf("\n");
  }

  return 0;
}

5
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 1 3 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 
1 2 1 3 1 2 1 4 1 2 1 3 1 
1 2 1 3 1 2 1 4 1 2 1 3 
1 2 1 3 1 2 1 4 1 2 1 
1 2 1 3 1 2 1 4 1 2 
1 2 1 3 1 2 1 4 1 
1 2 1 3 1 2 1 4 
1 2 1 3 1 2 1 
1 2 1 3 1 2 
1 2 1 3 1 
1 2 1 3 
1 2 1 
1 2 
1 
 1 2 1 3 1 2 
1 2 1 3 1 
1 2 1 3 
1 2 1 
1 2 
1 
 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 
1 2 1 3 1 2 1 4 1 2 1 3 1 2 
1 2 1 3 1 2 1 4 1 2 1 3 1 
1 2 1 3 1 2 1 4 1 2 1 3 
1 2 1 3 1 2 1 4 1 2 1 
1 2 1 3 1 2 1 4 1 2 
1 2 1 3 1 2 1 4 1 
1 2 1 3 1 2 1 4 
1 2 1 3 1 2 1 
1 2 1 3 1 2 
1 2 1 3 1 
1 2 1 3 
1 2 1 
1 2 
1 

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>

#define MAX 500

int main(void){
  int i,j,x,y,num;

  int n;
  scanf("%d",&n);

  int arr[MAX][MAX]={};
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      x=i; y=j; num=1;
      while(1){
        if(x%2!=y%2){
          arr[i][j]=num;
          break;
        }else{
          x/=2; y/=2;
          num++;
        }
      }
    }
  }

  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      printf("%d ",arr[i][j]);
    }
    printf("\n");
  }

  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.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	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1000040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000016(%rbp), %rax
	movl	$1000000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1000036(%rbp)
	jmp	.L2
.L8:
	movl	-1000036(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1000032(%rbp)
	jmp	.L3
.L7:
	movl	-1000036(%rbp), %eax
	movl	%eax, -1000028(%rbp)
	movl	-1000032(%rbp), %eax
	movl	%eax, -1000024(%rbp)
	movl	$1, -1000020(%rbp)
.L6:
	movl	-1000028(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-1000024(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	%eax, %ecx
	je	.L4
	movl	-1000032(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rax, %rdx
	movl	-1000020(%rbp), %eax
	movl	%eax, -1000016(%rbp,%rdx,4)
	jmp	.L15
.L4:
	movl	-1000028(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000028(%rbp)
	movl	-1000024(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000024(%rbp)
	addl	$1, -1000020(%rbp)
	jmp	.L6
.L15:
	addl	$1, -1000032(%rbp)
.L3:
	movl	-1000040(%rbp), %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L7
	addl	$1, -1000036(%rbp)
.L2:
	movl	-1000040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000036(%rbp)
	jl	.L8
	movl	$0, -1000036(%rbp)
	jmp	.L9
.L12:
	movl	-1000036(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1000032(%rbp)
	jmp	.L10
.L11:
	movl	-1000032(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000032(%rbp)
.L10:
	movl	-1000040(%rbp), %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L11
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -1000036(%rbp)
.L9:
	movl	-1000040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000036(%rbp)
	jl	.L12
	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
.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 "
	.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	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1000040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1000016(%rbp), %rax
	movl	$1000000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -1000036(%rbp)
	jmp	.L2
.L8:
	movl	-1000036(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1000032(%rbp)
	jmp	.L3
.L7:
	movl	-1000036(%rbp), %eax
	movl	%eax, -1000028(%rbp)
	movl	-1000032(%rbp), %eax
	movl	%eax, -1000024(%rbp)
	movl	$1, -1000020(%rbp)
.L6:
	movl	-1000028(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-1000024(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	%eax, %ecx
	je	.L4
	movl	-1000032(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rax, %rdx
	movl	-1000020(%rbp), %eax
	movl	%eax, -1000016(%rbp,%rdx,4)
	jmp	.L15
.L4:
	movl	-1000028(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000028(%rbp)
	movl	-1000024(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000024(%rbp)
	addl	$1, -1000020(%rbp)
	jmp	.L6
.L15:
	addl	$1, -1000032(%rbp)
.L3:
	movl	-1000040(%rbp), %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L7
	addl	$1, -1000036(%rbp)
.L2:
	movl	-1000040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000036(%rbp)
	jl	.L8
	movl	$0, -1000036(%rbp)
	jmp	.L9
.L12:
	movl	-1000036(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1000032(%rbp)
	jmp	.L10
.L11:
	movl	-1000032(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1000036(%rbp), %eax
	cltq
	imulq	$500, %rax, %rax
	addq	%rdx, %rax
	movl	-1000016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000032(%rbp)
.L10:
	movl	-1000040(%rbp), %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L11
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -1000036(%rbp)
.L9:
	movl	-1000040(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000036(%rbp)
	jl	.L12
	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
.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:
