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 i, N, W, w[101], v[101], sum = 0;
	scanf("%d %d", &N, &W);
	for (i = 1; i <= N; i++) {
		scanf("%d %d", &(w[i]), &(v[i]));
		sum += v[i];
	}

	int j, dp[100001];
	for (i = 1, dp[0] = 0; i <= sum; i++) dp[i] = W + 1;
	for (i = 1; i <= N; i++) {
		for (j = sum; j >= v[i]; j--) if (dp[j-v[i]] + w[i] < dp[j]) dp[j] = dp[j-v[i]] + w[i];
	}
	for (j = sum; j >= 0; j--) if (dp[j] <= W) break;
	printf("%d\n", j);
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3568, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -400856(%rbp)
	leaq	-400864(%rbp), %rdx
	leaq	-400868(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -400860(%rbp)
	jmp	.L2
.L3:
	leaq	-400432(%rbp), %rdx
	movl	-400860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-400848(%rbp), %rcx
	movl	-400860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %eax
	addl	%eax, -400856(%rbp)
	addl	$1, -400860(%rbp)
.L2:
	movl	-400868(%rbp), %eax
	cmpl	%eax, -400860(%rbp)
	jle	.L3
	movl	$1, -400860(%rbp)
	movl	$0, -400016(%rbp)
	jmp	.L4
.L5:
	movl	-400864(%rbp), %eax
	leal	1(%rax), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400860(%rbp)
.L4:
	movl	-400860(%rbp), %eax
	cmpl	-400856(%rbp), %eax
	jle	.L5
	movl	$1, -400860(%rbp)
	jmp	.L6
.L10:
	movl	-400856(%rbp), %eax
	movl	%eax, -400852(%rbp)
	jmp	.L7
.L9:
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %edx
	movl	-400852(%rbp), %eax
	subl	%edx, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	-400848(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-400852(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %edx
	movl	-400852(%rbp), %eax
	subl	%edx, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	-400848(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-400852(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
.L8:
	subl	$1, -400852(%rbp)
.L7:
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %eax
	cmpl	%eax, -400852(%rbp)
	jge	.L9
	addl	$1, -400860(%rbp)
.L6:
	movl	-400868(%rbp), %eax
	cmpl	%eax, -400860(%rbp)
	jle	.L10
	movl	-400856(%rbp), %eax
	movl	%eax, -400852(%rbp)
	jmp	.L11
.L14:
	movl	-400852(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400864(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L17
	subl	$1, -400852(%rbp)
.L11:
	cmpl	$0, -400852(%rbp)
	jns	.L14
	jmp	.L13
.L17:
	nop
.L13:
	movl	-400852(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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 %d"
.LC1:
	.string	"%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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	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	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3576, %rsp
	.cfi_def_cfa_offset 400944
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400872(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	movl	$1, %r14d
	xorl	%r12d, %r12d
	leaq	32(%rsp), %rbx
	leaq	448(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(,%r14,4), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	leaq	0(%rbp,%rsi), %rdx
	addq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movl	0(%rbp,%r14,4), %r8d
	movl	24(%rsp), %r10d
	addq	$1, %r14
	addl	%r12d, %r8d
	movl	%r8d, %r12d
	cmpl	%r14d, %r10d
	jge	.L3
	movl	$0, 864(%rsp)
	testl	%r8d, %r8d
	jle	.L6
	movl	28(%rsp), %eax
	leal	1(%rax), %ecx
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r8d, %edx
	movd	%ecx, %xmm7
	leaq	868(%rsp), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	884(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L8:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L8
	movl	%r8d, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%edx, %r8d
	je	.L9
.L7:
	movslq	%eax, %rdx
	movl	%ecx, 864(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r8d
	jl	.L9
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	%ecx, 864(%rsp,%rdx,4)
	cmpl	%eax, %r8d
	jl	.L9
	cltq
	movl	%ecx, 864(%rsp,%rax,4)
.L9:
	testl	%r10d, %r10d
	jle	.L5
.L21:
	movslq	%r8d, %r11
	leaq	864(%rsp), %r13
	movl	%r12d, 12(%rsp)
	movl	$1, %r9d
	leaq	0(,%r11,4), %rax
	leaq	852(%rsp,%rax), %rcx
	addq	%r13, %rax
	movq	%rax, (%rsp)
	subq	$4, %rax
	movq	%rax, %r12
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%r9,4), %r14d
	cmpl	%r14d, %r8d
	jl	.L18
	movslq	%r14d, %rax
	movl	%r8d, %esi
	movl	(%rbx,%r9,4), %edi
	leaq	12(,%rax,4), %rdx
	subl	%r14d, %esi
	cmpq	$8, %rdx
	jbe	.L12
	cmpl	$2, %esi
	jbe	.L12
	movq	%r11, %rdx
	addl	$1, %esi
	movd	%edi, %xmm6
	subq	%rax, %rdx
	pshufd	$0, %xmm6, %xmm3
	xorl	%eax, %eax
	leaq	-12(%r13,%rdx,4), %r15
	movl	%esi, %edx
	shrl	$2, %edx
	negq	%rdx
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%r15,%rax), %xmm4
	movdqu	(%rcx,%rax), %xmm5
	pshufd	$27, %xmm4, %xmm2
	pshufd	$27, %xmm5, %xmm1
	paddd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	pshufd	$27, %xmm0, %xmm0
	movups	%xmm0, (%rcx,%rax)
	subq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L13
	movl	%esi, %edx
	movl	%r8d, %eax
	andl	$-4, %edx
	subl	%edx, %eax
	cmpl	%edx, %esi
	je	.L18
	movl	%eax, %edx
	movslq	%eax, %rsi
	subl	%r14d, %edx
	movslq	%edx, %rdx
	movl	864(%rsp,%rdx,4), %r15d
	addl	%edi, %r15d
	movl	%r15d, %edx
	movl	864(%rsp,%rsi,4), %r15d
	cmpl	%r15d, %edx
	cmovg	%r15d, %edx
	movl	%edx, 864(%rsp,%rsi,4)
	leal	-1(%rax), %edx
	cmpl	%r14d, %edx
	jl	.L18
	movslq	%edx, %rsi
	subl	%r14d, %edx
	movslq	%edx, %rdx
	movl	864(%rsp,%rdx,4), %r15d
	addl	%edi, %r15d
	movl	%r15d, %edx
	movl	864(%rsp,%rsi,4), %r15d
	cmpl	%r15d, %edx
	cmovg	%r15d, %edx
	subl	$2, %eax
	movl	%edx, 864(%rsp,%rsi,4)
	cmpl	%eax, %r14d
	jg	.L18
	movslq	%eax, %rdx
	subl	%r14d, %eax
	cltq
	addl	864(%rsp,%rax,4), %edi
	movl	864(%rsp,%rdx,4), %eax
	cmpl	%eax, %edi
	cmovg	%eax, %edi
	movl	%edi, 864(%rsp,%rdx,4)
.L18:
	addq	$1, %r9
	cmpl	%r9d, %r10d
	jge	.L11
	movl	12(%rsp), %r12d
.L10:
	testl	%r8d, %r8d
	js	.L19
.L5:
	movslq	%r12d, %rax
	movl	28(%rsp), %edx
	leaq	864(%rsp,%rax,4), %rax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L41:
	subl	$1, %r12d
	subq	$4, %rax
	cmpl	$-1, %r12d
	je	.L19
.L20:
	cmpl	%edx, (%rax)
	jg	.L41
.L19:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r12d, %edx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	400872(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L42
	addq	$400888, %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
.L12:
	.cfi_restore_state
	salq	$2, %rsi
	movq	%r12, %r15
	movq	(%rsp), %rax
	subq	%rsi, %r15
	movl	%r8d, %esi
	subl	%r14d, %esi
	movslq	%esi, %rsi
	subq	%r11, %rsi
.L15:
	movl	(%rax,%rsi,4), %edx
	movl	(%rax), %r14d
	addl	%edi, %edx
	cmpl	%r14d, %edx
	cmovg	%r14d, %edx
	subq	$4, %rax
	movl	%edx, 4(%rax)
	cmpq	%r15, %rax
	jne	.L15
	jmp	.L18
.L2:
	movl	$0, 864(%rsp)
	xorl	%r12d, %r12d
	jmp	.L5
.L23:
	movl	$1, %eax
	jmp	.L7
.L6:
	testl	%r10d, %r10d
	jg	.L21
	jmp	.L10
.L42:
	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 %d"
.LC1:
	.string	"%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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	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	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3576, %rsp
	.cfi_def_cfa_offset 400944
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400872(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	movl	$1, %r14d
	xorl	%r12d, %r12d
	leaq	32(%rsp), %rbx
	leaq	448(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(,%r14,4), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	leaq	0(%rbp,%rsi), %rdx
	addq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movl	0(%rbp,%r14,4), %r8d
	movl	24(%rsp), %r10d
	addq	$1, %r14
	addl	%r12d, %r8d
	movl	%r8d, %r12d
	cmpl	%r14d, %r10d
	jge	.L3
	movl	$0, 864(%rsp)
	testl	%r8d, %r8d
	jle	.L6
	movl	28(%rsp), %eax
	leal	1(%rax), %ecx
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r8d, %edx
	movd	%ecx, %xmm7
	leaq	868(%rsp), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm7, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	884(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L8:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L8
	movl	%r8d, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%edx, %r8d
	je	.L9
.L7:
	movslq	%eax, %rdx
	movl	%ecx, 864(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r8d
	jl	.L9
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	%ecx, 864(%rsp,%rdx,4)
	cmpl	%eax, %r8d
	jl	.L9
	cltq
	movl	%ecx, 864(%rsp,%rax,4)
.L9:
	testl	%r10d, %r10d
	jle	.L5
.L21:
	movslq	%r8d, %r11
	leaq	864(%rsp), %r13
	movl	%r12d, 12(%rsp)
	movl	$1, %r9d
	leaq	0(,%r11,4), %rax
	leaq	852(%rsp,%rax), %rcx
	addq	%r13, %rax
	movq	%rax, (%rsp)
	subq	$4, %rax
	movq	%rax, %r12
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%r9,4), %r14d
	cmpl	%r14d, %r8d
	jl	.L18
	movslq	%r14d, %rax
	movl	%r8d, %esi
	movl	(%rbx,%r9,4), %edi
	leaq	12(,%rax,4), %rdx
	subl	%r14d, %esi
	cmpq	$8, %rdx
	jbe	.L12
	cmpl	$2, %esi
	jbe	.L12
	movq	%r11, %rdx
	addl	$1, %esi
	movd	%edi, %xmm6
	subq	%rax, %rdx
	pshufd	$0, %xmm6, %xmm3
	xorl	%eax, %eax
	leaq	-12(%r13,%rdx,4), %r15
	movl	%esi, %edx
	shrl	$2, %edx
	negq	%rdx
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%r15,%rax), %xmm4
	movdqu	(%rcx,%rax), %xmm5
	pshufd	$27, %xmm4, %xmm2
	pshufd	$27, %xmm5, %xmm1
	paddd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	pshufd	$27, %xmm0, %xmm0
	movups	%xmm0, (%rcx,%rax)
	subq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L13
	movl	%esi, %edx
	movl	%r8d, %eax
	andl	$-4, %edx
	subl	%edx, %eax
	cmpl	%edx, %esi
	je	.L18
	movl	%eax, %edx
	movslq	%eax, %rsi
	subl	%r14d, %edx
	movslq	%edx, %rdx
	movl	864(%rsp,%rdx,4), %r15d
	addl	%edi, %r15d
	movl	%r15d, %edx
	movl	864(%rsp,%rsi,4), %r15d
	cmpl	%r15d, %edx
	cmovg	%r15d, %edx
	movl	%edx, 864(%rsp,%rsi,4)
	leal	-1(%rax), %edx
	cmpl	%r14d, %edx
	jl	.L18
	movslq	%edx, %rsi
	subl	%r14d, %edx
	movslq	%edx, %rdx
	movl	864(%rsp,%rdx,4), %r15d
	addl	%edi, %r15d
	movl	%r15d, %edx
	movl	864(%rsp,%rsi,4), %r15d
	cmpl	%r15d, %edx
	cmovg	%r15d, %edx
	subl	$2, %eax
	movl	%edx, 864(%rsp,%rsi,4)
	cmpl	%eax, %r14d
	jg	.L18
	movslq	%eax, %rdx
	subl	%r14d, %eax
	cltq
	addl	864(%rsp,%rax,4), %edi
	movl	864(%rsp,%rdx,4), %eax
	cmpl	%eax, %edi
	cmovg	%eax, %edi
	movl	%edi, 864(%rsp,%rdx,4)
.L18:
	addq	$1, %r9
	cmpl	%r9d, %r10d
	jge	.L11
	movl	12(%rsp), %r12d
.L10:
	testl	%r8d, %r8d
	js	.L19
.L5:
	movslq	%r12d, %rax
	movl	28(%rsp), %edx
	leaq	864(%rsp,%rax,4), %rax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L41:
	subl	$1, %r12d
	subq	$4, %rax
	cmpl	$-1, %r12d
	je	.L19
.L20:
	cmpl	%edx, (%rax)
	jg	.L41
.L19:
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r12d, %edx
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	400872(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L42
	addq	$400888, %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
.L12:
	.cfi_restore_state
	salq	$2, %rsi
	movq	%r12, %r15
	movq	(%rsp), %rax
	subq	%rsi, %r15
	movl	%r8d, %esi
	subl	%r14d, %esi
	movslq	%esi, %rsi
	subq	%r11, %rsi
.L15:
	movl	(%rax,%rsi,4), %edx
	movl	(%rax), %r14d
	addl	%edi, %edx
	cmpl	%r14d, %edx
	cmovg	%r14d, %edx
	subq	$4, %rax
	movl	%edx, 4(%rax)
	cmpq	%r15, %rax
	jne	.L15
	jmp	.L18
.L2:
	movl	$0, 864(%rsp)
	xorl	%r12d, %r12d
	jmp	.L5
.L23:
	movl	$1, %eax
	jmp	.L7
.L6:
	testl	%r10d, %r10d
	jg	.L21
	jmp	.L10
.L42:
	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()
{
	int i, N, W, w[101], v[101], sum = 0;
	scanf("%d %d", &N, &W);
	for (i = 1; i <= N; i++) {
		scanf("%d %d", &(w[i]), &(v[i]));
		sum += v[i];
	}

	int j, dp[100001];
	for (i = 1, dp[0] = 0; i <= sum; i++) dp[i] = W + 1;
	for (i = 1; i <= N; i++) {
		for (j = sum; j >= v[i]; j--) if (dp[j-v[i]] + w[i] < dp[j]) dp[j] = dp[j-v[i]] + w[i];
	}
	for (j = sum; j >= 0; j--) if (dp[j] <= W) break;
	printf("%d\n", j);
	fflush(stdout);
	return 0;
}
1 1000000000
0000000000 10
 6 15
6 5
5 6
3 4
6 6
3 5
7 2
 3 8
3 30
4 35
5 60
 3 8
3 30
4 35
5 78
 6 15
6 5
0 6
3 4
6 6
3 5
7 3
 3 8
3 30
0 35
5 78
 2 8
3 30
4 50
5 60
 1 1000000000
0000000000 7
 6 15
6 5
5 5
3 4
6 6
3 5
7 3
 6 8
6 5
5 6
3 3
6 6
3 5
7 2

10
 17
 90
 108
 22
 143
 80
 7
 16
 11

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 i, N, W, w[101], v[101], sum = 0;
	scanf("%d %d", &N, &W);
	for (i = 1; i <= N; i++) {
		scanf("%d %d", &(w[i]), &(v[i]));
		sum += v[i];
	}

	int j, dp[100001];
	for (i = 1, dp[0] = 0; i <= sum; i++) dp[i] = W + 1;
	for (i = 1; i <= N; i++) {
		for (j = sum; j >= v[i]; j--) if (dp[j-v[i]] + w[i] < dp[j]) dp[j] = dp[j-v[i]] + w[i];
	}
	for (j = sum; j >= 0; j--) if (dp[j] <= W) break;
	printf("%d\n", j);
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3568, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -400856(%rbp)
	leaq	-400864(%rbp), %rdx
	leaq	-400868(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -400860(%rbp)
	jmp	.L2
.L3:
	leaq	-400432(%rbp), %rdx
	movl	-400860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-400848(%rbp), %rcx
	movl	-400860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %eax
	addl	%eax, -400856(%rbp)
	addl	$1, -400860(%rbp)
.L2:
	movl	-400868(%rbp), %eax
	cmpl	%eax, -400860(%rbp)
	jle	.L3
	movl	$1, -400860(%rbp)
	movl	$0, -400016(%rbp)
	jmp	.L4
.L5:
	movl	-400864(%rbp), %eax
	leal	1(%rax), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400860(%rbp)
.L4:
	movl	-400860(%rbp), %eax
	cmpl	-400856(%rbp), %eax
	jle	.L5
	movl	$1, -400860(%rbp)
	jmp	.L6
.L10:
	movl	-400856(%rbp), %eax
	movl	%eax, -400852(%rbp)
	jmp	.L7
.L9:
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %edx
	movl	-400852(%rbp), %eax
	subl	%edx, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	-400848(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-400852(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %edx
	movl	-400852(%rbp), %eax
	subl	%edx, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	-400848(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-400852(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
.L8:
	subl	$1, -400852(%rbp)
.L7:
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %eax
	cmpl	%eax, -400852(%rbp)
	jge	.L9
	addl	$1, -400860(%rbp)
.L6:
	movl	-400868(%rbp), %eax
	cmpl	%eax, -400860(%rbp)
	jle	.L10
	movl	-400856(%rbp), %eax
	movl	%eax, -400852(%rbp)
	jmp	.L11
.L14:
	movl	-400852(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400864(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L17
	subl	$1, -400852(%rbp)
.L11:
	cmpl	$0, -400852(%rbp)
	jns	.L14
	jmp	.L13
.L17:
	nop
.L13:
	movl	-400852(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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 %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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3568, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -400856(%rbp)
	leaq	-400864(%rbp), %rdx
	leaq	-400868(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -400860(%rbp)
	jmp	.L2
.L3:
	leaq	-400432(%rbp), %rdx
	movl	-400860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-400848(%rbp), %rcx
	movl	-400860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %eax
	addl	%eax, -400856(%rbp)
	addl	$1, -400860(%rbp)
.L2:
	movl	-400868(%rbp), %eax
	cmpl	%eax, -400860(%rbp)
	jle	.L3
	movl	$1, -400860(%rbp)
	movl	$0, -400016(%rbp)
	jmp	.L4
.L5:
	movl	-400864(%rbp), %eax
	leal	1(%rax), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -400860(%rbp)
.L4:
	movl	-400860(%rbp), %eax
	cmpl	-400856(%rbp), %eax
	jle	.L5
	movl	$1, -400860(%rbp)
	jmp	.L6
.L10:
	movl	-400856(%rbp), %eax
	movl	%eax, -400852(%rbp)
	jmp	.L7
.L9:
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %edx
	movl	-400852(%rbp), %eax
	subl	%edx, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	-400848(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-400852(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %edx
	movl	-400852(%rbp), %eax
	subl	%edx, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400860(%rbp), %eax
	cltq
	movl	-400848(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-400852(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
.L8:
	subl	$1, -400852(%rbp)
.L7:
	movl	-400860(%rbp), %eax
	cltq
	movl	-400432(%rbp,%rax,4), %eax
	cmpl	%eax, -400852(%rbp)
	jge	.L9
	addl	$1, -400860(%rbp)
.L6:
	movl	-400868(%rbp), %eax
	cmpl	%eax, -400860(%rbp)
	jle	.L10
	movl	-400856(%rbp), %eax
	movl	%eax, -400852(%rbp)
	jmp	.L11
.L14:
	movl	-400852(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400864(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L17
	subl	$1, -400852(%rbp)
.L11:
	cmpl	$0, -400852(%rbp)
	jns	.L14
	jmp	.L13
.L17:
	nop
.L13:
	movl	-400852(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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:
