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 n;
  int a[10000] = {} ;
  scanf("%d",&n);
  while(n > 0){
    for(int i = 0 ; i < n ; i ++) {
      scanf("%d",&a[i]);
    }
    int sum = 0 ;
    for(int i = 0 ; i < n ; i ++){
      sum=sum + a[i];
    }
    int cnt=0;
    for(int i = 0 ; i < n ; i ++){
      if(a[i]*n <= sum){
        cnt++;
      }
    }
    printf("%d\n" ,cnt);
    scanf("%d",&n);
  }
  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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	xorl	%esi, %esi
	movl	$40000, %edx
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %r12
	leaq	12(%rsp), %r13
	movq	%r12, %rdi
	call	memset@PLT
	movq	%r13, %rsi
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movq	%r12, %rbx
	movq	%r12, %r14
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r14
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L20
	leal	-1(%rax), %edi
	cmpl	$2, %edi
	jbe	.L6
	movl	%eax, %edx
	leaq	16(%r12), %rsi
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leal	-1(%rdx), %ecx
	movq	%r12, %rdx
	salq	$4, %rcx
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rdx), %xmm0
	addq	$16, %rdx
	cmpq	%rdx, %rcx
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%eax, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %al
	je	.L8
	movslq	%edx, %r8
	addl	$1, %edx
	addl	16(%rsp,%r8,4), %ecx
	cmpl	%edx, %eax
	jle	.L8
.L18:
	movslq	%edx, %rsi
	addl	$1, %edx
	addl	16(%rsp,%rsi,4), %ecx
	cmpl	%edx, %eax
	jle	.L10
	movslq	%edx, %rdx
	addl	16(%rsp,%rdx,4), %ecx
.L10:
	cmpl	$2, %edi
	jbe	.L21
	leaq	16(%r12), %rsi
.L8:
	movl	%eax, %edx
	movd	%eax, %xmm7
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm3
	movd	%ecx, %xmm7
	movdqa	%xmm3, %xmm5
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm2, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	psrlq	$32, %xmm5
	addq	%rsi, %rdx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L34:
	addq	$16, %rsi
.L12:
	movdqa	(%rbx), %xmm1
	movdqa	%xmm3, %xmm0
	pmuludq	(%rbx), %xmm0
	movq	%rsi, %rbx
	pshufd	$8, %xmm0, %xmm0
	psrlq	$32, %xmm1
	pmuludq	%xmm5, %xmm1
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	pcmpgtd	%xmm6, %xmm0
	pcmpeqd	%xmm4, %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rdx, %rsi
	jne	.L34
	movdqa	%xmm2, %xmm0
	movl	%eax, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %edx
	testb	$3, %al
	je	.L5
.L11:
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	movzbl	%dil, %edi
	addl	%edi, %edx
	leal	1(%rsi), %edi
	cmpl	%edi, %eax
	jle	.L5
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	addl	$2, %esi
	movzbl	%dil, %edi
	addl	%edi, %edx
	cmpl	%esi, %eax
	jle	.L5
	movslq	%esi, %rsi
	imull	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %eax
	setle	%al
	movzbl	%al, %eax
	addl	%eax, %edx
.L5:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsi
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L3:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$40040, %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
.L6:
	.cfi_restore_state
	movl	16(%rsp), %ecx
	movl	$1, %edx
	cmpl	$1, %eax
	jne	.L18
.L21:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L11
.L20:
	xorl	%edx, %edx
	jmp	.L5
.L35:
	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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	xorl	%esi, %esi
	movl	$40000, %edx
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %r12
	leaq	12(%rsp), %r13
	movq	%r12, %rdi
	call	memset@PLT
	movq	%r13, %rsi
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movq	%r12, %rbx
	movq	%r12, %r14
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r14
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L20
	leal	-1(%rax), %edi
	cmpl	$2, %edi
	jbe	.L6
	movl	%eax, %edx
	leaq	16(%r12), %rsi
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leal	-1(%rdx), %ecx
	movq	%r12, %rdx
	salq	$4, %rcx
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rdx), %xmm0
	addq	$16, %rdx
	cmpq	%rdx, %rcx
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%eax, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %al
	je	.L8
	movslq	%edx, %r8
	addl	$1, %edx
	addl	16(%rsp,%r8,4), %ecx
	cmpl	%edx, %eax
	jle	.L8
.L18:
	movslq	%edx, %rsi
	addl	$1, %edx
	addl	16(%rsp,%rsi,4), %ecx
	cmpl	%edx, %eax
	jle	.L10
	movslq	%edx, %rdx
	addl	16(%rsp,%rdx,4), %ecx
.L10:
	cmpl	$2, %edi
	jbe	.L21
	leaq	16(%r12), %rsi
.L8:
	movl	%eax, %edx
	movd	%eax, %xmm7
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm3
	movd	%ecx, %xmm7
	movdqa	%xmm3, %xmm5
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm2, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	psrlq	$32, %xmm5
	addq	%rsi, %rdx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L34:
	addq	$16, %rsi
.L12:
	movdqa	(%rbx), %xmm1
	movdqa	%xmm3, %xmm0
	pmuludq	(%rbx), %xmm0
	movq	%rsi, %rbx
	pshufd	$8, %xmm0, %xmm0
	psrlq	$32, %xmm1
	pmuludq	%xmm5, %xmm1
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	pcmpgtd	%xmm6, %xmm0
	pcmpeqd	%xmm4, %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rdx, %rsi
	jne	.L34
	movdqa	%xmm2, %xmm0
	movl	%eax, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %edx
	testb	$3, %al
	je	.L5
.L11:
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	movzbl	%dil, %edi
	addl	%edi, %edx
	leal	1(%rsi), %edi
	cmpl	%edi, %eax
	jle	.L5
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	addl	$2, %esi
	movzbl	%dil, %edi
	addl	%edi, %edx
	cmpl	%esi, %eax
	jle	.L5
	movslq	%esi, %rsi
	imull	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %eax
	setle	%al
	movzbl	%al, %eax
	addl	%eax, %edx
.L5:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsi
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L3:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$40040, %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
.L6:
	.cfi_restore_state
	movl	16(%rsp), %ecx
	movl	$1, %edx
	cmpl	$1, %eax
	jne	.L18
.L21:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L11
.L20:
	xorl	%edx, %edx
	jmp	.L5
.L35:
	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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	xorl	%esi, %esi
	movl	$40000, %edx
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %r12
	leaq	12(%rsp), %r13
	movq	%r12, %rdi
	call	memset@PLT
	movq	%r13, %rsi
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movq	%r12, %rbx
	movq	%r12, %r14
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r14
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L20
	leal	-1(%rax), %edi
	cmpl	$2, %edi
	jbe	.L6
	movl	%eax, %edx
	leaq	16(%r12), %rsi
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leal	-1(%rdx), %ecx
	movq	%r12, %rdx
	salq	$4, %rcx
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rdx), %xmm0
	addq	$16, %rdx
	cmpq	%rdx, %rcx
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%eax, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %al
	je	.L8
	movslq	%edx, %r8
	addl	$1, %edx
	addl	16(%rsp,%r8,4), %ecx
	cmpl	%edx, %eax
	jle	.L8
.L18:
	movslq	%edx, %rsi
	addl	$1, %edx
	addl	16(%rsp,%rsi,4), %ecx
	cmpl	%edx, %eax
	jle	.L10
	movslq	%edx, %rdx
	addl	16(%rsp,%rdx,4), %ecx
.L10:
	cmpl	$2, %edi
	jbe	.L21
	leaq	16(%r12), %rsi
.L8:
	movl	%eax, %edx
	movd	%eax, %xmm7
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm3
	movd	%ecx, %xmm7
	movdqa	%xmm3, %xmm5
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm2, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	psrlq	$32, %xmm5
	addq	%rsi, %rdx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L34:
	addq	$16, %rsi
.L12:
	movdqa	(%rbx), %xmm1
	movdqa	%xmm3, %xmm0
	pmuludq	(%rbx), %xmm0
	movq	%rsi, %rbx
	pshufd	$8, %xmm0, %xmm0
	psrlq	$32, %xmm1
	pmuludq	%xmm5, %xmm1
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	pcmpgtd	%xmm6, %xmm0
	pcmpeqd	%xmm4, %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rdx, %rsi
	jne	.L34
	movdqa	%xmm2, %xmm0
	movl	%eax, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %edx
	testb	$3, %al
	je	.L5
.L11:
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	movzbl	%dil, %edi
	addl	%edi, %edx
	leal	1(%rsi), %edi
	cmpl	%edi, %eax
	jle	.L5
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	addl	$2, %esi
	movzbl	%dil, %edi
	addl	%edi, %edx
	cmpl	%esi, %eax
	jle	.L5
	movslq	%esi, %rsi
	imull	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %eax
	setle	%al
	movzbl	%al, %eax
	addl	%eax, %edx
.L5:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsi
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L3:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$40040, %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
.L6:
	.cfi_restore_state
	movl	16(%rsp), %ecx
	movl	$1, %edx
	cmpl	$1, %eax
	jne	.L18
.L21:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L11
.L20:
	xorl	%edx, %edx
	jmp	.L5
.L35:
	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 n;
  int a[10000] = {} ;
  scanf("%d",&n);
  while(n > 0){
    for(int i = 0 ; i < n ; i ++) {
      scanf("%d",&a[i]);
    }
    int sum = 0 ;
    for(int i = 0 ; i < n ; i ++){
      sum=sum + a[i];
    }
    int cnt=0;
    for(int i = 0 ; i < n ; i ++){
      if(a[i]*n <= sum){
        cnt++;
      }
    }
    printf("%d\n" ,cnt);
    scanf("%d",&n);
  }
  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 n;
  int a[10000] = {} ;
  scanf("%d",&n);
  while(n > 0){
    for(int i = 0 ; i < n ; i ++) {
      scanf("%d",&a[i]);
    }
    int sum = 0 ;
    for(int i = 0 ; i < n ; i ++){
      sum=sum + a[i];
    }
    int cnt=0;
    for(int i = 0 ; i < n ; i ++){
      if(a[i]*n <= sum){
        cnt++;
      }
    }
    printf("%d\n" ,cnt);
    scanf("%d",&n);
  }
  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:

7
15 15 15 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 8 4
0
 7
15 15 1 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
23 15 1 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
23 15 1 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
31 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
23 15 1 5 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
31 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
23 24 1 5 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
31 90 90 90 90 90 10
7
2 7 1 8 2 11 4
0
 7
15 15 15 15 15 15 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
4 7 1 8 2 8 4
0
 7
15 15 1 15 15 23 15
4
10 20 30 60
10
1 1 1 1 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 11 8
0
 7
23 24 1 5 15 23 15
4
10 20 30 60
10
1 1 1 1 0 1 1 1 0 000
7
31 90 90 90 90 90 10
7
2 7 0 8 2 11 4
0
 7
15 15 15 15 15 23 15
4
10 20 30 60
10
1 2 1 0 1 1 1 1 1 100
7
90 90 90 90 90 90 10
7
2 7 1 8 2 11 7
0

6
3
9
1
4
 1
3
9
1
4
 5
3
9
1
4
 5
3
9
2
4
 2
3
9
2
4
 4
3
9
2
4
 7
3
9
1
4
 1
3
9
1
3
 4
3
3
2
4
 6
3
9
1
3

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 n;
  int a[10000] = {} ;
  scanf("%d",&n);
  while(n > 0){
    for(int i = 0 ; i < n ; i ++) {
      scanf("%d",&a[i]);
    }
    int sum = 0 ;
    for(int i = 0 ; i < n ; i ++){
      sum=sum + a[i];
    }
    int cnt=0;
    for(int i = 0 ; i < n ; i ++){
      if(a[i]*n <= sum){
        cnt++;
      }
    }
    printf("%d\n" ,cnt);
    scanf("%d",&n);
  }
  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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	xorl	%esi, %esi
	movl	$40000, %edx
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %r12
	leaq	12(%rsp), %r13
	movq	%r12, %rdi
	call	memset@PLT
	movq	%r13, %rsi
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movq	%r12, %rbx
	movq	%r12, %r14
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r14
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L20
	leal	-1(%rax), %edi
	cmpl	$2, %edi
	jbe	.L6
	movl	%eax, %edx
	leaq	16(%r12), %rsi
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leal	-1(%rdx), %ecx
	movq	%r12, %rdx
	salq	$4, %rcx
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rdx), %xmm0
	addq	$16, %rdx
	cmpq	%rdx, %rcx
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%eax, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %al
	je	.L8
	movslq	%edx, %r8
	addl	$1, %edx
	addl	16(%rsp,%r8,4), %ecx
	cmpl	%edx, %eax
	jle	.L8
.L18:
	movslq	%edx, %rsi
	addl	$1, %edx
	addl	16(%rsp,%rsi,4), %ecx
	cmpl	%edx, %eax
	jle	.L10
	movslq	%edx, %rdx
	addl	16(%rsp,%rdx,4), %ecx
.L10:
	cmpl	$2, %edi
	jbe	.L21
	leaq	16(%r12), %rsi
.L8:
	movl	%eax, %edx
	movd	%eax, %xmm7
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm3
	movd	%ecx, %xmm7
	movdqa	%xmm3, %xmm5
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm2, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	psrlq	$32, %xmm5
	addq	%rsi, %rdx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L34:
	addq	$16, %rsi
.L12:
	movdqa	(%rbx), %xmm1
	movdqa	%xmm3, %xmm0
	pmuludq	(%rbx), %xmm0
	movq	%rsi, %rbx
	pshufd	$8, %xmm0, %xmm0
	psrlq	$32, %xmm1
	pmuludq	%xmm5, %xmm1
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	pcmpgtd	%xmm6, %xmm0
	pcmpeqd	%xmm4, %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rdx, %rsi
	jne	.L34
	movdqa	%xmm2, %xmm0
	movl	%eax, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %edx
	testb	$3, %al
	je	.L5
.L11:
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	movzbl	%dil, %edi
	addl	%edi, %edx
	leal	1(%rsi), %edi
	cmpl	%edi, %eax
	jle	.L5
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	addl	$2, %esi
	movzbl	%dil, %edi
	addl	%edi, %edx
	cmpl	%esi, %eax
	jle	.L5
	movslq	%esi, %rsi
	imull	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %eax
	setle	%al
	movzbl	%al, %eax
	addl	%eax, %edx
.L5:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsi
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L3:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$40040, %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
.L6:
	.cfi_restore_state
	movl	16(%rsp), %ecx
	movl	$1, %edx
	cmpl	$1, %eax
	jne	.L18
.L21:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L11
.L20:
	xorl	%edx, %edx
	jmp	.L5
.L35:
	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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	xorl	%esi, %esi
	movl	$40000, %edx
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %r12
	leaq	12(%rsp), %r13
	movq	%r12, %rdi
	call	memset@PLT
	movq	%r13, %rsi
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movq	%r12, %rbx
	movq	%r12, %r14
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r14
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L20
	leal	-1(%rax), %edi
	cmpl	$2, %edi
	jbe	.L6
	movl	%eax, %edx
	leaq	16(%r12), %rsi
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leal	-1(%rdx), %ecx
	movq	%r12, %rdx
	salq	$4, %rcx
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rdx), %xmm0
	addq	$16, %rdx
	cmpq	%rdx, %rcx
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%eax, %edx
	psrldq	$8, %xmm1
	andl	$-4, %edx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ecx
	testb	$3, %al
	je	.L8
	movslq	%edx, %r8
	addl	$1, %edx
	addl	16(%rsp,%r8,4), %ecx
	cmpl	%edx, %eax
	jle	.L8
.L18:
	movslq	%edx, %rsi
	addl	$1, %edx
	addl	16(%rsp,%rsi,4), %ecx
	cmpl	%edx, %eax
	jle	.L10
	movslq	%edx, %rdx
	addl	16(%rsp,%rdx,4), %ecx
.L10:
	cmpl	$2, %edi
	jbe	.L21
	leaq	16(%r12), %rsi
.L8:
	movl	%eax, %edx
	movd	%eax, %xmm7
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm3
	movd	%ecx, %xmm7
	movdqa	%xmm3, %xmm5
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm2, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	psrlq	$32, %xmm5
	addq	%rsi, %rdx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L34:
	addq	$16, %rsi
.L12:
	movdqa	(%rbx), %xmm1
	movdqa	%xmm3, %xmm0
	pmuludq	(%rbx), %xmm0
	movq	%rsi, %rbx
	pshufd	$8, %xmm0, %xmm0
	psrlq	$32, %xmm1
	pmuludq	%xmm5, %xmm1
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	pcmpgtd	%xmm6, %xmm0
	pcmpeqd	%xmm4, %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rdx, %rsi
	jne	.L34
	movdqa	%xmm2, %xmm0
	movl	%eax, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %edx
	testb	$3, %al
	je	.L5
.L11:
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	movzbl	%dil, %edi
	addl	%edi, %edx
	leal	1(%rsi), %edi
	cmpl	%edi, %eax
	jle	.L5
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ebx
	imull	%eax, %ebx
	cmpl	%ecx, %ebx
	setle	%dil
	addl	$2, %esi
	movzbl	%dil, %edi
	addl	%edi, %edx
	cmpl	%esi, %eax
	jle	.L5
	movslq	%esi, %rsi
	imull	16(%rsp,%rsi,4), %eax
	cmpl	%ecx, %eax
	setle	%al
	movzbl	%al, %eax
	addl	%eax, %edx
.L5:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsi
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L3:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$40040, %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
.L6:
	.cfi_restore_state
	movl	16(%rsp), %ecx
	movl	$1, %edx
	cmpl	$1, %eax
	jne	.L18
.L21:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L11
.L20:
	xorl	%edx, %edx
	jmp	.L5
.L35:
	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:
```