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()
{
	int i, n, a[100001];
	scanf("%d", &n);
	for (i = 1; i <= n; i++) scanf("%d", &(a[i]));
	
	int max = 0;
	for (i = 1; i <= n; i++) if (a[i] > max) max = a[i];
	
	int ans = a[1] + 1, min = abs(a[1] * 2 - max) + 1;
	for (i = 1; i <= n; i++) {
		if (a[i] != max && abs(a[i] * 2 - max) < min) {
			min = abs(a[i] * 2 - max);
			ans = a[i];
		}
	}
	
	printf("%d %d\n", max, ans);
	fflush(stdout);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	20(%rsp), %rbx
	movl	$1, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jge	.L3
	testl	%eax, %eax
	jle	.L2
	leal	-1(%rax), %esi
	cmpl	$2, %esi
	jbe	.L11
	movl	%eax, %edx
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	36(%rsp,%rdx), %rcx
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rcx, %rdx
	jne	.L5
	movdqa	%xmm2, %xmm1
	movl	%eax, %edi
	psrldq	$8, %xmm1
	andl	$-4, %edi
	movdqa	%xmm1, %xmm0
	leal	1(%rdi), %ecx
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %eax
	je	.L6
.L4:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	leal	1(%rcx), %edi
	cmpl	%edi, %eax
	jl	.L6
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	addl	$2, %ecx
	cmpl	%ecx, %eax
	jl	.L6
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L6:
	movl	20(%rsp), %eax
	leaq	24(%rsp,%rsi,4), %r8
	leal	1(%rax), %r9d
	addl	%eax, %eax
	subl	%edx, %eax
	movl	%eax, %edi
	negl	%edi
	cmovs	%eax, %edi
	addl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx), %ecx
	cmpl	%edx, %ecx
	je	.L7
	leal	(%rcx,%rcx), %eax
	subl	%edx, %eax
	movl	%eax, %esi
	negl	%esi
	cmovns	%esi, %eax
	cmpl	%edi, %eax
	jge	.L7
	movl	%eax, %edi
	movl	%ecx, %r9d
.L7:
	addq	$4, %rbx
	cmpq	%rbx, %r8
	jne	.L8
.L9:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r9d, %ecx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$400040, %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
.L2:
	.cfi_restore_state
	movl	20(%rsp), %eax
	xorl	%edx, %edx
	leal	1(%rax), %r9d
	jmp	.L9
.L11:
	xorl	%edx, %edx
	movl	$1, %ecx
	jmp	.L4
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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 %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	20(%rsp), %rbx
	movl	$1, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jge	.L3
	testl	%eax, %eax
	jle	.L2
	leal	-1(%rax), %esi
	cmpl	$2, %esi
	jbe	.L11
	movl	%eax, %edx
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	36(%rsp,%rdx), %rcx
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rcx, %rdx
	jne	.L5
	movdqa	%xmm2, %xmm1
	movl	%eax, %edi
	psrldq	$8, %xmm1
	andl	$-4, %edi
	movdqa	%xmm1, %xmm0
	leal	1(%rdi), %ecx
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %eax
	je	.L6
.L4:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	leal	1(%rcx), %edi
	cmpl	%edi, %eax
	jl	.L6
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	addl	$2, %ecx
	cmpl	%ecx, %eax
	jl	.L6
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L6:
	movl	20(%rsp), %eax
	leaq	24(%rsp,%rsi,4), %r8
	leal	1(%rax), %r9d
	addl	%eax, %eax
	subl	%edx, %eax
	movl	%eax, %edi
	negl	%edi
	cmovs	%eax, %edi
	addl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx), %ecx
	cmpl	%edx, %ecx
	je	.L7
	leal	(%rcx,%rcx), %eax
	subl	%edx, %eax
	movl	%eax, %esi
	negl	%esi
	cmovns	%esi, %eax
	cmpl	%edi, %eax
	jge	.L7
	movl	%eax, %edi
	movl	%ecx, %r9d
.L7:
	addq	$4, %rbx
	cmpq	%rbx, %r8
	jne	.L8
.L9:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r9d, %ecx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$400040, %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
.L2:
	.cfi_restore_state
	movl	20(%rsp), %eax
	xorl	%edx, %edx
	leal	1(%rax), %r9d
	jmp	.L9
.L11:
	xorl	%edx, %edx
	movl	$1, %ecx
	jmp	.L4
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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 %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	20(%rsp), %rbx
	movl	$1, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jge	.L3
	testl	%eax, %eax
	jle	.L2
	leal	-1(%rax), %esi
	cmpl	$2, %esi
	jbe	.L11
	movl	%eax, %edx
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	36(%rsp,%rdx), %rcx
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rcx, %rdx
	jne	.L5
	movdqa	%xmm2, %xmm1
	movl	%eax, %edi
	psrldq	$8, %xmm1
	andl	$-4, %edi
	movdqa	%xmm1, %xmm0
	leal	1(%rdi), %ecx
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %eax
	je	.L6
.L4:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	leal	1(%rcx), %edi
	cmpl	%edi, %eax
	jl	.L6
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	addl	$2, %ecx
	cmpl	%ecx, %eax
	jl	.L6
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L6:
	movl	20(%rsp), %eax
	leaq	24(%rsp,%rsi,4), %r8
	leal	1(%rax), %r9d
	addl	%eax, %eax
	subl	%edx, %eax
	movl	%eax, %edi
	negl	%edi
	cmovs	%eax, %edi
	addl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx), %ecx
	cmpl	%edx, %ecx
	je	.L7
	leal	(%rcx,%rcx), %eax
	subl	%edx, %eax
	movl	%eax, %esi
	negl	%esi
	cmovns	%esi, %eax
	cmpl	%edi, %eax
	jge	.L7
	movl	%eax, %edi
	movl	%ecx, %r9d
.L7:
	addq	$4, %rbx
	cmpq	%rbx, %r8
	jne	.L8
.L9:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r9d, %ecx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$400040, %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
.L2:
	.cfi_restore_state
	movl	20(%rsp), %eax
	xorl	%edx, %edx
	leal	1(%rax), %r9d
	jmp	.L9
.L11:
	xorl	%edx, %edx
	movl	$1, %ecx
	jmp	.L4
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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>
#include <stdlib.h>

int main()
{
	int i, n, a[100001];
	scanf("%d", &n);
	for (i = 1; i <= n; i++) scanf("%d", &(a[i]));
	
	int max = 0;
	for (i = 1; i <= n; i++) if (a[i] > max) max = a[i];
	
	int ans = a[1] + 1, min = abs(a[1] * 2 - max) + 1;
	for (i = 1; i <= n; i++) {
		if (a[i] != max && abs(a[i] * 2 - max) < min) {
			min = abs(a[i] * 2 - max);
			ans = a[i];
		}
	}
	
	printf("%d %d\n", max, ans);
	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>
#include <stdlib.h>

int main()
{
	int i, n, a[100001];
	scanf("%d", &n);
	for (i = 1; i <= n; i++) scanf("%d", &(a[i]));
	
	int max = 0;
	for (i = 1; i <= n; i++) if (a[i] > max) max = a[i];
	
	int ans = a[1] + 1, min = abs(a[1] * 2 - max) + 1;
	for (i = 1; i <= n; i++) {
		if (a[i] != max && abs(a[i] * 2 - max) < min) {
			min = abs(a[i] * 2 - max);
			ans = a[i];
		}
	}
	
	printf("%d %d\n", max, ans);
	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:

5
6 9 1 2 11
 5
6 9 1 2 20
 5
3 9 4 2 11
 2
010 0
 5
6 9 1 2 16
 5
10 9 1 4 20
 2
001 0
 5
6 9 1 2 0
 5
3 9 4 0 9
 2
101 0

11 6
 20 9
 11 4
 10 0
 16 9
 20 10
 1 0
 9 6
 9 4
 101 0

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()
{
	int i, n, a[100001];
	scanf("%d", &n);
	for (i = 1; i <= n; i++) scanf("%d", &(a[i]));
	
	int max = 0;
	for (i = 1; i <= n; i++) if (a[i] > max) max = a[i];
	
	int ans = a[1] + 1, min = abs(a[1] * 2 - max) + 1;
	for (i = 1; i <= n; i++) {
		if (a[i] != max && abs(a[i] * 2 - max) < min) {
			min = abs(a[i] * 2 - max);
			ans = a[i];
		}
	}
	
	printf("%d %d\n", max, ans);
	fflush(stdout);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	20(%rsp), %rbx
	movl	$1, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jge	.L3
	testl	%eax, %eax
	jle	.L2
	leal	-1(%rax), %esi
	cmpl	$2, %esi
	jbe	.L11
	movl	%eax, %edx
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	36(%rsp,%rdx), %rcx
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rcx, %rdx
	jne	.L5
	movdqa	%xmm2, %xmm1
	movl	%eax, %edi
	psrldq	$8, %xmm1
	andl	$-4, %edi
	movdqa	%xmm1, %xmm0
	leal	1(%rdi), %ecx
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %eax
	je	.L6
.L4:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	leal	1(%rcx), %edi
	cmpl	%edi, %eax
	jl	.L6
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	addl	$2, %ecx
	cmpl	%ecx, %eax
	jl	.L6
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L6:
	movl	20(%rsp), %eax
	leaq	24(%rsp,%rsi,4), %r8
	leal	1(%rax), %r9d
	addl	%eax, %eax
	subl	%edx, %eax
	movl	%eax, %edi
	negl	%edi
	cmovs	%eax, %edi
	addl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx), %ecx
	cmpl	%edx, %ecx
	je	.L7
	leal	(%rcx,%rcx), %eax
	subl	%edx, %eax
	movl	%eax, %esi
	negl	%esi
	cmovns	%esi, %eax
	cmpl	%edi, %eax
	jge	.L7
	movl	%eax, %edi
	movl	%ecx, %r9d
.L7:
	addq	$4, %rbx
	cmpq	%rbx, %r8
	jne	.L8
.L9:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r9d, %ecx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$400040, %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
.L2:
	.cfi_restore_state
	movl	20(%rsp), %eax
	xorl	%edx, %edx
	leal	1(%rax), %r9d
	jmp	.L9
.L11:
	xorl	%edx, %edx
	movl	$1, %ecx
	jmp	.L4
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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 %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	20(%rsp), %rbx
	movl	$1, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jge	.L3
	testl	%eax, %eax
	jle	.L2
	leal	-1(%rax), %esi
	cmpl	$2, %esi
	jbe	.L11
	movl	%eax, %edx
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	36(%rsp,%rdx), %rcx
	movq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rdx), %xmm0
	addq	$16, %rdx
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rcx, %rdx
	jne	.L5
	movdqa	%xmm2, %xmm1
	movl	%eax, %edi
	psrldq	$8, %xmm1
	andl	$-4, %edi
	movdqa	%xmm1, %xmm0
	leal	1(%rdi), %ecx
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %eax
	je	.L6
.L4:
	movslq	%ecx, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	leal	1(%rcx), %edi
	cmpl	%edi, %eax
	jl	.L6
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	addl	$2, %ecx
	cmpl	%ecx, %eax
	jl	.L6
	movslq	%ecx, %rcx
	movl	16(%rsp,%rcx,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L6:
	movl	20(%rsp), %eax
	leaq	24(%rsp,%rsi,4), %r8
	leal	1(%rax), %r9d
	addl	%eax, %eax
	subl	%edx, %eax
	movl	%eax, %edi
	negl	%edi
	cmovs	%eax, %edi
	addl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx), %ecx
	cmpl	%edx, %ecx
	je	.L7
	leal	(%rcx,%rcx), %eax
	subl	%edx, %eax
	movl	%eax, %esi
	negl	%esi
	cmovns	%esi, %eax
	cmpl	%edi, %eax
	jge	.L7
	movl	%eax, %edi
	movl	%ecx, %r9d
.L7:
	addq	$4, %rbx
	cmpq	%rbx, %r8
	jne	.L8
.L9:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r9d, %ecx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$400040, %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
.L2:
	.cfi_restore_state
	movl	20(%rsp), %eax
	xorl	%edx, %edx
	leal	1(%rax), %r9d
	jmp	.L9
.L11:
	xorl	%edx, %edx
	movl	$1, %ecx
	jmp	.L4
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:
```