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>
#include <stdlib.h>
int main(void){
	int n;
	int a[100];
	scanf("%d",&n);
	int i,sum;
	sum=0;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	int ans=0,ans2=0;
	for(i=0;i<n;i++){
		ans+=(sum/n-a[i])*(sum/n-a[i]);
		ans2+=(sum/n-a[i]+1)*(sum/n-a[i]+1);
	}
	if(ans<ans2){
		printf("%d\n",ans);
	}else{
		printf("%d\n",ans2);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addl	0(%r13,%rbx,4), %r12d
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L2
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	leal	-1(%rcx), %edx
	movl	%eax, %r12d
	cmpl	$3, %edx
	jbe	.L10
	movl	%ecx, %edx
	movd	%eax, %xmm7
	pxor	%xmm3, %xmm3
	movdqa	.LC1(%rip), %xmm5
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm3, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm6, %xmm0
	psubd	0(%rbp), %xmm0
	addq	$16, %rbp
	movdqa	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	psrlq	$32, %xmm1
	pmuludq	%xmm0, %xmm2
	paddd	%xmm5, %xmm0
	pmuludq	%xmm1, %xmm1
	pshufd	$8, %xmm2, %xmm2
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	paddd	%xmm2, %xmm4
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm3
	cmpq	%rbp, %rdx
	jne	.L5
	movdqa	%xmm3, %xmm0
	movl	%ecx, %edi
	psrldq	$8, %xmm0
	andl	$-4, %edi
	paddd	%xmm0, %xmm3
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm3
	movdqa	%xmm4, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm3, %edx
	paddd	%xmm0, %xmm4
	movdqa	%xmm4, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm4
	movd	%xmm4, %r8d
	testb	$3, %cl
	je	.L6
.L4:
	movslq	%edi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	2(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	addl	$3, %edi
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	cmpl	%edi, %ecx
	jle	.L6
	movslq	%edi, %rdi
	subl	16(%rsp,%rdi,4), %r12d
	movl	%r12d, %eax
	imull	%r12d, %eax
	addl	$1, %r12d
	imull	%r12d, %r12d
	addl	%eax, %r8d
	addl	%r12d, %edx
.L6:
	cmpl	%edx, %r8d
	jge	.L7
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L8:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$432, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
.L7:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L10:
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%edi, %edi
	jmp	.L4
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addl	0(%r13,%rbx,4), %r12d
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L2
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	leal	-1(%rcx), %edx
	movl	%eax, %r12d
	cmpl	$3, %edx
	jbe	.L10
	movl	%ecx, %edx
	movd	%eax, %xmm7
	pxor	%xmm3, %xmm3
	movdqa	.LC1(%rip), %xmm5
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm3, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm6, %xmm0
	psubd	0(%rbp), %xmm0
	addq	$16, %rbp
	movdqa	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	psrlq	$32, %xmm1
	pmuludq	%xmm0, %xmm2
	paddd	%xmm5, %xmm0
	pmuludq	%xmm1, %xmm1
	pshufd	$8, %xmm2, %xmm2
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	paddd	%xmm2, %xmm4
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm3
	cmpq	%rbp, %rdx
	jne	.L5
	movdqa	%xmm3, %xmm0
	movl	%ecx, %edi
	psrldq	$8, %xmm0
	andl	$-4, %edi
	paddd	%xmm0, %xmm3
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm3
	movdqa	%xmm4, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm3, %edx
	paddd	%xmm0, %xmm4
	movdqa	%xmm4, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm4
	movd	%xmm4, %r8d
	testb	$3, %cl
	je	.L6
.L4:
	movslq	%edi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	2(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	addl	$3, %edi
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	cmpl	%edi, %ecx
	jle	.L6
	movslq	%edi, %rdi
	subl	16(%rsp,%rdi,4), %r12d
	movl	%r12d, %eax
	imull	%r12d, %eax
	addl	$1, %r12d
	imull	%r12d, %r12d
	addl	%eax, %r8d
	addl	%r12d, %edx
.L6:
	cmpl	%edx, %r8d
	jge	.L7
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L8:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$432, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
.L7:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L10:
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%edi, %edi
	jmp	.L4
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addl	0(%r13,%rbx,4), %r12d
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L2
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	leal	-1(%rcx), %edx
	movl	%eax, %r12d
	cmpl	$3, %edx
	jbe	.L10
	movl	%ecx, %edx
	movd	%eax, %xmm7
	pxor	%xmm3, %xmm3
	movdqa	.LC1(%rip), %xmm5
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm3, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm6, %xmm0
	psubd	0(%rbp), %xmm0
	addq	$16, %rbp
	movdqa	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	psrlq	$32, %xmm1
	pmuludq	%xmm0, %xmm2
	paddd	%xmm5, %xmm0
	pmuludq	%xmm1, %xmm1
	pshufd	$8, %xmm2, %xmm2
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	paddd	%xmm2, %xmm4
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm3
	cmpq	%rbp, %rdx
	jne	.L5
	movdqa	%xmm3, %xmm0
	movl	%ecx, %edi
	psrldq	$8, %xmm0
	andl	$-4, %edi
	paddd	%xmm0, %xmm3
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm3
	movdqa	%xmm4, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm3, %edx
	paddd	%xmm0, %xmm4
	movdqa	%xmm4, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm4
	movd	%xmm4, %r8d
	testb	$3, %cl
	je	.L6
.L4:
	movslq	%edi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	2(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	addl	$3, %edi
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	cmpl	%edi, %ecx
	jle	.L6
	movslq	%edi, %rdi
	subl	16(%rsp,%rdi,4), %r12d
	movl	%r12d, %eax
	imull	%r12d, %eax
	addl	$1, %r12d
	imull	%r12d, %r12d
	addl	%eax, %r8d
	addl	%r12d, %edx
.L6:
	cmpl	%edx, %r8d
	jge	.L7
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L8:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$432, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
.L7:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L10:
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%edi, %edi
	jmp	.L4
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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>
#include <stdlib.h>
int main(void){
	int n;
	int a[100];
	scanf("%d",&n);
	int i,sum;
	sum=0;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	int ans=0,ans2=0;
	for(i=0;i<n;i++){
		ans+=(sum/n-a[i])*(sum/n-a[i]);
		ans2+=(sum/n-a[i]+1)*(sum/n-a[i]+1);
	}
	if(ans<ans2){
		printf("%d\n",ans);
	}else{
		printf("%d\n",ans2);
	}
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
int main(void){
	int n;
	int a[100];
	scanf("%d",&n);
	int i,sum;
	sum=0;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	int ans=0,ans2=0;
	for(i=0;i<n;i++){
		ans+=(sum/n-a[i])*(sum/n-a[i]);
		ans2+=(sum/n-a[i]+1)*(sum/n-a[i]+1);
	}
	if(ans<ans2){
		printf("%d\n",ans);
	}else{
		printf("%d\n",ans2);
	}
	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
4 8

8

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>
#include <stdlib.h>
int main(void){
	int n;
	int a[100];
	scanf("%d",&n);
	int i,sum;
	sum=0;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	int ans=0,ans2=0;
	for(i=0;i<n;i++){
		ans+=(sum/n-a[i])*(sum/n-a[i]);
		ans2+=(sum/n-a[i]+1)*(sum/n-a[i]+1);
	}
	if(ans<ans2){
		printf("%d\n",ans);
	}else{
		printf("%d\n",ans2);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addl	0(%r13,%rbx,4), %r12d
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L2
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	leal	-1(%rcx), %edx
	movl	%eax, %r12d
	cmpl	$3, %edx
	jbe	.L10
	movl	%ecx, %edx
	movd	%eax, %xmm7
	pxor	%xmm3, %xmm3
	movdqa	.LC1(%rip), %xmm5
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm3, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm6, %xmm0
	psubd	0(%rbp), %xmm0
	addq	$16, %rbp
	movdqa	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	psrlq	$32, %xmm1
	pmuludq	%xmm0, %xmm2
	paddd	%xmm5, %xmm0
	pmuludq	%xmm1, %xmm1
	pshufd	$8, %xmm2, %xmm2
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	paddd	%xmm2, %xmm4
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm3
	cmpq	%rbp, %rdx
	jne	.L5
	movdqa	%xmm3, %xmm0
	movl	%ecx, %edi
	psrldq	$8, %xmm0
	andl	$-4, %edi
	paddd	%xmm0, %xmm3
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm3
	movdqa	%xmm4, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm3, %edx
	paddd	%xmm0, %xmm4
	movdqa	%xmm4, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm4
	movd	%xmm4, %r8d
	testb	$3, %cl
	je	.L6
.L4:
	movslq	%edi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	2(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	addl	$3, %edi
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	cmpl	%edi, %ecx
	jle	.L6
	movslq	%edi, %rdi
	subl	16(%rsp,%rdi,4), %r12d
	movl	%r12d, %eax
	imull	%r12d, %eax
	addl	$1, %r12d
	imull	%r12d, %r12d
	addl	%eax, %r8d
	addl	%r12d, %edx
.L6:
	cmpl	%edx, %r8d
	jge	.L7
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L8:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$432, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
.L7:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L10:
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%edi, %edi
	jmp	.L4
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addl	0(%r13,%rbx,4), %r12d
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L2
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	leal	-1(%rcx), %edx
	movl	%eax, %r12d
	cmpl	$3, %edx
	jbe	.L10
	movl	%ecx, %edx
	movd	%eax, %xmm7
	pxor	%xmm3, %xmm3
	movdqa	.LC1(%rip), %xmm5
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm6
	movdqa	%xmm3, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm6, %xmm0
	psubd	0(%rbp), %xmm0
	addq	$16, %rbp
	movdqa	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	psrlq	$32, %xmm1
	pmuludq	%xmm0, %xmm2
	paddd	%xmm5, %xmm0
	pmuludq	%xmm1, %xmm1
	pshufd	$8, %xmm2, %xmm2
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	paddd	%xmm2, %xmm4
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm3
	cmpq	%rbp, %rdx
	jne	.L5
	movdqa	%xmm3, %xmm0
	movl	%ecx, %edi
	psrldq	$8, %xmm0
	andl	$-4, %edi
	paddd	%xmm0, %xmm3
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm3
	movdqa	%xmm4, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm3, %edx
	paddd	%xmm0, %xmm4
	movdqa	%xmm4, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm4
	movd	%xmm4, %r8d
	testb	$3, %cl
	je	.L6
.L4:
	movslq	%edi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	leal	2(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movslq	%esi, %rsi
	movl	%r12d, %eax
	addl	$3, %edi
	subl	16(%rsp,%rsi,4), %eax
	movl	%eax, %esi
	movl	%eax, %r9d
	addl	$1, %esi
	imull	%eax, %r9d
	imull	%esi, %esi
	addl	%r9d, %r8d
	addl	%esi, %edx
	cmpl	%edi, %ecx
	jle	.L6
	movslq	%edi, %rdi
	subl	16(%rsp,%rdi,4), %r12d
	movl	%r12d, %eax
	imull	%r12d, %eax
	addl	$1, %r12d
	imull	%r12d, %r12d
	addl	%eax, %r8d
	addl	%r12d, %edx
.L6:
	cmpl	%edx, %r8d
	jge	.L7
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L8:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$432, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
.L7:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L10:
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%edi, %edi
	jmp	.L4
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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:
```