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;
  scanf("%d",&n);
  int f[n+1][11],i,j,k;
  for(i=0;i<n;i++)
    for(j=0;j<10;j++)
      scanf("%d",&f[i][j]);
  int p[n+1][11];
  for(i=0;i<n;i++)
    for(j=0;j<=10;j++)
      scanf("%d",&p[i][j]);
  int max=-1000000000;
  for(i=1;i<1024;i++){
    int c[n+1];
    for(k=0;k<n;k++)
      c[k]=0;
    int num=i;
    for(j=0;j<10;j++){
      if(num%2==1)
        for(k=0;k<n;k++)
          if(f[k][j]==1)
            c[k]++;
      num/=2;
    }
    int count=0;
    for(j=0;j<n;j++)
      count+=p[j][c[j]];
    if(max<count)
      max=count;
  }
  printf("%d\n",max);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %eax
	leal	1(%rax), %esi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$352, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rcx
	movl	$352, %eax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%esi, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%rbp), %r9
	imulq	$352, %r9, %rdx
	imulq	$0, %r8, %rax
	leaq	(%rdx,%rax), %rcx
	movl	$352, %eax
	mulq	%r8
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	$0, -128(%rbp)
	jmp	.L5
.L8:
	movl	$0, -124(%rbp)
	jmp	.L6
.L7:
	movl	-124(%rbp), %eax
	movslq	%eax, %rcx
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L6:
	cmpl	$9, -124(%rbp)
	jle	.L7
	addl	$1, -128(%rbp)
.L5:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L8
	movl	-132(%rbp), %eax
	leal	1(%rax), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-176(%rbp), %r10
	movq	-168(%rbp), %r11
	imulq	$352, %r11, %rdx
	imulq	$0, %r10, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$352, %eax
	mulq	%r10
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$352, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$352, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -128(%rbp)
	jmp	.L12
.L15:
	movl	$0, -124(%rbp)
	jmp	.L13
.L14:
	movl	-124(%rbp), %eax
	movslq	%eax, %rcx
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L13:
	cmpl	$10, -124(%rbp)
	jle	.L14
	addl	$1, -128(%rbp)
.L12:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L15
	movl	$-1000000000, -116(%rbp)
	movl	$1, -128(%rbp)
	jmp	.L16
.L31:
	movq	%rsp, %rax
	movq	%rax, %rdi
	movl	-132(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -208(%rbp)
	movq	$0, -200(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L17:
	cmpq	%rdx, %rsp
	je	.L18
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L17
.L18:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L19
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L19:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L20
.L21:
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -120(%rbp)
.L20:
	movl	-132(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L21
	movl	-128(%rbp), %eax
	movl	%eax, -112(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L22
.L27:
	movl	-112(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L23
	movl	$0, -120(%rbp)
	jmp	.L24
.L26:
	movq	-96(%rbp), %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rsi
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L25:
	addl	$1, -120(%rbp)
.L24:
	movl	-132(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L26
.L23:
	movl	-112(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -112(%rbp)
	addl	$1, -124(%rbp)
.L22:
	cmpl	$9, -124(%rbp)
	jle	.L27
	movl	$0, -108(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L28
.L29:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	-80(%rbp), %rcx
	movslq	%eax, %rsi
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	addl	%eax, -108(%rbp)
	addl	$1, -124(%rbp)
.L28:
	movl	-132(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L29
	movl	-116(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jge	.L30
	movl	-108(%rbp), %eax
	movl	%eax, -116(%rbp)
.L30:
	movq	%rdi, %rsp
	addl	$1, -128(%rbp)
.L16:
	cmpl	$1023, -128(%rbp)
	jle	.L31
	movl	-116(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r8d
	movq	%rsp, %rsi
	leal	1(%r8), %eax
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,4), %rcx
	leaq	(%rdx,%rcx,2), %rdx
	leaq	15(,%rdx,4), %rcx
	movq	%rcx, %rdx
	andq	$-4096, %rcx
	subq	%rcx, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L3
.L57:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L57
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L58
.L4:
	movq	%rsp, %rcx
	movq	%rcx, -80(%rbp)
	testl	%r8d, %r8d
	jle	.L5
	leaq	40(%rcx), %rbx
	xorl	%r15d, %r15d
	movq	%rbx, %r14
.L7:
	leaq	-40(%r14), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %r12
	call	__isoc99_scanf@PLT
	cmpq	%r14, %r12
	jne	.L6
	movl	-60(%rbp), %r8d
	addl	$1, %r15d
	leaq	44(%r12), %r14
	cmpl	%r15d, %r8d
	jg	.L7
	leal	1(%r8), %eax
	movq	%rsp, %rsi
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,4), %rcx
	leaq	(%rdx,%rcx,2), %rdx
	leaq	15(,%rdx,4), %rcx
	movq	%rcx, %rdx
	andq	$-4096, %rcx
	andq	$-16, %rdx
	subq	%rcx, %rsi
.L8:
	cmpq	%rsi, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L59
.L10:
	movq	%rsp, %r12
	testl	%r8d, %r8d
	jle	.L11
	movl	$0, -68(%rbp)
	leaq	44(%r12), %r14
.L13:
	leaq	-44(%r14), %r15
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %r15
	call	__isoc99_scanf@PLT
	cmpq	%r15, %r14
	jne	.L12
	addl	$1, -68(%rbp)
	movl	-60(%rbp), %r8d
	addq	$44, %r14
	movl	-68(%rbp), %eax
	cmpl	%eax, %r8d
	jg	.L13
	leal	1(%r8), %eax
.L11:
	movl	$-1000000000, %r14d
	movl	$1, %r13d
	.p2align 4,,10
	.p2align 3
.L28:
	cltq
	movq	%rsp, %rsi
	movq	%rsp, %r15
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L15
.L60:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L60
.L15:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L16
	orq	$0, -8(%rsp,%rdx)
.L16:
	movq	%rsp, %rdi
	testl	%r8d, %r8d
	jle	.L19
	movslq	%r8d, %rdx
	xorl	%esi, %esi
	movl	%r8d, -68(%rbp)
	salq	$2, %rdx
	call	memset@PLT
	movl	-68(%rbp), %r8d
	movq	%rax, %rdi
.L19:
	leal	-1(%r8), %r9d
	movq	-80(%rbp), %rsi
	movl	%r13d, %r10d
	leaq	4(%rdi,%r9,4), %r11
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rsi
	sarl	%r10d
	cmpq	%rsi, %rbx
	je	.L61
.L18:
	testb	$1, %r10b
	je	.L22
	testl	%r8d, %r8d
	jle	.L22
	movq	%rdi, %rax
	movq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L24:
	cmpl	$1, (%rdx)
	jne	.L23
	addl	$1, (%rax)
.L23:
	addq	$4, %rax
	addq	$44, %rdx
	cmpq	%rax, %r11
	jne	.L24
	addq	$4, %rsi
	sarl	%r10d
	cmpq	%rsi, %rbx
	jne	.L18
	.p2align 4,,10
	.p2align 3
.L61:
	testl	%r8d, %r8d
	jle	.L33
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L26:
	movslq	%eax, %rdx
	movslq	(%rdi,%rax,4), %r8
	leaq	(%rdx,%rdx,4), %r10
	leaq	(%rdx,%r10,2), %rdx
	addq	%r8, %rdx
	addl	(%r12,%rdx,4), %esi
	movq	%rax, %rdx
	addq	$1, %rax
	cmpq	%r9, %rdx
	jne	.L26
.L25:
	cmpl	%esi, %r14d
	movq	%r15, %rsp
	cmovl	%esi, %r14d
	addl	$1, %r13d
	cmpl	$1024, %r13d
	je	.L27
	movl	-60(%rbp), %r8d
	leal	1(%r8), %eax
	jmp	.L28
.L33:
	xorl	%esi, %esi
	jmp	.L25
.L27:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L62
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L59:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L10
.L58:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movslq	%eax, %rdx
	movq	%rsp, %rsi
	imulq	$44, %rdx, %rdx
	addq	$15, %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L29:
	cmpq	%rsi, %rsp
	je	.L30
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L29
.L30:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	je	.L31
	orq	$0, -8(%rsp,%rcx)
.L31:
	movq	-80(%rbp), %rcx
	movq	%rsp, %r12
	leaq	40(%rcx), %rbx
	jmp	.L11
.L62:
	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\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r8d
	movq	%rsp, %rsi
	leal	1(%r8), %eax
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,4), %rcx
	leaq	(%rdx,%rcx,2), %rdx
	leaq	15(,%rdx,4), %rcx
	movq	%rcx, %rdx
	andq	$-4096, %rcx
	subq	%rcx, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L3
.L57:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L57
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L58
.L4:
	movq	%rsp, %rcx
	movq	%rcx, -80(%rbp)
	testl	%r8d, %r8d
	jle	.L5
	leaq	40(%rcx), %rbx
	xorl	%r15d, %r15d
	movq	%rbx, %r14
.L7:
	leaq	-40(%r14), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %r12
	call	__isoc99_scanf@PLT
	cmpq	%r14, %r12
	jne	.L6
	movl	-60(%rbp), %r8d
	addl	$1, %r15d
	leaq	44(%r12), %r14
	cmpl	%r15d, %r8d
	jg	.L7
	leal	1(%r8), %eax
	movq	%rsp, %rsi
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,4), %rcx
	leaq	(%rdx,%rcx,2), %rdx
	leaq	15(,%rdx,4), %rcx
	movq	%rcx, %rdx
	andq	$-4096, %rcx
	andq	$-16, %rdx
	subq	%rcx, %rsi
.L8:
	cmpq	%rsi, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L59
.L10:
	movq	%rsp, %r12
	testl	%r8d, %r8d
	jle	.L11
	movl	$0, -68(%rbp)
	leaq	44(%r12), %r14
.L13:
	leaq	-44(%r14), %r15
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$4, %r15
	call	__isoc99_scanf@PLT
	cmpq	%r15, %r14
	jne	.L12
	addl	$1, -68(%rbp)
	movl	-60(%rbp), %r8d
	addq	$44, %r14
	movl	-68(%rbp), %eax
	cmpl	%eax, %r8d
	jg	.L13
	leal	1(%r8), %eax
.L11:
	movl	$-1000000000, %r14d
	movl	$1, %r13d
	.p2align 4,,10
	.p2align 3
.L28:
	cltq
	movq	%rsp, %rsi
	movq	%rsp, %r15
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L15
.L60:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L60
.L15:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L16
	orq	$0, -8(%rsp,%rdx)
.L16:
	movq	%rsp, %rdi
	testl	%r8d, %r8d
	jle	.L19
	movslq	%r8d, %rdx
	xorl	%esi, %esi
	movl	%r8d, -68(%rbp)
	salq	$2, %rdx
	call	memset@PLT
	movl	-68(%rbp), %r8d
	movq	%rax, %rdi
.L19:
	leal	-1(%r8), %r9d
	movq	-80(%rbp), %rsi
	movl	%r13d, %r10d
	leaq	4(%rdi,%r9,4), %r11
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rsi
	sarl	%r10d
	cmpq	%rsi, %rbx
	je	.L61
.L18:
	testb	$1, %r10b
	je	.L22
	testl	%r8d, %r8d
	jle	.L22
	movq	%rdi, %rax
	movq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L24:
	cmpl	$1, (%rdx)
	jne	.L23
	addl	$1, (%rax)
.L23:
	addq	$4, %rax
	addq	$44, %rdx
	cmpq	%rax, %r11
	jne	.L24
	addq	$4, %rsi
	sarl	%r10d
	cmpq	%rsi, %rbx
	jne	.L18
	.p2align 4,,10
	.p2align 3
.L61:
	testl	%r8d, %r8d
	jle	.L33
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L26:
	movslq	%eax, %rdx
	movslq	(%rdi,%rax,4), %r8
	leaq	(%rdx,%rdx,4), %r10
	leaq	(%rdx,%r10,2), %rdx
	addq	%r8, %rdx
	addl	(%r12,%rdx,4), %esi
	movq	%rax, %rdx
	addq	$1, %rax
	cmpq	%r9, %rdx
	jne	.L26
.L25:
	cmpl	%esi, %r14d
	movq	%r15, %rsp
	cmovl	%esi, %r14d
	addl	$1, %r13d
	cmpl	$1024, %r13d
	je	.L27
	movl	-60(%rbp), %r8d
	leal	1(%r8), %eax
	jmp	.L28
.L33:
	xorl	%esi, %esi
	jmp	.L25
.L27:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L62
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L59:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L10
.L58:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movslq	%eax, %rdx
	movq	%rsp, %rsi
	imulq	$44, %rdx, %rdx
	addq	$15, %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L29:
	cmpq	%rsi, %rsp
	je	.L30
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L29
.L30:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	je	.L31
	orq	$0, -8(%rsp,%rcx)
.L31:
	movq	-80(%rbp), %rcx
	movq	%rsp, %r12
	leaq	40(%rcx), %rbx
	jmp	.L11
.L62:
	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;
  scanf("%d",&n);
  int f[n+1][11],i,j,k;
  for(i=0;i<n;i++)
    for(j=0;j<10;j++)
      scanf("%d",&f[i][j]);
  int p[n+1][11];
  for(i=0;i<n;i++)
    for(j=0;j<=10;j++)
      scanf("%d",&p[i][j]);
  int max=-1000000000;
  for(i=1;i<1024;i++){
    int c[n+1];
    for(k=0;k<n;k++)
      c[k]=0;
    int num=i;
    for(j=0;j<10;j++){
      if(num%2==1)
        for(k=0;k<n;k++)
          if(f[k][j]==1)
            c[k]++;
      num/=2;
    }
    int count=0;
    for(j=0;j<n;j++)
      count+=p[j][c[j]];
    if(max<count)
      max=count;
  }
  printf("%d\n",max);
  return 0;
}

2
1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1
0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1
0 -2 -2 -2 -1 -2 -1 -1 -1 -1 -1
 1
1 1 0 1 0 0 0 1 0 1
3 4 5 6 7 8 9 -4 -3 4 -2
 2
1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1
0 -2 -2 -2 -4 -2 -1 -1 -1 -1 -1
0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1
 2
1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1
0 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1
0 0 -2 -2 -1 -2 -1 -1 -1 -1 -1
 1
1 1 0 1 0 1 0 1 0 1
3 4 5 6 7 8 10 -4 -3 4 -2
 1
1 1 0 1 0 0 0 1 0 1
3 4 5 11 7 8 9 -2 -3 4 -2
 3
1 1 1 1 1 1 0 0 1 0
0 1 0 1 1 1 1 0 1 0
1 0 1 1 0 1 0 1 0 1
-8 6 -2 -8 -8 4 8 7 -6 2 2
-9 2 0 1 7 -5 0 -2 -6 5 5
6 -6 7 -9 6 -5 8 0 -9 -7 -7
 2
1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1
1 -2 -2 -2 -2 -2 -1 -1 -1 -1 -1
0 0 -2 -2 -1 -2 -1 -1 -1 -1 -1
 1
1 1 0 1 0 0 0 1 0 0
3 1 5 6 7 8 9 -7 -3 4 -2
 1
1 1 0 1 1 0 0 1 0 1
4 4 5 12 7 8 10 -4 -3 4 -2

-1
 8
 -2
 0
 10
 11
 23
 1
 7
 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>
int main(){
  int n;
  scanf("%d",&n);
  int f[n+1][11],i,j,k;
  for(i=0;i<n;i++)
    for(j=0;j<10;j++)
      scanf("%d",&f[i][j]);
  int p[n+1][11];
  for(i=0;i<n;i++)
    for(j=0;j<=10;j++)
      scanf("%d",&p[i][j]);
  int max=-1000000000;
  for(i=1;i<1024;i++){
    int c[n+1];
    for(k=0;k<n;k++)
      c[k]=0;
    int num=i;
    for(j=0;j<10;j++){
      if(num%2==1)
        for(k=0;k<n;k++)
          if(f[k][j]==1)
            c[k]++;
      num/=2;
    }
    int count=0;
    for(j=0;j<n;j++)
      count+=p[j][c[j]];
    if(max<count)
      max=count;
  }
  printf("%d\n",max);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %eax
	leal	1(%rax), %esi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$352, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rcx
	movl	$352, %eax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%esi, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%rbp), %r9
	imulq	$352, %r9, %rdx
	imulq	$0, %r8, %rax
	leaq	(%rdx,%rax), %rcx
	movl	$352, %eax
	mulq	%r8
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	$0, -128(%rbp)
	jmp	.L5
.L8:
	movl	$0, -124(%rbp)
	jmp	.L6
.L7:
	movl	-124(%rbp), %eax
	movslq	%eax, %rcx
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L6:
	cmpl	$9, -124(%rbp)
	jle	.L7
	addl	$1, -128(%rbp)
.L5:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L8
	movl	-132(%rbp), %eax
	leal	1(%rax), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-176(%rbp), %r10
	movq	-168(%rbp), %r11
	imulq	$352, %r11, %rdx
	imulq	$0, %r10, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$352, %eax
	mulq	%r10
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$352, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$352, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -128(%rbp)
	jmp	.L12
.L15:
	movl	$0, -124(%rbp)
	jmp	.L13
.L14:
	movl	-124(%rbp), %eax
	movslq	%eax, %rcx
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L13:
	cmpl	$10, -124(%rbp)
	jle	.L14
	addl	$1, -128(%rbp)
.L12:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L15
	movl	$-1000000000, -116(%rbp)
	movl	$1, -128(%rbp)
	jmp	.L16
.L31:
	movq	%rsp, %rax
	movq	%rax, %rdi
	movl	-132(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -208(%rbp)
	movq	$0, -200(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L17:
	cmpq	%rdx, %rsp
	je	.L18
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L17
.L18:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L19
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L19:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L20
.L21:
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -120(%rbp)
.L20:
	movl	-132(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L21
	movl	-128(%rbp), %eax
	movl	%eax, -112(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L22
.L27:
	movl	-112(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L23
	movl	$0, -120(%rbp)
	jmp	.L24
.L26:
	movq	-96(%rbp), %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rsi
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L25:
	addl	$1, -120(%rbp)
.L24:
	movl	-132(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L26
.L23:
	movl	-112(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -112(%rbp)
	addl	$1, -124(%rbp)
.L22:
	cmpl	$9, -124(%rbp)
	jle	.L27
	movl	$0, -108(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L28
.L29:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	-80(%rbp), %rcx
	movslq	%eax, %rsi
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	addl	%eax, -108(%rbp)
	addl	$1, -124(%rbp)
.L28:
	movl	-132(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L29
	movl	-116(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jge	.L30
	movl	-108(%rbp), %eax
	movl	%eax, -116(%rbp)
.L30:
	movq	%rdi, %rsp
	addl	$1, -128(%rbp)
.L16:
	cmpl	$1023, -128(%rbp)
	jle	.L31
	movl	-116(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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\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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$168, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-132(%rbp), %eax
	leal	1(%rax), %esi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$352, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rcx
	movl	$352, %eax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%esi, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%rbp), %r9
	imulq	$352, %r9, %rdx
	imulq	$0, %r8, %rax
	leaq	(%rdx,%rax), %rcx
	movl	$352, %eax
	mulq	%r8
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	$0, -128(%rbp)
	jmp	.L5
.L8:
	movl	$0, -124(%rbp)
	jmp	.L6
.L7:
	movl	-124(%rbp), %eax
	movslq	%eax, %rcx
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L6:
	cmpl	$9, -124(%rbp)
	jle	.L7
	addl	$1, -128(%rbp)
.L5:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L8
	movl	-132(%rbp), %eax
	leal	1(%rax), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-176(%rbp), %r10
	movq	-168(%rbp), %r11
	imulq	$352, %r11, %rdx
	imulq	$0, %r10, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$352, %eax
	mulq	%r10
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$352, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$352, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -128(%rbp)
	jmp	.L12
.L15:
	movl	$0, -124(%rbp)
	jmp	.L13
.L14:
	movl	-124(%rbp), %eax
	movslq	%eax, %rcx
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L13:
	cmpl	$10, -124(%rbp)
	jle	.L14
	addl	$1, -128(%rbp)
.L12:
	movl	-132(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L15
	movl	$-1000000000, -116(%rbp)
	movl	$1, -128(%rbp)
	jmp	.L16
.L31:
	movq	%rsp, %rax
	movq	%rax, %rdi
	movl	-132(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -208(%rbp)
	movq	$0, -200(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L17:
	cmpq	%rdx, %rsp
	je	.L18
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L17
.L18:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L19
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L19:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L20
.L21:
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -120(%rbp)
.L20:
	movl	-132(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L21
	movl	-128(%rbp), %eax
	movl	%eax, -112(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L22
.L27:
	movl	-112(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L23
	movl	$0, -120(%rbp)
	jmp	.L24
.L26:
	movq	-96(%rbp), %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rsi
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L25:
	addl	$1, -120(%rbp)
.L24:
	movl	-132(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L26
.L23:
	movl	-112(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -112(%rbp)
	addl	$1, -124(%rbp)
.L22:
	cmpl	$9, -124(%rbp)
	jle	.L27
	movl	$0, -108(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L28
.L29:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	-80(%rbp), %rcx
	movslq	%eax, %rsi
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	addl	%eax, -108(%rbp)
	addl	$1, -124(%rbp)
.L28:
	movl	-132(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L29
	movl	-116(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jge	.L30
	movl	-108(%rbp), %eax
	movl	%eax, -116(%rbp)
.L30:
	movq	%rdi, %rsp
	addl	$1, -128(%rbp)
.L16:
	cmpl	$1023, -128(%rbp)
	jle	.L31
	movl	-116(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L33
	call	__stack_chk_fail@PLT
.L33:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
