Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint_fast32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }

int dif(const int a, const int b){return a>b?a-b:b-a;}

int a[100000];
int main(int argc, char *argv[], char *envp[]){
	int n=nextpint();
	int max=0, maxi;
	for(int i=0; i<n; i++){
		int A=nextpint();
		a[i]=A;
		if(A>max){
			max=A;
			maxi=i;
		}
	}
	int min=INT_MAX, ans;
	for(int i=0; i<n; i++){
		if(i!=maxi){
			int now=dif(a[i]*2, max);
			if(now<min){min=now; ans=a[i];}
		}
	}
	printf("%d %d\n", max, ans);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	comp
	.type	comp, @function
comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp, .-comp
	.globl	compw
	.type	compw, @function
compw:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	setg	%al
	movzbl	%al, %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	setl	%al
	movzbl	%al, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	compw, .-compw
	.globl	nextpint
	.type	nextpint, @function
nextpint:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	call	getchar@PLT
	movb	%al, -9(%rbp)
	jmp	.L6
.L7:
	call	getchar@PLT
	movb	%al, -9(%rbp)
.L6:
	cmpb	$47, -9(%rbp)
	jle	.L7
	cmpb	$57, -9(%rbp)
	jg	.L7
	movq	$0, -8(%rbp)
	jmp	.L8
.L10:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-9(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar@PLT
	movb	%al, -9(%rbp)
.L8:
	cmpb	$47, -9(%rbp)
	jle	.L9
	cmpb	$57, -9(%rbp)
	jle	.L10
.L9:
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	nextpint, .-nextpint
	.globl	dif
	.type	dif, @function
dif:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L13
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	jmp	.L15
.L13:
	movl	-8(%rbp), %eax
	subl	-4(%rbp), %eax
.L15:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	dif, .-dif
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.section	.rodata
.LC0:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	call	nextpint
	movl	%eax, -12(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L17
.L19:
	call	nextpint
	movl	%eax, -4(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jle	.L18
	movl	-4(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
.L18:
	addl	$1, -28(%rbp)
.L17:
	movl	-28(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L19
	movl	$2147483647, -24(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L20
.L22:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	je	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	dif
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L21
	movl	-8(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
.L21:
	addl	$1, -16(%rbp)
.L20:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L22
	movl	-20(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	comp
	.type	comp, @function
comp:
.LFB63:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE63:
	.size	comp, .-comp
	.p2align 4
	.globl	compw
	.type	compw, @function
compw:
.LFB64:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	setg	%al
	setl	%dl
	movzbl	%dl, %edx
	movzbl	%al, %eax
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE64:
	.size	compw, .-compw
	.p2align 4
	.globl	nextpint
	.type	nextpint, @function
nextpint:
.LFB65:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	.p2align 4,,10
	.p2align 3
.L14:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L14
	movsbq	%al, %rdx
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdi
	leaq	(%rbx,%rbx,4), %rax
	leaq	-48(%rdx,%rax,2), %rbx
	call	getc@PLT
	movsbq	%al, %rdx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L8
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE65:
	.size	nextpint, .-nextpint
	.p2align 4
	.globl	dif
	.type	dif, @function
dif:
.LFB66:
	.cfi_startproc
	endbr64
	movl	%edi, %edx
	movl	%esi, %eax
	subl	%esi, %edx
	subl	%edi, %eax
	cmpl	%esi, %edi
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE66:
	.size	dif, .-dif
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB67:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	nextpint
	testl	%eax, %eax
	jle	.L30
	movl	%eax, %ebp
	xorl	%ebx, %ebx
	leaq	a(%rip), %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L25:
	movl	%ebx, %r15d
	.p2align 4,,10
	.p2align 3
.L38:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L38
	movsbq	%al, %rdx
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L23:
	movq	stdin(%rip), %rdi
	leaq	(%r14,%r14,4), %rax
	leaq	-48(%rdx,%rax,2), %r14
	call	getc@PLT
	movsbq	%al, %rdx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L23
	movl	%r14d, 0(%r13,%rbx,4)
	cmpl	%r12d, %r14d
	jle	.L24
	movl	%r15d, 8(%rsp)
	movl	%r14d, %r12d
.L24:
	addq	$1, %rbx
	cmpq	%rbx, %rbp
	jne	.L25
	xorl	%eax, %eax
	movl	$2147483647, %r8d
	.p2align 4,,10
	.p2align 3
.L29:
	cmpl	%eax, 8(%rsp)
	je	.L26
	movl	0(%r13,%rax,4), %esi
	movl	%r12d, %edx
	leal	(%rsi,%rsi), %ecx
	movl	%ecx, %edi
	subl	%ecx, %edx
	subl	%r12d, %edi
	cmpl	%ecx, %r12d
	cmovl	%edi, %edx
	cmpl	%r8d, %edx
	jge	.L26
	movl	%esi, 12(%rsp)
	movl	%edx, %r8d
.L26:
	addq	$1, %rax
	cmpq	%rax, %rbp
	jne	.L29
.L19:
	movl	12(%rsp), %ecx
	movl	%r12d, %edx
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	xorl	%r12d, %r12d
	jmp	.L19
	.cfi_endproc
.LFE67:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.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
	.file	"temp.c"
	.text
	.p2align 4
	.globl	comp
	.type	comp, @function
comp:
.LFB63:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE63:
	.size	comp, .-comp
	.p2align 4
	.globl	compw
	.type	compw, @function
compw:
.LFB64:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	setg	%al
	setl	%dl
	movzbl	%dl, %edx
	movzbl	%al, %eax
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE64:
	.size	compw, .-compw
	.p2align 4
	.globl	nextpint
	.type	nextpint, @function
nextpint:
.LFB65:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	.p2align 4,,10
	.p2align 3
.L14:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L14
	movsbq	%al, %rdx
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdi
	leaq	(%rbx,%rbx,4), %rax
	leaq	-48(%rdx,%rax,2), %rbx
	call	getc@PLT
	movsbq	%al, %rdx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L8
	movl	%ebx, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE65:
	.size	nextpint, .-nextpint
	.p2align 4
	.globl	dif
	.type	dif, @function
dif:
.LFB66:
	.cfi_startproc
	endbr64
	movl	%edi, %edx
	movl	%esi, %eax
	subl	%esi, %edx
	subl	%edi, %eax
	cmpl	%esi, %edi
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE66:
	.size	dif, .-dif
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB67:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	nextpint
	testl	%eax, %eax
	jle	.L30
	movl	%eax, %ebp
	xorl	%ebx, %ebx
	leaq	a(%rip), %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L25:
	movl	%ebx, %r15d
	.p2align 4,,10
	.p2align 3
.L38:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L38
	movsbq	%al, %rdx
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L23:
	movq	stdin(%rip), %rdi
	leaq	(%r14,%r14,4), %rax
	leaq	-48(%rdx,%rax,2), %r14
	call	getc@PLT
	movsbq	%al, %rdx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L23
	movl	%r14d, 0(%r13,%rbx,4)
	cmpl	%r12d, %r14d
	jle	.L24
	movl	%r15d, 8(%rsp)
	movl	%r14d, %r12d
.L24:
	addq	$1, %rbx
	cmpq	%rbx, %rbp
	jne	.L25
	xorl	%eax, %eax
	movl	$2147483647, %r8d
	.p2align 4,,10
	.p2align 3
.L29:
	cmpl	%eax, 8(%rsp)
	je	.L26
	movl	0(%r13,%rax,4), %esi
	movl	%r12d, %edx
	leal	(%rsi,%rsi), %ecx
	movl	%ecx, %edi
	subl	%ecx, %edx
	subl	%r12d, %edi
	cmpl	%ecx, %r12d
	cmovl	%edi, %edx
	cmpl	%r8d, %edx
	jge	.L26
	movl	%esi, 12(%rsp)
	movl	%edx, %r8d
.L26:
	addq	$1, %rax
	cmpq	%rax, %rbp
	jne	.L29
.L19:
	movl	12(%rsp), %ecx
	movl	%r12d, %edx
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	xorl	%r12d, %r12d
	jmp	.L19
	.cfi_endproc
.LFE67:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.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:

#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint_fast32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }

int dif(const int a, const int b){return a>b?a-b:b-a;}

int a[100000];
int main(int argc, char *argv[], char *envp[]){
	int n=nextpint();
	int max=0, maxi;
	for(int i=0; i<n; i++){
		int A=nextpint();
		a[i]=A;
		if(A>max){
			max=A;
			maxi=i;
		}
	}
	int min=INT_MAX, ans;
	for(int i=0; i<n; i++){
		if(i!=maxi){
			int now=dif(a[i]*2, max);
			if(now<min){min=now; ans=a[i];}
		}
	}
	printf("%d %d\n", max, ans);
}

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 unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint_fast32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }

int dif(const int a, const int b){return a>b?a-b:b-a;}

int a[100000];
int main(int argc, char *argv[], char *envp[]){
	int n=nextpint();
	int max=0, maxi;
	for(int i=0; i<n; i++){
		int A=nextpint();
		a[i]=A;
		if(A>max){
			max=A;
			maxi=i;
		}
	}
	int min=INT_MAX, ans;
	for(int i=0; i<n; i++){
		if(i!=maxi){
			int now=dif(a[i]*2, max);
			if(now<min){min=now; ans=a[i];}
		}
	}
	printf("%d %d\n", max, ans);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	comp
	.type	comp, @function
comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp, .-comp
	.globl	compw
	.type	compw, @function
compw:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	setg	%al
	movzbl	%al, %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	setl	%al
	movzbl	%al, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	compw, .-compw
	.globl	nextpint
	.type	nextpint, @function
nextpint:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	call	getchar@PLT
	movb	%al, -9(%rbp)
	jmp	.L6
.L7:
	call	getchar@PLT
	movb	%al, -9(%rbp)
.L6:
	cmpb	$47, -9(%rbp)
	jle	.L7
	cmpb	$57, -9(%rbp)
	jg	.L7
	movq	$0, -8(%rbp)
	jmp	.L8
.L10:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-9(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar@PLT
	movb	%al, -9(%rbp)
.L8:
	cmpb	$47, -9(%rbp)
	jle	.L9
	cmpb	$57, -9(%rbp)
	jle	.L10
.L9:
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	nextpint, .-nextpint
	.globl	dif
	.type	dif, @function
dif:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L13
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	jmp	.L15
.L13:
	movl	-8(%rbp), %eax
	subl	-4(%rbp), %eax
.L15:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	dif, .-dif
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.section	.rodata
.LC0:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	call	nextpint
	movl	%eax, -12(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L17
.L19:
	call	nextpint
	movl	%eax, -4(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jle	.L18
	movl	-4(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
.L18:
	addl	$1, -28(%rbp)
.L17:
	movl	-28(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L19
	movl	$2147483647, -24(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L20
.L22:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	je	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	dif
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L21
	movl	-8(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
.L21:
	addl	$1, -16(%rbp)
.L20:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L22
	movl	-20(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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.
train
	.file	"temp.c"
	.text
	.globl	comp
	.type	comp, @function
comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp, .-comp
	.globl	compw
	.type	compw, @function
compw:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	setg	%al
	movzbl	%al, %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	setl	%al
	movzbl	%al, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	compw, .-compw
	.globl	nextpint
	.type	nextpint, @function
nextpint:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	call	getchar@PLT
	movb	%al, -9(%rbp)
	jmp	.L6
.L7:
	call	getchar@PLT
	movb	%al, -9(%rbp)
.L6:
	cmpb	$47, -9(%rbp)
	jle	.L7
	cmpb	$57, -9(%rbp)
	jg	.L7
	movq	$0, -8(%rbp)
	jmp	.L8
.L10:
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-9(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	call	getchar@PLT
	movb	%al, -9(%rbp)
.L8:
	cmpb	$47, -9(%rbp)
	jle	.L9
	cmpb	$57, -9(%rbp)
	jle	.L10
.L9:
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	nextpint, .-nextpint
	.globl	dif
	.type	dif, @function
dif:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L13
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	jmp	.L15
.L13:
	movl	-8(%rbp), %eax
	subl	-4(%rbp), %eax
.L15:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	dif, .-dif
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.section	.rodata
.LC0:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	call	nextpint
	movl	%eax, -12(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L17
.L19:
	call	nextpint
	movl	%eax, -4(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jle	.L18
	movl	-4(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
.L18:
	addl	$1, -28(%rbp)
.L17:
	movl	-28(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L19
	movl	$2147483647, -24(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L20
.L22:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	je	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rax,%rax), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	dif
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L21
	movl	-8(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
.L21:
	addl	$1, -16(%rbp)
.L20:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L22
	movl	-20(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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:
