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 max, min;
  int read[1000];
  int n;
  int ans=1000000,tmp;
  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&read[i]);
    if(i == 0){
      max = read[0];
      min = read[0];
    }
    //printf("%d ",read[i]);
    if(read[i] > max){
      max = read[i];
    }else if(read[i] < min){
      min = read[i];
    }
  }
  //printf("max=%d,min=%d\n",max,min);

  for(i=min;i<=max;i++){
    for(j=0;j<n;j++){
      tmp += (read[j] - i)*(read[j] - i);
    }
    if(tmp<ans){
      ans = tmp;
    }
    tmp = 0;
  }
  printf("%d\n",ans);

  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	%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	$4032, %rsp
	.cfi_def_cfa_offset 4080
	movq	%fs:40, %rax
	movq	%rax, 4024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L22:
	movl	16(%rsp), %ebx
	movl	(%r12), %eax
	movl	%ebx, %r13d
.L4:
	cmpl	%eax, %ebx
	movl	12(%rsp), %edx
	cmovg	%eax, %ebx
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%ebp, %edx
	jle	.L2
.L6:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	testl	%ebp, %ebp
	je	.L22
	movl	(%r12), %eax
	cmpl	%r13d, %eax
	jle	.L4
	movl	12(%rsp), %edx
	addl	$1, %ebp
	movl	%eax, %r13d
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L6
.L2:
	cmpl	%ebx, %r13d
	jl	.L16
	movl	%edx, %eax
	movl	%edx, %r10d
	leal	1(%r13), %r9d
	movl	$1000000, %r8d
	shrl	$2, %eax
	leal	-1(%rdx), %r11d
	leaq	16(%rsp), %rbp
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L13
	cmpl	$2, %r11d
	jbe	.L17
	movd	%ebx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L10:
	movdqa	(%rax), %xmm0
	addq	$16, %rax
	psubd	%xmm3, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L10
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%r10d, %edx
	je	.L13
.L9:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	leal	1(%rcx), %edi
	cmpl	%edx, %edi
	jge	.L13
	movslq	%edi, %rdi
	addl	$2, %ecx
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %ecx
	subl	%ebx, %ecx
	imull	%ecx, %ecx
	addl	%ecx, %eax
.L13:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %ebx
	cmpl	%r9d, %ebx
	jne	.L8
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$4032, %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
.L17:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L9
.L16:
	movl	$1000000, %r8d
	jmp	.L7
.L23:
	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	%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	$4032, %rsp
	.cfi_def_cfa_offset 4080
	movq	%fs:40, %rax
	movq	%rax, 4024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L22:
	movl	16(%rsp), %ebx
	movl	(%r12), %eax
	movl	%ebx, %r13d
.L4:
	cmpl	%eax, %ebx
	movl	12(%rsp), %edx
	cmovg	%eax, %ebx
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%ebp, %edx
	jle	.L2
.L6:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	testl	%ebp, %ebp
	je	.L22
	movl	(%r12), %eax
	cmpl	%r13d, %eax
	jle	.L4
	movl	12(%rsp), %edx
	addl	$1, %ebp
	movl	%eax, %r13d
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L6
.L2:
	cmpl	%ebx, %r13d
	jl	.L16
	movl	%edx, %eax
	movl	%edx, %r10d
	leal	1(%r13), %r9d
	movl	$1000000, %r8d
	shrl	$2, %eax
	leal	-1(%rdx), %r11d
	leaq	16(%rsp), %rbp
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L13
	cmpl	$2, %r11d
	jbe	.L17
	movd	%ebx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L10:
	movdqa	(%rax), %xmm0
	addq	$16, %rax
	psubd	%xmm3, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L10
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%r10d, %edx
	je	.L13
.L9:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	leal	1(%rcx), %edi
	cmpl	%edx, %edi
	jge	.L13
	movslq	%edi, %rdi
	addl	$2, %ecx
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %ecx
	subl	%ebx, %ecx
	imull	%ecx, %ecx
	addl	%ecx, %eax
.L13:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %ebx
	cmpl	%r9d, %ebx
	jne	.L8
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$4032, %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
.L17:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L9
.L16:
	movl	$1000000, %r8d
	jmp	.L7
.L23:
	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	%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	$4032, %rsp
	.cfi_def_cfa_offset 4080
	movq	%fs:40, %rax
	movq	%rax, 4024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L22:
	movl	16(%rsp), %ebx
	movl	(%r12), %eax
	movl	%ebx, %r13d
.L4:
	cmpl	%eax, %ebx
	movl	12(%rsp), %edx
	cmovg	%eax, %ebx
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%ebp, %edx
	jle	.L2
.L6:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	testl	%ebp, %ebp
	je	.L22
	movl	(%r12), %eax
	cmpl	%r13d, %eax
	jle	.L4
	movl	12(%rsp), %edx
	addl	$1, %ebp
	movl	%eax, %r13d
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L6
.L2:
	cmpl	%ebx, %r13d
	jl	.L16
	movl	%edx, %eax
	movl	%edx, %r10d
	leal	1(%r13), %r9d
	movl	$1000000, %r8d
	shrl	$2, %eax
	leal	-1(%rdx), %r11d
	leaq	16(%rsp), %rbp
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L13
	cmpl	$2, %r11d
	jbe	.L17
	movd	%ebx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L10:
	movdqa	(%rax), %xmm0
	addq	$16, %rax
	psubd	%xmm3, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L10
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%r10d, %edx
	je	.L13
.L9:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	leal	1(%rcx), %edi
	cmpl	%edx, %edi
	jge	.L13
	movslq	%edi, %rdi
	addl	$2, %ecx
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %ecx
	subl	%ebx, %ecx
	imull	%ecx, %ecx
	addl	%ecx, %eax
.L13:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %ebx
	cmpl	%r9d, %ebx
	jne	.L8
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$4032, %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
.L17:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L9
.L16:
	movl	$1000000, %r8d
	jmp	.L7
.L23:
	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 max, min;
  int read[1000];
  int n;
  int ans=1000000,tmp;
  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&read[i]);
    if(i == 0){
      max = read[0];
      min = read[0];
    }
    //printf("%d ",read[i]);
    if(read[i] > max){
      max = read[i];
    }else if(read[i] < min){
      min = read[i];
    }
  }
  //printf("max=%d,min=%d\n",max,min);

  for(i=min;i<=max;i++){
    for(j=0;j<n;j++){
      tmp += (read[j] - i)*(read[j] - i);
    }
    if(tmp<ans){
      ans = tmp;
    }
    tmp = 0;
  }
  printf("%d\n",ans);

  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 max, min;
  int read[1000];
  int n;
  int ans=1000000,tmp;
  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&read[i]);
    if(i == 0){
      max = read[0];
      min = read[0];
    }
    //printf("%d ",read[i]);
    if(read[i] > max){
      max = read[i];
    }else if(read[i] < min){
      min = read[i];
    }
  }
  //printf("max=%d,min=%d\n",max,min);

  for(i=min;i<=max;i++){
    for(j=0;j<n;j++){
      tmp += (read[j] - i)*(read[j] - i);
    }
    if(tmp<ans){
      ans = tmp;
    }
    tmp = 0;
  }
  printf("%d\n",ans);

  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
5 8
 3
1 1 6
 3
4 3 5
 4
-100 -45 -100 -100
 2
5 11
 3
1 1 8
 3
3 3 5
 3
0 1 8
 3
3 0 5
 2
10 6

5
 17
 2
 2269
 18
 33
 3
 38
 13
 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>

int main(){
  int max, min;
  int read[1000];
  int n;
  int ans=1000000,tmp;
  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&read[i]);
    if(i == 0){
      max = read[0];
      min = read[0];
    }
    //printf("%d ",read[i]);
    if(read[i] > max){
      max = read[i];
    }else if(read[i] < min){
      min = read[i];
    }
  }
  //printf("max=%d,min=%d\n",max,min);

  for(i=min;i<=max;i++){
    for(j=0;j<n;j++){
      tmp += (read[j] - i)*(read[j] - i);
    }
    if(tmp<ans){
      ans = tmp;
    }
    tmp = 0;
  }
  printf("%d\n",ans);

  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	%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	$4032, %rsp
	.cfi_def_cfa_offset 4080
	movq	%fs:40, %rax
	movq	%rax, 4024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L22:
	movl	16(%rsp), %ebx
	movl	(%r12), %eax
	movl	%ebx, %r13d
.L4:
	cmpl	%eax, %ebx
	movl	12(%rsp), %edx
	cmovg	%eax, %ebx
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%ebp, %edx
	jle	.L2
.L6:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	testl	%ebp, %ebp
	je	.L22
	movl	(%r12), %eax
	cmpl	%r13d, %eax
	jle	.L4
	movl	12(%rsp), %edx
	addl	$1, %ebp
	movl	%eax, %r13d
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L6
.L2:
	cmpl	%ebx, %r13d
	jl	.L16
	movl	%edx, %eax
	movl	%edx, %r10d
	leal	1(%r13), %r9d
	movl	$1000000, %r8d
	shrl	$2, %eax
	leal	-1(%rdx), %r11d
	leaq	16(%rsp), %rbp
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L13
	cmpl	$2, %r11d
	jbe	.L17
	movd	%ebx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L10:
	movdqa	(%rax), %xmm0
	addq	$16, %rax
	psubd	%xmm3, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L10
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%r10d, %edx
	je	.L13
.L9:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	leal	1(%rcx), %edi
	cmpl	%edx, %edi
	jge	.L13
	movslq	%edi, %rdi
	addl	$2, %ecx
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %ecx
	subl	%ebx, %ecx
	imull	%ecx, %ecx
	addl	%ecx, %eax
.L13:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %ebx
	cmpl	%r9d, %ebx
	jne	.L8
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$4032, %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
.L17:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L9
.L16:
	movl	$1000000, %r8d
	jmp	.L7
.L23:
	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	%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	$4032, %rsp
	.cfi_def_cfa_offset 4080
	movq	%fs:40, %rax
	movq	%rax, 4024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L22:
	movl	16(%rsp), %ebx
	movl	(%r12), %eax
	movl	%ebx, %r13d
.L4:
	cmpl	%eax, %ebx
	movl	12(%rsp), %edx
	cmovg	%eax, %ebx
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%ebp, %edx
	jle	.L2
.L6:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	testl	%ebp, %ebp
	je	.L22
	movl	(%r12), %eax
	cmpl	%r13d, %eax
	jle	.L4
	movl	12(%rsp), %edx
	addl	$1, %ebp
	movl	%eax, %r13d
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L6
.L2:
	cmpl	%ebx, %r13d
	jl	.L16
	movl	%edx, %eax
	movl	%edx, %r10d
	leal	1(%r13), %r9d
	movl	$1000000, %r8d
	shrl	$2, %eax
	leal	-1(%rdx), %r11d
	leaq	16(%rsp), %rbp
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L13
	cmpl	$2, %r11d
	jbe	.L17
	movd	%ebx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L10:
	movdqa	(%rax), %xmm0
	addq	$16, %rax
	psubd	%xmm3, %xmm0
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L10
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%r10d, %edx
	je	.L13
.L9:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	leal	1(%rcx), %edi
	cmpl	%edx, %edi
	jge	.L13
	movslq	%edi, %rdi
	addl	$2, %ecx
	movl	16(%rsp,%rdi,4), %edi
	subl	%ebx, %edi
	imull	%edi, %edi
	addl	%edi, %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %ecx
	subl	%ebx, %ecx
	imull	%ecx, %ecx
	addl	%ecx, %eax
.L13:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %ebx
	cmpl	%r9d, %ebx
	jne	.L8
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	4024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$4032, %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
.L17:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L9
.L16:
	movl	$1000000, %r8d
	jmp	.L7
.L23:
	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:
```