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 100

int main(void)
{
  int i, j, N, NN;
  int a, b, aa, bb, temp, ranknum, check;
  int max;
  int team[MAX];
  int rank[MAX];

  scanf("%d",&N);
  for(i=0;i<=N;i++)
    {
      team[i] = 0;
    }

  NN = N*(N-1)/2;

  for(i=1;i<=NN;i++)
    {
      scanf("%d %d %d %d",&a,&b,&aa,&bb);
      if(aa>bb)
	team[a]+=3;
      if(bb>aa)
	team[b]+=3;
      if(aa==bb)
	{
	  team[a]+=1;
	  team[b]+=1;
	}
    }

  max = 0;
  for(i=1;i<=N;i++)
    {
      if(max<team[i])
	{
	  max = team[i];
	  temp = i;
	}
    }
  rank[temp] = 1;
  
  temp = max;
  ranknum = 1;
  for(;temp>=0;temp--)
    {
      for(j=N;j>0;j--)
	{
	  if(team[j]==temp)
	    {
	      rank[j] = ranknum;
	      check++;
	    }
	}
      ranknum = ranknum + check;
      check = 0;
    }
  
  for(i=1;i<=N;i++)
    {
      printf("%d\n",rank[i]);
    }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d %d"
.LC2:
	.string	"%d\n"
	.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	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-864(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -844(%rbp)
	jmp	.L2
.L3:
	movl	-844(%rbp), %eax
	cltq
	movl	$0, -816(%rbp,%rax,4)
	addl	$1, -844(%rbp)
.L2:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L3
	movl	-864(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-864(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -820(%rbp)
	movl	$1, -844(%rbp)
	jmp	.L4
.L8:
	leaq	-848(%rbp), %rsi
	leaq	-852(%rbp), %rcx
	leaq	-856(%rbp), %rdx
	leaq	-860(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-852(%rbp), %edx
	movl	-848(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-860(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-860(%rbp), %eax
	addl	$3, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L5:
	movl	-848(%rbp), %edx
	movl	-852(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L6
	movl	-856(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-856(%rbp), %eax
	addl	$3, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L6:
	movl	-852(%rbp), %edx
	movl	-848(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-860(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-860(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	movl	-856(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-856(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L7:
	addl	$1, -844(%rbp)
.L4:
	movl	-844(%rbp), %eax
	cmpl	-820(%rbp), %eax
	jle	.L8
	movl	$0, -824(%rbp)
	movl	$1, -844(%rbp)
	jmp	.L9
.L11:
	movl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -824(%rbp)
	jge	.L10
	movl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -824(%rbp)
	movl	-844(%rbp), %eax
	movl	%eax, -836(%rbp)
.L10:
	addl	$1, -844(%rbp)
.L9:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L11
	movl	-836(%rbp), %eax
	cltq
	movl	$1, -416(%rbp,%rax,4)
	movl	-824(%rbp), %eax
	movl	%eax, -836(%rbp)
	movl	$1, -832(%rbp)
	jmp	.L12
.L16:
	movl	-864(%rbp), %eax
	movl	%eax, -840(%rbp)
	jmp	.L13
.L15:
	movl	-840(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -836(%rbp)
	jne	.L14
	movl	-840(%rbp), %eax
	cltq
	movl	-832(%rbp), %edx
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -828(%rbp)
.L14:
	subl	$1, -840(%rbp)
.L13:
	cmpl	$0, -840(%rbp)
	jg	.L15
	movl	-828(%rbp), %eax
	addl	%eax, -832(%rbp)
	movl	$0, -828(%rbp)
	subl	$1, -836(%rbp)
.L12:
	cmpl	$0, -836(%rbp)
	jns	.L16
	movl	$1, -844(%rbp)
	jmp	.L17
.L18:
	movl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -844(%rbp)
.L17:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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 %d %d"
.LC2:
	.string	"%d\n"
	.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
	leaq	.LC0(%rip), %rdi
	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
	subq	$872, %rsp
	.cfi_def_cfa_offset 928
	movq	%fs:40, %rax
	movq	%rax, 856(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ebx
	testl	%ebx, %ebx
	js	.L5
	movslq	%ebx, %rax
	leaq	48(%rsp), %rdi
	xorl	%esi, %esi
	leaq	4(,%rax,4), %rdx
	call	memset@PLT
.L5:
	leal	-1(%rbx), %eax
	imull	%ebx, %eax
	movl	%eax, %ebx
	shrl	$31, %ebx
	addl	%eax, %ebx
	sarl	%ebx
	movl	%ebx, 8(%rsp)
	cmpl	$1, %eax
	jle	.L4
	movl	$1, %ebx
	leaq	44(%rsp), %r12
	leaq	40(%rsp), %r15
	leaq	36(%rsp), %r14
	leaq	32(%rsp), %r13
	leaq	.LC1(%rip), %rbp
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movslq	32(%rsp), %rax
	addl	$3, 48(%rsp,%rax,4)
.L9:
	addl	$1, %ebx
	cmpl	%ebx, 8(%rsp)
	jl	.L4
.L3:
	movq	%r12, %r8
	movq	%r15, %rcx
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	cmpl	%eax, 40(%rsp)
	jg	.L32
	jge	.L33
	movslq	36(%rsp), %rax
	addl	$1, %ebx
	addl	$3, 48(%rsp,%rax,4)
	cmpl	%ebx, 8(%rsp)
	jge	.L3
.L4:
	movslq	28(%rsp), %r8
	testl	%r8d, %r8d
	jle	.L7
	leal	1(%r8), %esi
	movl	$1, %eax
	leaq	48(%rsp), %rdi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rdi,%rax,4), %ecx
	cmpl	%edx, %ecx
	jle	.L12
	movl	%eax, 12(%rsp)
	movl	%ecx, %edx
.L12:
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L13
	movslq	12(%rsp), %r12
	movl	$1, %esi
	leaq	448(%rsp), %rbp
	movl	$1, 448(%rsp,%r12,4)
	testl	%edx, %edx
	js	.L34
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r8, %rax
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	%edx, (%rdi,%rax,4)
	jne	.L16
	movl	%esi, 0(%rbp,%rax,4)
	addl	$1, %ecx
.L16:
	subq	$1, %rax
	testl	%eax, %eax
	jg	.L17
	addl	%ecx, %esi
	subl	$1, %edx
	jnb	.L14
.L18:
	movl	$1, %ebx
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L15:
	movl	0(%rbp,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 28(%rsp)
	jge	.L15
.L7:
	movq	856(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$872, %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
.L33:
	.cfi_restore_state
	jne	.L9
	movslq	32(%rsp), %rax
	addl	$1, 48(%rsp,%rax,4)
	movslq	36(%rsp), %rax
	addl	$1, 48(%rsp,%rax,4)
	jmp	.L9
.L34:
	leaq	448(%rsp), %rbp
	jmp	.L18
.L35:
	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 %d %d"
.LC2:
	.string	"%d\n"
	.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
	leaq	.LC0(%rip), %rdi
	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
	subq	$872, %rsp
	.cfi_def_cfa_offset 928
	movq	%fs:40, %rax
	movq	%rax, 856(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ebx
	testl	%ebx, %ebx
	js	.L5
	movslq	%ebx, %rax
	leaq	48(%rsp), %rdi
	xorl	%esi, %esi
	leaq	4(,%rax,4), %rdx
	call	memset@PLT
.L5:
	leal	-1(%rbx), %eax
	imull	%ebx, %eax
	movl	%eax, %ebx
	shrl	$31, %ebx
	addl	%eax, %ebx
	sarl	%ebx
	movl	%ebx, 8(%rsp)
	cmpl	$1, %eax
	jle	.L4
	movl	$1, %ebx
	leaq	44(%rsp), %r12
	leaq	40(%rsp), %r15
	leaq	36(%rsp), %r14
	leaq	32(%rsp), %r13
	leaq	.LC1(%rip), %rbp
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movslq	32(%rsp), %rax
	addl	$3, 48(%rsp,%rax,4)
.L9:
	addl	$1, %ebx
	cmpl	%ebx, 8(%rsp)
	jl	.L4
.L3:
	movq	%r12, %r8
	movq	%r15, %rcx
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	cmpl	%eax, 40(%rsp)
	jg	.L32
	jge	.L33
	movslq	36(%rsp), %rax
	addl	$1, %ebx
	addl	$3, 48(%rsp,%rax,4)
	cmpl	%ebx, 8(%rsp)
	jge	.L3
.L4:
	movslq	28(%rsp), %r8
	testl	%r8d, %r8d
	jle	.L7
	leal	1(%r8), %esi
	movl	$1, %eax
	leaq	48(%rsp), %rdi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rdi,%rax,4), %ecx
	cmpl	%edx, %ecx
	jle	.L12
	movl	%eax, 12(%rsp)
	movl	%ecx, %edx
.L12:
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L13
	movslq	12(%rsp), %r12
	movl	$1, %esi
	leaq	448(%rsp), %rbp
	movl	$1, 448(%rsp,%r12,4)
	testl	%edx, %edx
	js	.L34
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r8, %rax
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	%edx, (%rdi,%rax,4)
	jne	.L16
	movl	%esi, 0(%rbp,%rax,4)
	addl	$1, %ecx
.L16:
	subq	$1, %rax
	testl	%eax, %eax
	jg	.L17
	addl	%ecx, %esi
	subl	$1, %edx
	jnb	.L14
.L18:
	movl	$1, %ebx
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L15:
	movl	0(%rbp,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 28(%rsp)
	jge	.L15
.L7:
	movq	856(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$872, %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
.L33:
	.cfi_restore_state
	jne	.L9
	movslq	32(%rsp), %rax
	addl	$1, 48(%rsp,%rax,4)
	movslq	36(%rsp), %rax
	addl	$1, 48(%rsp,%rax,4)
	jmp	.L9
.L34:
	leaq	448(%rsp), %rbp
	jmp	.L18
.L35:
	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 100

int main(void)
{
  int i, j, N, NN;
  int a, b, aa, bb, temp, ranknum, check;
  int max;
  int team[MAX];
  int rank[MAX];

  scanf("%d",&N);
  for(i=0;i<=N;i++)
    {
      team[i] = 0;
    }

  NN = N*(N-1)/2;

  for(i=1;i<=NN;i++)
    {
      scanf("%d %d %d %d",&a,&b,&aa,&bb);
      if(aa>bb)
	team[a]+=3;
      if(bb>aa)
	team[b]+=3;
      if(aa==bb)
	{
	  team[a]+=1;
	  team[b]+=1;
	}
    }

  max = 0;
  for(i=1;i<=N;i++)
    {
      if(max<team[i])
	{
	  max = team[i];
	  temp = i;
	}
    }
  rank[temp] = 1;
  
  temp = max;
  ranknum = 1;
  for(;temp>=0;temp--)
    {
      for(j=N;j>0;j--)
	{
	  if(team[j]==temp)
	    {
	      rank[j] = ranknum;
	      check++;
	    }
	}
      ranknum = ranknum + check;
      check = 0;
    }
  
  for(i=1;i<=N;i++)
    {
      printf("%d\n",rank[i]);
    }

  return 0;
}
4
1 2 0 1
1 3 2 1
1 4 2 2
2 3 2 1
2 4 3 0
3 4 1 3
 4
1 2 0 1
1 3 2 1
1 4 2 2
4 3 2 1
2 4 3 0
3 4 1 3
 4
1 2 1 1
1 3 2 1
1 4 2 2
4 0 3 1
2 4 3 0
0 4 1 4
 4
1 1 1 1
1 3 2 1
1 4 2 0
4 0 3 1
2 4 3 0
0 4 1 4
 4
1 2 0 1
2 3 2 1
1 4 2 2
2 3 2 1
2 4 3 0
3 4 1 3
 4
1 2 0 1
1 3 2 1
1 4 2 2
4 0 2 1
3 4 3 0
0 4 1 4
 4
1 1 1 1
1 3 2 1
1 3 2 2
4 0 3 2
2 4 3 0
0 4 1 4
 4
1 4 0 1
1 3 2 1
1 4 2 2
4 0 2 1
3 4 3 0
-1 4 1 4
 4
1 1 1 1
1 3 2 1
2 4 2 0
4 0 3 1
2 4 3 0
0 4 2 8
 4
1 2 0 1
1 3 2 1
1 4 2 2
2 3 1 0
2 4 3 0
3 4 1 0

29102
1
29104
29102
 30182
30181
30183
1
 2
3
4
1
 1
3
4
2
 3
1
4
2
 28892
28893
28893
1
 1
3
4
1
 2
4
3
1
 32770
1
32771
1
 32768
1
32769
32770

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 100

int main(void)
{
  int i, j, N, NN;
  int a, b, aa, bb, temp, ranknum, check;
  int max;
  int team[MAX];
  int rank[MAX];

  scanf("%d",&N);
  for(i=0;i<=N;i++)
    {
      team[i] = 0;
    }

  NN = N*(N-1)/2;

  for(i=1;i<=NN;i++)
    {
      scanf("%d %d %d %d",&a,&b,&aa,&bb);
      if(aa>bb)
	team[a]+=3;
      if(bb>aa)
	team[b]+=3;
      if(aa==bb)
	{
	  team[a]+=1;
	  team[b]+=1;
	}
    }

  max = 0;
  for(i=1;i<=N;i++)
    {
      if(max<team[i])
	{
	  max = team[i];
	  temp = i;
	}
    }
  rank[temp] = 1;
  
  temp = max;
  ranknum = 1;
  for(;temp>=0;temp--)
    {
      for(j=N;j>0;j--)
	{
	  if(team[j]==temp)
	    {
	      rank[j] = ranknum;
	      check++;
	    }
	}
      ranknum = ranknum + check;
      check = 0;
    }
  
  for(i=1;i<=N;i++)
    {
      printf("%d\n",rank[i]);
    }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d %d"
.LC2:
	.string	"%d\n"
	.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	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-864(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -844(%rbp)
	jmp	.L2
.L3:
	movl	-844(%rbp), %eax
	cltq
	movl	$0, -816(%rbp,%rax,4)
	addl	$1, -844(%rbp)
.L2:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L3
	movl	-864(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-864(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -820(%rbp)
	movl	$1, -844(%rbp)
	jmp	.L4
.L8:
	leaq	-848(%rbp), %rsi
	leaq	-852(%rbp), %rcx
	leaq	-856(%rbp), %rdx
	leaq	-860(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-852(%rbp), %edx
	movl	-848(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-860(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-860(%rbp), %eax
	addl	$3, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L5:
	movl	-848(%rbp), %edx
	movl	-852(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L6
	movl	-856(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-856(%rbp), %eax
	addl	$3, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L6:
	movl	-852(%rbp), %edx
	movl	-848(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-860(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-860(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	movl	-856(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-856(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L7:
	addl	$1, -844(%rbp)
.L4:
	movl	-844(%rbp), %eax
	cmpl	-820(%rbp), %eax
	jle	.L8
	movl	$0, -824(%rbp)
	movl	$1, -844(%rbp)
	jmp	.L9
.L11:
	movl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -824(%rbp)
	jge	.L10
	movl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -824(%rbp)
	movl	-844(%rbp), %eax
	movl	%eax, -836(%rbp)
.L10:
	addl	$1, -844(%rbp)
.L9:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L11
	movl	-836(%rbp), %eax
	cltq
	movl	$1, -416(%rbp,%rax,4)
	movl	-824(%rbp), %eax
	movl	%eax, -836(%rbp)
	movl	$1, -832(%rbp)
	jmp	.L12
.L16:
	movl	-864(%rbp), %eax
	movl	%eax, -840(%rbp)
	jmp	.L13
.L15:
	movl	-840(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -836(%rbp)
	jne	.L14
	movl	-840(%rbp), %eax
	cltq
	movl	-832(%rbp), %edx
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -828(%rbp)
.L14:
	subl	$1, -840(%rbp)
.L13:
	cmpl	$0, -840(%rbp)
	jg	.L15
	movl	-828(%rbp), %eax
	addl	%eax, -832(%rbp)
	movl	$0, -828(%rbp)
	subl	$1, -836(%rbp)
.L12:
	cmpl	$0, -836(%rbp)
	jns	.L16
	movl	$1, -844(%rbp)
	jmp	.L17
.L18:
	movl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -844(%rbp)
.L17:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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 %d %d"
.LC2:
	.string	"%d\n"
	.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	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-864(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -844(%rbp)
	jmp	.L2
.L3:
	movl	-844(%rbp), %eax
	cltq
	movl	$0, -816(%rbp,%rax,4)
	addl	$1, -844(%rbp)
.L2:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L3
	movl	-864(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-864(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -820(%rbp)
	movl	$1, -844(%rbp)
	jmp	.L4
.L8:
	leaq	-848(%rbp), %rsi
	leaq	-852(%rbp), %rcx
	leaq	-856(%rbp), %rdx
	leaq	-860(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-852(%rbp), %edx
	movl	-848(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-860(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-860(%rbp), %eax
	addl	$3, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L5:
	movl	-848(%rbp), %edx
	movl	-852(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L6
	movl	-856(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-856(%rbp), %eax
	addl	$3, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L6:
	movl	-852(%rbp), %edx
	movl	-848(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-860(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-860(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	movl	-856(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-856(%rbp), %eax
	addl	$1, %edx
	cltq
	movl	%edx, -816(%rbp,%rax,4)
.L7:
	addl	$1, -844(%rbp)
.L4:
	movl	-844(%rbp), %eax
	cmpl	-820(%rbp), %eax
	jle	.L8
	movl	$0, -824(%rbp)
	movl	$1, -844(%rbp)
	jmp	.L9
.L11:
	movl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -824(%rbp)
	jge	.L10
	movl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -824(%rbp)
	movl	-844(%rbp), %eax
	movl	%eax, -836(%rbp)
.L10:
	addl	$1, -844(%rbp)
.L9:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L11
	movl	-836(%rbp), %eax
	cltq
	movl	$1, -416(%rbp,%rax,4)
	movl	-824(%rbp), %eax
	movl	%eax, -836(%rbp)
	movl	$1, -832(%rbp)
	jmp	.L12
.L16:
	movl	-864(%rbp), %eax
	movl	%eax, -840(%rbp)
	jmp	.L13
.L15:
	movl	-840(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -836(%rbp)
	jne	.L14
	movl	-840(%rbp), %eax
	cltq
	movl	-832(%rbp), %edx
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -828(%rbp)
.L14:
	subl	$1, -840(%rbp)
.L13:
	cmpl	$0, -840(%rbp)
	jg	.L15
	movl	-828(%rbp), %eax
	addl	%eax, -832(%rbp)
	movl	$0, -828(%rbp)
	subl	$1, -836(%rbp)
.L12:
	cmpl	$0, -836(%rbp)
	jns	.L16
	movl	$1, -844(%rbp)
	jmp	.L17
.L18:
	movl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -844(%rbp)
.L17:
	movl	-864(%rbp), %eax
	cmpl	%eax, -844(%rbp)
	jle	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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:
