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,i,time[101],a,b,j;

  while(scanf("%d",&n)!=EOF)
    {
      a=0;
      for(i=0;i<n;i++)
	{
	  scanf("%d",&time[i]);
	}

      for(i=0;i<n;i++)
	{
	  for(j=i+1;j<n;j++)
	    {
	      if(time[i]>time[j])
		{
		  b=time[i];
		  time[i]=time[j];
		  time[j]=b;
		}
	    }
	}
      for(i=1;i<n;i++)
	{
	  time[i]=time[i]+time[i-1]; 
	}
      for(i=0;i<n;i++)
	{
	  a+=time[i];
	}
      printf("%d\n",a);
    }
  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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	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), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L15
	movl	12(%rsp), %eax
	leaq	16(%rsp), %rbx
	xorl	%r14d, %r14d
	xorl	%edx, %edx
	movq	%rbx, %r15
	testl	%eax, %eax
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %r15
	cmpl	%r14d, %r8d
	jg	.L3
	cmpl	$1, %r8d
	jle	.L4
	leaq	20(%rsp), %r9
	movl	$1, %r10d
	movq	%r9, %rdi
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdi, %rax
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	leal	1(%r10), %ecx
	movl	%r10d, %esi
	addq	$4, %rdi
	movl	%ecx, %r10d
	cmpl	%ecx, %r8d
	jne	.L5
	subl	$1, %esi
	movl	16(%rsp), %edx
	movq	%r9, %rax
	leaq	24(%rsp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rsi, %rax
	jne	.L10
	testl	%ecx, %ecx
	movl	$1, %esi
	cmovg	%ecx, %esi
	cmpl	$3, %ecx
	jle	.L35
	movl	%esi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rbx), %xmm0
	addq	$16, %rbx
	cmpq	%rax, %rbx
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%esi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	andl	$3, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	je	.L17
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
.L18:
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
	cltq
	addl	16(%rsp,%rax,4), %edx
.L17:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L15:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	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
.L35:
	.cfi_restore_state
	movl	16(%rsp), %edx
	movl	$1, %eax
	jmp	.L18
.L4:
	movl	$0, %edx
	cmove	16(%rsp), %edx
	jmp	.L17
.L36:
	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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	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), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L15
	movl	12(%rsp), %eax
	leaq	16(%rsp), %rbx
	xorl	%r14d, %r14d
	xorl	%edx, %edx
	movq	%rbx, %r15
	testl	%eax, %eax
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %r15
	cmpl	%r14d, %r8d
	jg	.L3
	cmpl	$1, %r8d
	jle	.L4
	leaq	20(%rsp), %r9
	movl	$1, %r10d
	movq	%r9, %rdi
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdi, %rax
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	leal	1(%r10), %ecx
	movl	%r10d, %esi
	addq	$4, %rdi
	movl	%ecx, %r10d
	cmpl	%ecx, %r8d
	jne	.L5
	subl	$1, %esi
	movl	16(%rsp), %edx
	movq	%r9, %rax
	leaq	24(%rsp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rsi, %rax
	jne	.L10
	testl	%ecx, %ecx
	movl	$1, %esi
	cmovg	%ecx, %esi
	cmpl	$3, %ecx
	jle	.L35
	movl	%esi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rbx), %xmm0
	addq	$16, %rbx
	cmpq	%rax, %rbx
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%esi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	andl	$3, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	je	.L17
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
.L18:
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
	cltq
	addl	16(%rsp,%rax,4), %edx
.L17:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L15:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	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
.L35:
	.cfi_restore_state
	movl	16(%rsp), %edx
	movl	$1, %eax
	jmp	.L18
.L4:
	movl	$0, %edx
	cmove	16(%rsp), %edx
	jmp	.L17
.L36:
	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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	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), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L15
	movl	12(%rsp), %eax
	leaq	16(%rsp), %rbx
	xorl	%r14d, %r14d
	xorl	%edx, %edx
	movq	%rbx, %r15
	testl	%eax, %eax
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %r15
	cmpl	%r14d, %r8d
	jg	.L3
	cmpl	$1, %r8d
	jle	.L4
	leaq	20(%rsp), %r9
	movl	$1, %r10d
	movq	%r9, %rdi
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdi, %rax
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	leal	1(%r10), %ecx
	movl	%r10d, %esi
	addq	$4, %rdi
	movl	%ecx, %r10d
	cmpl	%ecx, %r8d
	jne	.L5
	subl	$1, %esi
	movl	16(%rsp), %edx
	movq	%r9, %rax
	leaq	24(%rsp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rsi, %rax
	jne	.L10
	testl	%ecx, %ecx
	movl	$1, %esi
	cmovg	%ecx, %esi
	cmpl	$3, %ecx
	jle	.L35
	movl	%esi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rbx), %xmm0
	addq	$16, %rbx
	cmpq	%rax, %rbx
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%esi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	andl	$3, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	je	.L17
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
.L18:
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
	cltq
	addl	16(%rsp,%rax,4), %edx
.L17:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L15:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	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
.L35:
	.cfi_restore_state
	movl	16(%rsp), %edx
	movl	$1, %eax
	jmp	.L18
.L4:
	movl	$0, %edx
	cmove	16(%rsp), %edx
	jmp	.L17
.L36:
	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,i,time[101],a,b,j;

  while(scanf("%d",&n)!=EOF)
    {
      a=0;
      for(i=0;i<n;i++)
	{
	  scanf("%d",&time[i]);
	}

      for(i=0;i<n;i++)
	{
	  for(j=i+1;j<n;j++)
	    {
	      if(time[i]>time[j])
		{
		  b=time[i];
		  time[i]=time[j];
		  time[j]=b;
		}
	    }
	}
      for(i=1;i<n;i++)
	{
	  time[i]=time[i]+time[i-1]; 
	}
      for(i=0;i<n;i++)
	{
	  a+=time[i];
	}
      printf("%d\n",a);
    }
  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,i,time[101],a,b,j;

  while(scanf("%d",&n)!=EOF)
    {
      a=0;
      for(i=0;i<n;i++)
	{
	  scanf("%d",&time[i]);
	}

      for(i=0;i<n;i++)
	{
	  for(j=i+1;j<n;j++)
	    {
	      if(time[i]>time[j])
		{
		  b=time[i];
		  time[i]=time[j];
		  time[j]=b;
		}
	    }
	}
      for(i=1;i<n;i++)
	{
	  time[i]=time[i]+time[i-1]; 
	}
      for(i=0;i<n;i++)
	{
	  a+=time[i];
	}
      printf("%d\n",a);
    }
  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
10 20 30
7
56 26 62 43 38 80 7
 3
10 20 47
7
56 26 62 43 38 80 7
 3
19 20 47
7
56 26 62 43 38 80 7
 3
19 20 47
7
56 26 49 43 38 80 7
 3
19 20 2
7
56 26 49 43 38 80 7
 3
19 20 2
7
72 26 49 43 38 80 7
 3
19 20 2
7
72 26 49 43 38 80 3
 3
19 20 2
7
72 26 20 43 38 80 3
 3
19 20 2
7
72 26 20 43 66 80 3
 3
19 21 2
7
72 26 20 43 66 80 3

100
939
 117
939
 144
939
 144
906
 64
906
 64
938
 64
910
 64
776
 64
865
 65
865

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,i,time[101],a,b,j;

  while(scanf("%d",&n)!=EOF)
    {
      a=0;
      for(i=0;i<n;i++)
	{
	  scanf("%d",&time[i]);
	}

      for(i=0;i<n;i++)
	{
	  for(j=i+1;j<n;j++)
	    {
	      if(time[i]>time[j])
		{
		  b=time[i];
		  time[i]=time[j];
		  time[j]=b;
		}
	    }
	}
      for(i=1;i<n;i++)
	{
	  time[i]=time[i]+time[i-1]; 
	}
      for(i=0;i<n;i++)
	{
	  a+=time[i];
	}
      printf("%d\n",a);
    }
  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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	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), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L15
	movl	12(%rsp), %eax
	leaq	16(%rsp), %rbx
	xorl	%r14d, %r14d
	xorl	%edx, %edx
	movq	%rbx, %r15
	testl	%eax, %eax
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %r15
	cmpl	%r14d, %r8d
	jg	.L3
	cmpl	$1, %r8d
	jle	.L4
	leaq	20(%rsp), %r9
	movl	$1, %r10d
	movq	%r9, %rdi
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdi, %rax
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	leal	1(%r10), %ecx
	movl	%r10d, %esi
	addq	$4, %rdi
	movl	%ecx, %r10d
	cmpl	%ecx, %r8d
	jne	.L5
	subl	$1, %esi
	movl	16(%rsp), %edx
	movq	%r9, %rax
	leaq	24(%rsp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rsi, %rax
	jne	.L10
	testl	%ecx, %ecx
	movl	$1, %esi
	cmovg	%ecx, %esi
	cmpl	$3, %ecx
	jle	.L35
	movl	%esi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rbx), %xmm0
	addq	$16, %rbx
	cmpq	%rax, %rbx
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%esi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	andl	$3, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	je	.L17
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
.L18:
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
	cltq
	addl	16(%rsp,%rax,4), %edx
.L17:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L15:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	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
.L35:
	.cfi_restore_state
	movl	16(%rsp), %edx
	movl	$1, %eax
	jmp	.L18
.L4:
	movl	$0, %edx
	cmove	16(%rsp), %edx
	jmp	.L17
.L36:
	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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	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), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L15
	movl	12(%rsp), %eax
	leaq	16(%rsp), %rbx
	xorl	%r14d, %r14d
	xorl	%edx, %edx
	movq	%rbx, %r15
	testl	%eax, %eax
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %r15
	cmpl	%r14d, %r8d
	jg	.L3
	cmpl	$1, %r8d
	jle	.L4
	leaq	20(%rsp), %r9
	movl	$1, %r10d
	movq	%r9, %rdi
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdi, %rax
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	leal	1(%r10), %ecx
	movl	%r10d, %esi
	addq	$4, %rdi
	movl	%ecx, %r10d
	cmpl	%ecx, %r8d
	jne	.L5
	subl	$1, %esi
	movl	16(%rsp), %edx
	movq	%r9, %rax
	leaq	24(%rsp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rsi, %rax
	jne	.L10
	testl	%ecx, %ecx
	movl	$1, %esi
	cmovg	%ecx, %esi
	cmpl	$3, %ecx
	jle	.L35
	movl	%esi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rbx), %xmm0
	addq	$16, %rbx
	cmpq	%rax, %rbx
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%esi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	andl	$3, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	je	.L17
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
.L18:
	movslq	%eax, %rsi
	addl	$1, %eax
	addl	16(%rsp,%rsi,4), %edx
	cmpl	%ecx, %eax
	jge	.L17
	cltq
	addl	16(%rsp,%rax,4), %edx
.L17:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L15:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	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
.L35:
	.cfi_restore_state
	movl	16(%rsp), %edx
	movl	$1, %eax
	jmp	.L18
.L4:
	movl	$0, %edx
	cmove	16(%rsp), %edx
	jmp	.L17
.L36:
	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:
```