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 (void){
    int i,box,W,K,W1=0,W2=0,W3=0,K1=0,K2=0,K3=0,ten;
    for(i=0;i<20;i++){
        scanf("%d",&ten);
        if(i<10){
            if(W3<ten){
                W3=ten;
                if(W2<ten){
                    W3=W2;
                    W2=ten;
                    if(W1<ten){
                        W2=W1;
                        W1=ten;
                    }
                }
            }
        }
        else if(i>9){
            if(K3<ten){
                K3=ten;
                if(K2<ten){
                    K3=K2;
                    K2=ten;
                    if(K1<ten){
                        K2=K1;
                        K1=ten;
                    }
                }
            }
        }
    }
    W=W1+W2+W3;
    K=K1+K2+K3;
    printf("%d %d\n",W,K);
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L2
.L5:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$9, -44(%rbp)
	jg	.L3
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L4
	movl	-48(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L4
	movl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L4
	movl	-40(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	jmp	.L4
.L3:
	cmpl	$9, -44(%rbp)
	jle	.L4
	movl	-48(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L4
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L4
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jge	.L4
	movl	-28(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -28(%rbp)
.L4:
	addl	$1, -44(%rbp)
.L2:
	cmpl	$19, -44(%rbp)
	jle	.L5
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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 %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	$1, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %r13
	movl	$0, 8(%rsp)
	movl	$0, 4(%rsp)
	movl	$0, 12(%rsp)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	%ebx, %eax
	jle	.L7
	movl	4(%rsp), %edx
	movl	%eax, %ebx
	cmpl	%edx, %eax
	jle	.L7
	movl	12(%rsp), %ecx
	movl	%edx, %ebx
	cmpl	%ecx, %eax
	jle	.L10
	movl	%ecx, 4(%rsp)
	movl	%eax, 12(%rsp)
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r14d
.L6:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	leal	-1(%r14), %eax
	cmpl	$9, %eax
	movl	20(%rsp), %eax
	jbe	.L16
	cmpl	%ebp, %eax
	jle	.L4
	movl	%eax, %ebp
	cmpl	%r15d, %eax
	jle	.L4
	movl	8(%rsp), %ecx
	movl	%r15d, %ebp
	movl	%eax, %r15d
	cmpl	%ecx, %eax
	jle	.L4
	movl	%eax, 8(%rsp)
	movl	%ecx, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	$20, %r14d
	jne	.L7
	movl	8(%rsp), %ecx
	movl	12(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	addl	4(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	addl	%r15d, %ecx
	addl	%ebx, %edx
	addl	%ebp, %ecx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$40, %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
.L10:
	.cfi_restore_state
	movl	%eax, 4(%rsp)
	jmp	.L7
.L17:
	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
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	$1, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %r13
	movl	$0, 8(%rsp)
	movl	$0, 4(%rsp)
	movl	$0, 12(%rsp)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	%ebx, %eax
	jle	.L7
	movl	4(%rsp), %edx
	movl	%eax, %ebx
	cmpl	%edx, %eax
	jle	.L7
	movl	12(%rsp), %ecx
	movl	%edx, %ebx
	cmpl	%ecx, %eax
	jle	.L10
	movl	%ecx, 4(%rsp)
	movl	%eax, 12(%rsp)
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r14d
.L6:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	leal	-1(%r14), %eax
	cmpl	$9, %eax
	movl	20(%rsp), %eax
	jbe	.L16
	cmpl	%ebp, %eax
	jle	.L4
	movl	%eax, %ebp
	cmpl	%r15d, %eax
	jle	.L4
	movl	8(%rsp), %ecx
	movl	%r15d, %ebp
	movl	%eax, %r15d
	cmpl	%ecx, %eax
	jle	.L4
	movl	%eax, 8(%rsp)
	movl	%ecx, %r15d
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	$20, %r14d
	jne	.L7
	movl	8(%rsp), %ecx
	movl	12(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	addl	4(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	addl	%r15d, %ecx
	addl	%ebx, %edx
	addl	%ebp, %ecx
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$40, %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
.L10:
	.cfi_restore_state
	movl	%eax, 4(%rsp)
	jmp	.L7
.L17:
	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:

#include <stdio.h>
int main (void){
    int i,box,W,K,W1=0,W2=0,W3=0,K1=0,K2=0,K3=0,ten;
    for(i=0;i<20;i++){
        scanf("%d",&ten);
        if(i<10){
            if(W3<ten){
                W3=ten;
                if(W2<ten){
                    W3=W2;
                    W2=ten;
                    if(W1<ten){
                        W2=W1;
                        W1=ten;
                    }
                }
            }
        }
        else if(i>9){
            if(K3<ten){
                K3=ten;
                if(K2<ten){
                    K3=K2;
                    K2=ten;
                    if(K1<ten){
                        K2=K1;
                        K1=ten;
                    }
                }
            }
        }
    }
    W=W1+W2+W3;
    K=K1+K2+K3;
    printf("%d %d\n",W,K);
return 0;
}
23
23
20
15
15
14
13
9
7
6
25
19
17
17
16
13
12
11
9
5

66 61

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 (void){
    int i,box,W,K,W1=0,W2=0,W3=0,K1=0,K2=0,K3=0,ten;
    for(i=0;i<20;i++){
        scanf("%d",&ten);
        if(i<10){
            if(W3<ten){
                W3=ten;
                if(W2<ten){
                    W3=W2;
                    W2=ten;
                    if(W1<ten){
                        W2=W1;
                        W1=ten;
                    }
                }
            }
        }
        else if(i>9){
            if(K3<ten){
                K3=ten;
                if(K2<ten){
                    K3=K2;
                    K2=ten;
                    if(K1<ten){
                        K2=K1;
                        K1=ten;
                    }
                }
            }
        }
    }
    W=W1+W2+W3;
    K=K1+K2+K3;
    printf("%d %d\n",W,K);
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L2
.L5:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$9, -44(%rbp)
	jg	.L3
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L4
	movl	-48(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L4
	movl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L4
	movl	-40(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	jmp	.L4
.L3:
	cmpl	$9, -44(%rbp)
	jle	.L4
	movl	-48(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L4
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L4
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jge	.L4
	movl	-28(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -28(%rbp)
.L4:
	addl	$1, -44(%rbp)
.L2:
	cmpl	$19, -44(%rbp)
	jle	.L5
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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 %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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L2
.L5:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$9, -44(%rbp)
	jg	.L3
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L4
	movl	-48(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L4
	movl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L4
	movl	-40(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	jmp	.L4
.L3:
	cmpl	$9, -44(%rbp)
	jle	.L4
	movl	-48(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L4
	movl	-48(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L4
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jge	.L4
	movl	-28(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -28(%rbp)
.L4:
	addl	$1, -44(%rbp)
.L2:
	cmpl	$19, -44(%rbp)
	jle	.L5
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	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:
