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()
{
    int a,b[55],sum=0,p=0;
    scanf("%d",&a);
    for(int i=0;i<a;i++)
    {
        scanf("%d",&b[i]);
    }
    for(int j=0;j<a;j++)
    {
        p+=b[j];
    }
    for(int m=0;m<a-1;m++)
    {
        p-=b[m];
        sum+=b[m]*p;
    }
    printf("%d\n",sum);
    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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$264, %rsp
	.cfi_def_cfa_offset 304
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	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), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L12
	movl	%edx, %eax
	movdqa	16(%rsp), %xmm0
	shrl	$2, %eax
	cmpl	$1, %eax
	je	.L5
	paddd	32(%rsp), %xmm0
	cmpl	$2, %eax
	je	.L5
	paddd	48(%rsp), %xmm0
	cmpl	$3, %eax
	je	.L5
	paddd	64(%rsp), %xmm0
	cmpl	$4, %eax
	je	.L5
	paddd	80(%rsp), %xmm0
	cmpl	$5, %eax
	je	.L5
	paddd	96(%rsp), %xmm0
	cmpl	$6, %eax
	je	.L5
	paddd	112(%rsp), %xmm0
	cmpl	$7, %eax
	je	.L5
	paddd	128(%rsp), %xmm0
	cmpl	$8, %eax
	je	.L5
	paddd	144(%rsp), %xmm0
	cmpl	$9, %eax
	je	.L5
	paddd	160(%rsp), %xmm0
	cmpl	$10, %eax
	je	.L5
	paddd	176(%rsp), %xmm0
	cmpl	$11, %eax
	je	.L5
	paddd	192(%rsp), %xmm0
	cmpl	$12, %eax
	je	.L5
	paddd	208(%rsp), %xmm0
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L6
.L4:
	movslq	%ecx, %rsi
	addl	16(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%esi, %edx
	jle	.L9
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L6
	movslq	%ecx, %rcx
	addl	16(%rsp,%rcx,4), %eax
.L6:
	subl	$2, %edx
	movq	%rbx, %rcx
	xorl	%r8d, %r8d
	leaq	20(%rsp,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rcx), %edx
	addq	$4, %rcx
	subl	%edx, %eax
	imull	%eax, %edx
	addl	%edx, %r8d
	cmpq	%rsi, %rcx
	jne	.L10
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	248(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$264, %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
.L9:
	.cfi_restore_state
	cmpl	$1, %edx
	jg	.L6
.L2:
	xorl	%r8d, %r8d
	jmp	.L7
.L12:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L4
.L54:
	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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$264, %rsp
	.cfi_def_cfa_offset 304
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	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), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L12
	movl	%edx, %eax
	movdqa	16(%rsp), %xmm0
	shrl	$2, %eax
	cmpl	$1, %eax
	je	.L5
	paddd	32(%rsp), %xmm0
	cmpl	$2, %eax
	je	.L5
	paddd	48(%rsp), %xmm0
	cmpl	$3, %eax
	je	.L5
	paddd	64(%rsp), %xmm0
	cmpl	$4, %eax
	je	.L5
	paddd	80(%rsp), %xmm0
	cmpl	$5, %eax
	je	.L5
	paddd	96(%rsp), %xmm0
	cmpl	$6, %eax
	je	.L5
	paddd	112(%rsp), %xmm0
	cmpl	$7, %eax
	je	.L5
	paddd	128(%rsp), %xmm0
	cmpl	$8, %eax
	je	.L5
	paddd	144(%rsp), %xmm0
	cmpl	$9, %eax
	je	.L5
	paddd	160(%rsp), %xmm0
	cmpl	$10, %eax
	je	.L5
	paddd	176(%rsp), %xmm0
	cmpl	$11, %eax
	je	.L5
	paddd	192(%rsp), %xmm0
	cmpl	$12, %eax
	je	.L5
	paddd	208(%rsp), %xmm0
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L6
.L4:
	movslq	%ecx, %rsi
	addl	16(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%esi, %edx
	jle	.L9
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L6
	movslq	%ecx, %rcx
	addl	16(%rsp,%rcx,4), %eax
.L6:
	subl	$2, %edx
	movq	%rbx, %rcx
	xorl	%r8d, %r8d
	leaq	20(%rsp,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rcx), %edx
	addq	$4, %rcx
	subl	%edx, %eax
	imull	%eax, %edx
	addl	%edx, %r8d
	cmpq	%rsi, %rcx
	jne	.L10
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	248(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$264, %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
.L9:
	.cfi_restore_state
	cmpl	$1, %edx
	jg	.L6
.L2:
	xorl	%r8d, %r8d
	jmp	.L7
.L12:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L4
.L54:
	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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$264, %rsp
	.cfi_def_cfa_offset 304
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	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), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L12
	movl	%edx, %eax
	movdqa	16(%rsp), %xmm0
	shrl	$2, %eax
	cmpl	$1, %eax
	je	.L5
	paddd	32(%rsp), %xmm0
	cmpl	$2, %eax
	je	.L5
	paddd	48(%rsp), %xmm0
	cmpl	$3, %eax
	je	.L5
	paddd	64(%rsp), %xmm0
	cmpl	$4, %eax
	je	.L5
	paddd	80(%rsp), %xmm0
	cmpl	$5, %eax
	je	.L5
	paddd	96(%rsp), %xmm0
	cmpl	$6, %eax
	je	.L5
	paddd	112(%rsp), %xmm0
	cmpl	$7, %eax
	je	.L5
	paddd	128(%rsp), %xmm0
	cmpl	$8, %eax
	je	.L5
	paddd	144(%rsp), %xmm0
	cmpl	$9, %eax
	je	.L5
	paddd	160(%rsp), %xmm0
	cmpl	$10, %eax
	je	.L5
	paddd	176(%rsp), %xmm0
	cmpl	$11, %eax
	je	.L5
	paddd	192(%rsp), %xmm0
	cmpl	$12, %eax
	je	.L5
	paddd	208(%rsp), %xmm0
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L6
.L4:
	movslq	%ecx, %rsi
	addl	16(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%esi, %edx
	jle	.L9
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L6
	movslq	%ecx, %rcx
	addl	16(%rsp,%rcx,4), %eax
.L6:
	subl	$2, %edx
	movq	%rbx, %rcx
	xorl	%r8d, %r8d
	leaq	20(%rsp,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rcx), %edx
	addq	$4, %rcx
	subl	%edx, %eax
	imull	%eax, %edx
	addl	%edx, %r8d
	cmpq	%rsi, %rcx
	jne	.L10
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	248(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$264, %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
.L9:
	.cfi_restore_state
	cmpl	$1, %edx
	jg	.L6
.L2:
	xorl	%r8d, %r8d
	jmp	.L7
.L12:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L4
.L54:
	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()
{
    int a,b[55],sum=0,p=0;
    scanf("%d",&a);
    for(int i=0;i<a;i++)
    {
        scanf("%d",&b[i]);
    }
    for(int j=0;j<a;j++)
    {
        p+=b[j];
    }
    for(int m=0;m<a-1;m++)
    {
        p-=b[m];
        sum+=b[m]*p;
    }
    printf("%d\n",sum);
    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()
{
    int a,b[55],sum=0,p=0;
    scanf("%d",&a);
    for(int i=0;i<a;i++)
    {
        scanf("%d",&b[i]);
    }
    for(int j=0;j<a;j++)
    {
        p+=b[j];
    }
    for(int m=0;m<a-1;m++)
    {
        p-=b[m];
        sum+=b[m]*p;
    }
    printf("%d\n",sum);
    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:

3
3 1 3
 7
5 0 7 8 6 3 2
 3
3 1 5
 7
5 0 7 10 6 3 2
 3
1 1 5
 7
5 0 7 2 6 3 2
 3
1 1 8
 7
5 -1 7 2 6 3 2
 3
0 1 8
 7
5 -1 7 2 12 3 2

15
 387
 23
 433
 11
 249
 17
 224
 8
 332

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()
{
    int a,b[55],sum=0,p=0;
    scanf("%d",&a);
    for(int i=0;i<a;i++)
    {
        scanf("%d",&b[i]);
    }
    for(int j=0;j<a;j++)
    {
        p+=b[j];
    }
    for(int m=0;m<a-1;m++)
    {
        p-=b[m];
        sum+=b[m]*p;
    }
    printf("%d\n",sum);
    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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$264, %rsp
	.cfi_def_cfa_offset 304
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	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), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L12
	movl	%edx, %eax
	movdqa	16(%rsp), %xmm0
	shrl	$2, %eax
	cmpl	$1, %eax
	je	.L5
	paddd	32(%rsp), %xmm0
	cmpl	$2, %eax
	je	.L5
	paddd	48(%rsp), %xmm0
	cmpl	$3, %eax
	je	.L5
	paddd	64(%rsp), %xmm0
	cmpl	$4, %eax
	je	.L5
	paddd	80(%rsp), %xmm0
	cmpl	$5, %eax
	je	.L5
	paddd	96(%rsp), %xmm0
	cmpl	$6, %eax
	je	.L5
	paddd	112(%rsp), %xmm0
	cmpl	$7, %eax
	je	.L5
	paddd	128(%rsp), %xmm0
	cmpl	$8, %eax
	je	.L5
	paddd	144(%rsp), %xmm0
	cmpl	$9, %eax
	je	.L5
	paddd	160(%rsp), %xmm0
	cmpl	$10, %eax
	je	.L5
	paddd	176(%rsp), %xmm0
	cmpl	$11, %eax
	je	.L5
	paddd	192(%rsp), %xmm0
	cmpl	$12, %eax
	je	.L5
	paddd	208(%rsp), %xmm0
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L6
.L4:
	movslq	%ecx, %rsi
	addl	16(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%esi, %edx
	jle	.L9
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L6
	movslq	%ecx, %rcx
	addl	16(%rsp,%rcx,4), %eax
.L6:
	subl	$2, %edx
	movq	%rbx, %rcx
	xorl	%r8d, %r8d
	leaq	20(%rsp,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rcx), %edx
	addq	$4, %rcx
	subl	%edx, %eax
	imull	%eax, %edx
	addl	%edx, %r8d
	cmpq	%rsi, %rcx
	jne	.L10
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	248(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$264, %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
.L9:
	.cfi_restore_state
	cmpl	$1, %edx
	jg	.L6
.L2:
	xorl	%r8d, %r8d
	jmp	.L7
.L12:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L4
.L54:
	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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$264, %rsp
	.cfi_def_cfa_offset 304
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	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), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L12
	movl	%edx, %eax
	movdqa	16(%rsp), %xmm0
	shrl	$2, %eax
	cmpl	$1, %eax
	je	.L5
	paddd	32(%rsp), %xmm0
	cmpl	$2, %eax
	je	.L5
	paddd	48(%rsp), %xmm0
	cmpl	$3, %eax
	je	.L5
	paddd	64(%rsp), %xmm0
	cmpl	$4, %eax
	je	.L5
	paddd	80(%rsp), %xmm0
	cmpl	$5, %eax
	je	.L5
	paddd	96(%rsp), %xmm0
	cmpl	$6, %eax
	je	.L5
	paddd	112(%rsp), %xmm0
	cmpl	$7, %eax
	je	.L5
	paddd	128(%rsp), %xmm0
	cmpl	$8, %eax
	je	.L5
	paddd	144(%rsp), %xmm0
	cmpl	$9, %eax
	je	.L5
	paddd	160(%rsp), %xmm0
	cmpl	$10, %eax
	je	.L5
	paddd	176(%rsp), %xmm0
	cmpl	$11, %eax
	je	.L5
	paddd	192(%rsp), %xmm0
	cmpl	$12, %eax
	je	.L5
	paddd	208(%rsp), %xmm0
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L6
.L4:
	movslq	%ecx, %rsi
	addl	16(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%esi, %edx
	jle	.L9
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L6
	movslq	%ecx, %rcx
	addl	16(%rsp,%rcx,4), %eax
.L6:
	subl	$2, %edx
	movq	%rbx, %rcx
	xorl	%r8d, %r8d
	leaq	20(%rsp,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rcx), %edx
	addq	$4, %rcx
	subl	%edx, %eax
	imull	%eax, %edx
	addl	%edx, %r8d
	cmpq	%rsi, %rcx
	jne	.L10
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	248(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$264, %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
.L9:
	.cfi_restore_state
	cmpl	$1, %edx
	jg	.L6
.L2:
	xorl	%r8d, %r8d
	jmp	.L7
.L12:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L4
.L54:
	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:
```