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 A[10000];
	int i, lop, cnt = 0;

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

	do{
		lop = 0;
		for(i = 0; i < n; i++){
			if(A[i] % 2 == 0){
				A[i] /= 2;
				cnt++;
				lop = 1;
			}
			else{
				A[i] *= 3;
			}
		}
	}while(lop);

	printf("%d\n", cnt);

	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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3168, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40020(%rbp)
	movl	$0, -40028(%rbp)
	jmp	.L2
.L3:
	leaq	-40016(%rbp), %rdx
	movl	-40028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40028(%rbp)
.L2:
	movl	-40032(%rbp), %eax
	cmpl	%eax, -40028(%rbp)
	jl	.L3
.L8:
	movl	$0, -40024(%rbp)
	movl	$0, -40028(%rbp)
	jmp	.L4
.L7:
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-40028(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
	addl	$1, -40020(%rbp)
	movl	$1, -40024(%rbp)
	jmp	.L6
.L5:
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L6:
	addl	$1, -40028(%rbp)
.L4:
	movl	-40032(%rbp), %eax
	cmpl	%eax, -40028(%rbp)
	jl	.L7
	cmpl	$0, -40024(%rbp)
	jne	.L8
	movl	-40020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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"
.LC2:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36904
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40080
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L16
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L3
	movl	%ecx, %eax
	movl	%ecx, %r9d
	movdqa	.LC1(%rip), %xmm6
	xorl	%r8d, %r8d
	shrl	$2, %eax
	leal	-1(%rcx), %r10d
	pxor	%xmm7, %xmm7
	andl	$-4, %r9d
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbx,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L14:
	testl	%ecx, %ecx
	jle	.L13
	cmpl	$2, %r10d
	jbe	.L17
	pxor	%xmm4, %xmm4
	movq	%rbx, %rax
	movdqa	%xmm4, %xmm5
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	(%rax), %xmm2
	movdqa	%xmm6, %xmm1
	addq	$16, %rax
	movdqa	%xmm2, %xmm0
	pand	%xmm6, %xmm0
	pcmpeqd	%xmm7, %xmm0
	movdqa	%xmm0, %xmm3
	pand	%xmm0, %xmm1
	psubd	%xmm0, %xmm4
	pandn	%xmm5, %xmm3
	movdqa	%xmm3, %xmm5
	movdqa	%xmm7, %xmm3
	pcmpgtd	%xmm2, %xmm3
	por	%xmm1, %xmm5
	movdqa	%xmm2, %xmm1
	psubd	%xmm3, %xmm1
	movdqa	%xmm2, %xmm3
	pslld	$1, %xmm3
	psrad	$1, %xmm1
	paddd	%xmm3, %xmm2
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rsi, %rax
	jne	.L5
	movdqa	%xmm4, %xmm0
	movdqa	%xmm5, %xmm1
	psrldq	$8, %xmm0
	psrldq	$8, %xmm1
	paddd	%xmm0, %xmm4
	movdqa	%xmm4, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm4
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm5, %xmm0
	movd	%xmm4, %eax
	addl	%eax, %r8d
	movl	%r9d, %eax
	pand	%xmm0, %xmm1
	pandn	%xmm5, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	cmpl	%r9d, %ecx
	je	.L6
.L4:
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %edi
	testb	$1, %dil
	jne	.L7
	movl	%edi, %edx
	addl	$1, %eax
	addl	$1, %r8d
	shrl	$31, %edx
	addl	%edi, %edx
	sarl	%edx
	movl	%edx, 16(%rsp,%r11,4)
	movl	$1, %edx
	cmpl	%eax, %ecx
	jle	.L14
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %edi
	testb	$1, %dil
	jne	.L10
.L28:
	movl	%edi, %edx
	addl	$1, %eax
	addl	$1, %r8d
	shrl	$31, %edx
	addl	%edi, %edx
	sarl	%edx
	movl	%edx, 16(%rsp,%r11,4)
	movl	$1, %edx
	cmpl	%eax, %ecx
	jle	.L14
	cltq
	movl	16(%rsp,%rax,4), %edi
	testb	$1, %dil
	je	.L12
.L29:
	leal	(%rdi,%rdi,2), %edi
	movl	%edi, 16(%rsp,%rax,4)
.L6:
	testl	%edx, %edx
	jne	.L14
.L13:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$40040, %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
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leal	(%rdi,%rdi,2), %edi
	addl	$1, %eax
	movl	%edi, 16(%rsp,%r11,4)
	cmpl	%eax, %ecx
	jle	.L6
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %edi
	testb	$1, %dil
	je	.L28
.L10:
	leal	(%rdi,%rdi,2), %edi
	addl	$1, %eax
	movl	%edi, 16(%rsp,%r11,4)
	cmpl	%eax, %ecx
	jle	.L6
	cltq
	movl	16(%rsp,%rax,4), %edi
	testb	$1, %dil
	jne	.L29
.L12:
	movl	%edi, %edx
	addl	$1, %r8d
	shrl	$31, %edx
	addl	%edi, %edx
	sarl	%edx
	movl	%edx, 16(%rsp,%rax,4)
	jmp	.L14
.L17:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L4
.L16:
	xorl	%r8d, %r8d
	jmp	.L13
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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"
.LC2:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36904
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40080
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L16
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r12
	cmpl	%ebp, %ecx
	jg	.L3
	movl	%ecx, %eax
	movl	%ecx, %r9d
	movdqa	.LC1(%rip), %xmm6
	xorl	%r8d, %r8d
	shrl	$2, %eax
	leal	-1(%rcx), %r10d
	pxor	%xmm7, %xmm7
	andl	$-4, %r9d
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbx,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L14:
	testl	%ecx, %ecx
	jle	.L13
	cmpl	$2, %r10d
	jbe	.L17
	pxor	%xmm4, %xmm4
	movq	%rbx, %rax
	movdqa	%xmm4, %xmm5
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	(%rax), %xmm2
	movdqa	%xmm6, %xmm1
	addq	$16, %rax
	movdqa	%xmm2, %xmm0
	pand	%xmm6, %xmm0
	pcmpeqd	%xmm7, %xmm0
	movdqa	%xmm0, %xmm3
	pand	%xmm0, %xmm1
	psubd	%xmm0, %xmm4
	pandn	%xmm5, %xmm3
	movdqa	%xmm3, %xmm5
	movdqa	%xmm7, %xmm3
	pcmpgtd	%xmm2, %xmm3
	por	%xmm1, %xmm5
	movdqa	%xmm2, %xmm1
	psubd	%xmm3, %xmm1
	movdqa	%xmm2, %xmm3
	pslld	$1, %xmm3
	psrad	$1, %xmm1
	paddd	%xmm3, %xmm2
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rsi, %rax
	jne	.L5
	movdqa	%xmm4, %xmm0
	movdqa	%xmm5, %xmm1
	psrldq	$8, %xmm0
	psrldq	$8, %xmm1
	paddd	%xmm0, %xmm4
	movdqa	%xmm4, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm4
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm5, %xmm0
	movd	%xmm4, %eax
	addl	%eax, %r8d
	movl	%r9d, %eax
	pand	%xmm0, %xmm1
	pandn	%xmm5, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	cmpl	%r9d, %ecx
	je	.L6
.L4:
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %edi
	testb	$1, %dil
	jne	.L7
	movl	%edi, %edx
	addl	$1, %eax
	addl	$1, %r8d
	shrl	$31, %edx
	addl	%edi, %edx
	sarl	%edx
	movl	%edx, 16(%rsp,%r11,4)
	movl	$1, %edx
	cmpl	%eax, %ecx
	jle	.L14
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %edi
	testb	$1, %dil
	jne	.L10
.L28:
	movl	%edi, %edx
	addl	$1, %eax
	addl	$1, %r8d
	shrl	$31, %edx
	addl	%edi, %edx
	sarl	%edx
	movl	%edx, 16(%rsp,%r11,4)
	movl	$1, %edx
	cmpl	%eax, %ecx
	jle	.L14
	cltq
	movl	16(%rsp,%rax,4), %edi
	testb	$1, %dil
	je	.L12
.L29:
	leal	(%rdi,%rdi,2), %edi
	movl	%edi, 16(%rsp,%rax,4)
.L6:
	testl	%edx, %edx
	jne	.L14
.L13:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$40040, %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
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	leal	(%rdi,%rdi,2), %edi
	addl	$1, %eax
	movl	%edi, 16(%rsp,%r11,4)
	cmpl	%eax, %ecx
	jle	.L6
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %edi
	testb	$1, %dil
	je	.L28
.L10:
	leal	(%rdi,%rdi,2), %edi
	addl	$1, %eax
	movl	%edi, 16(%rsp,%r11,4)
	cmpl	%eax, %ecx
	jle	.L6
	cltq
	movl	16(%rsp,%rax,4), %edi
	testb	$1, %dil
	jne	.L29
.L12:
	movl	%edi, %edx
	addl	$1, %r8d
	shrl	$31, %edx
	addl	%edi, %edx
	sarl	%edx
	movl	%edx, 16(%rsp,%rax,4)
	jmp	.L14
.L17:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L4
.L16:
	xorl	%r8d, %r8d
	jmp	.L13
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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 A[10000];
	int i, lop, cnt = 0;

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

	do{
		lop = 0;
		for(i = 0; i < n; i++){
			if(A[i] % 2 == 0){
				A[i] /= 2;
				cnt++;
				lop = 1;
			}
			else{
				A[i] *= 3;
			}
		}
	}while(lop);

	printf("%d\n", cnt);

	return 0;
}

