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>
#include <stdlib.h>

#define INF 1 << 29

int n,a,b,c;
int l[8];

int min(int x,int y){return (x<y)?x:y;}

int dfs(int cur,int _a,int _b,int _c){
    if(cur == n){
        if(min(_a,min(_b,_c))>0){
            return abs(_a-a)+abs(_b-b)+abs(_c-c)-30;
        }else{
            return INF;
        }
    }
    int ch0 = dfs(cur+1,_a,_b,_c);
    int ch1 = dfs(cur+1,_a+l[cur],_b,_c)+10;
    int ch2 = dfs(cur+1,_a,_b+l[cur],_c)+10;
    int ch3 = dfs(cur+1,_a,_b,_c+l[cur])+10;
    
    return min(min(ch0,ch1),min(ch2,ch3));
}

int main(){
    int i;
    scanf("%d%d%d%d",&n,&a,&b,&c);
    for(i=0;i<n;i++)scanf("%d",&l[i]);
    printf("%d\n",dfs(0,0,0,0));
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	l
	.align 32
	.type	l, @object
	.size	l, 32
l:
	.zero	32
	.text
	.globl	min
	.type	min, @function
min:
.LFB6:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB7:
	.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	$40, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jne	.L4
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	testl	%eax, %eax
	jle	.L5
	movl	a(%rip), %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movl	b(%rip), %edx
	movl	-44(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, %ecx
	movl	c(%rip), %edx
	movl	-48(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	subl	$30, %eax
	jmp	.L6
.L5:
	movl	$536870912, %eax
	jmp	.L6
.L4:
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %ecx
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	call	dfs
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	call	dfs
	addl	$10, %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %ecx
	movl	%esi, %edx
	movl	%eax, %esi
	call	dfs
	addl	$10, %eax
	movl	%eax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-48(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	call	dfs
	addl	$10, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, %ebx
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%ebx, %esi
	movl	%eax, %edi
	call	min
.L6:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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
	leaq	c(%rip), %r8
	leaq	b(%rip), %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4(%rbp)
	jmp	.L8
.L9:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4(%rbp)
.L8:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L9
	movl	$0, %ecx
	movl	$0, %edx
	movl	$0, %esi
	movl	$0, %edi
	call	dfs
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	min
	.type	min, @function
min:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovle	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	min, .-min
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB40:
	.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
	movslq	%edi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ecx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	cmpl	%r13d, n(%rip)
	jne	.L4
	cmpl	%ecx, %edx
	movl	%ecx, %eax
	cmovle	%edx, %eax
	cmpl	%esi, %eax
	cmovg	%esi, %eax
	movl	%eax, %edx
	movl	$536870912, %eax
	testl	%edx, %edx
	jle	.L3
	subl	a(%rip), %ebp
	movl	%ebp, %eax
	negl	%eax
	cmovns	%eax, %ebp
	subl	b(%rip), %r12d
	movl	%r12d, %eax
	negl	%eax
	cmovns	%eax, %r12d
	subl	c(%rip), %ebx
	movl	%ebx, %eax
	addl	%r12d, %ebp
	negl	%eax
	cmovns	%eax, %ebx
	leal	-30(%rbp,%rbx), %eax
.L3:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L4:
	.cfi_restore_state
	leal	1(%r13), %r14d
	movl	%r14d, %edi
	call	dfs
	movl	%ebx, %ecx
	movl	%r12d, %edx
	movl	%r14d, %edi
	movl	%eax, 12(%rsp)
	leaq	l(%rip), %rax
	movl	(%rax,%r13,4), %r15d
	leal	0(%rbp,%r15), %esi
	call	dfs
	leal	(%r12,%r15), %edx
	movl	%ebx, %ecx
	movl	%ebp, %esi
	movl	%r14d, %edi
	movl	%eax, %r13d
	call	dfs
	leal	(%rbx,%r15), %ecx
	movl	%r12d, %edx
	movl	%ebp, %esi
	movl	%r14d, %edi
	movl	%eax, 8(%rsp)
	call	dfs
	movl	8(%rsp), %r14d
	movl	12(%rsp), %r8d
	movl	%eax, %r9d
	leal	10(%r13), %eax
	addl	$10, %r14d
	leal	10(%r9), %edx
	cmpl	%r14d, %eax
	cmovg	%r14d, %eax
	cmpl	%r8d, %eax
	cmovg	%r8d, %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	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
	.cfi_endproc
.LFE40:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	c(%rip), %r8
	xorl	%eax, %eax
	leaq	b(%rip), %rcx
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	a(%rip), %rdx
	leaq	n(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L9
	leaq	l(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L10
.L9:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	xorl	%esi, %esi
	xorl	%edi, %edi
	call	dfs
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	l
	.bss
	.align 32
	.type	l, @object
	.size	l, 32
l:
	.zero	32
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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	min
	.type	min, @function
min:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovle	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	min, .-min
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB40:
	.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
	movslq	%edi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%ecx, %ebx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	cmpl	%r13d, n(%rip)
	jne	.L4
	cmpl	%ecx, %edx
	movl	%ecx, %eax
	cmovle	%edx, %eax
	cmpl	%esi, %eax
	cmovg	%esi, %eax
	movl	%eax, %edx
	movl	$536870912, %eax
	testl	%edx, %edx
	jle	.L3
	subl	a(%rip), %ebp
	movl	%ebp, %eax
	negl	%eax
	cmovns	%eax, %ebp
	subl	b(%rip), %r12d
	movl	%r12d, %eax
	negl	%eax
	cmovns	%eax, %r12d
	subl	c(%rip), %ebx
	movl	%ebx, %eax
	addl	%r12d, %ebp
	negl	%eax
	cmovns	%eax, %ebx
	leal	-30(%rbp,%rbx), %eax
.L3:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L4:
	.cfi_restore_state
	leal	1(%r13), %r14d
	movl	%r14d, %edi
	call	dfs
	movl	%ebx, %ecx
	movl	%r12d, %edx
	movl	%r14d, %edi
	movl	%eax, 12(%rsp)
	leaq	l(%rip), %rax
	movl	(%rax,%r13,4), %r15d
	leal	0(%rbp,%r15), %esi
	call	dfs
	leal	(%r12,%r15), %edx
	movl	%ebx, %ecx
	movl	%ebp, %esi
	movl	%r14d, %edi
	movl	%eax, %r13d
	call	dfs
	leal	(%rbx,%r15), %ecx
	movl	%r12d, %edx
	movl	%ebp, %esi
	movl	%r14d, %edi
	movl	%eax, 8(%rsp)
	call	dfs
	movl	8(%rsp), %r14d
	movl	12(%rsp), %r8d
	movl	%eax, %r9d
	leal	10(%r13), %eax
	addl	$10, %r14d
	leal	10(%r9), %edx
	cmpl	%r14d, %eax
	cmovg	%r14d, %eax
	cmpl	%r8d, %eax
	cmovg	%r8d, %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	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
	.cfi_endproc
.LFE40:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	c(%rip), %r8
	xorl	%eax, %eax
	leaq	b(%rip), %rcx
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	a(%rip), %rdx
	leaq	n(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L9
	leaq	l(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L10
.L9:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	xorl	%esi, %esi
	xorl	%edi, %edi
	call	dfs
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	l
	.bss
	.align 32
	.type	l, @object
	.size	l, 32
l:
	.zero	32
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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>
#include <stdlib.h>

#define INF 1 << 29

int n,a,b,c;
int l[8];

int min(int x,int y){return (x<y)?x:y;}

int dfs(int cur,int _a,int _b,int _c){
    if(cur == n){
        if(min(_a,min(_b,_c))>0){
            return abs(_a-a)+abs(_b-b)+abs(_c-c)-30;
        }else{
            return INF;
        }
    }
    int ch0 = dfs(cur+1,_a,_b,_c);
    int ch1 = dfs(cur+1,_a+l[cur],_b,_c)+10;
    int ch2 = dfs(cur+1,_a,_b+l[cur],_c)+10;
    int ch3 = dfs(cur+1,_a,_b,_c+l[cur])+10;
    
    return min(min(ch0,ch1),min(ch2,ch3));
}

int main(){
    int i;
    scanf("%d%d%d%d",&n,&a,&b,&c);
    for(i=0;i<n;i++)scanf("%d",&l[i]);
    printf("%d\n",dfs(0,0,0,0));
    return 0;
}
8 1100 800 100
300
333
400
444
500
555
600
666
 5 100 171 80
98
40
30
21
80
 8 100 90 80
100
100
90
90
90
80
80
20
 8 1100 800 100
297
333
400
444
500
555
600
666
 5 100 171 80
68
40
30
21
80
 8 100 90 110
100
100
90
90
90
80
80
20
 8 1100 800 100
297
333
400
444
336
555
600
666
 5 100 171 80
68
40
42
21
80
 8 100 90 110
100
100
90
104
90
80
80
20
 5 100 171 80
80
40
42
21
80

243
 102
 0
 240
 132
 10
 271
 120
 6
 108

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>
#include <stdlib.h>

#define INF 1 << 29

int n,a,b,c;
int l[8];

int min(int x,int y){return (x<y)?x:y;}

int dfs(int cur,int _a,int _b,int _c){
    if(cur == n){
        if(min(_a,min(_b,_c))>0){
            return abs(_a-a)+abs(_b-b)+abs(_c-c)-30;
        }else{
            return INF;
        }
    }
    int ch0 = dfs(cur+1,_a,_b,_c);
    int ch1 = dfs(cur+1,_a+l[cur],_b,_c)+10;
    int ch2 = dfs(cur+1,_a,_b+l[cur],_c)+10;
    int ch3 = dfs(cur+1,_a,_b,_c+l[cur])+10;
    
    return min(min(ch0,ch1),min(ch2,ch3));
}

int main(){
    int i;
    scanf("%d%d%d%d",&n,&a,&b,&c);
    for(i=0;i<n;i++)scanf("%d",&l[i]);
    printf("%d\n",dfs(0,0,0,0));
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	l
	.align 32
	.type	l, @object
	.size	l, 32
l:
	.zero	32
	.text
	.globl	min
	.type	min, @function
min:
.LFB6:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB7:
	.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	$40, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jne	.L4
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	testl	%eax, %eax
	jle	.L5
	movl	a(%rip), %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movl	b(%rip), %edx
	movl	-44(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, %ecx
	movl	c(%rip), %edx
	movl	-48(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	subl	$30, %eax
	jmp	.L6
.L5:
	movl	$536870912, %eax
	jmp	.L6
.L4:
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %ecx
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	call	dfs
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	call	dfs
	addl	$10, %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %ecx
	movl	%esi, %edx
	movl	%eax, %esi
	call	dfs
	addl	$10, %eax
	movl	%eax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-48(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	call	dfs
	addl	$10, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, %ebx
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%ebx, %esi
	movl	%eax, %edi
	call	min
.L6:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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
	leaq	c(%rip), %r8
	leaq	b(%rip), %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4(%rbp)
	jmp	.L8
.L9:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4(%rbp)
.L8:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L9
	movl	$0, %ecx
	movl	$0, %edx
	movl	$0, %esi
	movl	$0, %edi
	call	dfs
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	l
	.align 32
	.type	l, @object
	.size	l, 32
l:
	.zero	32
	.text
	.globl	min
	.type	min, @function
min:
.LFB6:
	.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	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	min, .-min
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB7:
	.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	$40, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jne	.L4
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	testl	%eax, %eax
	jle	.L5
	movl	a(%rip), %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movl	b(%rip), %edx
	movl	-44(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, %ecx
	movl	c(%rip), %edx
	movl	-48(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%ecx, %eax
	subl	$30, %eax
	jmp	.L6
.L5:
	movl	$536870912, %eax
	jmp	.L6
.L4:
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %ecx
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	call	dfs
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	call	dfs
	addl	$10, %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%edx, %ecx
	movl	%esi, %edx
	movl	%eax, %esi
	call	dfs
	addl	$10, %eax
	movl	%eax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-48(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-36(%rbp), %eax
	leal	1(%rax), %edi
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	call	dfs
	addl	$10, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, %ebx
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%ebx, %esi
	movl	%eax, %edi
	call	min
.L6:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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
	leaq	c(%rip), %r8
	leaq	b(%rip), %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4(%rbp)
	jmp	.L8
.L9:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4(%rbp)
.L8:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L9
	movl	$0, %ecx
	movl	$0, %edx
	movl	$0, %esi
	movl	$0, %edi
	call	dfs
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
