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

```c
s[2],a[20];main(i,j,n,N,m){for(;scanf("%d",&n),n;printf("%d\n",m)){for(i=0;i<n;i++)scanf("%d",a+i);for(i=0,m=99999,N=1<<n;i<N;j=abs(*s-s[1]),m=m<j?m:j,i++)for(*s=s[1]=j=0;j<n;j++)s[(i>>j)&1]+=a[j];}exit(0);}```

Assembly Code:

```assembly
	.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:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	a(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	s(%rip), %r13
	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
	leaq	.LC0(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edx, 12(%rsp)
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %edi
	testl	%edi, %edi
	je	.L8
	leaq	a(%rip), %r12
	movl	$0, %r14d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	scanf@PLT
	movl	12(%rsp), %edi
	addq	$4, %r12
	cmpl	%r14d, %edi
	jg	.L3
.L10:
	movl	$1, %r9d
	movl	%edi, %ecx
	movl	$99999, %r8d
	sall	%cl, %r9d
	testl	%r9d, %r9d
	jle	.L4
	xorl	%r14d, %r14d
	movslq	%edi, %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	$0, s(%rip)
	testl	%edi, %edi
	jle	.L12
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%r14d, %eax
	movl	(%r15,%rcx,4), %edx
	sarl	%cl, %eax
	addq	$1, %rcx
	andl	$1, %eax
	addl	%edx, 0(%r13,%rax,4)
	cmpq	%rcx, %rsi
	jne	.L6
	movl	0(%r13), %eax
	subl	4+s(%rip), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
.L5:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %r14d
	cmpl	%r14d, %r9d
	jne	.L7
.L4:
	movl	%r8d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	jmp	.L5
.L8:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	s
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.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.
Optimized Assembly Code:

user
```assembly
	.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:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	a(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	s(%rip), %r13
	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
	leaq	.LC0(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edx, 12(%rsp)
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %edi
	testl	%edi, %edi
	je	.L8
	leaq	a(%rip), %r12
	movl	$0, %r14d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	scanf@PLT
	movl	12(%rsp), %edi
	addq	$4, %r12
	cmpl	%r14d, %edi
	jg	.L3
.L10:
	movl	$1, %r9d
	movl	%edi, %ecx
	movl	$99999, %r8d
	sall	%cl, %r9d
	testl	%r9d, %r9d
	jle	.L4
	xorl	%r14d, %r14d
	movslq	%edi, %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	$0, s(%rip)
	testl	%edi, %edi
	jle	.L12
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%r14d, %eax
	movl	(%r15,%rcx,4), %edx
	sarl	%cl, %eax
	addq	$1, %rcx
	andl	$1, %eax
	addl	%edx, 0(%r13,%rax,4)
	cmpq	%rcx, %rsi
	jne	.L6
	movl	0(%r13), %eax
	subl	4+s(%rip), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
.L5:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %r14d
	cmpl	%r14d, %r9d
	jne	.L7
.L4:
	movl	%r8d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	jmp	.L5
.L8:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	s
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.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
```assembly
	.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:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	a(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	s(%rip), %r13
	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
	leaq	.LC0(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edx, 12(%rsp)
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %edi
	testl	%edi, %edi
	je	.L8
	leaq	a(%rip), %r12
	movl	$0, %r14d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	scanf@PLT
	movl	12(%rsp), %edi
	addq	$4, %r12
	cmpl	%r14d, %edi
	jg	.L3
.L10:
	movl	$1, %r9d
	movl	%edi, %ecx
	movl	$99999, %r8d
	sall	%cl, %r9d
	testl	%r9d, %r9d
	jle	.L4
	xorl	%r14d, %r14d
	movslq	%edi, %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	$0, s(%rip)
	testl	%edi, %edi
	jle	.L12
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%r14d, %eax
	movl	(%r15,%rcx,4), %edx
	sarl	%cl, %eax
	addq	$1, %rcx
	andl	$1, %eax
	addl	%edx, 0(%r13,%rax,4)
	cmpq	%rcx, %rsi
	jne	.L6
	movl	0(%r13), %eax
	subl	4+s(%rip), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
.L5:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %r14d
	cmpl	%r14d, %r9d
	jne	.L7
.L4:
	movl	%r8d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	jmp	.L5
.L8:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	s
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.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:
```
```c
s[2],a[20];main(i,j,n,N,m){for(;scanf("%d",&n),n;printf("%d\n",m)){for(i=0;i<n;i++)scanf("%d",a+i);for(i=0,m=99999,N=1<<n;i<N;j=abs(*s-s[1]),m=m<j?m:j,i++)for(*s=s[1]=j=0;j<n;j++)s[(i>>j)&1]+=a[j];}exit(0);}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
s[2],a[20];main(i,j,n,N,m){for(;scanf("%d",&n),n;printf("%d\n",m)){for(i=0;i<n;i++)scanf("%d",a+i);for(i=0,m=99999,N=1<<n;i<N;j=abs(*s-s[1]),m=m<j?m:j,i++)for(*s=s[1]=j=0;j<n;j++)s[(i>>j)&1]+=a[j];}exit(0);}```

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.
Optimized Assembly Code:

5
1 2 3 4 5
4
2 3 5 10
0
 5
1 2 3 4 5
4
1 3 5 10
0
 5
1 2 3 4 5
4
1 3 4 10
0
 5
1 3 3 4 5
4
2 3 5 7
0
 5
1 2 3 4 4
4
1 3 4 10
0
 5
1 3 3 4 5
4
2 3 5 10
0
 5
1 2 3 4 5
4
0 3 5 11
0

1
0
 1
1
 1
2
 0
1
 0
2
 0
0
 1
3

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

```c
s[2],a[20];main(i,j,n,N,m){for(;scanf("%d",&n),n;printf("%d\n",m)){for(i=0;i<n;i++)scanf("%d",a+i);for(i=0,m=99999,N=1<<n;i<N;j=abs(*s-s[1]),m=m<j?m:j,i++)for(*s=s[1]=j=0;j<n;j++)s[(i>>j)&1]+=a[j];}exit(0);}```

Assembly Code:

```assembly
	.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:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	a(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	s(%rip), %r13
	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
	leaq	.LC0(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edx, 12(%rsp)
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %edi
	testl	%edi, %edi
	je	.L8
	leaq	a(%rip), %r12
	movl	$0, %r14d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	scanf@PLT
	movl	12(%rsp), %edi
	addq	$4, %r12
	cmpl	%r14d, %edi
	jg	.L3
.L10:
	movl	$1, %r9d
	movl	%edi, %ecx
	movl	$99999, %r8d
	sall	%cl, %r9d
	testl	%r9d, %r9d
	jle	.L4
	xorl	%r14d, %r14d
	movslq	%edi, %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	$0, s(%rip)
	testl	%edi, %edi
	jle	.L12
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%r14d, %eax
	movl	(%r15,%rcx,4), %edx
	sarl	%cl, %eax
	addq	$1, %rcx
	andl	$1, %eax
	addl	%edx, 0(%r13,%rax,4)
	cmpq	%rcx, %rsi
	jne	.L6
	movl	0(%r13), %eax
	subl	4+s(%rip), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
.L5:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %r14d
	cmpl	%r14d, %r9d
	jne	.L7
.L4:
	movl	%r8d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	jmp	.L5
.L8:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	s
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.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.
Optimized Assembly Code:

train
```assembly
	.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:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	a(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	s(%rip), %r13
	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
	leaq	.LC0(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edx, 12(%rsp)
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %edi
	testl	%edi, %edi
	je	.L8
	leaq	a(%rip), %r12
	movl	$0, %r14d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	scanf@PLT
	movl	12(%rsp), %edi
	addq	$4, %r12
	cmpl	%r14d, %edi
	jg	.L3
.L10:
	movl	$1, %r9d
	movl	%edi, %ecx
	movl	$99999, %r8d
	sall	%cl, %r9d
	testl	%r9d, %r9d
	jle	.L4
	xorl	%r14d, %r14d
	movslq	%edi, %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	$0, s(%rip)
	testl	%edi, %edi
	jle	.L12
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%r14d, %eax
	movl	(%r15,%rcx,4), %edx
	sarl	%cl, %eax
	addq	$1, %rcx
	andl	$1, %eax
	addl	%edx, 0(%r13,%rax,4)
	cmpq	%rcx, %rsi
	jne	.L6
	movl	0(%r13), %eax
	subl	4+s(%rip), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
.L5:
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %r14d
	cmpl	%r14d, %r9d
	jne	.L7
.L4:
	movl	%r8d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	jmp	.L5
.L8:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	s
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.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:
```