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,cnt,min,min2;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  min = a[0];
  min2 = a[1];
  for(int i = 1;i<n;i++){
     if(min > a[i]){
       min2 = min;
       min = a[i];
     } 
    if(min < a[i] && min2 > a[i]){
      min2 = a[i];
    }
  }

  while(min2 > 0){
    cnt = 0;
    for(int i = 0;i < n;i++){
      if(a[i]%min2 != 0){
        cnt++;
      }
    }
    if(cnt <= 1){
      printf("%d\n",min2);
      min2 = 0;
    }
    min2 --;
  }
}
```

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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %r9
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L34:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L34
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L35
.L4:
	leaq	3(%rsp), %rbx
	movq	%rbx, %r14
	andq	$-4, %rbx
	shrq	$2, %r14
	testl	%r9d, %r9d
	jle	.L5
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r9d
	addq	$4, %r15
	cmpl	%r12d, %r9d
	jg	.L6
	movl	0(,%r14,4), %ecx
	movl	4(,%r14,4), %r8d
	cmpl	$1, %r9d
	jle	.L10
	leal	-2(%r9), %edx
	leaq	4(%rbx), %rax
	leaq	8(%rbx,%rdx,4), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L36:
	jge	.L8
	cmpl	%edx, %r8d
	cmovg	%edx, %r8d
.L8:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L9:
	movl	(%rax), %edx
	cmpl	%edx, %ecx
	jle	.L36
	addq	$4, %rax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	cmpq	%rsi, %rax
	jne	.L9
.L10:
	testl	%r8d, %r8d
	jle	.L11
	leal	-1(%r9), %eax
	leaq	4(%rbx,%rax,4), %rdi
	testl	%r9d, %r9d
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rbx, %rcx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rcx), %eax
	cltd
	idivl	%r8d
	cmpl	$1, %edx
	sbbl	$-1, %esi
	addq	$4, %rcx
	cmpq	%rdi, %rcx
	jne	.L14
	cmpl	$1, %esi
	jle	.L16
	subl	$1, %r8d
	je	.L11
	testl	%r9d, %r9d
	jg	.L19
.L16:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L37
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L35:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movl	4(,%r14,4), %r8d
	jmp	.L10
.L37:
	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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %r9
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L34:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L34
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L35
.L4:
	leaq	3(%rsp), %rbx
	movq	%rbx, %r14
	andq	$-4, %rbx
	shrq	$2, %r14
	testl	%r9d, %r9d
	jle	.L5
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r9d
	addq	$4, %r15
	cmpl	%r12d, %r9d
	jg	.L6
	movl	0(,%r14,4), %ecx
	movl	4(,%r14,4), %r8d
	cmpl	$1, %r9d
	jle	.L10
	leal	-2(%r9), %edx
	leaq	4(%rbx), %rax
	leaq	8(%rbx,%rdx,4), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L36:
	jge	.L8
	cmpl	%edx, %r8d
	cmovg	%edx, %r8d
.L8:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L9:
	movl	(%rax), %edx
	cmpl	%edx, %ecx
	jle	.L36
	addq	$4, %rax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	cmpq	%rsi, %rax
	jne	.L9
.L10:
	testl	%r8d, %r8d
	jle	.L11
	leal	-1(%r9), %eax
	leaq	4(%rbx,%rax,4), %rdi
	testl	%r9d, %r9d
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rbx, %rcx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rcx), %eax
	cltd
	idivl	%r8d
	cmpl	$1, %edx
	sbbl	$-1, %esi
	addq	$4, %rcx
	cmpq	%rdi, %rcx
	jne	.L14
	cmpl	$1, %esi
	jle	.L16
	subl	$1, %r8d
	je	.L11
	testl	%r9d, %r9d
	jg	.L19
.L16:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L37
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L35:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movl	4(,%r14,4), %r8d
	jmp	.L10
.L37:
	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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %r9
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L34:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L34
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L35
.L4:
	leaq	3(%rsp), %rbx
	movq	%rbx, %r14
	andq	$-4, %rbx
	shrq	$2, %r14
	testl	%r9d, %r9d
	jle	.L5
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r9d
	addq	$4, %r15
	cmpl	%r12d, %r9d
	jg	.L6
	movl	0(,%r14,4), %ecx
	movl	4(,%r14,4), %r8d
	cmpl	$1, %r9d
	jle	.L10
	leal	-2(%r9), %edx
	leaq	4(%rbx), %rax
	leaq	8(%rbx,%rdx,4), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L36:
	jge	.L8
	cmpl	%edx, %r8d
	cmovg	%edx, %r8d
.L8:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L9:
	movl	(%rax), %edx
	cmpl	%edx, %ecx
	jle	.L36
	addq	$4, %rax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	cmpq	%rsi, %rax
	jne	.L9
.L10:
	testl	%r8d, %r8d
	jle	.L11
	leal	-1(%r9), %eax
	leaq	4(%rbx,%rax,4), %rdi
	testl	%r9d, %r9d
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rbx, %rcx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rcx), %eax
	cltd
	idivl	%r8d
	cmpl	$1, %edx
	sbbl	$-1, %esi
	addq	$4, %rcx
	cmpq	%rdi, %rcx
	jne	.L14
	cmpl	$1, %esi
	jle	.L16
	subl	$1, %r8d
	je	.L11
	testl	%r9d, %r9d
	jg	.L19
.L16:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L37
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L35:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movl	4(,%r14,4), %r8d
	jmp	.L10
.L37:
	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,cnt,min,min2;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  min = a[0];
  min2 = a[1];
  for(int i = 1;i<n;i++){
     if(min > a[i]){
       min2 = min;
       min = a[i];
     } 
    if(min < a[i] && min2 > a[i]){
      min2 = a[i];
    }
  }

  while(min2 > 0){
    cnt = 0;
    for(int i = 0;i < n;i++){
      if(a[i]%min2 != 0){
        cnt++;
      }
    }
    if(cnt <= 1){
      printf("%d\n",min2);
      min2 = 0;
    }
    min2 --;
  }
}
```
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,cnt,min,min2;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  min = a[0];
  min2 = a[1];
  for(int i = 1;i<n;i++){
     if(min > a[i]){
       min2 = min;
       min = a[i];
     } 
    if(min < a[i] && min2 > a[i]){
      min2 = a[i];
    }
  }

  while(min2 > 0){
    cnt = 0;
    for(int i = 0;i < n;i++){
      if(a[i]%min2 != 0){
        cnt++;
      }
    }
    if(cnt <= 1){
      printf("%d\n",min2);
      min2 = 0;
    }
    min2 --;
  }
}
```

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:

3
7 6 7
 2
1000010000 1000000000
 3
12 29 18
 2
1000000000 1000001000
 3
4 8 7
 2
1001000000 1000001000
 3
9 28 18
 3
9 28 30
 2
1001100000 1000001100
 2
1101000000 1000001100

7
 1000010000
 6
 1000001000
 4
 1001000000
 9
 3
 1001100000
 1101000000

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,cnt,min,min2;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&a[i]);
  }
  min = a[0];
  min2 = a[1];
  for(int i = 1;i<n;i++){
     if(min > a[i]){
       min2 = min;
       min = a[i];
     } 
    if(min < a[i] && min2 > a[i]){
      min2 = a[i];
    }
  }

  while(min2 > 0){
    cnt = 0;
    for(int i = 0;i < n;i++){
      if(a[i]%min2 != 0){
        cnt++;
      }
    }
    if(cnt <= 1){
      printf("%d\n",min2);
      min2 = 0;
    }
    min2 --;
  }
}
```

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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %r9
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L34:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L34
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L35
.L4:
	leaq	3(%rsp), %rbx
	movq	%rbx, %r14
	andq	$-4, %rbx
	shrq	$2, %r14
	testl	%r9d, %r9d
	jle	.L5
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r9d
	addq	$4, %r15
	cmpl	%r12d, %r9d
	jg	.L6
	movl	0(,%r14,4), %ecx
	movl	4(,%r14,4), %r8d
	cmpl	$1, %r9d
	jle	.L10
	leal	-2(%r9), %edx
	leaq	4(%rbx), %rax
	leaq	8(%rbx,%rdx,4), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L36:
	jge	.L8
	cmpl	%edx, %r8d
	cmovg	%edx, %r8d
.L8:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L9:
	movl	(%rax), %edx
	cmpl	%edx, %ecx
	jle	.L36
	addq	$4, %rax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	cmpq	%rsi, %rax
	jne	.L9
.L10:
	testl	%r8d, %r8d
	jle	.L11
	leal	-1(%r9), %eax
	leaq	4(%rbx,%rax,4), %rdi
	testl	%r9d, %r9d
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rbx, %rcx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rcx), %eax
	cltd
	idivl	%r8d
	cmpl	$1, %edx
	sbbl	$-1, %esi
	addq	$4, %rcx
	cmpq	%rdi, %rcx
	jne	.L14
	cmpl	$1, %esi
	jle	.L16
	subl	$1, %r8d
	je	.L11
	testl	%r9d, %r9d
	jg	.L19
.L16:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L37
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L35:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movl	4(,%r14,4), %r8d
	jmp	.L10
.L37:
	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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %r9
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L34:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L34
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L35
.L4:
	leaq	3(%rsp), %rbx
	movq	%rbx, %r14
	andq	$-4, %rbx
	shrq	$2, %r14
	testl	%r9d, %r9d
	jle	.L5
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r9d
	addq	$4, %r15
	cmpl	%r12d, %r9d
	jg	.L6
	movl	0(,%r14,4), %ecx
	movl	4(,%r14,4), %r8d
	cmpl	$1, %r9d
	jle	.L10
	leal	-2(%r9), %edx
	leaq	4(%rbx), %rax
	leaq	8(%rbx,%rdx,4), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L36:
	jge	.L8
	cmpl	%edx, %r8d
	cmovg	%edx, %r8d
.L8:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L9:
	movl	(%rax), %edx
	cmpl	%edx, %ecx
	jle	.L36
	addq	$4, %rax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	cmpq	%rsi, %rax
	jne	.L9
.L10:
	testl	%r8d, %r8d
	jle	.L11
	leal	-1(%r9), %eax
	leaq	4(%rbx,%rax,4), %rdi
	testl	%r9d, %r9d
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rbx, %rcx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rcx), %eax
	cltd
	idivl	%r8d
	cmpl	$1, %edx
	sbbl	$-1, %esi
	addq	$4, %rcx
	cmpq	%rdi, %rcx
	jne	.L14
	cmpl	$1, %esi
	jle	.L16
	subl	$1, %r8d
	je	.L11
	testl	%r9d, %r9d
	jg	.L19
.L16:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L37
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L35:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movl	4(,%r14,4), %r8d
	jmp	.L10
.L37:
	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:
```