10
2184 2126 1721 1800 1480 2528 3360 1945 1280 1776
 4
631 846 243 199
 10
2184 2126 1721 1800 1480 2850 3360 1945 1280 1776
 4
631 846 218 199
 3
5 2 8
 10
2184 2126 1721 1800 1480 2850 1620 1945 1280 1776
 3
5 3 8
 10
2184 2126 1721 1800 1480 2850 1620 1945 875 1776
 3
3 3 11
 10
2184 2126 1721 1800 1480 1870 1620 1945 875 2447

32
 1
 28
 2
 4
 25
 3
 17
 0
 13

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 A[10000];
	int i, lop, cnt = 0;

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

	do{
		lop = 0;
		for(i = 0; i < n; i++){
			if(A[i] % 2 == 0){
				A[i] /= 2;
				cnt++;
				lop = 1;
			}
			else{
				A[i] *= 3;
			}
		}
	}while(lop);

	printf("%d\n", cnt);

	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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3168, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40020(%rbp)
	movl	$0, -40028(%rbp)
	jmp	.L2
.L3:
	leaq	-40016(%rbp), %rdx
	movl	-40028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40028(%rbp)
.L2:
	movl	-40032(%rbp), %eax
	cmpl	%eax, -40028(%rbp)
	jl	.L3
.L8:
	movl	$0, -40024(%rbp)
	movl	$0, -40028(%rbp)
	jmp	.L4
.L7:
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-40028(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
	addl	$1, -40020(%rbp)
	movl	$1, -40024(%rbp)
	jmp	.L6
.L5:
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L6:
	addl	$1, -40028(%rbp)
.L4:
	movl	-40032(%rbp), %eax
	cmpl	%eax, -40028(%rbp)
	jl	.L7
	cmpl	$0, -40024(%rbp)
	jne	.L8
	movl	-40020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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.
val
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3168, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40020(%rbp)
	movl	$0, -40028(%rbp)
	jmp	.L2
.L3:
	leaq	-40016(%rbp), %rdx
	movl	-40028(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40028(%rbp)
.L2:
	movl	-40032(%rbp), %eax
	cmpl	%eax, -40028(%rbp)
	jl	.L3
.L8:
	movl	$0, -40024(%rbp)
	movl	$0, -40028(%rbp)
	jmp	.L4
.L7:
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-40028(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
	addl	$1, -40020(%rbp)
	movl	$1, -40024(%rbp)
	jmp	.L6
.L5:
	movl	-40028(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L6:
	addl	$1, -40028(%rbp)
.L4:
	movl	-40032(%rbp), %eax
	cmpl	%eax, -40028(%rbp)
	jl	.L7
	cmpl	$0, -40024(%rbp)
	jne	.L8
	movl	-40020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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:
