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 i, N, P, X[101];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(X[i]));
	
	long sum = 0;
	for (i = 1; i <= N; i++) sum += X[i];
	if (sum % N <= N/2) P = sum / N;
	else P = sum / N + 1;
	
	sum = 0;
	for (i = 1; i <= N; i++) sum += (X[i] - P) * (X[i] - P);
	printf("%ld\n", sum);
	fflush(stdout);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\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	$440, %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), %ecx
	testl	%ecx, %ecx
	jle	.L17
	leaq	20(%rsp), %r12
	movl	$1, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jge	.L3
	testl	%ecx, %ecx
	jle	.L17
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	pxor	%xmm4, %xmm4
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	36(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%r12), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %r12
	pcmpgtd	%xmm1, %xmm2
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm1
	paddq	%xmm3, %xmm0
	paddq	%xmm1, %xmm0
	cmpq	%rax, %r12
	jne	.L5
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddq	%xmm1, %xmm0
	leal	1(%rsi), %edx
	movq	%xmm0, %rax
	cmpl	%esi, %ecx
	je	.L2
.L4:
	movslq	%edx, %rsi
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	leal	1(%rdx), %esi
	cmpl	%esi, %ecx
	jl	.L2
	movslq	%esi, %rsi
	addl	$2, %edx
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	cmpl	%edx, %ecx
	jl	.L2
	movslq	%edx, %rdx
	movslq	16(%rsp,%rdx,4), %rdx
	addq	%rdx, %rax
.L2:
	movslq	%ecx, %rsi
	cqto
	idivq	%rsi
	movl	%ecx, %esi
	shrl	$31, %esi
	addl	%ecx, %esi
	sarl	%esi
	movslq	%esi, %rsi
	leal	1(%rax), %edi
	cmpq	%rsi, %rdx
	cmovg	%edi, %eax
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L20
	movd	%eax, %xmm6
	leaq	20(%rsp), %rdx
	pxor	%xmm2, %xmm2
	movl	%ecx, %esi
	shrl	$2, %esi
	pshufd	$0, %xmm6, %xmm5
	pxor	%xmm4, %xmm4
	subl	$1, %esi
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L12:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	psubd	%xmm5, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	movdqa	%xmm4, %xmm0
	pcmpgtd	%xmm1, %xmm0
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm0, %xmm3
	punpckhdq	%xmm0, %xmm1
	paddq	%xmm3, %xmm2
	paddq	%xmm1, %xmm2
	cmpq	%rdx, %rsi
	jne	.L12
	movdqa	%xmm2, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm2
	leal	1(%rsi), %edi
	movq	%xmm2, %rdx
	cmpl	%ecx, %esi
	je	.L10
.L11:
	movslq	%edi, %rsi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jl	.L10
	movslq	%esi, %rsi
	addl	$2, %edi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	cmpl	%edi, %ecx
	jl	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ecx
	subl	%eax, %ecx
	imull	%ecx, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
.L10:
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$440, %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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L2
.L19:
	xorl	%edx, %edx
	jmp	.L10
.L18:
	xorl	%eax, %eax
	movl	$1, %edx
	jmp	.L4
.L20:
	xorl	%edx, %edx
	movl	$1, %edi
	jmp	.L11
.L26:
	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	"%ld\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	$440, %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), %ecx
	testl	%ecx, %ecx
	jle	.L17
	leaq	20(%rsp), %r12
	movl	$1, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jge	.L3
	testl	%ecx, %ecx
	jle	.L17
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	pxor	%xmm4, %xmm4
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	36(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%r12), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %r12
	pcmpgtd	%xmm1, %xmm2
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm1
	paddq	%xmm3, %xmm0
	paddq	%xmm1, %xmm0
	cmpq	%rax, %r12
	jne	.L5
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddq	%xmm1, %xmm0
	leal	1(%rsi), %edx
	movq	%xmm0, %rax
	cmpl	%esi, %ecx
	je	.L2
.L4:
	movslq	%edx, %rsi
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	leal	1(%rdx), %esi
	cmpl	%esi, %ecx
	jl	.L2
	movslq	%esi, %rsi
	addl	$2, %edx
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	cmpl	%edx, %ecx
	jl	.L2
	movslq	%edx, %rdx
	movslq	16(%rsp,%rdx,4), %rdx
	addq	%rdx, %rax
.L2:
	movslq	%ecx, %rsi
	cqto
	idivq	%rsi
	movl	%ecx, %esi
	shrl	$31, %esi
	addl	%ecx, %esi
	sarl	%esi
	movslq	%esi, %rsi
	leal	1(%rax), %edi
	cmpq	%rsi, %rdx
	cmovg	%edi, %eax
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L20
	movd	%eax, %xmm6
	leaq	20(%rsp), %rdx
	pxor	%xmm2, %xmm2
	movl	%ecx, %esi
	shrl	$2, %esi
	pshufd	$0, %xmm6, %xmm5
	pxor	%xmm4, %xmm4
	subl	$1, %esi
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L12:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	psubd	%xmm5, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	movdqa	%xmm4, %xmm0
	pcmpgtd	%xmm1, %xmm0
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm0, %xmm3
	punpckhdq	%xmm0, %xmm1
	paddq	%xmm3, %xmm2
	paddq	%xmm1, %xmm2
	cmpq	%rdx, %rsi
	jne	.L12
	movdqa	%xmm2, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm2
	leal	1(%rsi), %edi
	movq	%xmm2, %rdx
	cmpl	%ecx, %esi
	je	.L10
.L11:
	movslq	%edi, %rsi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jl	.L10
	movslq	%esi, %rsi
	addl	$2, %edi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	cmpl	%edi, %ecx
	jl	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ecx
	subl	%eax, %ecx
	imull	%ecx, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
.L10:
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$440, %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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L2
.L19:
	xorl	%edx, %edx
	jmp	.L10
.L18:
	xorl	%eax, %eax
	movl	$1, %edx
	jmp	.L4
.L20:
	xorl	%edx, %edx
	movl	$1, %edi
	jmp	.L11
.L26:
	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	"%ld\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	$440, %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), %ecx
	testl	%ecx, %ecx
	jle	.L17
	leaq	20(%rsp), %r12
	movl	$1, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jge	.L3
	testl	%ecx, %ecx
	jle	.L17
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	pxor	%xmm4, %xmm4
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	36(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%r12), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %r12
	pcmpgtd	%xmm1, %xmm2
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm1
	paddq	%xmm3, %xmm0
	paddq	%xmm1, %xmm0
	cmpq	%rax, %r12
	jne	.L5
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddq	%xmm1, %xmm0
	leal	1(%rsi), %edx
	movq	%xmm0, %rax
	cmpl	%esi, %ecx
	je	.L2
.L4:
	movslq	%edx, %rsi
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	leal	1(%rdx), %esi
	cmpl	%esi, %ecx
	jl	.L2
	movslq	%esi, %rsi
	addl	$2, %edx
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	cmpl	%edx, %ecx
	jl	.L2
	movslq	%edx, %rdx
	movslq	16(%rsp,%rdx,4), %rdx
	addq	%rdx, %rax
.L2:
	movslq	%ecx, %rsi
	cqto
	idivq	%rsi
	movl	%ecx, %esi
	shrl	$31, %esi
	addl	%ecx, %esi
	sarl	%esi
	movslq	%esi, %rsi
	leal	1(%rax), %edi
	cmpq	%rsi, %rdx
	cmovg	%edi, %eax
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L20
	movd	%eax, %xmm6
	leaq	20(%rsp), %rdx
	pxor	%xmm2, %xmm2
	movl	%ecx, %esi
	shrl	$2, %esi
	pshufd	$0, %xmm6, %xmm5
	pxor	%xmm4, %xmm4
	subl	$1, %esi
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L12:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	psubd	%xmm5, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	movdqa	%xmm4, %xmm0
	pcmpgtd	%xmm1, %xmm0
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm0, %xmm3
	punpckhdq	%xmm0, %xmm1
	paddq	%xmm3, %xmm2
	paddq	%xmm1, %xmm2
	cmpq	%rdx, %rsi
	jne	.L12
	movdqa	%xmm2, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm2
	leal	1(%rsi), %edi
	movq	%xmm2, %rdx
	cmpl	%ecx, %esi
	je	.L10
.L11:
	movslq	%edi, %rsi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jl	.L10
	movslq	%esi, %rsi
	addl	$2, %edi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	cmpl	%edi, %ecx
	jl	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ecx
	subl	%eax, %ecx
	imull	%ecx, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
.L10:
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$440, %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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L2
.L19:
	xorl	%edx, %edx
	jmp	.L10
.L18:
	xorl	%eax, %eax
	movl	$1, %edx
	jmp	.L4
.L20:
	xorl	%edx, %edx
	movl	$1, %edi
	jmp	.L11
.L26:
	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 i, N, P, X[101];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(X[i]));
	
	long sum = 0;
	for (i = 1; i <= N; i++) sum += X[i];
	if (sum % N <= N/2) P = sum / N;
	else P = sum / N + 1;
	
	sum = 0;
	for (i = 1; i <= N; i++) sum += (X[i] - P) * (X[i] - P);
	printf("%ld\n", sum);
	fflush(stdout);
	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 i, N, P, X[101];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(X[i]));
	
	long sum = 0;
	for (i = 1; i <= N; i++) sum += X[i];
	if (sum % N <= N/2) P = sum / N;
	else P = sum / N + 1;
	
	sum = 0;
	for (i = 1; i <= N; i++) sum += (X[i] - P) * (X[i] - P);
	printf("%ld\n", sum);
	fflush(stdout);
	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
14 14 3 13 56 2 37
 2
0 4
 7
14 14 3 13 56 2 0
 2
0 1
 7
14 14 3 12 56 2 0
 7
19 14 3 12 56 2 0
 7
19 14 3 24 56 2 0
 7
11 14 3 24 56 2 0
 7
11 14 3 24 56 1 0
 7
11 14 3 33 56 1 0

2319
 8
 2225
 1
 2229
 2245
 2293
 2314
 2343
 2563

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 i, N, P, X[101];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(X[i]));
	
	long sum = 0;
	for (i = 1; i <= N; i++) sum += X[i];
	if (sum % N <= N/2) P = sum / N;
	else P = sum / N + 1;
	
	sum = 0;
	for (i = 1; i <= N; i++) sum += (X[i] - P) * (X[i] - P);
	printf("%ld\n", sum);
	fflush(stdout);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\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	$440, %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), %ecx
	testl	%ecx, %ecx
	jle	.L17
	leaq	20(%rsp), %r12
	movl	$1, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jge	.L3
	testl	%ecx, %ecx
	jle	.L17
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	pxor	%xmm4, %xmm4
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	36(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%r12), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %r12
	pcmpgtd	%xmm1, %xmm2
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm1
	paddq	%xmm3, %xmm0
	paddq	%xmm1, %xmm0
	cmpq	%rax, %r12
	jne	.L5
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddq	%xmm1, %xmm0
	leal	1(%rsi), %edx
	movq	%xmm0, %rax
	cmpl	%esi, %ecx
	je	.L2
.L4:
	movslq	%edx, %rsi
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	leal	1(%rdx), %esi
	cmpl	%esi, %ecx
	jl	.L2
	movslq	%esi, %rsi
	addl	$2, %edx
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	cmpl	%edx, %ecx
	jl	.L2
	movslq	%edx, %rdx
	movslq	16(%rsp,%rdx,4), %rdx
	addq	%rdx, %rax
.L2:
	movslq	%ecx, %rsi
	cqto
	idivq	%rsi
	movl	%ecx, %esi
	shrl	$31, %esi
	addl	%ecx, %esi
	sarl	%esi
	movslq	%esi, %rsi
	leal	1(%rax), %edi
	cmpq	%rsi, %rdx
	cmovg	%edi, %eax
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L20
	movd	%eax, %xmm6
	leaq	20(%rsp), %rdx
	pxor	%xmm2, %xmm2
	movl	%ecx, %esi
	shrl	$2, %esi
	pshufd	$0, %xmm6, %xmm5
	pxor	%xmm4, %xmm4
	subl	$1, %esi
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L12:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	psubd	%xmm5, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	movdqa	%xmm4, %xmm0
	pcmpgtd	%xmm1, %xmm0
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm0, %xmm3
	punpckhdq	%xmm0, %xmm1
	paddq	%xmm3, %xmm2
	paddq	%xmm1, %xmm2
	cmpq	%rdx, %rsi
	jne	.L12
	movdqa	%xmm2, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm2
	leal	1(%rsi), %edi
	movq	%xmm2, %rdx
	cmpl	%ecx, %esi
	je	.L10
.L11:
	movslq	%edi, %rsi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jl	.L10
	movslq	%esi, %rsi
	addl	$2, %edi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	cmpl	%edi, %ecx
	jl	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ecx
	subl	%eax, %ecx
	imull	%ecx, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
.L10:
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$440, %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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L2
.L19:
	xorl	%edx, %edx
	jmp	.L10
.L18:
	xorl	%eax, %eax
	movl	$1, %edx
	jmp	.L4
.L20:
	xorl	%edx, %edx
	movl	$1, %edi
	jmp	.L11
.L26:
	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	"%ld\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	$440, %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), %ecx
	testl	%ecx, %ecx
	jle	.L17
	leaq	20(%rsp), %r12
	movl	$1, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jge	.L3
	testl	%ecx, %ecx
	jle	.L17
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%ecx, %eax
	pxor	%xmm0, %xmm0
	pxor	%xmm4, %xmm4
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	36(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%r12), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %r12
	pcmpgtd	%xmm1, %xmm2
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm1
	paddq	%xmm3, %xmm0
	paddq	%xmm1, %xmm0
	cmpq	%rax, %r12
	jne	.L5
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddq	%xmm1, %xmm0
	leal	1(%rsi), %edx
	movq	%xmm0, %rax
	cmpl	%esi, %ecx
	je	.L2
.L4:
	movslq	%edx, %rsi
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	leal	1(%rdx), %esi
	cmpl	%esi, %ecx
	jl	.L2
	movslq	%esi, %rsi
	addl	$2, %edx
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rax
	cmpl	%edx, %ecx
	jl	.L2
	movslq	%edx, %rdx
	movslq	16(%rsp,%rdx,4), %rdx
	addq	%rdx, %rax
.L2:
	movslq	%ecx, %rsi
	cqto
	idivq	%rsi
	movl	%ecx, %esi
	shrl	$31, %esi
	addl	%ecx, %esi
	sarl	%esi
	movslq	%esi, %rsi
	leal	1(%rax), %edi
	cmpq	%rsi, %rdx
	cmovg	%edi, %eax
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L20
	movd	%eax, %xmm6
	leaq	20(%rsp), %rdx
	pxor	%xmm2, %xmm2
	movl	%ecx, %esi
	shrl	$2, %esi
	pshufd	$0, %xmm6, %xmm5
	pxor	%xmm4, %xmm4
	subl	$1, %esi
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L12:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	psubd	%xmm5, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	movdqa	%xmm4, %xmm0
	pcmpgtd	%xmm1, %xmm0
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm0, %xmm3
	punpckhdq	%xmm0, %xmm1
	paddq	%xmm3, %xmm2
	paddq	%xmm1, %xmm2
	cmpq	%rdx, %rsi
	jne	.L12
	movdqa	%xmm2, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm2
	leal	1(%rsi), %edi
	movq	%xmm2, %rdx
	cmpl	%ecx, %esi
	je	.L10
.L11:
	movslq	%edi, %rsi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jl	.L10
	movslq	%esi, %rsi
	addl	$2, %edi
	movl	16(%rsp,%rsi,4), %esi
	subl	%eax, %esi
	imull	%esi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
	cmpl	%edi, %ecx
	jl	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %ecx
	subl	%eax, %ecx
	imull	%ecx, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
.L10:
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$440, %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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L2
.L19:
	xorl	%edx, %edx
	jmp	.L10
.L18:
	xorl	%eax, %eax
	movl	$1, %edx
	jmp	.L4
.L20:
	xorl	%edx, %edx
	movl	$1, %edi
	jmp	.L11
.L26:
	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:
```