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>
#define max(a,b) (a)>(b)? (a):(b);

main(){
    int N,W;
    int v[100],w[100];
    int dp[101][15000]={{0,},};
    int i,j;

    scanf("%d %d",&N,&W);
    for(i=0;i<N;i++)
        scanf("%d %d",&v[i],&w[i]);

    for(i=1;i<=N;i++){
        for(j=0;j<=W+1;j++){
            if(j-w[i-1]<0)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }

    int maxv=-1;
    for(i=0;i<=W;i++){
        maxv=max(maxv,dp[N][i]);
    }
    printf("%d\n",maxv);

    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	-6057984(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-6060016(%rbp), %rax
	movl	$6060000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-6060832(%rbp), %rdx
	leaq	-6060836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -6060828(%rbp)
	jmp	.L2
.L3:
	leaq	-6060416(%rbp), %rdx
	movl	-6060828(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-6060816(%rbp), %rcx
	movl	-6060828(%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
	addl	$1, -6060828(%rbp)
.L2:
	movl	-6060836(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jl	.L3
	movl	$1, -6060828(%rbp)
	jmp	.L4
.L9:
	movl	$0, -6060824(%rbp)
	jmp	.L5
.L8:
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060416(%rbp,%rax,4), %edx
	movl	-6060824(%rbp), %eax
	subl	%edx, %eax
	testl	%eax, %eax
	jns	.L6
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-6060824(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$15000, %rax, %rax
	addq	%rcx, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	movl	-6060824(%rbp), %edx
	movslq	%edx, %rcx
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$15000, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -6060016(%rbp,%rdx,4)
	jmp	.L7
.L6:
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060416(%rbp,%rax,4), %ecx
	movl	-6060824(%rbp), %eax
	subl	%ecx, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$15000, %rax, %rax
	addq	%rcx, %rax
	movl	-6060016(%rbp,%rax,4), %edx
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060816(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-6060824(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$15000, %rax, %rax
	addq	%rsi, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	-6060824(%rbp), %edx
	movslq	%edx, %rcx
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$15000, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -6060016(%rbp,%rdx,4)
.L7:
	addl	$1, -6060824(%rbp)
.L5:
	movl	-6060832(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -6060824(%rbp)
	jle	.L8
	addl	$1, -6060828(%rbp)
.L4:
	movl	-6060836(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jle	.L9
	movl	$-1, -6060820(%rbp)
	movl	$0, -6060828(%rbp)
	jmp	.L10
.L11:
	movl	-6060836(%rbp), %eax
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$15000, %rax, %rax
	addq	%rdx, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	movl	-6060820(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -6060820(%rbp)
	addl	$1, -6060828(%rbp)
.L10:
	movl	-6060832(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jle	.L11
	movl	-6060820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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	-6057984(%rsp), %r11
	.cfi_def_cfa 11, 6058040
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2888, %rsp
	.cfi_def_cfa_offset 6060928
	movl	$6060000, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 6060856(%rsp)
	xorl	%eax, %eax
	leaq	848(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
	call	memset@PLT
	leaq	44(%rsp), %rdx
	movq	%r12, %rdi
	xorl	%eax, %eax
	leaq	40(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %r13
	testl	%r13d, %r13d
	jle	.L2
	leaq	48(%rsp), %rbx
	xorl	%r15d, %r15d
	leaq	448(%rsp), %rbp
	movq	%rbx, 8(%rsp)
	movq	%rbx, %r14
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%rbp,%r15,4), %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %r13
	addq	$1, %r15
	addq	$4, %r14
	cmpl	%r15d, %r13d
	jg	.L3
	movl	44(%rsp), %esi
	movq	8(%rsp), %rbx
	movl	%esi, 8(%rsp)
	testl	%r13d, %r13d
	jle	.L4
	cmpl	$-1, %esi
	jl	.L4
	leal	-1(%r13), %eax
	leaq	4(%rbx), %r12
	movl	%r13d, 28(%rsp)
	xorl	%r8d, %r8d
	leaq	(%r12,%rax,4), %r15
	leal	2(%rsi), %eax
	movl	$60000, %edi
	leaq	-59152(%rsp), %r14
	movl	%eax, %r13d
	.p2align 4,,10
	.p2align 3
.L6:
	movl	0(%rbp), %ecx
	movl	%r13d, %r10d
	leaq	(%r14,%rdi), %rax
	movl	%ecx, %edx
	subl	%ecx, %r10d
	negl	%edx
	movslq	%edx, %r11
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rax), %r9d
	testl	%edx, %edx
	js	.L7
	movl	(%rbx), %ecx
	addl	(%rax,%r11,4), %ecx
	leaq	(%rax,%r8), %rsi
	cmpl	%r9d, %ecx
	cmovl	%r9d, %ecx
	addl	$1, %edx
	addq	$4, %rax
	movl	%ecx, (%rsi,%rdi)
	cmpl	%r10d, %edx
	jne	.L10
.L9:
	addq	$4, %rbp
	subq	$60000, %r8
	addq	$60000, %rdi
	movq	%r12, %rbx
	cmpq	%r15, %r12
	je	.L23
	addq	$4, %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	(%rax,%r8), %rcx
	addl	$1, %edx
	addq	$4, %rax
	movl	%r9d, (%rcx,%rdi)
	cmpl	%r10d, %edx
	jne	.L10
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L23:
	movslq	28(%rsp), %r13
.L4:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	js	.L17
	leal	1(%rax), %esi
	cmpl	$2, %eax
	jle	.L18
	imulq	$60000, %r13, %rax
	movq	16(%rsp), %rdx
	pcmpeqd	%xmm0, %xmm0
	addq	%rax, %rdx
	movl	%esi, %eax
	shrl	$2, %eax
	leal	-1(%rax), %ecx
	leaq	16(%rdx), %rax
	salq	$4, %rcx
	addq	%rax, %rcx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$16, %rax
.L13:
	movdqa	(%rdx), %xmm2
	movdqa	%xmm0, %xmm1
	movq	%rax, %rdx
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rcx, %rax
	jne	.L26
	movdqa	%xmm0, %xmm2
	movl	%esi, %ecx
	psrldq	$8, %xmm2
	andl	$-4, %ecx
	andl	$3, %esi
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	je	.L11
.L12:
	imulq	$15000, %r13, %rax
	movslq	%ecx, %rsi
	movl	8(%rsp), %ebx
	addq	%rax, %rsi
	movl	848(%rsp,%rsi,4), %esi
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	leal	1(%rcx), %esi
	cmpl	%ebx, %esi
	jg	.L11
	movslq	%esi, %rsi
	addq	%rax, %rsi
	movl	848(%rsp,%rsi,4), %esi
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	addl	$2, %ecx
	cmpl	%ecx, %ebx
	jl	.L11
	movslq	%ecx, %rcx
	addq	%rcx, %rax
	movl	848(%rsp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L11:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	6060856(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$6060872, %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
.L2:
	.cfi_restore_state
	movl	44(%rsp), %eax
	movl	%eax, 8(%rsp)
	jmp	.L4
.L17:
	orl	$-1, %edx
	jmp	.L11
.L18:
	orl	$-1, %edx
	xorl	%ecx, %ecx
	jmp	.L12
.L27:
	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	-6057984(%rsp), %r11
	.cfi_def_cfa 11, 6058040
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2888, %rsp
	.cfi_def_cfa_offset 6060928
	movl	$6060000, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 6060856(%rsp)
	xorl	%eax, %eax
	leaq	848(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
	call	memset@PLT
	leaq	44(%rsp), %rdx
	movq	%r12, %rdi
	xorl	%eax, %eax
	leaq	40(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %r13
	testl	%r13d, %r13d
	jle	.L2
	leaq	48(%rsp), %rbx
	xorl	%r15d, %r15d
	leaq	448(%rsp), %rbp
	movq	%rbx, 8(%rsp)
	movq	%rbx, %r14
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%rbp,%r15,4), %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %r13
	addq	$1, %r15
	addq	$4, %r14
	cmpl	%r15d, %r13d
	jg	.L3
	movl	44(%rsp), %esi
	movq	8(%rsp), %rbx
	movl	%esi, 8(%rsp)
	testl	%r13d, %r13d
	jle	.L4
	cmpl	$-1, %esi
	jl	.L4
	leal	-1(%r13), %eax
	leaq	4(%rbx), %r12
	movl	%r13d, 28(%rsp)
	xorl	%r8d, %r8d
	leaq	(%r12,%rax,4), %r15
	leal	2(%rsi), %eax
	movl	$60000, %edi
	leaq	-59152(%rsp), %r14
	movl	%eax, %r13d
	.p2align 4,,10
	.p2align 3
.L6:
	movl	0(%rbp), %ecx
	movl	%r13d, %r10d
	leaq	(%r14,%rdi), %rax
	movl	%ecx, %edx
	subl	%ecx, %r10d
	negl	%edx
	movslq	%edx, %r11
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%rax), %r9d
	testl	%edx, %edx
	js	.L7
	movl	(%rbx), %ecx
	addl	(%rax,%r11,4), %ecx
	leaq	(%rax,%r8), %rsi
	cmpl	%r9d, %ecx
	cmovl	%r9d, %ecx
	addl	$1, %edx
	addq	$4, %rax
	movl	%ecx, (%rsi,%rdi)
	cmpl	%r10d, %edx
	jne	.L10
.L9:
	addq	$4, %rbp
	subq	$60000, %r8
	addq	$60000, %rdi
	movq	%r12, %rbx
	cmpq	%r15, %r12
	je	.L23
	addq	$4, %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	(%rax,%r8), %rcx
	addl	$1, %edx
	addq	$4, %rax
	movl	%r9d, (%rcx,%rdi)
	cmpl	%r10d, %edx
	jne	.L10
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L23:
	movslq	28(%rsp), %r13
.L4:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	js	.L17
	leal	1(%rax), %esi
	cmpl	$2, %eax
	jle	.L18
	imulq	$60000, %r13, %rax
	movq	16(%rsp), %rdx
	pcmpeqd	%xmm0, %xmm0
	addq	%rax, %rdx
	movl	%esi, %eax
	shrl	$2, %eax
	leal	-1(%rax), %ecx
	leaq	16(%rdx), %rax
	salq	$4, %rcx
	addq	%rax, %rcx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$16, %rax
.L13:
	movdqa	(%rdx), %xmm2
	movdqa	%xmm0, %xmm1
	movq	%rax, %rdx
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rcx, %rax
	jne	.L26
	movdqa	%xmm0, %xmm2
	movl	%esi, %ecx
	psrldq	$8, %xmm2
	andl	$-4, %ecx
	andl	$3, %esi
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	je	.L11
.L12:
	imulq	$15000, %r13, %rax
	movslq	%ecx, %rsi
	movl	8(%rsp), %ebx
	addq	%rax, %rsi
	movl	848(%rsp,%rsi,4), %esi
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	leal	1(%rcx), %esi
	cmpl	%ebx, %esi
	jg	.L11
	movslq	%esi, %rsi
	addq	%rax, %rsi
	movl	848(%rsp,%rsi,4), %esi
	cmpl	%esi, %edx
	cmovl	%esi, %edx
	addl	$2, %ecx
	cmpl	%ecx, %ebx
	jl	.L11
	movslq	%ecx, %rcx
	addq	%rcx, %rax
	movl	848(%rsp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L11:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	6060856(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$6060872, %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
.L2:
	.cfi_restore_state
	movl	44(%rsp), %eax
	movl	%eax, 8(%rsp)
	jmp	.L4
.L17:
	orl	$-1, %edx
	jmp	.L11
.L18:
	orl	$-1, %edx
	xorl	%ecx, %ecx
	jmp	.L12
.L27:
	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>
#define max(a,b) (a)>(b)? (a):(b);

main(){
    int N,W;
    int v[100],w[100];
    int dp[101][15000]={{0,},};
    int i,j;

    scanf("%d %d",&N,&W);
    for(i=0;i<N;i++)
        scanf("%d %d",&v[i],&w[i]);

    for(i=1;i<=N;i++){
        for(j=0;j<=W+1;j++){
            if(j-w[i-1]<0)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }

    int maxv=-1;
    for(i=0;i<=W;i++){
        maxv=max(maxv,dp[N][i]);
    }
    printf("%d\n",maxv);

    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>
#define max(a,b) (a)>(b)? (a):(b);

main(){
    int N,W;
    int v[100],w[100];
    int dp[101][15000]={{0,},};
    int i,j;

    scanf("%d %d",&N,&W);
    for(i=0;i<N;i++)
        scanf("%d %d",&v[i],&w[i]);

    for(i=1;i<=N;i++){
        for(j=0;j<=W+1;j++){
            if(j-w[i-1]<0)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
        }
    }

    int maxv=-1;
    for(i=0;i<=W;i++){
        maxv=max(maxv,dp[N][i]);
    }
    printf("%d\n",maxv);

    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	-6057984(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-6060016(%rbp), %rax
	movl	$6060000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-6060832(%rbp), %rdx
	leaq	-6060836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -6060828(%rbp)
	jmp	.L2
.L3:
	leaq	-6060416(%rbp), %rdx
	movl	-6060828(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-6060816(%rbp), %rcx
	movl	-6060828(%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
	addl	$1, -6060828(%rbp)
.L2:
	movl	-6060836(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jl	.L3
	movl	$1, -6060828(%rbp)
	jmp	.L4
.L9:
	movl	$0, -6060824(%rbp)
	jmp	.L5
.L8:
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060416(%rbp,%rax,4), %edx
	movl	-6060824(%rbp), %eax
	subl	%edx, %eax
	testl	%eax, %eax
	jns	.L6
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-6060824(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$15000, %rax, %rax
	addq	%rcx, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	movl	-6060824(%rbp), %edx
	movslq	%edx, %rcx
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$15000, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -6060016(%rbp,%rdx,4)
	jmp	.L7
.L6:
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060416(%rbp,%rax,4), %ecx
	movl	-6060824(%rbp), %eax
	subl	%ecx, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$15000, %rax, %rax
	addq	%rcx, %rax
	movl	-6060016(%rbp,%rax,4), %edx
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060816(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-6060824(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$15000, %rax, %rax
	addq	%rsi, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	-6060824(%rbp), %edx
	movslq	%edx, %rcx
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$15000, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -6060016(%rbp,%rdx,4)
.L7:
	addl	$1, -6060824(%rbp)
.L5:
	movl	-6060832(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -6060824(%rbp)
	jle	.L8
	addl	$1, -6060828(%rbp)
.L4:
	movl	-6060836(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jle	.L9
	movl	$-1, -6060820(%rbp)
	movl	$0, -6060828(%rbp)
	jmp	.L10
.L11:
	movl	-6060836(%rbp), %eax
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$15000, %rax, %rax
	addq	%rdx, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	movl	-6060820(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -6060820(%rbp)
	addl	$1, -6060828(%rbp)
.L10:
	movl	-6060832(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jle	.L11
	movl	-6060820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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	-6057984(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-6060016(%rbp), %rax
	movl	$6060000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-6060832(%rbp), %rdx
	leaq	-6060836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -6060828(%rbp)
	jmp	.L2
.L3:
	leaq	-6060416(%rbp), %rdx
	movl	-6060828(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-6060816(%rbp), %rcx
	movl	-6060828(%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
	addl	$1, -6060828(%rbp)
.L2:
	movl	-6060836(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jl	.L3
	movl	$1, -6060828(%rbp)
	jmp	.L4
.L9:
	movl	$0, -6060824(%rbp)
	jmp	.L5
.L8:
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060416(%rbp,%rax,4), %edx
	movl	-6060824(%rbp), %eax
	subl	%edx, %eax
	testl	%eax, %eax
	jns	.L6
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-6060824(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$15000, %rax, %rax
	addq	%rcx, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	movl	-6060824(%rbp), %edx
	movslq	%edx, %rcx
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$15000, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -6060016(%rbp,%rdx,4)
	jmp	.L7
.L6:
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060416(%rbp,%rax,4), %ecx
	movl	-6060824(%rbp), %eax
	subl	%ecx, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$15000, %rax, %rax
	addq	%rcx, %rax
	movl	-6060016(%rbp,%rax,4), %edx
	movl	-6060828(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-6060816(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-6060828(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-6060824(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$15000, %rax, %rax
	addq	%rsi, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	-6060824(%rbp), %edx
	movslq	%edx, %rcx
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$15000, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -6060016(%rbp,%rdx,4)
.L7:
	addl	$1, -6060824(%rbp)
.L5:
	movl	-6060832(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -6060824(%rbp)
	jle	.L8
	addl	$1, -6060828(%rbp)
.L4:
	movl	-6060836(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jle	.L9
	movl	$-1, -6060820(%rbp)
	movl	$0, -6060828(%rbp)
	jmp	.L10
.L11:
	movl	-6060836(%rbp), %eax
	movl	-6060828(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$15000, %rax, %rax
	addq	%rdx, %rax
	movl	-6060016(%rbp,%rax,4), %eax
	movl	-6060820(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -6060820(%rbp)
	addl	$1, -6060828(%rbp)
.L10:
	movl	-6060832(%rbp), %eax
	cmpl	%eax, -6060828(%rbp)
	jle	.L11
	movl	-6060820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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:
