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[31],i,j;
  for(i=0;i<31;i++)A[i]=i;
  for(i=0;i<31;i++){
    scanf("%d",&n);
    for(j=0;j<31;j++)if(n==j)A[j]=0;
  }
  for(i=0;i<31;i++){
    if(A[i]!=0)printf("%d\n",A[i]);
		 }
  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
	subq	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -152(%rbp)
	jmp	.L2
.L3:
	movl	-152(%rbp), %eax
	cltq
	movl	-152(%rbp), %edx
	movl	%edx, -144(%rbp,%rax,4)
	addl	$1, -152(%rbp)
.L2:
	cmpl	$30, -152(%rbp)
	jle	.L3
	movl	$0, -152(%rbp)
	jmp	.L4
.L8:
	leaq	-156(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L5
.L7:
	movl	-156(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jne	.L6
	movl	-148(%rbp), %eax
	cltq
	movl	$0, -144(%rbp,%rax,4)
.L6:
	addl	$1, -148(%rbp)
.L5:
	cmpl	$30, -148(%rbp)
	jle	.L7
	addl	$1, -152(%rbp)
.L4:
	cmpl	$30, -152(%rbp)
	jle	.L8
	movl	$0, -152(%rbp)
	jmp	.L9
.L11:
	movl	-152(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	movl	-152(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	addl	$1, -152(%rbp)
.L9:
	cmpl	$30, -152(%rbp)
	jle	.L11
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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
.LC8:
	.string	"%d"
.LC9:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC8(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	$31, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$168, %rsp
	.cfi_def_cfa_offset 208
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	movq	.LC7(%rip), %rax
	leaq	12(%rsp), %r13
	movl	$30, 136(%rsp)
	movaps	%xmm0, 16(%rsp)
	movdqa	.LC1(%rip), %xmm0
	leaq	16(%rsp), %rbx
	movq	%rax, 128(%rsp)
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC2(%rip), %xmm0
	movaps	%xmm0, 48(%rsp)
	movdqa	.LC3(%rip), %xmm0
	movaps	%xmm0, 64(%rsp)
	movdqa	.LC4(%rip), %xmm0
	movaps	%xmm0, 80(%rsp)
	movdqa	.LC5(%rip), %xmm0
	movaps	%xmm0, 96(%rsp)
	movdqa	.LC6(%rip), %xmm0
	movaps	%xmm0, 112(%rsp)
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	%eax, %edx
	jne	.L2
	movl	$0, (%rbx,%rax,4)
.L2:
	addq	$1, %rax
	cmpq	$31, %rax
	jne	.L3
	subl	$1, %ebp
	jne	.L4
	leaq	140(%rsp), %rbp
	leaq	.LC9(%rip), %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$4, %rbx
	cmpq	%rbp, %rbx
	je	.L16
.L6:
	movl	(%rbx), %edx
	testl	%edx, %edx
	je	.L5
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbp, %rbx
	jne	.L6
.L16:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$168, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	4
	.long	5
	.long	6
	.long	7
	.align 16
.LC2:
	.long	8
	.long	9
	.long	10
	.long	11
	.align 16
.LC3:
	.long	12
	.long	13
	.long	14
	.long	15
	.align 16
.LC4:
	.long	16
	.long	17
	.long	18
	.long	19
	.align 16
.LC5:
	.long	20
	.long	21
	.long	22
	.long	23
	.align 16
.LC6:
	.long	24
	.long	25
	.long	26
	.long	27
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC7:
	.long	28
	.long	29
	.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
.LC8:
	.string	"%d"
.LC9:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC8(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	$31, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$168, %rsp
	.cfi_def_cfa_offset 208
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	movq	.LC7(%rip), %rax
	leaq	12(%rsp), %r13
	movl	$30, 136(%rsp)
	movaps	%xmm0, 16(%rsp)
	movdqa	.LC1(%rip), %xmm0
	leaq	16(%rsp), %rbx
	movq	%rax, 128(%rsp)
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC2(%rip), %xmm0
	movaps	%xmm0, 48(%rsp)
	movdqa	.LC3(%rip), %xmm0
	movaps	%xmm0, 64(%rsp)
	movdqa	.LC4(%rip), %xmm0
	movaps	%xmm0, 80(%rsp)
	movdqa	.LC5(%rip), %xmm0
	movaps	%xmm0, 96(%rsp)
	movdqa	.LC6(%rip), %xmm0
	movaps	%xmm0, 112(%rsp)
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	cmpl	%eax, %edx
	jne	.L2
	movl	$0, (%rbx,%rax,4)
.L2:
	addq	$1, %rax
	cmpq	$31, %rax
	jne	.L3
	subl	$1, %ebp
	jne	.L4
	leaq	140(%rsp), %rbp
	leaq	.LC9(%rip), %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$4, %rbx
	cmpq	%rbp, %rbx
	je	.L16
.L6:
	movl	(%rbx), %edx
	testl	%edx, %edx
	je	.L5
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbp, %rbx
	jne	.L6
.L16:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$168, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	4
	.long	5
	.long	6
	.long	7
	.align 16
.LC2:
	.long	8
	.long	9
	.long	10
	.long	11
	.align 16
.LC3:
	.long	12
	.long	13
	.long	14
	.long	15
	.align 16
.LC4:
	.long	16
	.long	17
	.long	18
	.long	19
	.align 16
.LC5:
	.long	20
	.long	21
	.long	22
	.long	23
	.align 16
.LC6:
	.long	24
	.long	25
	.long	26
	.long	27
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC7:
	.long	28
	.long	29
	.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[31],i,j;
  for(i=0;i<31;i++)A[i]=i;
  for(i=0;i<31;i++){
    scanf("%d",&n);
    for(j=0;j<31;j++)if(n==j)A[j]=0;
  }
  for(i=0;i<31;i++){
    if(A[i]!=0)printf("%d\n",A[i]);
		 }
  return 0;
}
3
1
4
5
7
9
6
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

2
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[31],i,j;
  for(i=0;i<31;i++)A[i]=i;
  for(i=0;i<31;i++){
    scanf("%d",&n);
    for(j=0;j<31;j++)if(n==j)A[j]=0;
  }
  for(i=0;i<31;i++){
    if(A[i]!=0)printf("%d\n",A[i]);
		 }
  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
	subq	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -152(%rbp)
	jmp	.L2
.L3:
	movl	-152(%rbp), %eax
	cltq
	movl	-152(%rbp), %edx
	movl	%edx, -144(%rbp,%rax,4)
	addl	$1, -152(%rbp)
.L2:
	cmpl	$30, -152(%rbp)
	jle	.L3
	movl	$0, -152(%rbp)
	jmp	.L4
.L8:
	leaq	-156(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L5
.L7:
	movl	-156(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jne	.L6
	movl	-148(%rbp), %eax
	cltq
	movl	$0, -144(%rbp,%rax,4)
.L6:
	addl	$1, -148(%rbp)
.L5:
	cmpl	$30, -148(%rbp)
	jle	.L7
	addl	$1, -152(%rbp)
.L4:
	cmpl	$30, -152(%rbp)
	jle	.L8
	movl	$0, -152(%rbp)
	jmp	.L9
.L11:
	movl	-152(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	movl	-152(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	addl	$1, -152(%rbp)
.L9:
	cmpl	$30, -152(%rbp)
	jle	.L11
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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\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	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -152(%rbp)
	jmp	.L2
.L3:
	movl	-152(%rbp), %eax
	cltq
	movl	-152(%rbp), %edx
	movl	%edx, -144(%rbp,%rax,4)
	addl	$1, -152(%rbp)
.L2:
	cmpl	$30, -152(%rbp)
	jle	.L3
	movl	$0, -152(%rbp)
	jmp	.L4
.L8:
	leaq	-156(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -148(%rbp)
	jmp	.L5
.L7:
	movl	-156(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jne	.L6
	movl	-148(%rbp), %eax
	cltq
	movl	$0, -144(%rbp,%rax,4)
.L6:
	addl	$1, -148(%rbp)
.L5:
	cmpl	$30, -148(%rbp)
	jle	.L7
	addl	$1, -152(%rbp)
.L4:
	cmpl	$30, -152(%rbp)
	jle	.L8
	movl	$0, -152(%rbp)
	jmp	.L9
.L11:
	movl	-152(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	movl	-152(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	addl	$1, -152(%rbp)
.L9:
	cmpl	$30, -152(%rbp)
	jle	.L11
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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:
