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>
#include <stdlib.h>


int main () {
    int n, w, i, j, itmv, itmw, v1, v2;
    int value[100], weight[100];
    int **wv, *wv_data;

    scanf("%d %d", &n, &w);
    for (i=0; i<n; i++) {
        scanf("%d %d", &value[i], &weight[i]);
    }

    wv_data = (int*)malloc(sizeof(int) * (n+1) * (w+1));
    wv = (int**)malloc(sizeof(int*) * (n+1));
    for (i = 0; i <= n; i++) {
        wv[i] = &(wv_data[i*(w+1)]);
    }

    for (i=0; i <= w; i++) {
        wv[0][i] = 0;
    }
    for (i=1; i <= n; i++) {
        wv[i][0] = 0;
    }

    for (i = 1; i <= n; i++) {
        itmv = value[i-1];
        itmw = weight[i-1];
        for (j = 1; j <= w; j++) {
            if (j >= itmw) {
                v1 = wv[i-1][j-itmw] + itmv;
                v2 = wv[i-1][j];
                wv[i][j] = v1 > v2 ? v1 : v2;
            }
            else {
                wv[i][j] = wv[i-1][j];
            }
        }
    }
    printf("%d\n", wv[n][w]);

    free(wv_data);
    free(wv);

    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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-860(%rbp), %rdx
	leaq	-864(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -856(%rbp)
	jmp	.L2
.L3:
	leaq	-416(%rbp), %rdx
	movl	-856(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-816(%rbp), %rcx
	movl	-856(%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, -856(%rbp)
.L2:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jl	.L3
	movl	-864(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-860(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -832(%rbp)
	movl	-864(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -824(%rbp)
	movl	$0, -856(%rbp)
	jmp	.L4
.L5:
	movl	-860(%rbp), %eax
	addl	$1, %eax
	imull	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	-832(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addl	$1, -856(%rbp)
.L4:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L5
	movl	$0, -856(%rbp)
	jmp	.L6
.L7:
	movq	-824(%rbp), %rax
	movq	(%rax), %rdx
	movl	-856(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -856(%rbp)
.L6:
	movl	-860(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L7
	movl	$1, -856(%rbp)
	jmp	.L8
.L9:
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	$0, (%rax)
	addl	$1, -856(%rbp)
.L8:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L9
	movl	$1, -856(%rbp)
	jmp	.L10
.L15:
	movl	-856(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -848(%rbp)
	movl	-856(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -844(%rbp)
	movl	$1, -852(%rbp)
	jmp	.L11
.L14:
	movl	-852(%rbp), %eax
	cmpl	-844(%rbp), %eax
	jl	.L12
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	subl	-844(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-848(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -840(%rbp)
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -836(%rbp)
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-836(%rbp), %edx
	movl	-840(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, (%rcx)
	jmp	.L13
.L12:
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-856(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-824(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-852(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
.L13:
	addl	$1, -852(%rbp)
.L11:
	movl	-860(%rbp), %eax
	cmpl	%eax, -852(%rbp)
	jle	.L14
	addl	$1, -856(%rbp)
.L10:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L15
	movl	-864(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-832(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-824(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
.LC2:
	.string	"%d %d"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$904, %rsp
	.cfi_def_cfa_offset 960
	movq	%fs:40, %rax
	movq	%rax, 888(%rsp)
	xorl	%eax, %eax
	leaq	76(%rsp), %rdx
	leaq	72(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	72(%rsp), %ebp
	testl	%ebp, %ebp
	jle	.L2
	leaq	80(%rsp), %r12
	xorl	%ebx, %ebx
	leaq	480(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r14,%rbx,4), %rdx
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	72(%rsp), %ebp
	addq	$1, %rbx
	addq	$4, %r12
	cmpl	%ebx, %ebp
	jg	.L3
.L2:
	movl	76(%rsp), %r13d
	leal	1(%rbp), %ebx
	movslq	%ebx, %r12
	leal	1(%r13), %eax
	movl	%eax, 4(%rsp)
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	movq	%rax, 56(%rsp)
	imulq	%r12, %rdi
	call	malloc@PLT
	movq	%rax, 40(%rsp)
	leaq	0(,%r12,8), %rax
	movq	%rax, %rdi
	movq	%rax, 48(%rsp)
	call	malloc@PLT
	movq	%rax, %r15
	testl	%ebp, %ebp
	js	.L10
	cmpl	$5, %ebp
	jle	.L30
	movd	4(%rsp), %xmm3
	movdqa	.LC3(%rip), %xmm2
	movl	%ebx, %edx
	pxor	%xmm4, %xmm4
	shrl	$2, %edx
	movdqa	%xmm4, %xmm5
	movq	40(%rsp), %xmm6
	pshufd	$0, %xmm3, %xmm7
	subl	$1, %edx
	movdqa	.LC0(%rip), %xmm3
	pcmpgtd	%xmm2, %xmm5
	salq	$5, %rdx
	movdqa	%xmm7, %xmm8
	punpcklqdq	%xmm6, %xmm6
	leaq	32(%rax,%rdx), %rdx
	psrlq	$32, %xmm8
	.p2align 4,,10
	.p2align 3
.L8:
	movdqa	%xmm3, %xmm1
	movdqa	%xmm4, %xmm9
	paddd	%xmm2, %xmm3
	addq	$32, %rax
	movdqa	%xmm1, %xmm0
	psrlq	$32, %xmm1
	movdqa	%xmm5, %xmm10
	pmuludq	%xmm7, %xmm0
	pmuludq	%xmm8, %xmm1
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	punpckldq	%xmm0, %xmm1
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm1, %xmm9
	pmuludq	%xmm1, %xmm10
	pmuludq	%xmm2, %xmm1
	pmuludq	%xmm2, %xmm9
	paddq	%xmm10, %xmm9
	psllq	$32, %xmm9
	paddq	%xmm9, %xmm1
	movdqa	%xmm5, %xmm9
	paddq	%xmm6, %xmm1
	pmuludq	%xmm0, %xmm9
	movups	%xmm1, -32(%rax)
	movdqa	%xmm4, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pmuludq	%xmm2, %xmm0
	pmuludq	%xmm2, %xmm1
	paddq	%xmm9, %xmm1
	psllq	$32, %xmm1
	paddq	%xmm1, %xmm0
	paddq	%xmm6, %xmm0
	movups	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L8
	movl	%ebx, %ecx
	andl	$-4, %ecx
	andl	$3, %ebx
	je	.L10
.L7:
	movl	4(%rsp), %ebx
	movq	40(%rsp), %r14
	movslq	%ecx, %rsi
	leaq	0(,%rsi,8), %rdx
	movl	%ebx, %eax
	imull	%ecx, %eax
	movslq	%eax, %rdi
	leaq	(%r14,%rdi,4), %rdi
	movq	%rdi, (%r15,%rsi,8)
	leal	1(%rcx), %esi
	cmpl	%esi, %ebp
	jl	.L10
	addl	%ebx, %eax
	movslq	%eax, %rsi
	leaq	(%r14,%rsi,4), %rsi
	movq	%rsi, 8(%r15,%rdx)
	leal	2(%rcx), %esi
	cmpl	%esi, %ebp
	jl	.L10
	addl	%ebx, %eax
	movslq	%eax, %rsi
	leaq	(%r14,%rsi,4), %rsi
	movq	%rsi, 16(%r15,%rdx)
	leal	3(%rcx), %esi
	cmpl	%esi, %ebp
	jl	.L10
	addl	%ebx, %eax
	movslq	%eax, %rsi
	leaq	(%r14,%rsi,4), %rsi
	movq	%rsi, 24(%r15,%rdx)
	leal	4(%rcx), %esi
	cmpl	%esi, %ebp
	jl	.L10
	addl	%ebx, %eax
	addl	$5, %ecx
	movslq	%eax, %rsi
	leaq	(%r14,%rsi,4), %rsi
	movq	%rsi, 32(%r15,%rdx)
	cmpl	%ecx, %ebp
	jl	.L10
	addl	%ebx, %eax
	cltq
	leaq	(%r14,%rax,4), %rax
	movq	%rax, 40(%r15,%rdx)
.L10:
	testl	%r13d, %r13d
	js	.L6
	movslq	%r13d, %rax
	movq	(%r15), %rdi
	xorl	%esi, %esi
	leaq	4(,%rax,4), %rdx
	call	memset@PLT
.L6:
	testl	%ebp, %ebp
	jle	.L13
	leal	-1(%rbp), %edx
	leaq	8(%r15), %rax
	leaq	16(%r15,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L14:
	movq	(%rax), %rdx
	addq	$8, %rax
	movl	$0, (%rdx)
	cmpq	%rcx, %rax
	jne	.L14
	testl	%r13d, %r13d
	jle	.L13
	movl	%ebp, %eax
	movq	%r15, 8(%rsp)
	xorl	%r11d, %r11d
	movdqa	.LC3(%rip), %xmm4
	movq	%rax, 16(%rsp)
	leaq	80(%rsp), %rax
	movdqa	.LC5(%rip), %xmm3
	movq	%rax, 32(%rsp)
	leaq	480(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L17:
	movq	32(%rsp), %rax
	movl	(%rax,%r11,4), %r15d
	movq	24(%rsp), %rax
	movl	(%rax,%r11,4), %r10d
	movq	8(%rsp), %rax
	movq	(%rax,%r11,8), %rdx
	movq	8(%rax,%r11,8), %rcx
	cmpl	$1, %r10d
	jg	.L15
	movl	$1, %eax
.L16:
	movslq	%eax, %rsi
	movslq	%r10d, %r12
	movl	%r13d, %r9d
	leaq	0(,%rsi,4), %rdi
	movq	%rsi, %rbx
	subl	%eax, %r9d
	subq	%r12, %rbx
	leaq	(%rcx,%rdi), %r8
	leaq	4(%rdx,%rdi), %r14
	leaq	4(,%rbx,4), %rbp
	movq	%r8, %rbx
	subq	%r14, %rbx
	cmpq	$8, %rbx
	seta	%r14b
	cmpl	$2, %r9d
	seta	%bl
	cmpl	%eax, %r13d
	setge	3(%rsp)
	andb	3(%rsp), %bl
	testb	%bl, %r14b
	je	.L22
	leaq	(%rdx,%rbp), %r14
	movq	%r8, %rbx
	subq	%r14, %rbx
	cmpq	$8, %rbx
	jbe	.L22
	addl	$1, %r9d
	movl	$1, %ebx
	cmpl	%eax, %r13d
	cmovl	%ebx, %r9d
	movd	%r15d, %xmm2
	addq	%rdx, %rdi
	xorl	%esi, %esi
	leaq	-4(%rdx,%rbp), %rbp
	pshufd	$0, %xmm2, %xmm2
	movl	%r9d, %ebx
	shrl	$2, %ebx
	salq	$4, %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movdqu	0(%rbp,%rsi), %xmm1
	movdqu	(%rdi,%rsi), %xmm5
	paddd	%xmm2, %xmm1
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm5, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm5, %xmm0
	por	%xmm1, %xmm0
	movups	%xmm0, (%r8,%rsi)
	addq	$16, %rsi
	cmpq	%rbx, %rsi
	jne	.L23
	movl	%r9d, %esi
	andl	$-4, %esi
	addl	%esi, %eax
	cmpl	%r9d, %esi
	je	.L25
	movl	%eax, %esi
	movslq	%eax, %rdi
	subl	%r10d, %esi
	movl	(%rdx,%rdi,4), %r8d
	movslq	%esi, %rsi
	movl	(%rdx,%rsi,4), %ebx
	addl	%r15d, %ebx
	movl	%ebx, %esi
	cmpl	%r8d, %ebx
	cmovl	%r8d, %esi
	movl	%esi, (%rcx,%rdi,4)
	leal	1(%rax), %esi
	cmpl	%esi, %r13d
	jl	.L25
	movslq	%esi, %rdi
	subl	%r10d, %esi
	movslq	%esi, %rsi
	movl	(%rdx,%rdi,4), %r8d
	leaq	0(,%rdi,4), %r9
	movl	(%rdx,%rsi,4), %ebx
	addl	%r15d, %ebx
	cmpl	%r8d, %ebx
	movl	%ebx, %esi
	cmovl	%r8d, %esi
	addl	$2, %eax
	movl	%esi, (%rcx,%rdi,4)
	cmpl	%eax, %r13d
	jl	.L25
	subl	%r10d, %eax
	cltq
	addl	(%rdx,%rax,4), %r15d
	movl	4(%rdx,%r9), %edx
	movl	%r15d, %eax
	cmpl	%edx, %r15d
	cmovl	%edx, %eax
	movl	%eax, 4(%rcx,%r9)
.L25:
	addq	$1, %r11
	cmpq	16(%rsp), %r11
	jne	.L17
	movq	8(%rsp), %r15
.L13:
	movq	48(%rsp), %rax
	movq	56(%rsp), %rcx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	movq	-8(%r15,%rax), %rax
	movl	-4(%rax,%rcx), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	40(%rsp), %rdi
	call	free@PLT
	movq	%r15, %rdi
	call	free@PLT
	movq	888(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$904, %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
.L15:
	.cfi_restore_state
	movl	4(%rsp), %eax
	cmpl	%r10d, %eax
	movl	%eax, %esi
	movq	%rcx, %rax
	cmovg	%r10d, %esi
	subq	%rdx, %rax
	subq	$4, %rax
	cmpq	$8, %rax
	jbe	.L31
	cmpl	$5, %esi
	jle	.L31
	cmpl	$1, %esi
	movl	$1, %eax
	leal	-1(%rsi), %edi
	movdqa	.LC1(%rip), %xmm1
	cmovle	%eax, %edi
	movl	%edi, %eax
	shrl	$2, %eax
	leal	-1(%rax), %r8d
	movl	$4, %eax
	salq	$4, %r8
	addq	$20, %r8
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%rdx,%rax), %xmm7
	movdqa	%xmm1, %xmm0
	paddd	%xmm4, %xmm1
	paddd	%xmm3, %xmm0
	movups	%xmm7, (%rcx,%rax)
	addq	$16, %rax
	cmpq	%rax, %r8
	jne	.L19
	movl	%edi, %r8d
	pshufd	$255, %xmm0, %xmm0
	andl	$-4, %r8d
	movd	%xmm0, %eax
	leal	1(%r8), %r9d
	cmpl	%r8d, %edi
	je	.L21
	movslq	%r9d, %r9
	movl	(%rdx,%r9,4), %eax
	leaq	0(,%r9,4), %rdi
	movl	%eax, (%rcx,%r9,4)
	leal	2(%r8), %eax
	cmpl	%esi, %eax
	jge	.L21
	movl	4(%rdx,%rdi), %eax
	movl	%eax, 4(%rcx,%rdi)
	leal	3(%r8), %eax
	cmpl	%eax, %esi
	jle	.L21
	movl	8(%rdx,%rdi), %eax
	movl	%eax, 8(%rcx,%rdi)
	leal	4(%r8), %eax
.L21:
	cmpl	%eax, %r13d
	jge	.L16
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L31:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%rdx,%rdi,4), %eax
	movl	%eax, (%rcx,%rdi,4)
	leal	1(%rdi), %eax
	addq	$1, %rdi
	cmpl	%edi, %esi
	jg	.L18
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L22:
	negq	%r12
	leaq	(%rdx,%r12,4), %r8
	.p2align 4,,10
	.p2align 3
.L27:
	movl	(%r8,%rsi,4), %eax
	movl	(%rdx,%rsi,4), %edi
	addl	%r15d, %eax
	cmpl	%edi, %eax
	cmovl	%edi, %eax
	movl	%eax, (%rcx,%rsi,4)
	addq	$1, %rsi
	cmpl	%esi, %r13d
	jge	.L27
	jmp	.L25
.L30:
	xorl	%ecx, %ecx
	jmp	.L7
.L54:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC3:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC5:
	.long	1
	.long	1
	.long	1
	.long	1
	.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
.LC2:
	.string	"%d %d"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$904, %rsp
	.cfi_def_cfa_offset 960
	movq	%fs:40, %rax
	movq	%rax, 888(%rsp)
	xorl	%eax, %eax
	leaq	76(%rsp), %rdx
	leaq	72(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	72(%rsp), %ebp
	testl	%ebp, %ebp
	jle	.L2
	leaq	80(%rsp), %r12
	xorl	%ebx, %ebx
	leaq	480(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r14,%rbx,4), %rdx
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	72(%rsp), %ebp
	addq	$1, %rbx
	addq	$4, %r12
	cmpl	%ebx, %ebp
	jg	.L3
.L2:
	movl	76(%rsp), %r13d
	leal	1(%rbp), %ebx
	movslq	%ebx, %r12
	leal	1(%r13), %eax
	movl	%eax, 4(%rsp)
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	movq	%rax, 56(%rsp)
	imulq	%r12, %rdi
	call	malloc@PLT
	movq	%rax, 40(%rsp)
	leaq	0(,%r12,8), %rax
	movq	%rax, %rdi
	movq	%rax, 48(%rsp)
	call	malloc@PLT
	movq	%rax, %r15
	testl	%ebp, %ebp
	js	.L10
	cmpl	$5, %ebp
	jle	.L30
	movd	4(%rsp), %xmm3
	movdqa	.LC3(%rip), %xmm2
	movl	%ebx, %edx
	pxor	%xmm4, %xmm4
	shrl	$2, %edx
	movdqa	%xmm4, %xmm5
	movq	40(%rsp), %xmm6
	pshufd	$0, %xmm3, %xmm7
	subl	$1, %edx
	movdqa	.LC0(%rip), %xmm3
	pcmpgtd	%xmm2, %xmm5
	salq	$5, %rdx
	movdqa	%xmm7, %xmm8
	punpcklqdq	%xmm6, %xmm6
	leaq	32(%rax,%rdx), %rdx
	psrlq	$32, %xmm8
	.p2align 4,,10
	.p2align 3
.L8:
	movdqa	%xmm3, %xmm1
	movdqa	%xmm4, %xmm9
	paddd	%xmm2, %xmm3
	addq	$32, %rax
	movdqa	%xmm1, %xmm0
	psrlq	$32, %xmm1
	movdqa	%xmm5, %xmm10
	pmuludq	%xmm7, %xmm0
	pmuludq	%xmm8, %xmm1
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	punpckldq	%xmm0, %xmm1
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm1, %xmm9
	pmuludq	%xmm1, %xmm10
	pmuludq	%xmm2, %xmm1
	pmuludq	%xmm2, %xmm9
	paddq	%xmm10, %xmm9
	psllq	$32, %xmm9
	paddq	%xmm9, %xmm1
	movdqa	%xmm5, %xmm9
	paddq	%xmm6, %xmm1
	pmuludq	%xmm0, %xmm9
	movups	%xmm1, -32(%rax)
	movdqa	%xmm4, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pmuludq	%xmm2, %xmm0
	pmuludq	%xmm2, %xmm1
	paddq	%xmm9, %xmm1
	psllq	$32, %xmm1
	paddq	%xmm1, %xmm0
	paddq	%xmm6, %xmm0
	movups	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L8
	movl	%ebx, %ecx
	andl	$-4, %ecx
	andl	$3, %ebx
	je	.L10
.L7:
	movl	4(%rsp), %ebx
	movq	40(%rsp), %r14
	movslq	%ecx, %rsi
	leaq	0(,%rsi,8), %rdx
	movl	%ebx, %eax
	imull	%ecx, %eax
	movslq	%eax, %rdi
	leaq	(%r14,%rdi,4), %rdi
	movq	%rdi, (%r15,%rsi,8)
	leal	1(%rcx), %esi
	cmpl	%esi, %ebp
	jl	.L10
	addl	%ebx, %eax
	movslq	%eax, %rsi
	leaq	(%r14,%rsi,4), %rsi
	movq	%rsi, 8(%r15,%rdx)
	leal	2(%rcx), %esi
	cmpl	%esi, %ebp
	jl	.L10
	addl	%ebx, %eax
	movslq	%eax, %rsi
	leaq	(%r14,%rsi,4), %rsi
	movq	%rsi, 16(%r15,%rdx)
	leal	3(%rcx), %esi
	cmpl	%esi, %ebp
	jl	.L10
	addl	%ebx, %eax
	movslq	%eax, %rsi
	leaq	(%r14,%rsi,4), %rsi
	movq	%rsi, 24(%r15,%rdx)
	leal	4(%rcx), %esi
	cmpl	%esi, %ebp
	jl	.L10
	addl	%ebx, %eax
	addl	$5, %ecx
	movslq	%eax, %rsi
	leaq	(%r14,%rsi,4), %rsi
	movq	%rsi, 32(%r15,%rdx)
	cmpl	%ecx, %ebp
	jl	.L10
	addl	%ebx, %eax
	cltq
	leaq	(%r14,%rax,4), %rax
	movq	%rax, 40(%r15,%rdx)
.L10:
	testl	%r13d, %r13d
	js	.L6
	movslq	%r13d, %rax
	movq	(%r15), %rdi
	xorl	%esi, %esi
	leaq	4(,%rax,4), %rdx
	call	memset@PLT
.L6:
	testl	%ebp, %ebp
	jle	.L13
	leal	-1(%rbp), %edx
	leaq	8(%r15), %rax
	leaq	16(%r15,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L14:
	movq	(%rax), %rdx
	addq	$8, %rax
	movl	$0, (%rdx)
	cmpq	%rcx, %rax
	jne	.L14
	testl	%r13d, %r13d
	jle	.L13
	movl	%ebp, %eax
	movq	%r15, 8(%rsp)
	xorl	%r11d, %r11d
	movdqa	.LC3(%rip), %xmm4
	movq	%rax, 16(%rsp)
	leaq	80(%rsp), %rax
	movdqa	.LC5(%rip), %xmm3
	movq	%rax, 32(%rsp)
	leaq	480(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L17:
	movq	32(%rsp), %rax
	movl	(%rax,%r11,4), %r15d
	movq	24(%rsp), %rax
	movl	(%rax,%r11,4), %r10d
	movq	8(%rsp), %rax
	movq	(%rax,%r11,8), %rdx
	movq	8(%rax,%r11,8), %rcx
	cmpl	$1, %r10d
	jg	.L15
	movl	$1, %eax
.L16:
	movslq	%eax, %rsi
	movslq	%r10d, %r12
	movl	%r13d, %r9d
	leaq	0(,%rsi,4), %rdi
	movq	%rsi, %rbx
	subl	%eax, %r9d
	subq	%r12, %rbx
	leaq	(%rcx,%rdi), %r8
	leaq	4(%rdx,%rdi), %r14
	leaq	4(,%rbx,4), %rbp
	movq	%r8, %rbx
	subq	%r14, %rbx
	cmpq	$8, %rbx
	seta	%r14b
	cmpl	$2, %r9d
	seta	%bl
	cmpl	%eax, %r13d
	setge	3(%rsp)
	andb	3(%rsp), %bl
	testb	%bl, %r14b
	je	.L22
	leaq	(%rdx,%rbp), %r14
	movq	%r8, %rbx
	subq	%r14, %rbx
	cmpq	$8, %rbx
	jbe	.L22
	addl	$1, %r9d
	movl	$1, %ebx
	cmpl	%eax, %r13d
	cmovl	%ebx, %r9d
	movd	%r15d, %xmm2
	addq	%rdx, %rdi
	xorl	%esi, %esi
	leaq	-4(%rdx,%rbp), %rbp
	pshufd	$0, %xmm2, %xmm2
	movl	%r9d, %ebx
	shrl	$2, %ebx
	salq	$4, %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movdqu	0(%rbp,%rsi), %xmm1
	movdqu	(%rdi,%rsi), %xmm5
	paddd	%xmm2, %xmm1
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm5, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm5, %xmm0
	por	%xmm1, %xmm0
	movups	%xmm0, (%r8,%rsi)
	addq	$16, %rsi
	cmpq	%rbx, %rsi
	jne	.L23
	movl	%r9d, %esi
	andl	$-4, %esi
	addl	%esi, %eax
	cmpl	%r9d, %esi
	je	.L25
	movl	%eax, %esi
	movslq	%eax, %rdi
	subl	%r10d, %esi
	movl	(%rdx,%rdi,4), %r8d
	movslq	%esi, %rsi
	movl	(%rdx,%rsi,4), %ebx
	addl	%r15d, %ebx
	movl	%ebx, %esi
	cmpl	%r8d, %ebx
	cmovl	%r8d, %esi
	movl	%esi, (%rcx,%rdi,4)
	leal	1(%rax), %esi
	cmpl	%esi, %r13d
	jl	.L25
	movslq	%esi, %rdi
	subl	%r10d, %esi
	movslq	%esi, %rsi
	movl	(%rdx,%rdi,4), %r8d
	leaq	0(,%rdi,4), %r9
	movl	(%rdx,%rsi,4), %ebx
	addl	%r15d, %ebx
	cmpl	%r8d, %ebx
	movl	%ebx, %esi
	cmovl	%r8d, %esi
	addl	$2, %eax
	movl	%esi, (%rcx,%rdi,4)
	cmpl	%eax, %r13d
	jl	.L25
	subl	%r10d, %eax
	cltq
	addl	(%rdx,%rax,4), %r15d
	movl	4(%rdx,%r9), %edx
	movl	%r15d, %eax
	cmpl	%edx, %r15d
	cmovl	%edx, %eax
	movl	%eax, 4(%rcx,%r9)
.L25:
	addq	$1, %r11
	cmpq	16(%rsp), %r11
	jne	.L17
	movq	8(%rsp), %r15
.L13:
	movq	48(%rsp), %rax
	movq	56(%rsp), %rcx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	movq	-8(%r15,%rax), %rax
	movl	-4(%rax,%rcx), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	40(%rsp), %rdi
	call	free@PLT
	movq	%r15, %rdi
	call	free@PLT
	movq	888(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$904, %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
.L15:
	.cfi_restore_state
	movl	4(%rsp), %eax
	cmpl	%r10d, %eax
	movl	%eax, %esi
	movq	%rcx, %rax
	cmovg	%r10d, %esi
	subq	%rdx, %rax
	subq	$4, %rax
	cmpq	$8, %rax
	jbe	.L31
	cmpl	$5, %esi
	jle	.L31
	cmpl	$1, %esi
	movl	$1, %eax
	leal	-1(%rsi), %edi
	movdqa	.LC1(%rip), %xmm1
	cmovle	%eax, %edi
	movl	%edi, %eax
	shrl	$2, %eax
	leal	-1(%rax), %r8d
	movl	$4, %eax
	salq	$4, %r8
	addq	$20, %r8
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%rdx,%rax), %xmm7
	movdqa	%xmm1, %xmm0
	paddd	%xmm4, %xmm1
	paddd	%xmm3, %xmm0
	movups	%xmm7, (%rcx,%rax)
	addq	$16, %rax
	cmpq	%rax, %r8
	jne	.L19
	movl	%edi, %r8d
	pshufd	$255, %xmm0, %xmm0
	andl	$-4, %r8d
	movd	%xmm0, %eax
	leal	1(%r8), %r9d
	cmpl	%r8d, %edi
	je	.L21
	movslq	%r9d, %r9
	movl	(%rdx,%r9,4), %eax
	leaq	0(,%r9,4), %rdi
	movl	%eax, (%rcx,%r9,4)
	leal	2(%r8), %eax
	cmpl	%esi, %eax
	jge	.L21
	movl	4(%rdx,%rdi), %eax
	movl	%eax, 4(%rcx,%rdi)
	leal	3(%r8), %eax
	cmpl	%eax, %esi
	jle	.L21
	movl	8(%rdx,%rdi), %eax
	movl	%eax, 8(%rcx,%rdi)
	leal	4(%r8), %eax
.L21:
	cmpl	%eax, %r13d
	jge	.L16
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L31:
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%rdx,%rdi,4), %eax
	movl	%eax, (%rcx,%rdi,4)
	leal	1(%rdi), %eax
	addq	$1, %rdi
	cmpl	%edi, %esi
	jg	.L18
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L22:
	negq	%r12
	leaq	(%rdx,%r12,4), %r8
	.p2align 4,,10
	.p2align 3
.L27:
	movl	(%r8,%rsi,4), %eax
	movl	(%rdx,%rsi,4), %edi
	addl	%r15d, %eax
	cmpl	%edi, %eax
	cmovl	%edi, %eax
	movl	%eax, (%rcx,%rsi,4)
	addq	$1, %rsi
	cmpl	%esi, %r13d
	jge	.L27
	jmp	.L25
.L30:
	xorl	%ecx, %ecx
	jmp	.L7
.L54:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC3:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC5:
	.long	1
	.long	1
	.long	1
	.long	1
	.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>
#include <stdlib.h>


int main () {
    int n, w, i, j, itmv, itmw, v1, v2;
    int value[100], weight[100];
    int **wv, *wv_data;

    scanf("%d %d", &n, &w);
    for (i=0; i<n; i++) {
        scanf("%d %d", &value[i], &weight[i]);
    }

    wv_data = (int*)malloc(sizeof(int) * (n+1) * (w+1));
    wv = (int**)malloc(sizeof(int*) * (n+1));
    for (i = 0; i <= n; i++) {
        wv[i] = &(wv_data[i*(w+1)]);
    }

    for (i=0; i <= w; i++) {
        wv[0][i] = 0;
    }
    for (i=1; i <= n; i++) {
        wv[i][0] = 0;
    }

    for (i = 1; i <= n; i++) {
        itmv = value[i-1];
        itmw = weight[i-1];
        for (j = 1; j <= w; j++) {
            if (j >= itmw) {
                v1 = wv[i-1][j-itmw] + itmv;
                v2 = wv[i-1][j];
                wv[i][j] = v1 > v2 ? v1 : v2;
            }
            else {
                wv[i][j] = wv[i-1][j];
            }
        }
    }
    printf("%d\n", wv[n][w]);

    free(wv_data);
    free(wv);

    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>
#include <stdlib.h>


int main () {
    int n, w, i, j, itmv, itmw, v1, v2;
    int value[100], weight[100];
    int **wv, *wv_data;

    scanf("%d %d", &n, &w);
    for (i=0; i<n; i++) {
        scanf("%d %d", &value[i], &weight[i]);
    }

    wv_data = (int*)malloc(sizeof(int) * (n+1) * (w+1));
    wv = (int**)malloc(sizeof(int*) * (n+1));
    for (i = 0; i <= n; i++) {
        wv[i] = &(wv_data[i*(w+1)]);
    }

    for (i=0; i <= w; i++) {
        wv[0][i] = 0;
    }
    for (i=1; i <= n; i++) {
        wv[i][0] = 0;
    }

    for (i = 1; i <= n; i++) {
        itmv = value[i-1];
        itmw = weight[i-1];
        for (j = 1; j <= w; j++) {
            if (j >= itmw) {
                v1 = wv[i-1][j-itmw] + itmv;
                v2 = wv[i-1][j];
                wv[i][j] = v1 > v2 ? v1 : v2;
            }
            else {
                wv[i][j] = wv[i-1][j];
            }
        }
    }
    printf("%d\n", wv[n][w]);

    free(wv_data);
    free(wv);

    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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-860(%rbp), %rdx
	leaq	-864(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -856(%rbp)
	jmp	.L2
.L3:
	leaq	-416(%rbp), %rdx
	movl	-856(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-816(%rbp), %rcx
	movl	-856(%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, -856(%rbp)
.L2:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jl	.L3
	movl	-864(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-860(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -832(%rbp)
	movl	-864(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -824(%rbp)
	movl	$0, -856(%rbp)
	jmp	.L4
.L5:
	movl	-860(%rbp), %eax
	addl	$1, %eax
	imull	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	-832(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addl	$1, -856(%rbp)
.L4:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L5
	movl	$0, -856(%rbp)
	jmp	.L6
.L7:
	movq	-824(%rbp), %rax
	movq	(%rax), %rdx
	movl	-856(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -856(%rbp)
.L6:
	movl	-860(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L7
	movl	$1, -856(%rbp)
	jmp	.L8
.L9:
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	$0, (%rax)
	addl	$1, -856(%rbp)
.L8:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L9
	movl	$1, -856(%rbp)
	jmp	.L10
.L15:
	movl	-856(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -848(%rbp)
	movl	-856(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -844(%rbp)
	movl	$1, -852(%rbp)
	jmp	.L11
.L14:
	movl	-852(%rbp), %eax
	cmpl	-844(%rbp), %eax
	jl	.L12
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	subl	-844(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-848(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -840(%rbp)
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -836(%rbp)
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-836(%rbp), %edx
	movl	-840(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, (%rcx)
	jmp	.L13
.L12:
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-856(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-824(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-852(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
.L13:
	addl	$1, -852(%rbp)
.L11:
	movl	-860(%rbp), %eax
	cmpl	%eax, -852(%rbp)
	jle	.L14
	addl	$1, -856(%rbp)
.L10:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L15
	movl	-864(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-832(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-824(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-860(%rbp), %rdx
	leaq	-864(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -856(%rbp)
	jmp	.L2
.L3:
	leaq	-416(%rbp), %rdx
	movl	-856(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-816(%rbp), %rcx
	movl	-856(%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, -856(%rbp)
.L2:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jl	.L3
	movl	-864(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movl	-860(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -832(%rbp)
	movl	-864(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -824(%rbp)
	movl	$0, -856(%rbp)
	jmp	.L4
.L5:
	movl	-860(%rbp), %eax
	addl	$1, %eax
	imull	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	-832(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addl	$1, -856(%rbp)
.L4:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L5
	movl	$0, -856(%rbp)
	jmp	.L6
.L7:
	movq	-824(%rbp), %rax
	movq	(%rax), %rdx
	movl	-856(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -856(%rbp)
.L6:
	movl	-860(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L7
	movl	$1, -856(%rbp)
	jmp	.L8
.L9:
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	$0, (%rax)
	addl	$1, -856(%rbp)
.L8:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L9
	movl	$1, -856(%rbp)
	jmp	.L10
.L15:
	movl	-856(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -848(%rbp)
	movl	-856(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -844(%rbp)
	movl	$1, -852(%rbp)
	jmp	.L11
.L14:
	movl	-852(%rbp), %eax
	cmpl	-844(%rbp), %eax
	jl	.L12
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	subl	-844(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-848(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -840(%rbp)
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -836(%rbp)
	movl	-856(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	movl	-836(%rbp), %edx
	movl	-840(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, (%rcx)
	jmp	.L13
.L12:
	movl	-856(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-852(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-856(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-824(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-852(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
.L13:
	addl	$1, -852(%rbp)
.L11:
	movl	-860(%rbp), %eax
	cmpl	%eax, -852(%rbp)
	jle	.L14
	addl	$1, -856(%rbp)
.L10:
	movl	-864(%rbp), %eax
	cmpl	%eax, -856(%rbp)
	jle	.L15
	movl	-864(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-824(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-860(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-832(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-824(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
