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

```c
#include <stdio.h>

int max(int n,int s[100]){
	int p=s[0];
	for(int i=1;i<n;i++){
		if(p<s[i]) {
			int k;
			k=p; p=s[i]; s[i]=k;
		}
		}
	return p;
}

int min(int n,int s[100]){
	int q=s[0];
	for(int i=1;i<n;i++){
		if(q>s[i]) {
			int k;
			k=q; q=s[i]; s[i]=k;
		}
		}
	return q;
}

int main(void){   
	while(1){   
		int n;
		scanf("%d",&n);   
		if(n==0) break;   
		int s[100],sum=0;   
		for(int i=0;i<n;i++){       
			scanf("%d",&s[i]);       
			sum+=s[i];
		}
		sum=sum-max(n,s)-min(n,s);
		int x;
		x=sum/(n-2);
		printf("%d\n",x);
		}
  	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L3
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
.L3:
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L4
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	min
	.type	min, @function
min:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L8
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L9
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$440, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
.L16:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	jmp	.L18
.L12:
	movl	$0, -444(%rbp)
	movl	$0, -440(%rbp)
	jmp	.L14
.L15:
	leaq	-432(%rbp), %rdx
	movl	-440(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-440(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	addl	%eax, -444(%rbp)
	addl	$1, -440(%rbp)
.L14:
	movl	-448(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L15
	movl	-448(%rbp), %eax
	leaq	-432(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movl	-444(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ebx
	movl	-448(%rbp), %eax
	leaq	-432(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	min
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	movl	%eax, -444(%rbp)
	movl	-448(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-444(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -436(%rbp)
	movl	-436(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L16
.L18:
	call	__stack_chk_fail@PLT
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	cmpl	$1, %edi
	jle	.L1
	leal	-2(%rdi), %edx
	leaq	4(%rsi), %rax
	leaq	8(%rsi,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movl	(%rax), %edx
	cmpl	%r8d, %edx
	jle	.L3
	movl	%r8d, (%rax)
	movl	%edx, %r8d
.L3:
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L4
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB24:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	cmpl	$1, %edi
	jle	.L7
	leal	-2(%rdi), %edx
	leaq	4(%rsi), %rax
	leaq	8(%rsi,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rax), %edx
	cmpl	%r8d, %edx
	jge	.L9
	movl	%r8d, (%rax)
	movl	%edx, %r8d
.L9:
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L10
.L7:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	min, .-min
	.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:
.LFB25:
	.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
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	je	.L13
	jle	.L25
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
	leaq	16(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L15:
	leaq	(%r15,%rbx,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addl	(%r15,%rbx,4), %r14d
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L15
.L14:
	movl	16(%rsp), %edi
	cmpl	$1, %edx
	jle	.L16
	leal	-2(%rdx), %eax
	leaq	20(%rsp), %rcx
	movq	%rax, %r8
	leaq	24(%rsp,%rax,4), %r9
	movq	%rcx, %rsi
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%rsi), %eax
	cmpl	%edi, %eax
	jle	.L17
	movl	%edi, (%rsi)
	movl	%eax, %edi
.L17:
	addq	$4, %rsi
	cmpq	%r9, %rsi
	jne	.L18
	movl	%r14d, %eax
	subl	%edi, %eax
	movl	16(%rsp), %edi
	.p2align 4,,10
	.p2align 3
.L21:
	movl	(%rcx), %edx
	cmpl	%edi, %edx
	jge	.L20
	movl	%edi, (%rcx)
	movl	%edx, %edi
.L20:
	addq	$4, %rcx
	cmpq	%r9, %rcx
	jne	.L21
.L23:
	subl	%edi, %eax
	movq	%r13, %rsi
	movl	$1, %edi
	cltd
	idivl	%r8d
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L13:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$440, %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
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	movl	%r14d, %eax
	leal	-2(%rdx), %r8d
	subl	%edi, %eax
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L25:
	xorl	%r14d, %r14d
	jmp	.L14
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	cmpl	$1, %edi
	jle	.L1
	leal	-2(%rdi), %edx
	leaq	4(%rsi), %rax
	leaq	8(%rsi,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movl	(%rax), %edx
	cmpl	%r8d, %edx
	jle	.L3
	movl	%r8d, (%rax)
	movl	%edx, %r8d
.L3:
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L4
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB24:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	cmpl	$1, %edi
	jle	.L7
	leal	-2(%rdi), %edx
	leaq	4(%rsi), %rax
	leaq	8(%rsi,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rax), %edx
	cmpl	%r8d, %edx
	jge	.L9
	movl	%r8d, (%rax)
	movl	%edx, %r8d
.L9:
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L10
.L7:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	min, .-min
	.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:
.LFB25:
	.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
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	je	.L13
	jle	.L25
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
	leaq	16(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L15:
	leaq	(%r15,%rbx,4), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addl	(%r15,%rbx,4), %r14d
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L15
.L14:
	movl	16(%rsp), %edi
	cmpl	$1, %edx
	jle	.L16
	leal	-2(%rdx), %eax
	leaq	20(%rsp), %rcx
	movq	%rax, %r8
	leaq	24(%rsp,%rax,4), %r9
	movq	%rcx, %rsi
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%rsi), %eax
	cmpl	%edi, %eax
	jle	.L17
	movl	%edi, (%rsi)
	movl	%eax, %edi
.L17:
	addq	$4, %rsi
	cmpq	%r9, %rsi
	jne	.L18
	movl	%r14d, %eax
	subl	%edi, %eax
	movl	16(%rsp), %edi
	.p2align 4,,10
	.p2align 3
.L21:
	movl	(%rcx), %edx
	cmpl	%edi, %edx
	jge	.L20
	movl	%edi, (%rcx)
	movl	%edx, %edi
.L20:
	addq	$4, %rcx
	cmpq	%r9, %rcx
	jne	.L21
.L23:
	subl	%edi, %eax
	movq	%r13, %rsi
	movl	$1, %edi
	cltd
	idivl	%r8d
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L13:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$440, %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
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	movl	%r14d, %eax
	leal	-2(%rdx), %r8d
	subl	%edi, %eax
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L25:
	xorl	%r14d, %r14d
	jmp	.L14
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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:

#include <stdio.h>

int max(int n,int s[100]){
	int p=s[0];
	for(int i=1;i<n;i++){
		if(p<s[i]) {
			int k;
			k=p; p=s[i]; s[i]=k;
		}
		}
	return p;
}

int min(int n,int s[100]){
	int q=s[0];
	for(int i=1;i<n;i++){
		if(q>s[i]) {
			int k;
			k=q; q=s[i]; s[i]=k;
		}
		}
	return q;
}

int main(void){   
	while(1){   
		int n;
		scanf("%d",&n);   
		if(n==0) break;   
		int s[100],sum=0;   
		for(int i=0;i<n;i++){       
			scanf("%d",&s[i]);       
			sum+=s[i];
		}
		sum=sum-max(n,s)-min(n,s);
		int x;
		x=sum/(n-2);
		printf("%d\n",x);
		}
  	return 0;
}

3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
353
242
708
274
283
132
402
523
0
 3
1000
342
0
5
0
2
9
11
932
5
300
1000
0
200
400
8
353
242
402
274
283
132
402
523
0
 3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
297
242
924
274
283
132
402
523
0
 3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
297
242
924
274
5
132
402
523
0
 3
1000
342
0
5
0
2
9
11
932
5
300
1000
0
200
685
8
353
242
402
274
283
31
402
523
0
 3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
297
242
924
274
5
132
531
523
0
 3
1000
342
0
5
0
2
9
11
932
5
300
1000
0
200
685
8
353
143
402
274
283
31
402
523
0
 3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
203
242
924
274
5
132
531
523
0
 3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
479
8
353
242
402
274
283
132
402
523
0
 3
1000
342
0
5
2
2
9
11
932
5
300
1000
0
200
400
8
353
242
708
274
283
132
13
523
0

342
7
300
346
 342
7
300
326
 342
7
300
336
 342
7
300
311
 342
7
395
326
 342
7
300
333
 342
7
395
309
 342
7
300
317
 342
7
326
326
 342
7
300
301

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

```c
#include <stdio.h>

int max(int n,int s[100]){
	int p=s[0];
	for(int i=1;i<n;i++){
		if(p<s[i]) {
			int k;
			k=p; p=s[i]; s[i]=k;
		}
		}
	return p;
}

int min(int n,int s[100]){
	int q=s[0];
	for(int i=1;i<n;i++){
		if(q>s[i]) {
			int k;
			k=q; q=s[i]; s[i]=k;
		}
		}
	return q;
}

int main(void){   
	while(1){   
		int n;
		scanf("%d",&n);   
		if(n==0) break;   
		int s[100],sum=0;   
		for(int i=0;i<n;i++){       
			scanf("%d",&s[i]);       
			sum+=s[i];
		}
		sum=sum-max(n,s)-min(n,s);
		int x;
		x=sum/(n-2);
		printf("%d\n",x);
		}
  	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L3
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
.L3:
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L4
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	min
	.type	min, @function
min:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L8
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L9
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$440, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
.L16:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	jmp	.L18
.L12:
	movl	$0, -444(%rbp)
	movl	$0, -440(%rbp)
	jmp	.L14
.L15:
	leaq	-432(%rbp), %rdx
	movl	-440(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-440(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	addl	%eax, -444(%rbp)
	addl	$1, -440(%rbp)
.L14:
	movl	-448(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L15
	movl	-448(%rbp), %eax
	leaq	-432(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movl	-444(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ebx
	movl	-448(%rbp), %eax
	leaq	-432(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	min
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	movl	%eax, -444(%rbp)
	movl	-448(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-444(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -436(%rbp)
	movl	-436(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L16
.L18:
	call	__stack_chk_fail@PLT
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L3
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
.L3:
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L4
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	min
	.type	min, @function
min:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L8
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L9
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$440, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
.L16:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	jmp	.L18
.L12:
	movl	$0, -444(%rbp)
	movl	$0, -440(%rbp)
	jmp	.L14
.L15:
	leaq	-432(%rbp), %rdx
	movl	-440(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-440(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	addl	%eax, -444(%rbp)
	addl	$1, -440(%rbp)
.L14:
	movl	-448(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L15
	movl	-448(%rbp), %eax
	leaq	-432(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movl	-444(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ebx
	movl	-448(%rbp), %eax
	leaq	-432(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	min
	movl	%eax, %edx
	movl	%ebx, %eax
	subl	%edx, %eax
	movl	%eax, -444(%rbp)
	movl	-448(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-444(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -436(%rbp)
	movl	-436(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L16
.L18:
	call	__stack_chk_fail@PLT
.L17:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
