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 K,U;
  int sum,total;
  int i;
  int array[5000];

  while(1){

    sum = 0;

    scanf("%d",&K);
    if( K == 0 )break;

    U = K * ( K - 1 ) / 2;

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

    for( i = 0 ; i < U ; i++ ){
      sum += array[i];
    }
    total = sum / ( K - 1 );
    printf("%d\n", total);
  }
  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
	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
	leaq	-16384(%rsp), %r11
	.cfi_def_cfa 11, 16440
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3672, %rsp
	.cfi_def_cfa_offset 20112
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 20040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leal	-1(%rax), %r13d
	imull	%eax, %r13d
	movl	%r13d, %ebx
	shrl	$31, %ebx
	addl	%r13d, %ebx
	sarl	%ebx
	cmpl	$1, %r13d
	jle	.L10
	xorl	%r14d, %r14d
	leaq	32(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%r12,%r14,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__isoc99_scanf@PLT
	movq	%r12, %r15
	cmpl	%r14d, %ebx
	jg	.L4
	cmpl	$1, %r13d
	movl	$1, %ecx
	cmovg	%ebx, %ecx
	cmpl	$7, %r13d
	jle	.L11
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	48(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L6:
	paddd	(%r15), %xmm0
	addq	$16, %r15
	cmpq	%rax, %r15
	jne	.L6
	movdqa	%xmm0, %xmm1
	movl	%ecx, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	andl	$3, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	je	.L7
.L5:
	movslq	%edx, %rcx
	addl	32(%rsp,%rcx,4), %eax
	leal	1(%rdx), %ecx
	cmpl	%ecx, %ebx
	jle	.L7
	movslq	%ecx, %rcx
	addl	$2, %edx
	addl	32(%rsp,%rcx,4), %eax
	cmpl	%edx, %ebx
	jle	.L7
	movslq	%edx, %rdx
	addl	32(%rsp,%rdx,4), %eax
.L7:
	movl	28(%rsp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
.L3:
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	20040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$20056, %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
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L3
.L11:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L5
.L16:
	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
	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
	leaq	-16384(%rsp), %r11
	.cfi_def_cfa 11, 16440
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3672, %rsp
	.cfi_def_cfa_offset 20112
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 20040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leal	-1(%rax), %r13d
	imull	%eax, %r13d
	movl	%r13d, %ebx
	shrl	$31, %ebx
	addl	%r13d, %ebx
	sarl	%ebx
	cmpl	$1, %r13d
	jle	.L10
	xorl	%r14d, %r14d
	leaq	32(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%r12,%r14,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__isoc99_scanf@PLT
	movq	%r12, %r15
	cmpl	%r14d, %ebx
	jg	.L4
	cmpl	$1, %r13d
	movl	$1, %ecx
	cmovg	%ebx, %ecx
	cmpl	$7, %r13d
	jle	.L11
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	48(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L6:
	paddd	(%r15), %xmm0
	addq	$16, %r15
	cmpq	%rax, %r15
	jne	.L6
	movdqa	%xmm0, %xmm1
	movl	%ecx, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	andl	$3, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	je	.L7
.L5:
	movslq	%edx, %rcx
	addl	32(%rsp,%rcx,4), %eax
	leal	1(%rdx), %ecx
	cmpl	%ecx, %ebx
	jle	.L7
	movslq	%ecx, %rcx
	addl	$2, %edx
	addl	32(%rsp,%rcx,4), %eax
	cmpl	%edx, %ebx
	jle	.L7
	movslq	%edx, %rdx
	addl	32(%rsp,%rdx,4), %eax
.L7:
	movl	28(%rsp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
.L3:
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	20040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$20056, %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
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L3
.L11:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L5
.L16:
	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
	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
	leaq	-16384(%rsp), %r11
	.cfi_def_cfa 11, 16440
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3672, %rsp
	.cfi_def_cfa_offset 20112
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 20040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leal	-1(%rax), %r13d
	imull	%eax, %r13d
	movl	%r13d, %ebx
	shrl	$31, %ebx
	addl	%r13d, %ebx
	sarl	%ebx
	cmpl	$1, %r13d
	jle	.L10
	xorl	%r14d, %r14d
	leaq	32(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%r12,%r14,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__isoc99_scanf@PLT
	movq	%r12, %r15
	cmpl	%r14d, %ebx
	jg	.L4
	cmpl	$1, %r13d
	movl	$1, %ecx
	cmovg	%ebx, %ecx
	cmpl	$7, %r13d
	jle	.L11
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	48(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L6:
	paddd	(%r15), %xmm0
	addq	$16, %r15
	cmpq	%rax, %r15
	jne	.L6
	movdqa	%xmm0, %xmm1
	movl	%ecx, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	andl	$3, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	je	.L7
.L5:
	movslq	%edx, %rcx
	addl	32(%rsp,%rcx,4), %eax
	leal	1(%rdx), %ecx
	cmpl	%ecx, %ebx
	jle	.L7
	movslq	%ecx, %rcx
	addl	$2, %edx
	addl	32(%rsp,%rcx,4), %eax
	cmpl	%edx, %ebx
	jle	.L7
	movslq	%edx, %rdx
	addl	32(%rsp,%rdx,4), %eax
.L7:
	movl	28(%rsp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
.L3:
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	20040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$20056, %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
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L3
.L11:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L5
.L16:
	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 K,U;
  int sum,total;
  int i;
  int array[5000];

  while(1){

    sum = 0;

    scanf("%d",&K);
    if( K == 0 )break;

    U = K * ( K - 1 ) / 2;

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

    for( i = 0 ; i < U ; i++ ){
      sum += array[i];
    }
    total = sum / ( K - 1 );
    printf("%d\n", total);
  }
  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 K,U;
  int sum,total;
  int i;
  int array[5000];

  while(1){

    sum = 0;

    scanf("%d",&K);
    if( K == 0 )break;

    U = K * ( K - 1 ) / 2;

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

    for( i = 0 ; i < U ; i++ ){
      sum += array[i];
    }
    total = sum / ( K - 1 );
    printf("%d\n", total);
  }
  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:

2
2
3
7 4 3
0
 2
2
0
7 4 3
0
 2
2
3
3 4 3
0
 2
0
0
7 8 3
0
 2
1
3
3 4 3
0
 2
1
0
7 14 4
0
 2
2
3
2 1 4
0
 2
2
3
4 1 4
0
 2
1
3
4 5 3
0
 2
-1
0
7 14 4
0

2
7
 2
 2
5
 0
 1
5
 1
 2
3
 2
4
 1
6
 -1

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 K,U;
  int sum,total;
  int i;
  int array[5000];

  while(1){

    sum = 0;

    scanf("%d",&K);
    if( K == 0 )break;

    U = K * ( K - 1 ) / 2;

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

    for( i = 0 ; i < U ; i++ ){
      sum += array[i];
    }
    total = sum / ( K - 1 );
    printf("%d\n", total);
  }
  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
	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
	leaq	-16384(%rsp), %r11
	.cfi_def_cfa 11, 16440
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3672, %rsp
	.cfi_def_cfa_offset 20112
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 20040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leal	-1(%rax), %r13d
	imull	%eax, %r13d
	movl	%r13d, %ebx
	shrl	$31, %ebx
	addl	%r13d, %ebx
	sarl	%ebx
	cmpl	$1, %r13d
	jle	.L10
	xorl	%r14d, %r14d
	leaq	32(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%r12,%r14,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__isoc99_scanf@PLT
	movq	%r12, %r15
	cmpl	%r14d, %ebx
	jg	.L4
	cmpl	$1, %r13d
	movl	$1, %ecx
	cmovg	%ebx, %ecx
	cmpl	$7, %r13d
	jle	.L11
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	48(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L6:
	paddd	(%r15), %xmm0
	addq	$16, %r15
	cmpq	%rax, %r15
	jne	.L6
	movdqa	%xmm0, %xmm1
	movl	%ecx, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	andl	$3, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	je	.L7
.L5:
	movslq	%edx, %rcx
	addl	32(%rsp,%rcx,4), %eax
	leal	1(%rdx), %ecx
	cmpl	%ecx, %ebx
	jle	.L7
	movslq	%ecx, %rcx
	addl	$2, %edx
	addl	32(%rsp,%rcx,4), %eax
	cmpl	%edx, %ebx
	jle	.L7
	movslq	%edx, %rdx
	addl	32(%rsp,%rdx,4), %eax
.L7:
	movl	28(%rsp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
.L3:
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	20040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$20056, %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
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L3
.L11:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L5
.L16:
	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
	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
	leaq	-16384(%rsp), %r11
	.cfi_def_cfa 11, 16440
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3672, %rsp
	.cfi_def_cfa_offset 20112
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 20040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leal	-1(%rax), %r13d
	imull	%eax, %r13d
	movl	%r13d, %ebx
	shrl	$31, %ebx
	addl	%r13d, %ebx
	sarl	%ebx
	cmpl	$1, %r13d
	jle	.L10
	xorl	%r14d, %r14d
	leaq	32(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%r12,%r14,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__isoc99_scanf@PLT
	movq	%r12, %r15
	cmpl	%r14d, %ebx
	jg	.L4
	cmpl	$1, %r13d
	movl	$1, %ecx
	cmovg	%ebx, %ecx
	cmpl	$7, %r13d
	jle	.L11
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	48(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L6:
	paddd	(%r15), %xmm0
	addq	$16, %r15
	cmpq	%rax, %r15
	jne	.L6
	movdqa	%xmm0, %xmm1
	movl	%ecx, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	andl	$3, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	je	.L7
.L5:
	movslq	%edx, %rcx
	addl	32(%rsp,%rcx,4), %eax
	leal	1(%rdx), %ecx
	cmpl	%ecx, %ebx
	jle	.L7
	movslq	%ecx, %rcx
	addl	$2, %edx
	addl	32(%rsp,%rcx,4), %eax
	cmpl	%edx, %ebx
	jle	.L7
	movslq	%edx, %rdx
	addl	32(%rsp,%rdx,4), %eax
.L7:
	movl	28(%rsp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
.L3:
	movl	%eax, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	20040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$20056, %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
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L3
.L11:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L5
.L16:
	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:
```