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

```c
n,U,c[20],R[20],a,i;S(k,s,A,m,b){b=s<U;b&k<n&&S(k+1,s,A,m)+S(k+1,s+c[k],A|1<<k,m+1);for(i=n*!b;i--;)b|=A&1<<i&&A&R[i]^R[i];m<a*!b?a=m:0;}main(k,t){for(;scanf("%d%d",&n,&U)*n;S(0,0,0,0),printf("%d\n",a))for(a=i=n;i--;)for(R[i]=!scanf("%d%d",c+i,&k);k--;R[i]|=1<<n-1-t)scanf("%d",&t);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	U
	.align 4
	.type	U, @object
	.size	U, 4
U:
	.zero	4
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 80
c:
	.zero	80
	.globl	R
	.align 32
	.type	R, @object
	.size	R, 80
R:
	.zero	80
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.text
	.globl	S
	.type	S, @function
S:
.LFB0:
	.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -36(%rbp)
	movl	U(%rip), %eax
	cmpl	%eax, -24(%rbp)
	setl	%al
	movzbl	%al, %eax
	movl	%eax, -36(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	setl	%al
	movzbl	%al, %eax
	andl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L3
	movl	-20(%rbp), %eax
	leal	1(%rax), %edi
	movl	-32(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	movl	$0, %eax
	call	S
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %ecx
	sall	%cl, %esi
	movl	%esi, %eax
	orl	-28(%rbp), %eax
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	c(%rip), %rcx
	movl	(%rsi,%rcx), %esi
	movl	-24(%rbp), %ecx
	addl	%ecx, %esi
	movl	-20(%rbp), %ecx
	leal	1(%rcx), %edi
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %eax
	call	S
	addl	%ebx, %eax
	testl	%eax, %eax
.L3:
	cmpl	$0, -36(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	movl	%eax, i(%rip)
	jmp	.L4
.L7:
	movl	i(%rip), %eax
	movl	-28(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-28(%rbp), %eax
	notl	%eax
	movl	%eax, %ecx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	%ecx, %eax
	testl	%eax, %eax
	je	.L5
	movl	$1, %eax
	jmp	.L6
.L5:
	movl	$0, %eax
.L6:
	orl	%eax, -36(%rbp)
.L4:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L7
	cmpl	$0, -36(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	a(%rip), %eax
	imull	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jge	.L9
	movl	-32(%rbp), %eax
	movl	%eax, a(%rip)
.L9:
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	S, .-S
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	jmp	.L11
.L16:
	movl	n(%rip), %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	movl	%eax, a(%rip)
	jmp	.L12
.L15:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	leaq	-4(%rbp), %rax
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	testl	%eax, %eax
	sete	%al
	movl	i(%rip), %edx
	movzbl	%al, %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	R(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L14:
	leaq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	-8(%rbp), %ecx
	subl	%ecx, %eax
	movl	$1, %esi
	movl	%eax, %ecx
	sall	%cl, %esi
	movl	%esi, %ecx
	movl	i(%rip), %eax
	orl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4(%rbp)
	testl	%eax, %eax
	jne	.L14
.L12:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L15
	movl	$0, %ecx
	movl	$0, %edx
	movl	$0, %esi
	movl	$0, %edi
	movl	$0, %eax
	call	S
	movl	a(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	leaq	U(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	S
	.type	S, @function
S:
.LFB0:
	.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
	movl	%esi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%ecx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	U(%rip), %r14d
	movslq	n(%rip), %rdx
	cmpl	%esi, %r14d
	setg	%bl
	setg	%al
	movzbl	%bl, %ebx
	cmpl	%edi, %edx
	jle	.L2
	testb	%al, %al
	jne	.L23
.L2:
	xorl	%eax, %eax
	cmpl	%r13d, %r14d
	cmovg	%rax, %rdx
	leal	-1(%rdx), %eax
	movl	%eax, i(%rip)
	testl	%edx, %edx
	je	.L3
	movslq	%eax, %rcx
	subq	$2, %rdx
	movl	%eax, %eax
	movl	%ebp, %r8d
	subq	%rax, %rdx
	notl	%r8d
	leaq	R(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%ebp, %eax
	sarl	%cl, %eax
	andl	$1, %eax
	je	.L4
	movl	%r8d, %esi
	andl	(%rdi,%rcx,4), %esi
	cmovne	%eax, %ebx
.L4:
	subq	$1, %rcx
	cmpq	%rcx, %rdx
	jne	.L5
	movl	$-1, i(%rip)
.L3:
	xorl	$1, %ebx
	imull	a(%rip), %ebx
	cmpl	%r12d, %ebx
	jle	.L6
	movl	%r12d, a(%rip)
.L6:
	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
.L23:
	.cfi_restore_state
	movl	%edi, %r15d
	movl	%ebp, %edx
	leal	1(%rdi), %edi
	xorl	%eax, %eax
	movl	%edi, 12(%rsp)
	call	S
	movslq	%r15d, %rax
	movl	%ebp, %edx
	leal	1(%r12), %ecx
	leaq	c(%rip), %rsi
	btsl	%r15d, %edx
	movl	(%rsi,%rax,4), %edi
	xorl	%eax, %eax
	addl	%r13d, %edi
	movl	%edi, %esi
	movl	12(%rsp), %edi
	call	S
	movslq	n(%rip), %rdx
	jmp	.L2
	.cfi_endproc
.LFE0:
	.size	S, .-S
	.p2align 4
	.type	S.constprop.0.isra.0, @function
S.constprop.0.isra.0:
.LFB3:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	U(%rip), %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movslq	%edi, %rbx
	cmpl	%ebx, n(%rip)
	jle	.L25
	testl	%ebp, %ebp
	jg	.L34
.L25:
	movl	$-1, i(%rip)
	xorl	%eax, %eax
	testl	%ebp, %ebp
	cmovle	a(%rip), %eax
	testl	%eax, %eax
	jle	.L24
	movl	$0, a(%rip)
.L24:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L34:
	.cfi_restore_state
	leal	1(%rbx), %r12d
	xorl	%eax, %eax
	movl	%r12d, %edi
	call	S.constprop.0.isra.0
	movl	%ebx, %ecx
	movl	$1, %edx
	movl	%r12d, %edi
	leaq	c(%rip), %rax
	sall	%cl, %edx
	movl	$1, %ecx
	movl	(%rax,%rbx,4), %esi
	xorl	%eax, %eax
	call	S
	jmp	.L25
	.cfi_endproc
.LFE3:
	.size	S.constprop.0.isra.0, .-S.constprop.0.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC2(%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	R(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edi, 12(%rsp)
	movl	%esi, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L36:
	leaq	U(%rip), %rdx
	leaq	n(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L50
	leal	-1(%rdx), %eax
	movl	%edx, a(%rip)
	leaq	12(%rsp), %r15
	movl	%eax, i(%rip)
	testl	%edx, %edx
	je	.L40
	.p2align 4,,10
	.p2align 3
.L37:
	cltq
	leaq	c(%rip), %rdx
	movq	%r14, %rdi
	leaq	(%rdx,%rax,4), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	call	scanf@PLT
	xorl	%ecx, %ecx
	movl	%eax, %r8d
	movslq	i(%rip), %rax
	testl	%r8d, %r8d
	sete	%cl
	movq	%rax, %rdx
	movl	%ecx, (%rbx,%rax,4)
	movl	12(%rsp), %eax
	leal	-1(%rax), %ecx
	movl	%ecx, 12(%rsp)
	testl	%eax, %eax
	je	.L38
	leaq	8(%rsp), %r12
	movl	$1, %ebp
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	n(%rip), %esi
	movslq	i(%rip), %rax
	movl	%ebp, %edi
	leal	-1(%rsi), %ecx
	subl	8(%rsp), %ecx
	movq	%rax, %rdx
	sall	%cl, %edi
	orl	%edi, (%rbx,%rax,4)
	movl	12(%rsp), %eax
	leal	-1(%rax), %ecx
	movl	%ecx, 12(%rsp)
	testl	%eax, %eax
	jne	.L39
.L38:
	leal	-1(%rdx), %eax
	movl	%eax, i(%rip)
	testl	%edx, %edx
	jne	.L37
.L40:
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	S.constprop.0.isra.0
	movl	a(%rip), %esi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L36
.L50:
	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
.LFE1:
	.size	main, .-main
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	R
	.align 32
	.type	R, @object
	.size	R, 80
R:
	.zero	80
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 80
c:
	.zero	80
	.globl	U
	.align 4
	.type	U, @object
	.size	U, 4
U:
	.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	S
	.type	S, @function
S:
.LFB0:
	.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
	movl	%esi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%ecx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	U(%rip), %r14d
	movslq	n(%rip), %rdx
	cmpl	%esi, %r14d
	setg	%bl
	setg	%al
	movzbl	%bl, %ebx
	cmpl	%edi, %edx
	jle	.L2
	testb	%al, %al
	jne	.L23
.L2:
	xorl	%eax, %eax
	cmpl	%r13d, %r14d
	cmovg	%rax, %rdx
	leal	-1(%rdx), %eax
	movl	%eax, i(%rip)
	testl	%edx, %edx
	je	.L3
	movslq	%eax, %rcx
	subq	$2, %rdx
	movl	%eax, %eax
	movl	%ebp, %r8d
	subq	%rax, %rdx
	notl	%r8d
	leaq	R(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%ebp, %eax
	sarl	%cl, %eax
	andl	$1, %eax
	je	.L4
	movl	%r8d, %esi
	andl	(%rdi,%rcx,4), %esi
	cmovne	%eax, %ebx
.L4:
	subq	$1, %rcx
	cmpq	%rcx, %rdx
	jne	.L5
	movl	$-1, i(%rip)
.L3:
	xorl	$1, %ebx
	imull	a(%rip), %ebx
	cmpl	%r12d, %ebx
	jle	.L6
	movl	%r12d, a(%rip)
.L6:
	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
.L23:
	.cfi_restore_state
	movl	%edi, %r15d
	movl	%ebp, %edx
	leal	1(%rdi), %edi
	xorl	%eax, %eax
	movl	%edi, 12(%rsp)
	call	S
	movslq	%r15d, %rax
	movl	%ebp, %edx
	leal	1(%r12), %ecx
	leaq	c(%rip), %rsi
	btsl	%r15d, %edx
	movl	(%rsi,%rax,4), %edi
	xorl	%eax, %eax
	addl	%r13d, %edi
	movl	%edi, %esi
	movl	12(%rsp), %edi
	call	S
	movslq	n(%rip), %rdx
	jmp	.L2
	.cfi_endproc
.LFE0:
	.size	S, .-S
	.p2align 4
	.type	S.constprop.0.isra.0, @function
S.constprop.0.isra.0:
.LFB3:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	U(%rip), %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movslq	%edi, %rbx
	cmpl	%ebx, n(%rip)
	jle	.L25
	testl	%ebp, %ebp
	jg	.L34
.L25:
	movl	$-1, i(%rip)
	xorl	%eax, %eax
	testl	%ebp, %ebp
	cmovle	a(%rip), %eax
	testl	%eax, %eax
	jle	.L24
	movl	$0, a(%rip)
.L24:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L34:
	.cfi_restore_state
	leal	1(%rbx), %r12d
	xorl	%eax, %eax
	movl	%r12d, %edi
	call	S.constprop.0.isra.0
	movl	%ebx, %ecx
	movl	$1, %edx
	movl	%r12d, %edi
	leaq	c(%rip), %rax
	sall	%cl, %edx
	movl	$1, %ecx
	movl	(%rax,%rbx,4), %esi
	xorl	%eax, %eax
	call	S
	jmp	.L25
	.cfi_endproc
.LFE3:
	.size	S.constprop.0.isra.0, .-S.constprop.0.isra.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC2(%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	R(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edi, 12(%rsp)
	movl	%esi, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L36:
	leaq	U(%rip), %rdx
	leaq	n(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L50
	leal	-1(%rdx), %eax
	movl	%edx, a(%rip)
	leaq	12(%rsp), %r15
	movl	%eax, i(%rip)
	testl	%edx, %edx
	je	.L40
	.p2align 4,,10
	.p2align 3
.L37:
	cltq
	leaq	c(%rip), %rdx
	movq	%r14, %rdi
	leaq	(%rdx,%rax,4), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	call	scanf@PLT
	xorl	%ecx, %ecx
	movl	%eax, %r8d
	movslq	i(%rip), %rax
	testl	%r8d, %r8d
	sete	%cl
	movq	%rax, %rdx
	movl	%ecx, (%rbx,%rax,4)
	movl	12(%rsp), %eax
	leal	-1(%rax), %ecx
	movl	%ecx, 12(%rsp)
	testl	%eax, %eax
	je	.L38
	leaq	8(%rsp), %r12
	movl	$1, %ebp
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	n(%rip), %esi
	movslq	i(%rip), %rax
	movl	%ebp, %edi
	leal	-1(%rsi), %ecx
	subl	8(%rsp), %ecx
	movq	%rax, %rdx
	sall	%cl, %edi
	orl	%edi, (%rbx,%rax,4)
	movl	12(%rsp), %eax
	leal	-1(%rax), %ecx
	movl	%ecx, 12(%rsp)
	testl	%eax, %eax
	jne	.L39
.L38:
	leal	-1(%rdx), %eax
	movl	%eax, i(%rip)
	testl	%edx, %edx
	jne	.L37
.L40:
	xorl	%edi, %edi
	xorl	%eax, %eax
	call	S.constprop.0.isra.0
	movl	a(%rip), %esi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L36
.L50:
	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
.LFE1:
	.size	main, .-main
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	R
	.align 32
	.type	R, @object
	.size	R, 80
R:
	.zero	80
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 80
c:
	.zero	80
	.globl	U
	.align 4
	.type	U, @object
	.size	U, 4
U:
	.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:

n,U,c[20],R[20],a,i;S(k,s,A,m,b){b=s<U;b&k<n&&S(k+1,s,A,m)+S(k+1,s+c[k],A|1<<k,m+1);for(i=n*!b;i--;)b|=A&1<<i&&A&R[i]^R[i];m<a*!b?a=m:0;}main(k,t){for(;scanf("%d%d",&n,&U)*n;S(0,0,0,0),printf("%d\n",a))for(a=i=n;i--;)for(R[i]=!scanf("%d%d",c+i,&k);k--;R[i]|=1<<n-1-t)scanf("%d",&t);}
4 4
1 0
3 2 0 2
2 0
2 0
3 1
1 0
3 2 0 2
2 0
0 0
 4 4
1 0
3 2 0 2
2 0
0 0
3 1
1 0
3 2 0 2
2 0
0 0
 4 4
1 0
3 2 0 2
2 0
2 0
3 6
1 0
3 2 0 2
4 0
0 0
 4 4
1 0
3 2 0 2
4 0
0 0
3 1
1 0
3 2 0 2
2 0
0 0
 4 4
2 0
3 0 -1 2
2 1
0 0
3 2
1 0
3 2 0 2
1 0
0 0
 4 4
1 0
3 0 1 0
2 0
0 0
3 1
1 0
3 2 0 2
2 0
0 0
 4 4
1 0
3 2 0 2
2 0
2 0
3 1
1 0
3 2 1 2
2 0
0 0
 4 4
1 0
3 0 0 2
2 0
0 0
3 1
1 0
3 2 0 2
2 0
0 0
 4 4
1 0
3 0 1 2
2 0
0 0
3 1
1 0
3 2 0 2
2 0
0 0
 4 4
1 0
3 0 1 2
2 0
-1 0
3 1
1 0
3 2 0 2
2 0
0 0

2
1
 4
1
 2
3
 1
1
 2
2
 2
 2
1
 2
1
 2
1
 2
1

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

```c
n,U,c[20],R[20],a,i;S(k,s,A,m,b){b=s<U;b&k<n&&S(k+1,s,A,m)+S(k+1,s+c[k],A|1<<k,m+1);for(i=n*!b;i--;)b|=A&1<<i&&A&R[i]^R[i];m<a*!b?a=m:0;}main(k,t){for(;scanf("%d%d",&n,&U)*n;S(0,0,0,0),printf("%d\n",a))for(a=i=n;i--;)for(R[i]=!scanf("%d%d",c+i,&k);k--;R[i]|=1<<n-1-t)scanf("%d",&t);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	U
	.align 4
	.type	U, @object
	.size	U, 4
U:
	.zero	4
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 80
c:
	.zero	80
	.globl	R
	.align 32
	.type	R, @object
	.size	R, 80
R:
	.zero	80
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.text
	.globl	S
	.type	S, @function
S:
.LFB0:
	.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -36(%rbp)
	movl	U(%rip), %eax
	cmpl	%eax, -24(%rbp)
	setl	%al
	movzbl	%al, %eax
	movl	%eax, -36(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	setl	%al
	movzbl	%al, %eax
	andl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L3
	movl	-20(%rbp), %eax
	leal	1(%rax), %edi
	movl	-32(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	movl	$0, %eax
	call	S
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %ecx
	sall	%cl, %esi
	movl	%esi, %eax
	orl	-28(%rbp), %eax
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	c(%rip), %rcx
	movl	(%rsi,%rcx), %esi
	movl	-24(%rbp), %ecx
	addl	%ecx, %esi
	movl	-20(%rbp), %ecx
	leal	1(%rcx), %edi
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %eax
	call	S
	addl	%ebx, %eax
	testl	%eax, %eax
.L3:
	cmpl	$0, -36(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	movl	%eax, i(%rip)
	jmp	.L4
.L7:
	movl	i(%rip), %eax
	movl	-28(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-28(%rbp), %eax
	notl	%eax
	movl	%eax, %ecx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	%ecx, %eax
	testl	%eax, %eax
	je	.L5
	movl	$1, %eax
	jmp	.L6
.L5:
	movl	$0, %eax
.L6:
	orl	%eax, -36(%rbp)
.L4:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L7
	cmpl	$0, -36(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	a(%rip), %eax
	imull	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jge	.L9
	movl	-32(%rbp), %eax
	movl	%eax, a(%rip)
.L9:
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	S, .-S
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	jmp	.L11
.L16:
	movl	n(%rip), %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	movl	%eax, a(%rip)
	jmp	.L12
.L15:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	leaq	-4(%rbp), %rax
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	testl	%eax, %eax
	sete	%al
	movl	i(%rip), %edx
	movzbl	%al, %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	R(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L14:
	leaq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	-8(%rbp), %ecx
	subl	%ecx, %eax
	movl	$1, %esi
	movl	%eax, %ecx
	sall	%cl, %esi
	movl	%esi, %ecx
	movl	i(%rip), %eax
	orl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4(%rbp)
	testl	%eax, %eax
	jne	.L14
.L12:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L15
	movl	$0, %ecx
	movl	$0, %edx
	movl	$0, %esi
	movl	$0, %edi
	movl	$0, %eax
	call	S
	movl	a(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	leaq	U(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	U
	.align 4
	.type	U, @object
	.size	U, 4
U:
	.zero	4
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 80
c:
	.zero	80
	.globl	R
	.align 32
	.type	R, @object
	.size	R, 80
R:
	.zero	80
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.text
	.globl	S
	.type	S, @function
S:
.LFB0:
	.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -36(%rbp)
	movl	U(%rip), %eax
	cmpl	%eax, -24(%rbp)
	setl	%al
	movzbl	%al, %eax
	movl	%eax, -36(%rbp)
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	setl	%al
	movzbl	%al, %eax
	andl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L3
	movl	-20(%rbp), %eax
	leal	1(%rax), %edi
	movl	-32(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	movl	$0, %eax
	call	S
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %ecx
	sall	%cl, %esi
	movl	%esi, %eax
	orl	-28(%rbp), %eax
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	c(%rip), %rcx
	movl	(%rsi,%rcx), %esi
	movl	-24(%rbp), %ecx
	addl	%ecx, %esi
	movl	-20(%rbp), %ecx
	leal	1(%rcx), %edi
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %eax
	call	S
	addl	%ebx, %eax
	testl	%eax, %eax
.L3:
	cmpl	$0, -36(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	movl	%eax, i(%rip)
	jmp	.L4
.L7:
	movl	i(%rip), %eax
	movl	-28(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-28(%rbp), %eax
	notl	%eax
	movl	%eax, %ecx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	%ecx, %eax
	testl	%eax, %eax
	je	.L5
	movl	$1, %eax
	jmp	.L6
.L5:
	movl	$0, %eax
.L6:
	orl	%eax, -36(%rbp)
.L4:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L7
	cmpl	$0, -36(%rbp)
	sete	%al
	movzbl	%al, %edx
	movl	a(%rip), %eax
	imull	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jge	.L9
	movl	-32(%rbp), %eax
	movl	%eax, a(%rip)
.L9:
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	S, .-S
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	jmp	.L11
.L16:
	movl	n(%rip), %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	movl	%eax, a(%rip)
	jmp	.L12
.L15:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	leaq	-4(%rbp), %rax
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	testl	%eax, %eax
	sete	%al
	movl	i(%rip), %edx
	movzbl	%al, %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	R(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L14:
	leaq	-8(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	-8(%rbp), %ecx
	subl	%ecx, %eax
	movl	$1, %esi
	movl	%eax, %ecx
	sall	%cl, %esi
	movl	%esi, %ecx
	movl	i(%rip), %eax
	orl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	R(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4(%rbp)
	testl	%eax, %eax
	jne	.L14
.L12:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L15
	movl	$0, %ecx
	movl	$0, %edx
	movl	$0, %esi
	movl	$0, %edi
	movl	$0, %eax
	call	S
	movl	a(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	leaq	U(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
