Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main(void){
    int n, p[100], i, j, s=0, t;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&p[i]);
    for(i=0;i<n;i++){
        if(s<p[i]){
            s=p[i];
            j=i;
        }
    }
    for(i=0;i<j;i++) t+=p[i];
    t+=s/2;
    for(i=j+1;i<n;i++) t+=p[i];
    printf("%d\n",t);
    return 0;
}```

Assembly Code:

```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L18
	leaq	16(%rsp), %r13
	xorl	%ebx, %ebx
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L18
	movslq	%edx, %rdi
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	0(%r13,%rax,4), %ecx
	cmpl	%esi, %ecx
	jle	.L4
	movl	%ecx, %esi
	movl	%eax, %r12d
.L4:
	addq	$1, %rax
	cmpq	%rdi, %rax
	jne	.L5
.L2:
	testl	%r12d, %r12d
	je	.L6
	leal	-1(%r12), %eax
	cmpl	$2, %eax
	jbe	.L20
	movl	%r12d, %ecx
	leaq	16(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	32(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%r12d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %r14d
	testb	$3, %r12b
	je	.L6
.L7:
	movslq	%eax, %rcx
	addl	16(%rsp,%rcx,4), %r14d
	leal	1(%rax), %ecx
	cmpl	%ecx, %r12d
	jle	.L6
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	16(%rsp,%rcx,4), %r14d
	cmpl	%r12d, %eax
	jge	.L6
	cltq
	addl	16(%rsp,%rax,4), %r14d
.L6:
	movl	%esi, %r8d
	shrl	$31, %r8d
	addl	%esi, %r8d
	leal	1(%r12), %esi
	sarl	%r8d
	addl	%r14d, %r8d
	cmpl	%edx, %esi
	jge	.L11
	movl	%edx, %eax
	subl	%r12d, %eax
	leal	-1(%rax), %r9d
	subl	$2, %eax
	cmpl	$2, %eax
	jbe	.L12
	movslq	%esi, %rax
	pxor	%xmm0, %xmm0
	leaq	16(%rsp,%rax,4), %rcx
	movl	%r9d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rcx), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L31:
	addq	$16, %rax
.L13:
	movdqu	(%rcx), %xmm1
	movq	%rax, %rcx
	paddd	%xmm1, %xmm0
	cmpq	%rdi, %rax
	jne	.L31
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r9d, %eax
	andl	$-4, %eax
	addl	%eax, %esi
	cmpl	%eax, %r9d
	je	.L11
.L12:
	movslq	%esi, %rax
	addl	16(%rsp,%rax,4), %r8d
	leal	1(%rsi), %eax
	cmpl	%edx, %eax
	jge	.L11
	cltq
	addl	$2, %esi
	addl	16(%rsp,%rax,4), %r8d
	cmpl	%edx, %esi
	jge	.L11
	movslq	%esi, %rsi
	addl	16(%rsp,%rsi,4), %r8d
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$440, %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
.L18:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L32:
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L18
	leaq	16(%rsp), %r13
	xorl	%ebx, %ebx
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L18
	movslq	%edx, %rdi
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	0(%r13,%rax,4), %ecx
	cmpl	%esi, %ecx
	jle	.L4
	movl	%ecx, %esi
	movl	%eax, %r12d
.L4:
	addq	$1, %rax
	cmpq	%rdi, %rax
	jne	.L5
.L2:
	testl	%r12d, %r12d
	je	.L6
	leal	-1(%r12), %eax
	cmpl	$2, %eax
	jbe	.L20
	movl	%r12d, %ecx
	leaq	16(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	32(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%r12d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %r14d
	testb	$3, %r12b
	je	.L6
.L7:
	movslq	%eax, %rcx
	addl	16(%rsp,%rcx,4), %r14d
	leal	1(%rax), %ecx
	cmpl	%ecx, %r12d
	jle	.L6
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	16(%rsp,%rcx,4), %r14d
	cmpl	%r12d, %eax
	jge	.L6
	cltq
	addl	16(%rsp,%rax,4), %r14d
.L6:
	movl	%esi, %r8d
	shrl	$31, %r8d
	addl	%esi, %r8d
	leal	1(%r12), %esi
	sarl	%r8d
	addl	%r14d, %r8d
	cmpl	%edx, %esi
	jge	.L11
	movl	%edx, %eax
	subl	%r12d, %eax
	leal	-1(%rax), %r9d
	subl	$2, %eax
	cmpl	$2, %eax
	jbe	.L12
	movslq	%esi, %rax
	pxor	%xmm0, %xmm0
	leaq	16(%rsp,%rax,4), %rcx
	movl	%r9d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rcx), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L31:
	addq	$16, %rax
.L13:
	movdqu	(%rcx), %xmm1
	movq	%rax, %rcx
	paddd	%xmm1, %xmm0
	cmpq	%rdi, %rax
	jne	.L31
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r9d, %eax
	andl	$-4, %eax
	addl	%eax, %esi
	cmpl	%eax, %r9d
	je	.L11
.L12:
	movslq	%esi, %rax
	addl	16(%rsp,%rax,4), %r8d
	leal	1(%rsi), %eax
	cmpl	%edx, %eax
	jge	.L11
	cltq
	addl	$2, %esi
	addl	16(%rsp,%rax,4), %r8d
	cmpl	%edx, %esi
	jge	.L11
	movslq	%esi, %rsi
	addl	16(%rsp,%rsi,4), %r8d
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$440, %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
.L18:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L32:
	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
```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L18
	leaq	16(%rsp), %r13
	xorl	%ebx, %ebx
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L18
	movslq	%edx, %rdi
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	0(%r13,%rax,4), %ecx
	cmpl	%esi, %ecx
	jle	.L4
	movl	%ecx, %esi
	movl	%eax, %r12d
.L4:
	addq	$1, %rax
	cmpq	%rdi, %rax
	jne	.L5
.L2:
	testl	%r12d, %r12d
	je	.L6
	leal	-1(%r12), %eax
	cmpl	$2, %eax
	jbe	.L20
	movl	%r12d, %ecx
	leaq	16(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	32(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%r12d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %r14d
	testb	$3, %r12b
	je	.L6
.L7:
	movslq	%eax, %rcx
	addl	16(%rsp,%rcx,4), %r14d
	leal	1(%rax), %ecx
	cmpl	%ecx, %r12d
	jle	.L6
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	16(%rsp,%rcx,4), %r14d
	cmpl	%r12d, %eax
	jge	.L6
	cltq
	addl	16(%rsp,%rax,4), %r14d
.L6:
	movl	%esi, %r8d
	shrl	$31, %r8d
	addl	%esi, %r8d
	leal	1(%r12), %esi
	sarl	%r8d
	addl	%r14d, %r8d
	cmpl	%edx, %esi
	jge	.L11
	movl	%edx, %eax
	subl	%r12d, %eax
	leal	-1(%rax), %r9d
	subl	$2, %eax
	cmpl	$2, %eax
	jbe	.L12
	movslq	%esi, %rax
	pxor	%xmm0, %xmm0
	leaq	16(%rsp,%rax,4), %rcx
	movl	%r9d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rcx), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L31:
	addq	$16, %rax
.L13:
	movdqu	(%rcx), %xmm1
	movq	%rax, %rcx
	paddd	%xmm1, %xmm0
	cmpq	%rdi, %rax
	jne	.L31
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r9d, %eax
	andl	$-4, %eax
	addl	%eax, %esi
	cmpl	%eax, %r9d
	je	.L11
.L12:
	movslq	%esi, %rax
	addl	16(%rsp,%rax,4), %r8d
	leal	1(%rsi), %eax
	cmpl	%edx, %eax
	jge	.L11
	cltq
	addl	$2, %esi
	addl	16(%rsp,%rax,4), %r8d
	cmpl	%edx, %esi
	jge	.L11
	movslq	%esi, %rsi
	addl	16(%rsp,%rsi,4), %r8d
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$440, %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
.L18:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L32:
	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:
```
```c
#include<stdio.h>
int main(void){
    int n, p[100], i, j, s=0, t;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&p[i]);
    for(i=0;i<n;i++){
        if(s<p[i]){
            s=p[i];
            j=i;
        }
    }
    for(i=0;i<j;i++) t+=p[i];
    t+=s/2;
    for(i=j+1;i<n;i++) t+=p[i];
    printf("%d\n",t);
    return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main(void){
    int n, p[100], i, j, s=0, t;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&p[i]);
    for(i=0;i<n;i++){
        if(s<p[i]){
            s=p[i];
            j=i;
        }
    }
    for(i=0;i<j;i++) t+=p[i];
    t+=s/2;
    for(i=j+1;i<n;i++) t+=p[i];
    printf("%d\n",t);
    return 0;
}```

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.
Optimized Assembly Code:

4
4320
7204
4320
4320
 3
32
7980
6980
 3
32
7980
615
 3
6
7980
615
 3
6
7980
329
 3
6
7980
207
 3
7
7980
207
 3
7
7980
269
 3
7
4428
269
 3
7
4428
505

16562
 11002
 4637
 4611
 4325
 4203
 4204
 4266
 2490
 2726

Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main(void){
    int n, p[100], i, j, s=0, t;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&p[i]);
    for(i=0;i<n;i++){
        if(s<p[i]){
            s=p[i];
            j=i;
        }
    }
    for(i=0;i<j;i++) t+=p[i];
    t+=s/2;
    for(i=j+1;i<n;i++) t+=p[i];
    printf("%d\n",t);
    return 0;
}```

Assembly Code:

```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L18
	leaq	16(%rsp), %r13
	xorl	%ebx, %ebx
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L18
	movslq	%edx, %rdi
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	0(%r13,%rax,4), %ecx
	cmpl	%esi, %ecx
	jle	.L4
	movl	%ecx, %esi
	movl	%eax, %r12d
.L4:
	addq	$1, %rax
	cmpq	%rdi, %rax
	jne	.L5
.L2:
	testl	%r12d, %r12d
	je	.L6
	leal	-1(%r12), %eax
	cmpl	$2, %eax
	jbe	.L20
	movl	%r12d, %ecx
	leaq	16(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	32(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%r12d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %r14d
	testb	$3, %r12b
	je	.L6
.L7:
	movslq	%eax, %rcx
	addl	16(%rsp,%rcx,4), %r14d
	leal	1(%rax), %ecx
	cmpl	%ecx, %r12d
	jle	.L6
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	16(%rsp,%rcx,4), %r14d
	cmpl	%r12d, %eax
	jge	.L6
	cltq
	addl	16(%rsp,%rax,4), %r14d
.L6:
	movl	%esi, %r8d
	shrl	$31, %r8d
	addl	%esi, %r8d
	leal	1(%r12), %esi
	sarl	%r8d
	addl	%r14d, %r8d
	cmpl	%edx, %esi
	jge	.L11
	movl	%edx, %eax
	subl	%r12d, %eax
	leal	-1(%rax), %r9d
	subl	$2, %eax
	cmpl	$2, %eax
	jbe	.L12
	movslq	%esi, %rax
	pxor	%xmm0, %xmm0
	leaq	16(%rsp,%rax,4), %rcx
	movl	%r9d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rcx), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L31:
	addq	$16, %rax
.L13:
	movdqu	(%rcx), %xmm1
	movq	%rax, %rcx
	paddd	%xmm1, %xmm0
	cmpq	%rdi, %rax
	jne	.L31
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r9d, %eax
	andl	$-4, %eax
	addl	%eax, %esi
	cmpl	%eax, %r9d
	je	.L11
.L12:
	movslq	%esi, %rax
	addl	16(%rsp,%rax,4), %r8d
	leal	1(%rsi), %eax
	cmpl	%edx, %eax
	jge	.L11
	cltq
	addl	$2, %esi
	addl	16(%rsp,%rax,4), %r8d
	cmpl	%edx, %esi
	jge	.L11
	movslq	%esi, %rsi
	addl	16(%rsp,%rsi,4), %r8d
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$440, %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
.L18:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L32:
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L18
	leaq	16(%rsp), %r13
	xorl	%ebx, %ebx
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L18
	movslq	%edx, %rdi
	xorl	%eax, %eax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	0(%r13,%rax,4), %ecx
	cmpl	%esi, %ecx
	jle	.L4
	movl	%ecx, %esi
	movl	%eax, %r12d
.L4:
	addq	$1, %rax
	cmpq	%rdi, %rax
	jne	.L5
.L2:
	testl	%r12d, %r12d
	je	.L6
	leal	-1(%r12), %eax
	cmpl	$2, %eax
	jbe	.L20
	movl	%r12d, %ecx
	leaq	16(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	32(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%r12d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %r14d
	testb	$3, %r12b
	je	.L6
.L7:
	movslq	%eax, %rcx
	addl	16(%rsp,%rcx,4), %r14d
	leal	1(%rax), %ecx
	cmpl	%ecx, %r12d
	jle	.L6
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	16(%rsp,%rcx,4), %r14d
	cmpl	%r12d, %eax
	jge	.L6
	cltq
	addl	16(%rsp,%rax,4), %r14d
.L6:
	movl	%esi, %r8d
	shrl	$31, %r8d
	addl	%esi, %r8d
	leal	1(%r12), %esi
	sarl	%r8d
	addl	%r14d, %r8d
	cmpl	%edx, %esi
	jge	.L11
	movl	%edx, %eax
	subl	%r12d, %eax
	leal	-1(%rax), %r9d
	subl	$2, %eax
	cmpl	$2, %eax
	jbe	.L12
	movslq	%esi, %rax
	pxor	%xmm0, %xmm0
	leaq	16(%rsp,%rax,4), %rcx
	movl	%r9d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %edi
	leaq	16(%rcx), %rax
	salq	$4, %rdi
	addq	%rax, %rdi
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L31:
	addq	$16, %rax
.L13:
	movdqu	(%rcx), %xmm1
	movq	%rax, %rcx
	paddd	%xmm1, %xmm0
	cmpq	%rdi, %rax
	jne	.L31
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %r8d
	movl	%r9d, %eax
	andl	$-4, %eax
	addl	%eax, %esi
	cmpl	%eax, %r9d
	je	.L11
.L12:
	movslq	%esi, %rax
	addl	16(%rsp,%rax,4), %r8d
	leal	1(%rsi), %eax
	cmpl	%edx, %eax
	jge	.L11
	cltq
	addl	$2, %esi
	addl	16(%rsp,%rax,4), %r8d
	cmpl	%edx, %esi
	jge	.L11
	movslq	%esi, %rsi
	addl	16(%rsp,%rsi,4), %r8d
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$440, %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
.L18:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L32:
	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:
```