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>
#include <math.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

#define MAX_N 1000
#define MAX_B 10000
int dp[MAX_N + 1][MAX_B + 1];
int main() {
    int h, n;
    scanf("%d %d", &h, &n);
    int *a = malloc(sizeof(int) * n); // attack
    int *b = malloc(sizeof(int) * n); // cost
    int max = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        scanf("%d", &b[i]);
    }

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= h; j++) {
            dp[i][j] = 100000000;
        }
    }
    dp[0][0] = 0;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= h + max; j++) {
            if (j < a[i]) {
                dp[i+1][j] = MIN(dp[i][j], dp[i+1][0] + b[i]);
                //printf("1) %d, %d, %d\n", i, j, dp[i+1][j]);
            } else {
                dp[i+1][j] = MIN(dp[i][j], dp[i+1][j-a[i]] + b[i]);
                //printf("2) %d, %d, %d\n", i, j, dp[i+1][j]);
            }
        }
    }

    /*
        for (int i = 0; i < n + 1; i++) {
        for (int j = 0; j < h + 1; j++) {
            printf("%d ", dp[i][j]);
        }
        printf("\n");

    }
    */
    printf("%d\n", dp[n][h]);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 40044004
dp:
	.zero	40044004
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L2
.L3:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L3
	movl	$0, -44(%rbp)
	jmp	.L4
.L7:
	movl	$0, -40(%rbp)
	jmp	.L5
.L6:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$100000000, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L5:
	movl	-56(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L6
	addl	$1, -44(%rbp)
.L4:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L7
	movl	$0, dp(%rip)
	movl	$0, -36(%rbp)
	jmp	.L8
.L13:
	movl	$0, -32(%rbp)
	jmp	.L9
.L12:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L10
	movl	-36(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	$40004, %rax, %rax
	leaq	dp(%rip), %rdx
	movl	(%rax,%rdx), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-36(%rbp), %ecx
	addl	$1, %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$10001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L11
.L10:
	movl	-36(%rbp), %eax
	leal	1(%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %ecx
	movl	-32(%rbp), %eax
	subl	%ecx, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-36(%rbp), %ecx
	addl	$1, %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$10001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L11:
	addl	$1, -32(%rbp)
.L9:
	movl	-56(%rbp), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L12
	addl	$1, -36(%rbp)
.L8:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L13
	movl	-52(%rbp), %eax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$10001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d"
.LC6:
	.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
	leaq	.LC1(%rip), %rdi
	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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rdx
	leaq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	52(%rsp), %rax
	leaq	0(,%rax,4), %rbp
	movq	%rax, 8(%rsp)
	movq	%rax, %rbx
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, 24(%rsp)
	movq	%rax, %r14
	call	malloc@PLT
	movq	%rax, 32(%rsp)
	testl	%ebx, %ebx
	jle	.L2
	movq	%rax, %r12
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %ebx
	addq	$4, %r14
	addq	$4, %r12
	cmpl	%ebp, %ebx
	jg	.L3
	movl	48(%rsp), %r15d
	movl	%r15d, 44(%rsp)
	testl	%ebx, %ebx
	js	.L4
	movslq	%ebx, %rax
	movq	%rax, 8(%rsp)
.L27:
	movl	%r15d, 44(%rsp)
	testl	%r15d, %r15d
	js	.L5
	leal	1(%r15), %r11d
	leaq	dp(%rip), %rdx
	movdqa	.LC3(%rip), %xmm0
	xorl	%edi, %edi
	movl	%r11d, %eax
	movl	%r11d, 40(%rsp)
	movl	%r11d, %r8d
	movq	%rdx, %rsi
	shrl	$2, %eax
	andl	$-4, %r8d
	leal	-1(%rax), %r9d
	addq	$1, %r9
	salq	$4, %r9
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	(%r9,%rsi), %rcx
	movq	%rsi, %rax
	cmpl	$2, %r15d
	jle	.L60
	.p2align 4,,10
	.p2align 3
.L7:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L7
	movl	%r8d, %eax
	cmpl	%r8d, %r11d
	je	.L8
.L10:
	movslq	%edi, %rcx
	movslq	%eax, %r10
	imulq	$10001, %rcx, %rcx
	addq	%rcx, %r10
	movl	$100000000, (%rdx,%r10,4)
	leal	1(%rax), %r10d
	cmpl	%r10d, %r15d
	jl	.L8
	movslq	%r10d, %r10
	addl	$2, %eax
	addq	%rcx, %r10
	movl	$100000000, (%rdx,%r10,4)
	cmpl	%eax, %r15d
	jl	.L8
	cltq
	addq	%rax, %rcx
	movl	$100000000, (%rdx,%rcx,4)
.L8:
	addl	$1, %edi
	addq	$40004, %rsi
	cmpl	%edi, %ebx
	jge	.L6
	movl	$0, dp(%rip)
	testl	%ebx, %ebx
	je	.L12
	movdqa	.LC4(%rip), %xmm5
	movdqa	.LC5(%rip), %xmm4
	movl	$40004, %edi
	leaq	dp(%rip), %rcx
	movl	$10001, %r14d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L13:
	leal	1(%r11), %eax
	movl	%r11d, (%rsp)
	movl	%eax, 4(%rsp)
	movq	24(%rsp), %rax
	movl	(%rax,%r11,4), %r10d
	movq	32(%rsp), %rax
	movl	(%rax,%r11,4), %esi
	testl	%r10d, %r10d
	jg	.L26
	xorl	%eax, %eax
	leaq	40004(%rcx), %r9
.L25:
	movl	%eax, %ecx
	leal	-1(%rax), %r8d
	movl	%r15d, %ebx
	subl	%r10d, %ecx
	subl	%eax, %ebx
	subl	%ecx, %r8d
	cmpl	$2, %r8d
	jbe	.L18
	cmpl	$2, %ebx
	seta	%bpl
	cmpl	%r15d, %eax
	setle	%r8b
	testb	%r8b, %bpl
	je	.L18
	addl	$1, %ebx
	movl	$1, %ecx
	cmpl	%r15d, %eax
	movslq	%r10d, %r12
	movq	%r14, %r8
	cmovg	%ecx, %ebx
	movd	%esi, %xmm3
	movslq	%eax, %rbp
	leaq	-10001(%rbp,%r14), %rcx
	pshufd	$0, %xmm3, %xmm3
	subq	%r12, %r8
	addq	%rbp, %r8
	salq	$2, %rcx
	leaq	(%rdx,%r8,4), %r12
	movl	%ebx, %r8d
	leaq	(%rdx,%rcx), %r13
	shrl	$2, %r8d
	leaq	40004(%rdx,%rcx), %rbp
	xorl	%ecx, %ecx
	salq	$4, %r8
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%r12,%rcx), %xmm2
	movdqu	0(%r13,%rcx), %xmm7
	paddd	%xmm3, %xmm2
	movdqa	%xmm7, %xmm1
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm7, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movups	%xmm0, 0(%rbp,%rcx)
	addq	$16, %rcx
	cmpq	%rcx, %r8
	jne	.L19
	movl	%ebx, %ecx
	andl	$-4, %ecx
	addl	%ecx, %eax
	cmpl	%ecx, %ebx
	je	.L21
	movslq	4(%rsp), %rcx
	movl	%eax, %ebx
	movslq	%eax, %r8
	subl	%r10d, %ebx
	imulq	$10001, %rcx, %rcx
	movslq	%ebx, %rbx
	addq	%rcx, %rbx
	leaq	(%rcx,%r8), %rbp
	movl	(%rdx,%rbx,4), %r12d
	addl	%esi, %r12d
	movl	%r12d, %ebx
	movslq	(%rsp), %r12
	imulq	$10001, %r12, %r12
	addq	%r12, %r8
	movl	(%rdx,%r8,4), %r8d
	cmpl	%r8d, %ebx
	cmovg	%r8d, %ebx
	leal	1(%rax), %r8d
	movl	%ebx, (%rdx,%rbp,4)
	cmpl	%r15d, %r8d
	jg	.L21
	movslq	%r8d, %rbx
	subl	%r10d, %r8d
	movslq	%r8d, %r8
	leaq	(%rcx,%rbx), %rbp
	addq	%r12, %rbx
	addq	%rcx, %r8
	movl	(%rdx,%rbx,4), %ebx
	movl	(%rdx,%r8,4), %r13d
	addl	%esi, %r13d
	cmpl	%ebx, %r13d
	movl	%r13d, %r8d
	cmovg	%ebx, %r8d
	addl	$2, %eax
	movl	%r8d, (%rdx,%rbp,4)
	cmpl	%eax, %r15d
	jl	.L21
	movslq	%eax, %r8
	subl	%r10d, %eax
	cltq
	addq	%r8, %r12
	leaq	(%rcx,%r8), %rbx
	addq	%rax, %rcx
	movl	(%rdx,%r12,4), %eax
	addl	(%rdx,%rcx,4), %esi
	cmpl	%eax, %esi
	cmovg	%eax, %esi
	movl	%esi, (%rdx,%rbx,4)
.L21:
	addq	$1, %r11
	addq	$10001, %r14
	movq	%r9, %rcx
	addq	$40004, %rdi
	cmpq	8(%rsp), %r11
	jne	.L13
.L12:
	imulq	$10001, 8(%rsp), %rax
	movslq	44(%rsp), %rcx
	movl	$1, %edi
	leaq	.LC6(%rip), %rsi
	addq	%rcx, %rax
	movl	(%rdx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L61
	addq	$72, %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
.L26:
	.cfi_restore_state
	movl	40(%rsp), %eax
	movl	$4, %ebx
	leaq	4(%rdi), %r9
	cmpl	%r10d, %eax
	movl	%eax, %r8d
	cmovg	%r10d, %r8d
	movslq	%r8d, %rax
	salq	$2, %rax
	testl	%r8d, %r8d
	cmovle	%rbx, %rax
	addq	%rdi, %rax
	cmpq	%r9, %rax
	cmovg	%r9, %rax
	cmpq	%rax, %rdi
	jl	.L32
	cmpl	$3, %r8d
	jle	.L32
	testl	%r8d, %r8d
	movl	$1, %ebx
	movl	40004(%rcx), %r13d
	movdqa	.LC0(%rip), %xmm2
	cmovg	%r8d, %ebx
	leaq	40004(%rcx), %r9
	xorl	%eax, %eax
	addl	%esi, %r13d
	movl	%ebx, %ebp
	movd	%r13d, %xmm3
	shrl	$2, %ebp
	pshufd	$0, %xmm3, %xmm3
	salq	$4, %rbp
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rcx,%rax), %xmm0
	movdqu	(%rcx,%rax), %xmm7
	movdqa	%xmm3, %xmm6
	movdqa	%xmm2, %xmm1
	paddd	%xmm4, %xmm1
	paddd	%xmm5, %xmm2
	pcmpgtd	%xmm3, %xmm0
	pand	%xmm0, %xmm6
	pandn	%xmm7, %xmm0
	por	%xmm6, %xmm0
	movups	%xmm0, (%r9,%rax)
	addq	$16, %rax
	cmpq	%rbp, %rax
	jne	.L15
	movl	%ebx, %r12d
	pshufd	$255, %xmm1, %xmm1
	andl	$-4, %r12d
	andl	$3, %ebx
	movd	%xmm1, %eax
	je	.L17
	movslq	4(%rsp), %rbx
	movslq	%r12d, %rax
	movl	40004(%rcx), %r13d
	imulq	$10001, %rbx, %rbx
	addl	%esi, %r13d
	leaq	(%rbx,%rax), %rbp
	movq	%rbp, 16(%rsp)
	movslq	(%rsp), %rbp
	imulq	$10001, %rbp, %rbp
	addq	%rbp, %rax
	movl	(%rdx,%rax,4), %eax
	cmpl	%eax, %r13d
	cmovg	%eax, %r13d
	movq	16(%rsp), %rax
	movl	%r13d, (%rdx,%rax,4)
	leal	1(%r12), %eax
	cmpl	%eax, %r8d
	jle	.L17
	cltq
	leaq	(%rbx,%rax), %r13
	addq	%rbp, %rax
	movq	%r13, 16(%rsp)
	movl	40004(%rcx), %r13d
	movl	(%rdx,%rax,4), %eax
	addl	%esi, %r13d
	cmpl	%eax, %r13d
	cmovg	%eax, %r13d
	movq	16(%rsp), %rax
	movl	%r13d, (%rdx,%rax,4)
	leal	2(%r12), %eax
	cmpl	%eax, %r8d
	jle	.L17
	cltq
	movl	40004(%rcx), %r8d
	addq	%rax, %rbp
	addq	%rax, %rbx
	movl	(%rdx,%rbp,4), %eax
	addl	%esi, %r8d
	movl	%r8d, %ecx
	cmpl	%eax, %r8d
	cmovg	%eax, %ecx
	leal	3(%r12), %eax
	movl	%ecx, (%rdx,%rbx,4)
.L17:
	cmpl	%eax, %r15d
	jge	.L25
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L32:
	movl	$40004, %r13d
	movq	%rcx, %rbx
	xorl	%eax, %eax
	subq	%rdi, %r13
	.p2align 4,,10
	.p2align 3
.L14:
	movl	40004(%rcx), %r9d
	movl	(%rbx), %r12d
	leaq	0(%r13,%rbx), %rbp
	addl	%esi, %r9d
	cmpl	%r12d, %r9d
	cmovg	%r12d, %r9d
	addl	$1, %eax
	addq	$4, %rbx
	movl	%r9d, 0(%rbp,%rdi)
	cmpl	%eax, %r8d
	jg	.L14
	leaq	40004(%rcx), %r9
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%eax, %r10
	movslq	%ecx, %rcx
	leaq	-40004(%rdi), %rbp
	leaq	(%r10,%r14), %r8
	subq	%r10, %rcx
	leaq	(%rdx,%r8,4), %r8
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r8, %rbx
	movl	(%r8,%rcx,4), %r10d
	subq	%rdi, %rbx
	movl	(%rbx,%rbp), %ebx
	addl	%esi, %r10d
	cmpl	%ebx, %r10d
	cmovg	%ebx, %r10d
	addl	$1, %eax
	addq	$4, %r8
	movl	%r10d, -4(%r8)
	cmpl	%r15d, %eax
	jle	.L23
	jmp	.L21
.L60:
	xorl	%eax, %eax
	jmp	.L10
.L2:
	movl	48(%rsp), %r15d
	je	.L27
	movl	%r15d, 44(%rsp)
	leaq	dp(%rip), %rdx
	movl	$0, dp(%rip)
	jmp	.L12
.L4:
	movslq	%ebx, %rax
	leaq	dp(%rip), %rdx
	movl	$0, dp(%rip)
	movq	%rax, 8(%rsp)
	jmp	.L12
.L5:
	movl	$0, dp(%rip)
	leaq	dp(%rip), %rdx
	jmp	.L12
.L61:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 40044004
dp:
	.zero	40044004
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC3:
	.long	100000000
	.long	100000000
	.long	100000000
	.long	100000000
	.align 16
.LC4:
	.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
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d"
.LC6:
	.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
	leaq	.LC1(%rip), %rdi
	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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rdx
	leaq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	52(%rsp), %rax
	leaq	0(,%rax,4), %rbp
	movq	%rax, 8(%rsp)
	movq	%rax, %rbx
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, 24(%rsp)
	movq	%rax, %r14
	call	malloc@PLT
	movq	%rax, 32(%rsp)
	testl	%ebx, %ebx
	jle	.L2
	movq	%rax, %r12
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %ebx
	addq	$4, %r14
	addq	$4, %r12
	cmpl	%ebp, %ebx
	jg	.L3
	movl	48(%rsp), %r15d
	movl	%r15d, 44(%rsp)
	testl	%ebx, %ebx
	js	.L4
	movslq	%ebx, %rax
	movq	%rax, 8(%rsp)
.L27:
	movl	%r15d, 44(%rsp)
	testl	%r15d, %r15d
	js	.L5
	leal	1(%r15), %r11d
	leaq	dp(%rip), %rdx
	movdqa	.LC3(%rip), %xmm0
	xorl	%edi, %edi
	movl	%r11d, %eax
	movl	%r11d, 40(%rsp)
	movl	%r11d, %r8d
	movq	%rdx, %rsi
	shrl	$2, %eax
	andl	$-4, %r8d
	leal	-1(%rax), %r9d
	addq	$1, %r9
	salq	$4, %r9
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	(%r9,%rsi), %rcx
	movq	%rsi, %rax
	cmpl	$2, %r15d
	jle	.L60
	.p2align 4,,10
	.p2align 3
.L7:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L7
	movl	%r8d, %eax
	cmpl	%r8d, %r11d
	je	.L8
.L10:
	movslq	%edi, %rcx
	movslq	%eax, %r10
	imulq	$10001, %rcx, %rcx
	addq	%rcx, %r10
	movl	$100000000, (%rdx,%r10,4)
	leal	1(%rax), %r10d
	cmpl	%r10d, %r15d
	jl	.L8
	movslq	%r10d, %r10
	addl	$2, %eax
	addq	%rcx, %r10
	movl	$100000000, (%rdx,%r10,4)
	cmpl	%eax, %r15d
	jl	.L8
	cltq
	addq	%rax, %rcx
	movl	$100000000, (%rdx,%rcx,4)
.L8:
	addl	$1, %edi
	addq	$40004, %rsi
	cmpl	%edi, %ebx
	jge	.L6
	movl	$0, dp(%rip)
	testl	%ebx, %ebx
	je	.L12
	movdqa	.LC4(%rip), %xmm5
	movdqa	.LC5(%rip), %xmm4
	movl	$40004, %edi
	leaq	dp(%rip), %rcx
	movl	$10001, %r14d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L13:
	leal	1(%r11), %eax
	movl	%r11d, (%rsp)
	movl	%eax, 4(%rsp)
	movq	24(%rsp), %rax
	movl	(%rax,%r11,4), %r10d
	movq	32(%rsp), %rax
	movl	(%rax,%r11,4), %esi
	testl	%r10d, %r10d
	jg	.L26
	xorl	%eax, %eax
	leaq	40004(%rcx), %r9
.L25:
	movl	%eax, %ecx
	leal	-1(%rax), %r8d
	movl	%r15d, %ebx
	subl	%r10d, %ecx
	subl	%eax, %ebx
	subl	%ecx, %r8d
	cmpl	$2, %r8d
	jbe	.L18
	cmpl	$2, %ebx
	seta	%bpl
	cmpl	%r15d, %eax
	setle	%r8b
	testb	%r8b, %bpl
	je	.L18
	addl	$1, %ebx
	movl	$1, %ecx
	cmpl	%r15d, %eax
	movslq	%r10d, %r12
	movq	%r14, %r8
	cmovg	%ecx, %ebx
	movd	%esi, %xmm3
	movslq	%eax, %rbp
	leaq	-10001(%rbp,%r14), %rcx
	pshufd	$0, %xmm3, %xmm3
	subq	%r12, %r8
	addq	%rbp, %r8
	salq	$2, %rcx
	leaq	(%rdx,%r8,4), %r12
	movl	%ebx, %r8d
	leaq	(%rdx,%rcx), %r13
	shrl	$2, %r8d
	leaq	40004(%rdx,%rcx), %rbp
	xorl	%ecx, %ecx
	salq	$4, %r8
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%r12,%rcx), %xmm2
	movdqu	0(%r13,%rcx), %xmm7
	paddd	%xmm3, %xmm2
	movdqa	%xmm7, %xmm1
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm7, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movups	%xmm0, 0(%rbp,%rcx)
	addq	$16, %rcx
	cmpq	%rcx, %r8
	jne	.L19
	movl	%ebx, %ecx
	andl	$-4, %ecx
	addl	%ecx, %eax
	cmpl	%ecx, %ebx
	je	.L21
	movslq	4(%rsp), %rcx
	movl	%eax, %ebx
	movslq	%eax, %r8
	subl	%r10d, %ebx
	imulq	$10001, %rcx, %rcx
	movslq	%ebx, %rbx
	addq	%rcx, %rbx
	leaq	(%rcx,%r8), %rbp
	movl	(%rdx,%rbx,4), %r12d
	addl	%esi, %r12d
	movl	%r12d, %ebx
	movslq	(%rsp), %r12
	imulq	$10001, %r12, %r12
	addq	%r12, %r8
	movl	(%rdx,%r8,4), %r8d
	cmpl	%r8d, %ebx
	cmovg	%r8d, %ebx
	leal	1(%rax), %r8d
	movl	%ebx, (%rdx,%rbp,4)
	cmpl	%r15d, %r8d
	jg	.L21
	movslq	%r8d, %rbx
	subl	%r10d, %r8d
	movslq	%r8d, %r8
	leaq	(%rcx,%rbx), %rbp
	addq	%r12, %rbx
	addq	%rcx, %r8
	movl	(%rdx,%rbx,4), %ebx
	movl	(%rdx,%r8,4), %r13d
	addl	%esi, %r13d
	cmpl	%ebx, %r13d
	movl	%r13d, %r8d
	cmovg	%ebx, %r8d
	addl	$2, %eax
	movl	%r8d, (%rdx,%rbp,4)
	cmpl	%eax, %r15d
	jl	.L21
	movslq	%eax, %r8
	subl	%r10d, %eax
	cltq
	addq	%r8, %r12
	leaq	(%rcx,%r8), %rbx
	addq	%rax, %rcx
	movl	(%rdx,%r12,4), %eax
	addl	(%rdx,%rcx,4), %esi
	cmpl	%eax, %esi
	cmovg	%eax, %esi
	movl	%esi, (%rdx,%rbx,4)
.L21:
	addq	$1, %r11
	addq	$10001, %r14
	movq	%r9, %rcx
	addq	$40004, %rdi
	cmpq	8(%rsp), %r11
	jne	.L13
.L12:
	imulq	$10001, 8(%rsp), %rax
	movslq	44(%rsp), %rcx
	movl	$1, %edi
	leaq	.LC6(%rip), %rsi
	addq	%rcx, %rax
	movl	(%rdx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L61
	addq	$72, %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
.L26:
	.cfi_restore_state
	movl	40(%rsp), %eax
	movl	$4, %ebx
	leaq	4(%rdi), %r9
	cmpl	%r10d, %eax
	movl	%eax, %r8d
	cmovg	%r10d, %r8d
	movslq	%r8d, %rax
	salq	$2, %rax
	testl	%r8d, %r8d
	cmovle	%rbx, %rax
	addq	%rdi, %rax
	cmpq	%r9, %rax
	cmovg	%r9, %rax
	cmpq	%rax, %rdi
	jl	.L32
	cmpl	$3, %r8d
	jle	.L32
	testl	%r8d, %r8d
	movl	$1, %ebx
	movl	40004(%rcx), %r13d
	movdqa	.LC0(%rip), %xmm2
	cmovg	%r8d, %ebx
	leaq	40004(%rcx), %r9
	xorl	%eax, %eax
	addl	%esi, %r13d
	movl	%ebx, %ebp
	movd	%r13d, %xmm3
	shrl	$2, %ebp
	pshufd	$0, %xmm3, %xmm3
	salq	$4, %rbp
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rcx,%rax), %xmm0
	movdqu	(%rcx,%rax), %xmm7
	movdqa	%xmm3, %xmm6
	movdqa	%xmm2, %xmm1
	paddd	%xmm4, %xmm1
	paddd	%xmm5, %xmm2
	pcmpgtd	%xmm3, %xmm0
	pand	%xmm0, %xmm6
	pandn	%xmm7, %xmm0
	por	%xmm6, %xmm0
	movups	%xmm0, (%r9,%rax)
	addq	$16, %rax
	cmpq	%rbp, %rax
	jne	.L15
	movl	%ebx, %r12d
	pshufd	$255, %xmm1, %xmm1
	andl	$-4, %r12d
	andl	$3, %ebx
	movd	%xmm1, %eax
	je	.L17
	movslq	4(%rsp), %rbx
	movslq	%r12d, %rax
	movl	40004(%rcx), %r13d
	imulq	$10001, %rbx, %rbx
	addl	%esi, %r13d
	leaq	(%rbx,%rax), %rbp
	movq	%rbp, 16(%rsp)
	movslq	(%rsp), %rbp
	imulq	$10001, %rbp, %rbp
	addq	%rbp, %rax
	movl	(%rdx,%rax,4), %eax
	cmpl	%eax, %r13d
	cmovg	%eax, %r13d
	movq	16(%rsp), %rax
	movl	%r13d, (%rdx,%rax,4)
	leal	1(%r12), %eax
	cmpl	%eax, %r8d
	jle	.L17
	cltq
	leaq	(%rbx,%rax), %r13
	addq	%rbp, %rax
	movq	%r13, 16(%rsp)
	movl	40004(%rcx), %r13d
	movl	(%rdx,%rax,4), %eax
	addl	%esi, %r13d
	cmpl	%eax, %r13d
	cmovg	%eax, %r13d
	movq	16(%rsp), %rax
	movl	%r13d, (%rdx,%rax,4)
	leal	2(%r12), %eax
	cmpl	%eax, %r8d
	jle	.L17
	cltq
	movl	40004(%rcx), %r8d
	addq	%rax, %rbp
	addq	%rax, %rbx
	movl	(%rdx,%rbp,4), %eax
	addl	%esi, %r8d
	movl	%r8d, %ecx
	cmpl	%eax, %r8d
	cmovg	%eax, %ecx
	leal	3(%r12), %eax
	movl	%ecx, (%rdx,%rbx,4)
.L17:
	cmpl	%eax, %r15d
	jge	.L25
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L32:
	movl	$40004, %r13d
	movq	%rcx, %rbx
	xorl	%eax, %eax
	subq	%rdi, %r13
	.p2align 4,,10
	.p2align 3
.L14:
	movl	40004(%rcx), %r9d
	movl	(%rbx), %r12d
	leaq	0(%r13,%rbx), %rbp
	addl	%esi, %r9d
	cmpl	%r12d, %r9d
	cmovg	%r12d, %r9d
	addl	$1, %eax
	addq	$4, %rbx
	movl	%r9d, 0(%rbp,%rdi)
	cmpl	%eax, %r8d
	jg	.L14
	leaq	40004(%rcx), %r9
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%eax, %r10
	movslq	%ecx, %rcx
	leaq	-40004(%rdi), %rbp
	leaq	(%r10,%r14), %r8
	subq	%r10, %rcx
	leaq	(%rdx,%r8,4), %r8
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r8, %rbx
	movl	(%r8,%rcx,4), %r10d
	subq	%rdi, %rbx
	movl	(%rbx,%rbp), %ebx
	addl	%esi, %r10d
	cmpl	%ebx, %r10d
	cmovg	%ebx, %r10d
	addl	$1, %eax
	addq	$4, %r8
	movl	%r10d, -4(%r8)
	cmpl	%r15d, %eax
	jle	.L23
	jmp	.L21
.L60:
	xorl	%eax, %eax
	jmp	.L10
.L2:
	movl	48(%rsp), %r15d
	je	.L27
	movl	%r15d, 44(%rsp)
	leaq	dp(%rip), %rdx
	movl	$0, dp(%rip)
	jmp	.L12
.L4:
	movslq	%ebx, %rax
	leaq	dp(%rip), %rdx
	movl	$0, dp(%rip)
	movq	%rax, 8(%rsp)
	jmp	.L12
.L5:
	movl	$0, dp(%rip)
	leaq	dp(%rip), %rdx
	jmp	.L12
.L61:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 40044004
dp:
	.zero	40044004
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC3:
	.long	100000000
	.long	100000000
	.long	100000000
	.long	100000000
	.align 16
.LC4:
	.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>
#include <math.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

#define MAX_N 1000
#define MAX_B 10000
int dp[MAX_N + 1][MAX_B + 1];
int main() {
    int h, n;
    scanf("%d %d", &h, &n);
    int *a = malloc(sizeof(int) * n); // attack
    int *b = malloc(sizeof(int) * n); // cost
    int max = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        scanf("%d", &b[i]);
    }

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= h; j++) {
            dp[i][j] = 100000000;
        }
    }
    dp[0][0] = 0;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= h + max; j++) {
            if (j < a[i]) {
                dp[i+1][j] = MIN(dp[i][j], dp[i+1][0] + b[i]);
                //printf("1) %d, %d, %d\n", i, j, dp[i+1][j]);
            } else {
                dp[i+1][j] = MIN(dp[i][j], dp[i+1][j-a[i]] + b[i]);
                //printf("2) %d, %d, %d\n", i, j, dp[i+1][j]);
            }
        }
    }

    /*
        for (int i = 0; i < n + 1; i++) {
        for (int j = 0; j < h + 1; j++) {
            printf("%d ", dp[i][j]);
        }
        printf("\n");

    }
    */
    printf("%d\n", dp[n][h]);
    return 0;
}
9999 10
540 7550
691 13640
700 9790
510 7150
415 5818
551 7712
587 8227
619 8671
588 8228
176 2461
 100 6
1 1
2 3
3 9
4 27
5 81
5 243
 110 6
1 1
2 3
3 9
4 27
5 81
5 243
 9999 10
540 7550
691 20670
700 9790
863 7150
415 5818
551 7712
587 8227
619 8671
588 8228
176 2461
 9999 10
540 7550
691 20670
700 9790
863 7150
415 1114
551 7712
587 8227
941 8671
588 10398
176 2461
 9999 5
540 4853
1222 7523
1778 16913
231 7150
415 769
118 7712
1118 8227
908 8671
94 4378
37 2120
 9999 5
289 4853
1222 12181
1778 16913
231 7150
415 1085
118 7712
1118 8227
1028 8975
94 5576
37 2120
 18187 7
197 2752
1222 10579
1778 16891
231 7150
415 1085
118 7083
813 10801
1028 8975
94 737
72 2120
 18187 7
228 2752
1939 10579
1778 16891
206 7150
415 1085
118 7083
560 878
3260 8600
12 1223
72 2120
 18187 7
379 2752
979 10579
1778 10271
187 7150
415 2513
130 13207
731 878
28 8600
6 2361
72 2120

139815
 100
 110
 85800
 27850
 19225
 27125
 21700
 13170
 10536

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>
#include <math.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

#define MAX_N 1000
#define MAX_B 10000
int dp[MAX_N + 1][MAX_B + 1];
int main() {
    int h, n;
    scanf("%d %d", &h, &n);
    int *a = malloc(sizeof(int) * n); // attack
    int *b = malloc(sizeof(int) * n); // cost
    int max = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        scanf("%d", &b[i]);
    }

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= h; j++) {
            dp[i][j] = 100000000;
        }
    }
    dp[0][0] = 0;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= h + max; j++) {
            if (j < a[i]) {
                dp[i+1][j] = MIN(dp[i][j], dp[i+1][0] + b[i]);
                //printf("1) %d, %d, %d\n", i, j, dp[i+1][j]);
            } else {
                dp[i+1][j] = MIN(dp[i][j], dp[i+1][j-a[i]] + b[i]);
                //printf("2) %d, %d, %d\n", i, j, dp[i+1][j]);
            }
        }
    }

    /*
        for (int i = 0; i < n + 1; i++) {
        for (int j = 0; j < h + 1; j++) {
            printf("%d ", dp[i][j]);
        }
        printf("\n");

    }
    */
    printf("%d\n", dp[n][h]);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 40044004
dp:
	.zero	40044004
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L2
.L3:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L3
	movl	$0, -44(%rbp)
	jmp	.L4
.L7:
	movl	$0, -40(%rbp)
	jmp	.L5
.L6:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$100000000, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L5:
	movl	-56(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L6
	addl	$1, -44(%rbp)
.L4:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L7
	movl	$0, dp(%rip)
	movl	$0, -36(%rbp)
	jmp	.L8
.L13:
	movl	$0, -32(%rbp)
	jmp	.L9
.L12:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L10
	movl	-36(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	$40004, %rax, %rax
	leaq	dp(%rip), %rdx
	movl	(%rax,%rdx), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-36(%rbp), %ecx
	addl	$1, %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$10001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L11
.L10:
	movl	-36(%rbp), %eax
	leal	1(%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %ecx
	movl	-32(%rbp), %eax
	subl	%ecx, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-36(%rbp), %ecx
	addl	$1, %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$10001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L11:
	addl	$1, -32(%rbp)
.L9:
	movl	-56(%rbp), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L12
	addl	$1, -36(%rbp)
.L8:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L13
	movl	-52(%rbp), %eax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$10001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 40044004
dp:
	.zero	40044004
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-52(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L2
.L3:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -48(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L3
	movl	$0, -44(%rbp)
	jmp	.L4
.L7:
	movl	$0, -40(%rbp)
	jmp	.L5
.L6:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-44(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$100000000, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L5:
	movl	-56(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L6
	addl	$1, -44(%rbp)
.L4:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L7
	movl	$0, dp(%rip)
	movl	$0, -36(%rbp)
	jmp	.L8
.L13:
	movl	$0, -32(%rbp)
	jmp	.L9
.L12:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L10
	movl	-36(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	$40004, %rax, %rax
	leaq	dp(%rip), %rdx
	movl	(%rax,%rdx), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-36(%rbp), %ecx
	addl	$1, %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$10001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L11
.L10:
	movl	-36(%rbp), %eax
	leal	1(%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %ecx
	movl	-32(%rbp), %eax
	subl	%ecx, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	cltq
	imulq	$10001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-36(%rbp), %ecx
	addl	$1, %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$10001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L11:
	addl	$1, -32(%rbp)
.L9:
	movl	-56(%rbp), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L12
	addl	$1, -36(%rbp)
.L8:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L13
	movl	-52(%rbp), %eax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$10001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
