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 main(){
int num, score[100], i, max, min, sum, ave;
while(1){
	scanf("%d",&num);
		if(num==0) break;
for( i=0 ; i<num ; i++ ){
	scanf("%d",&score[i]);
}
max = min = score[0];
    for(i=1;i<num;i++){
      if(max < score[i])
    max = score[i];
      if(min > score[i])
    min = score[i];
}
sum=0;
for( i=0 ; i<num ; i++){
sum+=score[i];
}
sum = sum - max - min;
ave = sum / (num-2);
printf("%d\n",ave);
}
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$448, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-440(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-440(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$0, -436(%rbp)
	jmp	.L4
.L5:
	leaq	-416(%rbp), %rdx
	movl	-436(%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
	addl	$1, -436(%rbp)
.L4:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L5
	movl	-416(%rbp), %eax
	movl	%eax, -428(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -436(%rbp)
	jmp	.L6
.L9:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -432(%rbp)
	jge	.L7
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -432(%rbp)
.L7:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -428(%rbp)
	jle	.L8
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -428(%rbp)
.L8:
	addl	$1, -436(%rbp)
.L6:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L9
	movl	$0, -424(%rbp)
	movl	$0, -436(%rbp)
	jmp	.L10
.L11:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -424(%rbp)
	addl	$1, -436(%rbp)
.L10:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L11
	movl	-424(%rbp), %eax
	subl	-432(%rbp), %eax
	subl	-428(%rbp), %eax
	movl	%eax, -424(%rbp)
	movl	-440(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-424(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -420(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.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
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L2
	jle	.L3
	leaq	16(%rsp), %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r14
	cmpl	%r13d, %ecx
	jg	.L4
.L3:
	movl	16(%rsp), %eax
	movl	%eax, %edx
	cmpl	$1, %ecx
	jle	.L5
	leal	-2(%rcx), %r8d
	leal	-1(%rcx), %r9d
	cmpl	$2, %r8d
	jbe	.L21
	movl	%r9d, %esi
	movd	%eax, %xmm4
	leaq	20(%rsp), %rdx
	shrl	$2, %esi
	pshufd	$0, %xmm4, %xmm1
	subl	$1, %esi
	movdqa	%xmm1, %xmm3
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movdqu	(%rdx), %xmm0
	movdqa	%xmm1, %xmm2
	addq	$16, %rdx
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm1
	pandn	%xmm0, %xmm2
	por	%xmm2, %xmm1
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm0
	pandn	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	por	%xmm0, %xmm3
	cmpq	%rsi, %rdx
	jne	.L7
	movdqa	%xmm3, %xmm2
	movl	%r9d, %r10d
	psrldq	$8, %xmm2
	andl	$-4, %r10d
	movdqa	%xmm2, %xmm0
	leal	1(%r10), %edi
	pcmpgtd	%xmm3, %xmm0
	pand	%xmm0, %xmm3
	pandn	%xmm2, %xmm0
	por	%xmm3, %xmm0
	movdqa	%xmm0, %xmm3
	psrldq	$4, %xmm3
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm0
	pandn	%xmm3, %xmm2
	por	%xmm0, %xmm2
	movd	%xmm2, %esi
	movdqa	%xmm1, %xmm2
	psrldq	$8, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %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	%r10d, %r9d
	je	.L11
.L6:
	movslq	%edi, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	cmpl	%r9d, %esi
	cmovg	%r9d, %esi
	leal	1(%rdi), %r9d
	cmpl	%r9d, %ecx
	jle	.L11
	movslq	%r9d, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	cmpl	%r9d, %esi
	cmovg	%r9d, %esi
	addl	$2, %edi
	cmpl	%edi, %ecx
	jle	.L11
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	cmpl	%edi, %esi
	cmovg	%edi, %esi
.L11:
	testl	%ecx, %ecx
	movl	$1, %r9d
	cmovg	%ecx, %r9d
	cmpl	$3, %ecx
	jle	.L30
	leaq	16(%rsp), %rax
	pxor	%xmm0, %xmm0
	movl	%r9d, %edi
	shrl	$2, %edi
	subl	$1, %edi
	salq	$4, %rdi
	leaq	32(%rsp,%rdi), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rax, %rdi
	jne	.L14
	movdqa	%xmm0, %xmm1
	movl	%r9d, %edi
	psrldq	$8, %xmm1
	andl	$-4, %edi
	andl	$3, %r9d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	je	.L13
	movslq	%edi, %r9
	addl	$1, %edi
	addl	16(%rsp,%r9,4), %eax
	cmpl	%ecx, %edi
	jge	.L13
.L19:
	movslq	%edi, %r9
	addl	$1, %edi
	addl	16(%rsp,%r9,4), %eax
	cmpl	%ecx, %edi
	jge	.L13
	movslq	%edi, %rdi
	addl	16(%rsp,%rdi,4), %eax
.L13:
	subl	%edx, %eax
	movl	$1, %edi
	subl	%esi, %eax
	movq	%r12, %rsi
	cltd
	idivl	%r8d
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L2:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$432, %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
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	je	.L12
	movl	%eax, %esi
	leal	-2(%rcx), %r8d
	xorl	%eax, %eax
	jmp	.L13
.L30:
	movl	$1, %edi
	jmp	.L19
.L21:
	movl	%eax, %esi
	movl	$1, %edi
	jmp	.L6
.L31:
	call	__stack_chk_fail@PLT
.L12:
	movl	%eax, %esi
	orl	$-1, %r8d
	jmp	.L13
	.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
	.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
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L2
	jle	.L3
	leaq	16(%rsp), %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r14
	cmpl	%r13d, %ecx
	jg	.L4
.L3:
	movl	16(%rsp), %eax
	movl	%eax, %edx
	cmpl	$1, %ecx
	jle	.L5
	leal	-2(%rcx), %r8d
	leal	-1(%rcx), %r9d
	cmpl	$2, %r8d
	jbe	.L21
	movl	%r9d, %esi
	movd	%eax, %xmm4
	leaq	20(%rsp), %rdx
	shrl	$2, %esi
	pshufd	$0, %xmm4, %xmm1
	subl	$1, %esi
	movdqa	%xmm1, %xmm3
	salq	$4, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movdqu	(%rdx), %xmm0
	movdqa	%xmm1, %xmm2
	addq	$16, %rdx
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm1
	pandn	%xmm0, %xmm2
	por	%xmm2, %xmm1
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm0
	pandn	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	por	%xmm0, %xmm3
	cmpq	%rsi, %rdx
	jne	.L7
	movdqa	%xmm3, %xmm2
	movl	%r9d, %r10d
	psrldq	$8, %xmm2
	andl	$-4, %r10d
	movdqa	%xmm2, %xmm0
	leal	1(%r10), %edi
	pcmpgtd	%xmm3, %xmm0
	pand	%xmm0, %xmm3
	pandn	%xmm2, %xmm0
	por	%xmm3, %xmm0
	movdqa	%xmm0, %xmm3
	psrldq	$4, %xmm3
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm0
	pandn	%xmm3, %xmm2
	por	%xmm0, %xmm2
	movd	%xmm2, %esi
	movdqa	%xmm1, %xmm2
	psrldq	$8, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %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	%r10d, %r9d
	je	.L11
.L6:
	movslq	%edi, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	cmpl	%r9d, %esi
	cmovg	%r9d, %esi
	leal	1(%rdi), %r9d
	cmpl	%r9d, %ecx
	jle	.L11
	movslq	%r9d, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	cmpl	%r9d, %esi
	cmovg	%r9d, %esi
	addl	$2, %edi
	cmpl	%edi, %ecx
	jle	.L11
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	cmpl	%edi, %esi
	cmovg	%edi, %esi
.L11:
	testl	%ecx, %ecx
	movl	$1, %r9d
	cmovg	%ecx, %r9d
	cmpl	$3, %ecx
	jle	.L30
	leaq	16(%rsp), %rax
	pxor	%xmm0, %xmm0
	movl	%r9d, %edi
	shrl	$2, %edi
	subl	$1, %edi
	salq	$4, %rdi
	leaq	32(%rsp,%rdi), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rax, %rdi
	jne	.L14
	movdqa	%xmm0, %xmm1
	movl	%r9d, %edi
	psrldq	$8, %xmm1
	andl	$-4, %edi
	andl	$3, %r9d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	je	.L13
	movslq	%edi, %r9
	addl	$1, %edi
	addl	16(%rsp,%r9,4), %eax
	cmpl	%ecx, %edi
	jge	.L13
.L19:
	movslq	%edi, %r9
	addl	$1, %edi
	addl	16(%rsp,%r9,4), %eax
	cmpl	%ecx, %edi
	jge	.L13
	movslq	%edi, %rdi
	addl	16(%rsp,%rdi,4), %eax
.L13:
	subl	%edx, %eax
	movl	$1, %edi
	subl	%esi, %eax
	movq	%r12, %rsi
	cltd
	idivl	%r8d
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L2:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$432, %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
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	je	.L12
	movl	%eax, %esi
	leal	-2(%rcx), %r8d
	xorl	%eax, %eax
	jmp	.L13
.L30:
	movl	$1, %edi
	jmp	.L19
.L21:
	movl	%eax, %esi
	movl	$1, %edi
	jmp	.L6
.L31:
	call	__stack_chk_fail@PLT
.L12:
	movl	%eax, %esi
	orl	$-1, %r8d
	jmp	.L13
	.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:

#include <stdio.h>
int main(){
int num, score[100], i, max, min, sum, ave;
while(1){
	scanf("%d",&num);
		if(num==0) break;
for( i=0 ; i<num ; i++ ){
	scanf("%d",&score[i]);
}
max = min = score[0];
    for(i=1;i<num;i++){
      if(max < score[i])
    max = score[i];
      if(min > score[i])
    min = score[i];
}
sum=0;
for( i=0 ; i<num ; i++){
sum+=score[i];
}
sum = sum - max - min;
ave = sum / (num-2);
printf("%d\n",ave);
}
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 main(){
int num, score[100], i, max, min, sum, ave;
while(1){
	scanf("%d",&num);
		if(num==0) break;
for( i=0 ; i<num ; i++ ){
	scanf("%d",&score[i]);
}
max = min = score[0];
    for(i=1;i<num;i++){
      if(max < score[i])
    max = score[i];
      if(min > score[i])
    min = score[i];
}
sum=0;
for( i=0 ; i<num ; i++){
sum+=score[i];
}
sum = sum - max - min;
ave = sum / (num-2);
printf("%d\n",ave);
}
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$448, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-440(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-440(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$0, -436(%rbp)
	jmp	.L4
.L5:
	leaq	-416(%rbp), %rdx
	movl	-436(%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
	addl	$1, -436(%rbp)
.L4:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L5
	movl	-416(%rbp), %eax
	movl	%eax, -428(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -436(%rbp)
	jmp	.L6
.L9:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -432(%rbp)
	jge	.L7
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -432(%rbp)
.L7:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -428(%rbp)
	jle	.L8
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -428(%rbp)
.L8:
	addl	$1, -436(%rbp)
.L6:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L9
	movl	$0, -424(%rbp)
	movl	$0, -436(%rbp)
	jmp	.L10
.L11:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -424(%rbp)
	addl	$1, -436(%rbp)
.L10:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L11
	movl	-424(%rbp), %eax
	subl	-432(%rbp), %eax
	subl	-428(%rbp), %eax
	movl	%eax, -424(%rbp)
	movl	-440(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-424(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -420(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$448, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-440(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-440(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$0, -436(%rbp)
	jmp	.L4
.L5:
	leaq	-416(%rbp), %rdx
	movl	-436(%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
	addl	$1, -436(%rbp)
.L4:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L5
	movl	-416(%rbp), %eax
	movl	%eax, -428(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -436(%rbp)
	jmp	.L6
.L9:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -432(%rbp)
	jge	.L7
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -432(%rbp)
.L7:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -428(%rbp)
	jle	.L8
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -428(%rbp)
.L8:
	addl	$1, -436(%rbp)
.L6:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L9
	movl	$0, -424(%rbp)
	movl	$0, -436(%rbp)
	jmp	.L10
.L11:
	movl	-436(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -424(%rbp)
	addl	$1, -436(%rbp)
.L10:
	movl	-440(%rbp), %eax
	cmpl	%eax, -436(%rbp)
	jl	.L11
	movl	-424(%rbp), %eax
	subl	-432(%rbp), %eax
	subl	-428(%rbp), %eax
	movl	%eax, -424(%rbp)
	movl	-440(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-424(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, -420(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
