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 K[10005][10005];
void knapsack(int n, int wMax,int W[],int b[])
{

	for(int i=1;i<=n;i++)
	{
		for(int w=0;w<=wMax;w++)
		{
			if(W[i] <= w)
			{
				if(b[i] + K[i-1][w-W[i]] > K[i-1][w])
				{
					K[i][w] = b[i] + K[i-1][w-W[i]];
				}else
				{
					K[i][w] = K[i-1][w];
				}
			}else
			{
				K[i][w]=K[i-1][w];
			}
		}
	}
	
	printf("%d\n",K[n][wMax]);
}


int main()
{
	int N,Weight;
	int V[10000],W[10000];
	int answer;
	
	scanf("%d %d",&N,&Weight); getchar();
	for(int i=1;i<=N;i++)
	{
		scanf("%d %d",&V[i],&W[i]); getchar();
	}
	
	knapsack(N,Weight,W,V);
	
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	K
	.bss
	.align 32
	.type	K, @object
	.size	K, 400400100
K:
	.zero	400400100
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	knapsack
	.type	knapsack, @function
knapsack:
.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movq	%rcx, -40(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L8:
	movl	$0, -4(%rbp)
	jmp	.L3
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L4
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-4(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L5
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-4(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$10005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L6
.L5:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$10005, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	K(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L6
.L4:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$10005, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	K(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L6:
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L7
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L8
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$10005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	knapsack, .-knapsack
	.section	.rodata
.LC1:
	.string	"%d %d"
	.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
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2208, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-80024(%rbp), %rdx
	leaq	-80028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	movl	$1, -80020(%rbp)
	jmp	.L10
.L11:
	leaq	-40016(%rbp), %rdx
	movl	-80020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-80016(%rbp), %rcx
	movl	-80020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	addl	$1, -80020(%rbp)
.L10:
	movl	-80028(%rbp), %eax
	cmpl	%eax, -80020(%rbp)
	jle	.L11
	movl	-80024(%rbp), %esi
	movl	-80028(%rbp), %eax
	leaq	-80016(%rbp), %rcx
	leaq	-40016(%rbp), %rdx
	movl	%eax, %edi
	call	knapsack
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	knapsack
	.type	knapsack, @function
knapsack:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	testl	%edi, %edi
	jle	.L12
	testl	%esi, %esi
	js	.L12
	leaq	40020+K(%rip), %r10
	movslq	%edi, %r12
	movq	%rcx, %rbx
	xorl	%edi, %edi
	leaq	-40020(%r10), %rbp
	leaq	4(%rdx), %r8
	movslq	%esi, %rsi
	movq	%rbp, %r9
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%edi, %r11
	xorl	%eax, %eax
	imulq	$10005, %r11, %r11
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rdx, %rax
.L5:
	movl	(%r8), %r13d
	movl	(%r9,%rax,4), %edx
	cmpl	%eax, %r13d
	jg	.L4
	movl	%eax, %ecx
	subl	%r13d, %ecx
	movslq	%ecx, %rcx
	addq	%r11, %rcx
	movl	0(%rbp,%rcx,4), %ecx
	addl	4(%rbx,%rdi,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
.L4:
	movl	%edx, (%r10,%rax,4)
	leaq	1(%rax), %rdx
	cmpq	%rax, %rsi
	jne	.L6
	addq	$1, %rdi
	addq	$40020, %r10
	addq	$40020, %r9
	addq	$4, %r8
	cmpq	%r12, %rdi
	jne	.L3
.L2:
	imulq	$10005, %r12, %rax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	movl	$1, %edi
	addq	%rsi, %rax
	leaq	.LC0(%rip), %rsi
	movl	0(%rbp,%rax,4), %edx
	popq	%rbp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L12:
	.cfi_restore_state
	leaq	K(%rip), %rbp
	movslq	%edi, %r12
	movslq	%esi, %rsi
	jmp	.L2
	.cfi_endproc
.LFE23:
	.size	knapsack, .-knapsack
	.section	.rodata.str1.1
.LC1:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77872
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2208, %rsp
	.cfi_def_cfa_offset 80080
	leaq	.LC1(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 80024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	leaq	40016(%rsp), %r13
	leaq	16(%rsp), %r14
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movl	8(%rsp), %edi
	testl	%edi, %edi
	jle	.L15
	movl	$4, %ebx
	movl	$1, %ebp
	leaq	16(%rsp), %r14
	leaq	40016(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L16:
	leaq	0(%r13,%rbx), %rdx
	leaq	(%r14,%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdi
	addl	$1, %ebp
	addq	$4, %rbx
	call	getc@PLT
	movl	8(%rsp), %edi
	cmpl	%ebp, %edi
	jge	.L16
.L15:
	movl	12(%rsp), %esi
	movq	%r14, %rcx
	movq	%r13, %rdx
	call	knapsack
	movq	80024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$80032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	K
	.bss
	.align 32
	.type	K, @object
	.size	K, 400400100
K:
	.zero	400400100
	.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\n"
	.text
	.p2align 4
	.globl	knapsack
	.type	knapsack, @function
knapsack:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	testl	%edi, %edi
	jle	.L12
	testl	%esi, %esi
	js	.L12
	leaq	40020+K(%rip), %r10
	movslq	%edi, %r12
	movq	%rcx, %rbx
	xorl	%edi, %edi
	leaq	-40020(%r10), %rbp
	leaq	4(%rdx), %r8
	movslq	%esi, %rsi
	movq	%rbp, %r9
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%edi, %r11
	xorl	%eax, %eax
	imulq	$10005, %r11, %r11
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rdx, %rax
.L5:
	movl	(%r8), %r13d
	movl	(%r9,%rax,4), %edx
	cmpl	%eax, %r13d
	jg	.L4
	movl	%eax, %ecx
	subl	%r13d, %ecx
	movslq	%ecx, %rcx
	addq	%r11, %rcx
	movl	0(%rbp,%rcx,4), %ecx
	addl	4(%rbx,%rdi,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
.L4:
	movl	%edx, (%r10,%rax,4)
	leaq	1(%rax), %rdx
	cmpq	%rax, %rsi
	jne	.L6
	addq	$1, %rdi
	addq	$40020, %r10
	addq	$40020, %r9
	addq	$4, %r8
	cmpq	%r12, %rdi
	jne	.L3
.L2:
	imulq	$10005, %r12, %rax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	movl	$1, %edi
	addq	%rsi, %rax
	leaq	.LC0(%rip), %rsi
	movl	0(%rbp,%rax,4), %edx
	popq	%rbp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L12:
	.cfi_restore_state
	leaq	K(%rip), %rbp
	movslq	%edi, %r12
	movslq	%esi, %rsi
	jmp	.L2
	.cfi_endproc
.LFE23:
	.size	knapsack, .-knapsack
	.section	.rodata.str1.1
.LC1:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77872
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2208, %rsp
	.cfi_def_cfa_offset 80080
	leaq	.LC1(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 80024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	leaq	40016(%rsp), %r13
	leaq	16(%rsp), %r14
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movl	8(%rsp), %edi
	testl	%edi, %edi
	jle	.L15
	movl	$4, %ebx
	movl	$1, %ebp
	leaq	16(%rsp), %r14
	leaq	40016(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L16:
	leaq	0(%r13,%rbx), %rdx
	leaq	(%r14,%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdi
	addl	$1, %ebp
	addq	$4, %rbx
	call	getc@PLT
	movl	8(%rsp), %edi
	cmpl	%ebp, %edi
	jge	.L16
.L15:
	movl	12(%rsp), %esi
	movq	%r14, %rcx
	movq	%r13, %rdx
	call	knapsack
	movq	80024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$80032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	K
	.bss
	.align 32
	.type	K, @object
	.size	K, 400400100
K:
	.zero	400400100
	.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 K[10005][10005];
void knapsack(int n, int wMax,int W[],int b[])
{

	for(int i=1;i<=n;i++)
	{
		for(int w=0;w<=wMax;w++)
		{
			if(W[i] <= w)
			{
				if(b[i] + K[i-1][w-W[i]] > K[i-1][w])
				{
					K[i][w] = b[i] + K[i-1][w-W[i]];
				}else
				{
					K[i][w] = K[i-1][w];
				}
			}else
			{
				K[i][w]=K[i-1][w];
			}
		}
	}
	
	printf("%d\n",K[n][wMax]);
}


int main()
{
	int N,Weight;
	int V[10000],W[10000];
	int answer;
	
	scanf("%d %d",&N,&Weight); getchar();
	for(int i=1;i<=N;i++)
	{
		scanf("%d %d",&V[i],&W[i]); getchar();
	}
	
	knapsack(N,Weight,W,V);
	
	return 0;
}

4 5
4 2
5 2
2 1
8 3

13

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 K[10005][10005];
void knapsack(int n, int wMax,int W[],int b[])
{

	for(int i=1;i<=n;i++)
	{
		for(int w=0;w<=wMax;w++)
		{
			if(W[i] <= w)
			{
				if(b[i] + K[i-1][w-W[i]] > K[i-1][w])
				{
					K[i][w] = b[i] + K[i-1][w-W[i]];
				}else
				{
					K[i][w] = K[i-1][w];
				}
			}else
			{
				K[i][w]=K[i-1][w];
			}
		}
	}
	
	printf("%d\n",K[n][wMax]);
}


int main()
{
	int N,Weight;
	int V[10000],W[10000];
	int answer;
	
	scanf("%d %d",&N,&Weight); getchar();
	for(int i=1;i<=N;i++)
	{
		scanf("%d %d",&V[i],&W[i]); getchar();
	}
	
	knapsack(N,Weight,W,V);
	
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	K
	.bss
	.align 32
	.type	K, @object
	.size	K, 400400100
K:
	.zero	400400100
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	knapsack
	.type	knapsack, @function
knapsack:
.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movq	%rcx, -40(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L8:
	movl	$0, -4(%rbp)
	jmp	.L3
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L4
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-4(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L5
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-4(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$10005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L6
.L5:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$10005, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	K(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L6
.L4:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$10005, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	K(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L6:
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L7
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L8
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$10005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	knapsack, .-knapsack
	.section	.rodata
.LC1:
	.string	"%d %d"
	.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
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2208, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-80024(%rbp), %rdx
	leaq	-80028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	movl	$1, -80020(%rbp)
	jmp	.L10
.L11:
	leaq	-40016(%rbp), %rdx
	movl	-80020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-80016(%rbp), %rcx
	movl	-80020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	addl	$1, -80020(%rbp)
.L10:
	movl	-80028(%rbp), %eax
	cmpl	%eax, -80020(%rbp)
	jle	.L11
	movl	-80024(%rbp), %esi
	movl	-80028(%rbp), %eax
	leaq	-80016(%rbp), %rcx
	leaq	-40016(%rbp), %rdx
	movl	%eax, %edi
	call	knapsack
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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	K
	.bss
	.align 32
	.type	K, @object
	.size	K, 400400100
K:
	.zero	400400100
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	knapsack
	.type	knapsack, @function
knapsack:
.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movq	%rcx, -40(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L8:
	movl	$0, -4(%rbp)
	jmp	.L3
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L4
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-4(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L5
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-4(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$10005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L6
.L5:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$10005, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	K(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L6
.L4:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10005, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$10005, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	K(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L6:
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L7
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L8
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$10005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	K(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	knapsack, .-knapsack
	.section	.rodata
.LC1:
	.string	"%d %d"
	.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
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2208, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-80024(%rbp), %rdx
	leaq	-80028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	movl	$1, -80020(%rbp)
	jmp	.L10
.L11:
	leaq	-40016(%rbp), %rdx
	movl	-80020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-80016(%rbp), %rcx
	movl	-80020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	addl	$1, -80020(%rbp)
.L10:
	movl	-80028(%rbp), %eax
	cmpl	%eax, -80020(%rbp)
	jle	.L11
	movl	-80024(%rbp), %esi
	movl	-80028(%rbp), %eax
	leaq	-80016(%rbp), %rcx
	leaq	-40016(%rbp), %rdx
	movl	%eax, %edi
	call	knapsack
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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:
