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 INF 1000000
#define MIN(A,B) ((A) <= (B) ? (A) : (B))

int Ma,Mb,N,maxasum,maxbsum;
int a[41],b[41],c[41];
int DP[41][401][401];

int main(void){
    int i,j,k;


    scanf("%d %d %d",&N,&Ma,&Mb);

    for(i = 1;i <= N;i++)
        scanf("%d %d %d",&a[i],&b[i],&c[i]);

    j = 0;k = 0;
    for(i = 1;i <= N;i++){
        if(j < a[i])
            j = a[i];
        if(k < b[i])
            k = b[i];
    }
    maxasum = j * N;
    maxbsum = k * N;

    for(i = 0;i <= N;i++)
        for(j = 0;j <= 400;j++)
            for(k = 0;k <= 400;k++)
                DP[i][j][k] = INF;

    DP[0][0][0] = 0;
    for(i = 1;i <= N;i++){
        for(j = 0;j <= maxasum;j++ ){
            for(k = 0;k <= maxbsum;k++){
                if(a[i] <= j && b[i] <= k)
                    DP[i][j][k] = MIN(DP[i - 1][j - a[i]][k - b[i]] + c[i],DP[i - 1][j][k]);
                else
                    DP[i][j][k] = DP[i - 1][j][k];
            }
        }
    }

    i = Ma;j = Mb;k = INF;
    while(i <= maxasum && j <= maxbsum){
        if(k > DP[N][i][j])
            k = DP[N][i][j];
        i += Ma;j += Mb;
    }
    printf("%d\n",k < INF ? k : -1);
    return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	Ma
	.bss
	.align 4
	.type	Ma, @object
	.size	Ma, 4
Ma:
	.zero	4
	.globl	Mb
	.align 4
	.type	Mb, @object
	.size	Mb, 4
Mb:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	maxasum
	.align 4
	.type	maxasum, @object
	.size	maxasum, 4
maxasum:
	.zero	4
	.globl	maxbsum
	.align 4
	.type	maxbsum, @object
	.size	maxbsum, 4
maxbsum:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 164
a:
	.zero	164
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 164
b:
	.zero	164
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 164
c:
	.zero	164
	.globl	DP
	.align 32
	.type	DP, @object
	.size	DP, 26371364
DP:
	.zero	26371364
	.section	.rodata
.LC0:
	.string	"%d %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
	subq	$16, %rsp
	leaq	Mb(%rip), %rax
	movq	%rax, %rcx
	leaq	Ma(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	a(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L4
.L7:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L6
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L6:
	addl	$1, -12(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L7
	movl	N(%rip), %eax
	imull	-8(%rbp), %eax
	movl	%eax, maxasum(%rip)
	movl	N(%rip), %eax
	imull	-4(%rbp), %eax
	movl	%eax, maxbsum(%rip)
	movl	$0, -12(%rbp)
	jmp	.L8
.L13:
	movl	$0, -8(%rbp)
	jmp	.L9
.L12:
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	$1000000, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L10:
	cmpl	$400, -4(%rbp)
	jle	.L11
	addl	$1, -8(%rbp)
.L9:
	cmpl	$400, -8(%rbp)
	jle	.L12
	addl	$1, -12(%rbp)
.L8:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L13
	movl	$0, DP(%rip)
	movl	$1, -12(%rbp)
	jmp	.L14
.L21:
	movl	$0, -8(%rbp)
	jmp	.L15
.L20:
	movl	$0, -4(%rbp)
	jmp	.L16
.L19:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L17
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	-12(%rbp), %eax
	leal	-1(%rax), %esi
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	subl	%edx, %eax
	movslq	%eax, %rdi
	movslq	%esi, %rdx
	movslq	%ecx, %rax
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rcx,%rax), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	DP(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rsi
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	DP(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L18
.L17:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rsi
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	DP(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L18:
	addl	$1, -4(%rbp)
.L16:
	movl	maxbsum(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L19
	addl	$1, -8(%rbp)
.L15:
	movl	maxasum(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L20
	addl	$1, -12(%rbp)
.L14:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L21
	movl	Ma(%rip), %eax
	movl	%eax, -12(%rbp)
	movl	Mb(%rip), %eax
	movl	%eax, -8(%rbp)
	movl	$1000000, -4(%rbp)
	jmp	.L22
.L25:
	movl	N(%rip), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L23
	movl	N(%rip), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L23:
	movl	Ma(%rip), %eax
	addl	%eax, -12(%rbp)
	movl	Mb(%rip), %eax
	addl	%eax, -8(%rbp)
.L22:
	movl	maxasum(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L24
	movl	maxbsum(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L25
.L24:
	cmpl	$999999, -4(%rbp)
	jg	.L26
	movl	-4(%rbp), %eax
	jmp	.L27
.L26:
	movl	$-1, %eax
.L27:
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	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 %d"
.LC2:
	.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
	leaq	Ma(%rip), %rdx
	leaq	Mb(%rip), %rcx
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	leaq	N(%rip), %rsi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r14, %rdi
	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
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edx
	testl	%edx, %edx
	jle	.L2
	movl	$4, %r12d
	movl	$1, %r13d
	leaq	c(%rip), %r15
	leaq	b(%rip), %rbx
	leaq	a(%rip), %rbp
.L3:
	leaq	(%rbx,%r12), %rdx
	leaq	(%r15,%r12), %rcx
	movq	%r14, %rdi
	xorl	%eax, %eax
	leaq	0(%rbp,%r12), %rsi
	addl	$1, %r13d
	addq	$4, %r12
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edx
	cmpl	%r13d, %edx
	jge	.L3
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L37
	movdqu	4+a(%rip), %xmm0
	pxor	%xmm1, %xmm1
	movl	%edx, %eax
	movdqu	4+b(%rip), %xmm2
	movdqu	4+a(%rip), %xmm5
	shrl	$2, %eax
	pcmpgtd	%xmm1, %xmm0
	pcmpgtd	%xmm1, %xmm2
	movdqu	4+b(%rip), %xmm1
	pand	%xmm5, %xmm0
	pand	%xmm2, %xmm1
	cmpl	$1, %eax
	je	.L5
	movdqu	20+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	20+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$2, %eax
	je	.L5
	movdqu	36+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	36+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$3, %eax
	je	.L5
	movdqu	52+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	52+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$4, %eax
	je	.L5
	movdqu	68+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	68+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$5, %eax
	je	.L5
	movdqu	84+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	84+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$6, %eax
	je	.L5
	movdqu	100+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	100+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$7, %eax
	je	.L5
	movdqu	116+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	116+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$8, %eax
	je	.L5
	movdqu	132+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	132+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$9, %eax
	je	.L5
	movdqu	148+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	148+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
.L5:
	movdqa	%xmm1, %xmm3
	movl	%edx, %edi
	psrldq	$8, %xmm3
	andl	$-4, %edi
	movdqa	%xmm3, %xmm2
	leal	1(%rdi), %esi
	pcmpgtd	%xmm1, %xmm2
	pand	%xmm2, %xmm3
	pandn	%xmm1, %xmm2
	movdqa	%xmm2, %xmm1
	por	%xmm3, %xmm1
	movdqa	%xmm1, %xmm3
	psrldq	$4, %xmm3
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm1, %xmm2
	pand	%xmm2, %xmm3
	pandn	%xmm1, %xmm2
	movdqa	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	por	%xmm3, %xmm1
	psrldq	$8, %xmm2
	movd	%xmm1, %eax
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %ecx
	cmpl	%edi, %edx
	je	.L6
.L4:
	movslq	%esi, %rdi
	movl	0(%rbp,%rdi,4), %r8d
	movl	(%rbx,%rdi,4), %edi
	cmpl	%r8d, %ecx
	cmovl	%r8d, %ecx
	cmpl	%edi, %eax
	cmovl	%edi, %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %edx
	jl	.L6
	movslq	%edi, %rdi
	movl	0(%rbp,%rdi,4), %r8d
	movl	(%rbx,%rdi,4), %edi
	cmpl	%r8d, %ecx
	cmovl	%r8d, %ecx
	cmpl	%edi, %eax
	cmovl	%edi, %eax
	addl	$2, %esi
	cmpl	%esi, %edx
	jl	.L6
	movslq	%esi, %rsi
	movl	0(%rbp,%rsi,4), %edi
	movl	(%rbx,%rsi,4), %esi
	cmpl	%edi, %ecx
	cmovl	%edi, %ecx
	cmpl	%esi, %eax
	cmovl	%esi, %eax
.L6:
	imull	%edx, %ecx
	movl	%edx, %r14d
	imull	%edx, %eax
	movl	%ecx, maxasum(%rip)
	movl	%ecx, %edx
	movl	%eax, maxbsum(%rip)
.L35:
	leaq	DP(%rip), %rsi
	movdqa	.LC1(%rip), %xmm0
	xorl	%r10d, %r10d
	leaq	644804(%rsi), %r9
.L11:
	leaq	-643204(%r9), %rcx
	leaq	-644804(%r9), %rdi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rdi, %r8
	.p2align 4,,10
	.p2align 3
.L9:
	movups	%xmm0, (%r8)
	addq	$16, %r8
	cmpq	%r8, %rcx
	jne	.L9
	movl	$1000000, (%rcx)
	addq	$1604, %rcx
	addq	$1604, %rdi
	cmpq	%r9, %rcx
	jne	.L7
	addl	$1, %r10d
	leaq	643204(%rcx), %r9
	cmpl	%r14d, %r10d
	jle	.L11
	movl	$0, DP(%rip)
	testl	%r14d, %r14d
	je	.L13
	testl	%edx, %edx
	js	.L13
	leal	1(%r14), %ebx
	movl	%edx, 52(%rsp)
	xorl	%r15d, %r15d
	xorl	%r10d, %r10d
	movl	%ebx, 28(%rsp)
	leal	1(%rax), %ebx
	movl	%ebx, %ecx
	movl	%ebx, 24(%rsp)
	andl	$-4, %ebx
	shrl	$2, %ecx
	movl	%ebx, 20(%rsp)
	leaq	643204(%rsi), %rbx
	subl	$1, %ecx
	movq	%rbx, 32(%rsp)
	leal	1(%rdx), %ebx
	addq	$1, %rcx
	movl	%ebx, 48(%rsp)
	movl	%eax, %ebx
	salq	$4, %rcx
	movl	$1, 16(%rsp)
	movq	%rcx, 8(%rsp)
	movq	%rbx, (%rsp)
.L15:
	movq	32(%rsp), %rdx
	movslq	%r10d, %rcx
	leaq	(%rsi,%r15), %r12
	xorl	%r11d, %r11d
	leaq	(%rdx,%r15), %rdi
	imulq	$160801, %rcx, %rdx
	movslq	16(%rsp), %rcx
	imulq	$160801, %rcx, %rbx
	movq	%rbx, 40(%rsp)
.L27:
	testl	%eax, %eax
	js	.L26
	leaq	4+a(%rip), %rbx
	movl	%r11d, %r8d
	movl	(%rbx,%r10,4), %ecx
	subl	%ecx, %r8d
	cmpl	%r11d, %ecx
	jle	.L16
	cmpl	$2, %eax
	jbe	.L38
	leaq	-643204(%rdi), %r8
	xorl	%ecx, %ecx
.L18:
	movdqu	(%r8,%rcx), %xmm4
	movups	%xmm4, (%rdi,%rcx)
	addq	$16, %rcx
	cmpq	8(%rsp), %rcx
	jne	.L18
	movl	20(%rsp), %r8d
	movl	24(%rsp), %ebx
	cmpl	%ebx, %r8d
	je	.L26
.L17:
	movslq	%r11d, %rcx
	movslq	%r8d, %rbx
	imulq	$401, %rcx, %rcx
	leaq	(%rdx,%rcx), %r9
	addq	40(%rsp), %rcx
	leaq	(%r9,%rbx), %rbp
	addq	%rcx, %rbx
	movl	(%rsi,%rbp,4), %ebp
	movl	%ebp, (%rsi,%rbx,4)
	leal	1(%r8), %ebx
	cmpl	%eax, %ebx
	jg	.L26
	movslq	%ebx, %rbx
	addl	$2, %r8d
	leaq	(%r9,%rbx), %rbp
	addq	%rcx, %rbx
	movl	(%rsi,%rbp,4), %ebp
	movl	%ebp, (%rsi,%rbx,4)
	cmpl	%eax, %r8d
	jg	.L26
	movslq	%r8d, %r8
	addq	%r8, %r9
	addq	%r8, %rcx
	movl	(%rsi,%r9,4), %r9d
	movl	%r9d, (%rsi,%rcx,4)
.L26:
	addl	$1, %r11d
	addq	$1604, %rdi
	addq	$1604, %r12
	cmpl	48(%rsp), %r11d
	jne	.L27
	addl	$1, 16(%rsp)
	addq	$1, %r10
	movl	16(%rsp), %ebx
	addq	$643204, %r15
	cmpl	28(%rsp), %ebx
	jne	.L15
	movl	52(%rsp), %edx
.L13:
	movl	Mb(%rip), %esi
	movl	Ma(%rip), %edi
	cmpl	%eax, %esi
	jg	.L39
	cmpl	%edi, %edx
	jl	.L39
	cmpl	$1, %esi
	jne	.L102
	movslq	%edi, %r9
	movslq	%r14d, %rcx
	leaq	DP(%rip), %r8
	movl	%edi, %r10d
	imulq	$1604, %r9, %r9
	imulq	$643204, %rcx, %rcx
	addq	$4, %r9
	addq	%r9, %rcx
	addq	%r8, %rcx
	movl	$1000000, %r8d
	jmp	.L33
.L103:
	cmpl	%esi, %eax
	jl	.L32
.L33:
	movl	(%rcx), %r11d
	cmpl	%r11d, %r8d
	cmovg	%r11d, %r8d
	addl	%edi, %r10d
	addl	$1, %esi
	addq	%r9, %rcx
	cmpl	%r10d, %edx
	jge	.L103
.L32:
	cmpl	$1000000, %r8d
	movl	$-1, %eax
	cmove	%eax, %r8d
.L28:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	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
.L16:
	.cfi_restore_state
	movslq	%r8d, %r8
	leaq	4+b(%rip), %rbx
	xorl	%ecx, %ecx
	imulq	$401, %r8, %r8
	movl	(%rbx,%r10,4), %ebp
	movl	%ebp, %r9d
	addq	%rdx, %r8
	negl	%r9d
	movq	%r8, 56(%rsp)
	jmp	.L23
.L104:
	movq	56(%rsp), %r8
	movslq	%r9d, %r13
	addq	%r13, %r8
	leaq	4+c(%rip), %r13
	movl	0(%r13,%r10,4), %r13d
	addl	(%rsi,%r8,4), %r13d
	cmpl	%ebx, %r13d
	cmovg	%ebx, %r13d
	leaq	1(%rcx), %rbx
	addl	$1, %r9d
	movl	%r13d, (%rdi,%rcx,4)
	cmpq	(%rsp), %rcx
	je	.L26
.L21:
	movq	%rbx, %rcx
.L23:
	movl	(%r12,%rcx,4), %ebx
	cmpl	%ecx, %ebp
	jle	.L104
	movl	%ebx, (%rdi,%rcx,4)
	addl	$1, %r9d
	leaq	1(%rcx), %rbx
	cmpq	(%rsp), %rcx
	jne	.L21
	jmp	.L26
.L38:
	xorl	%r8d, %r8d
	jmp	.L17
.L2:
	movl	$0, maxasum(%rip)
	movl	$0, maxbsum(%rip)
	testl	%edx, %edx
	je	.L105
	movl	$0, DP(%rip)
	movl	%edx, %r14d
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L13
.L37:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	movl	$1, %esi
	jmp	.L4
.L39:
	orl	$-1, %r8d
	jmp	.L28
.L102:
	movslq	%edi, %rcx
	movslq	%esi, %r8
	movl	%esi, %r9d
	imulq	$401, %rcx, %rcx
	addq	%r8, %rcx
	movslq	%r14d, %r8
	imulq	$160801, %r8, %r8
	leaq	0(,%rcx,4), %rbx
	addq	%r8, %rcx
	leaq	DP(%rip), %r8
	leaq	(%r8,%rcx,4), %r10
	movl	%edi, %ecx
	movl	$1000000, %r8d
	jmp	.L30
.L106:
	cmpl	%ecx, %edx
	jl	.L32
.L30:
	movl	(%r10), %r11d
	cmpl	%r11d, %r8d
	cmovg	%r11d, %r8d
	addl	%esi, %r9d
	addl	%edi, %ecx
	addq	%rbx, %r10
	cmpl	%eax, %r9d
	jle	.L106
	jmp	.L32
.L105:
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	jmp	.L35
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	DP
	.bss
	.align 32
	.type	DP, @object
	.size	DP, 26371364
DP:
	.zero	26371364
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 164
c:
	.zero	164
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 164
b:
	.zero	164
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 164
a:
	.zero	164
	.globl	maxbsum
	.align 4
	.type	maxbsum, @object
	.size	maxbsum, 4
maxbsum:
	.zero	4
	.globl	maxasum
	.align 4
	.type	maxasum, @object
	.size	maxasum, 4
maxasum:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	Mb
	.align 4
	.type	Mb, @object
	.size	Mb, 4
Mb:
	.zero	4
	.globl	Ma
	.align 4
	.type	Ma, @object
	.size	Ma, 4
Ma:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1000000
	.long	1000000
	.long	1000000
	.long	1000000
	.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 %d"
.LC2:
	.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
	leaq	Ma(%rip), %rdx
	leaq	Mb(%rip), %rcx
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	leaq	N(%rip), %rsi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r14, %rdi
	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
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edx
	testl	%edx, %edx
	jle	.L2
	movl	$4, %r12d
	movl	$1, %r13d
	leaq	c(%rip), %r15
	leaq	b(%rip), %rbx
	leaq	a(%rip), %rbp
.L3:
	leaq	(%rbx,%r12), %rdx
	leaq	(%r15,%r12), %rcx
	movq	%r14, %rdi
	xorl	%eax, %eax
	leaq	0(%rbp,%r12), %rsi
	addl	$1, %r13d
	addq	$4, %r12
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edx
	cmpl	%r13d, %edx
	jge	.L3
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L37
	movdqu	4+a(%rip), %xmm0
	pxor	%xmm1, %xmm1
	movl	%edx, %eax
	movdqu	4+b(%rip), %xmm2
	movdqu	4+a(%rip), %xmm5
	shrl	$2, %eax
	pcmpgtd	%xmm1, %xmm0
	pcmpgtd	%xmm1, %xmm2
	movdqu	4+b(%rip), %xmm1
	pand	%xmm5, %xmm0
	pand	%xmm2, %xmm1
	cmpl	$1, %eax
	je	.L5
	movdqu	20+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	20+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$2, %eax
	je	.L5
	movdqu	36+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	36+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$3, %eax
	je	.L5
	movdqu	52+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	52+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$4, %eax
	je	.L5
	movdqu	68+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	68+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$5, %eax
	je	.L5
	movdqu	84+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	84+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$6, %eax
	je	.L5
	movdqu	100+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	100+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$7, %eax
	je	.L5
	movdqu	116+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	116+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$8, %eax
	je	.L5
	movdqu	132+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	132+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
	cmpl	$9, %eax
	je	.L5
	movdqu	148+a(%rip), %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm2, %xmm3
	movdqu	148+b(%rip), %xmm2
	movdqa	%xmm3, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm1, %xmm3
	movdqa	%xmm3, %xmm1
	por	%xmm2, %xmm1
.L5:
	movdqa	%xmm1, %xmm3
	movl	%edx, %edi
	psrldq	$8, %xmm3
	andl	$-4, %edi
	movdqa	%xmm3, %xmm2
	leal	1(%rdi), %esi
	pcmpgtd	%xmm1, %xmm2
	pand	%xmm2, %xmm3
	pandn	%xmm1, %xmm2
	movdqa	%xmm2, %xmm1
	por	%xmm3, %xmm1
	movdqa	%xmm1, %xmm3
	psrldq	$4, %xmm3
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm1, %xmm2
	pand	%xmm2, %xmm3
	pandn	%xmm1, %xmm2
	movdqa	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	por	%xmm3, %xmm1
	psrldq	$8, %xmm2
	movd	%xmm1, %eax
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %ecx
	cmpl	%edi, %edx
	je	.L6
.L4:
	movslq	%esi, %rdi
	movl	0(%rbp,%rdi,4), %r8d
	movl	(%rbx,%rdi,4), %edi
	cmpl	%r8d, %ecx
	cmovl	%r8d, %ecx
	cmpl	%edi, %eax
	cmovl	%edi, %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %edx
	jl	.L6
	movslq	%edi, %rdi
	movl	0(%rbp,%rdi,4), %r8d
	movl	(%rbx,%rdi,4), %edi
	cmpl	%r8d, %ecx
	cmovl	%r8d, %ecx
	cmpl	%edi, %eax
	cmovl	%edi, %eax
	addl	$2, %esi
	cmpl	%esi, %edx
	jl	.L6
	movslq	%esi, %rsi
	movl	0(%rbp,%rsi,4), %edi
	movl	(%rbx,%rsi,4), %esi
	cmpl	%edi, %ecx
	cmovl	%edi, %ecx
	cmpl	%esi, %eax
	cmovl	%esi, %eax
.L6:
	imull	%edx, %ecx
	movl	%edx, %r14d
	imull	%edx, %eax
	movl	%ecx, maxasum(%rip)
	movl	%ecx, %edx
	movl	%eax, maxbsum(%rip)
.L35:
	leaq	DP(%rip), %rsi
	movdqa	.LC1(%rip), %xmm0
	xorl	%r10d, %r10d
	leaq	644804(%rsi), %r9
.L11:
	leaq	-643204(%r9), %rcx
	leaq	-644804(%r9), %rdi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rdi, %r8
	.p2align 4,,10
	.p2align 3
.L9:
	movups	%xmm0, (%r8)
	addq	$16, %r8
	cmpq	%r8, %rcx
	jne	.L9
	movl	$1000000, (%rcx)
	addq	$1604, %rcx
	addq	$1604, %rdi
	cmpq	%r9, %rcx
	jne	.L7
	addl	$1, %r10d
	leaq	643204(%rcx), %r9
	cmpl	%r14d, %r10d
	jle	.L11
	movl	$0, DP(%rip)
	testl	%r14d, %r14d
	je	.L13
	testl	%edx, %edx
	js	.L13
	leal	1(%r14), %ebx
	movl	%edx, 52(%rsp)
	xorl	%r15d, %r15d
	xorl	%r10d, %r10d
	movl	%ebx, 28(%rsp)
	leal	1(%rax), %ebx
	movl	%ebx, %ecx
	movl	%ebx, 24(%rsp)
	andl	$-4, %ebx
	shrl	$2, %ecx
	movl	%ebx, 20(%rsp)
	leaq	643204(%rsi), %rbx
	subl	$1, %ecx
	movq	%rbx, 32(%rsp)
	leal	1(%rdx), %ebx
	addq	$1, %rcx
	movl	%ebx, 48(%rsp)
	movl	%eax, %ebx
	salq	$4, %rcx
	movl	$1, 16(%rsp)
	movq	%rcx, 8(%rsp)
	movq	%rbx, (%rsp)
.L15:
	movq	32(%rsp), %rdx
	movslq	%r10d, %rcx
	leaq	(%rsi,%r15), %r12
	xorl	%r11d, %r11d
	leaq	(%rdx,%r15), %rdi
	imulq	$160801, %rcx, %rdx
	movslq	16(%rsp), %rcx
	imulq	$160801, %rcx, %rbx
	movq	%rbx, 40(%rsp)
.L27:
	testl	%eax, %eax
	js	.L26
	leaq	4+a(%rip), %rbx
	movl	%r11d, %r8d
	movl	(%rbx,%r10,4), %ecx
	subl	%ecx, %r8d
	cmpl	%r11d, %ecx
	jle	.L16
	cmpl	$2, %eax
	jbe	.L38
	leaq	-643204(%rdi), %r8
	xorl	%ecx, %ecx
.L18:
	movdqu	(%r8,%rcx), %xmm4
	movups	%xmm4, (%rdi,%rcx)
	addq	$16, %rcx
	cmpq	8(%rsp), %rcx
	jne	.L18
	movl	20(%rsp), %r8d
	movl	24(%rsp), %ebx
	cmpl	%ebx, %r8d
	je	.L26
.L17:
	movslq	%r11d, %rcx
	movslq	%r8d, %rbx
	imulq	$401, %rcx, %rcx
	leaq	(%rdx,%rcx), %r9
	addq	40(%rsp), %rcx
	leaq	(%r9,%rbx), %rbp
	addq	%rcx, %rbx
	movl	(%rsi,%rbp,4), %ebp
	movl	%ebp, (%rsi,%rbx,4)
	leal	1(%r8), %ebx
	cmpl	%eax, %ebx
	jg	.L26
	movslq	%ebx, %rbx
	addl	$2, %r8d
	leaq	(%r9,%rbx), %rbp
	addq	%rcx, %rbx
	movl	(%rsi,%rbp,4), %ebp
	movl	%ebp, (%rsi,%rbx,4)
	cmpl	%eax, %r8d
	jg	.L26
	movslq	%r8d, %r8
	addq	%r8, %r9
	addq	%r8, %rcx
	movl	(%rsi,%r9,4), %r9d
	movl	%r9d, (%rsi,%rcx,4)
.L26:
	addl	$1, %r11d
	addq	$1604, %rdi
	addq	$1604, %r12
	cmpl	48(%rsp), %r11d
	jne	.L27
	addl	$1, 16(%rsp)
	addq	$1, %r10
	movl	16(%rsp), %ebx
	addq	$643204, %r15
	cmpl	28(%rsp), %ebx
	jne	.L15
	movl	52(%rsp), %edx
.L13:
	movl	Mb(%rip), %esi
	movl	Ma(%rip), %edi
	cmpl	%eax, %esi
	jg	.L39
	cmpl	%edi, %edx
	jl	.L39
	cmpl	$1, %esi
	jne	.L102
	movslq	%edi, %r9
	movslq	%r14d, %rcx
	leaq	DP(%rip), %r8
	movl	%edi, %r10d
	imulq	$1604, %r9, %r9
	imulq	$643204, %rcx, %rcx
	addq	$4, %r9
	addq	%r9, %rcx
	addq	%r8, %rcx
	movl	$1000000, %r8d
	jmp	.L33
.L103:
	cmpl	%esi, %eax
	jl	.L32
.L33:
	movl	(%rcx), %r11d
	cmpl	%r11d, %r8d
	cmovg	%r11d, %r8d
	addl	%edi, %r10d
	addl	$1, %esi
	addq	%r9, %rcx
	cmpl	%r10d, %edx
	jge	.L103
.L32:
	cmpl	$1000000, %r8d
	movl	$-1, %eax
	cmove	%eax, %r8d
.L28:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	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
.L16:
	.cfi_restore_state
	movslq	%r8d, %r8
	leaq	4+b(%rip), %rbx
	xorl	%ecx, %ecx
	imulq	$401, %r8, %r8
	movl	(%rbx,%r10,4), %ebp
	movl	%ebp, %r9d
	addq	%rdx, %r8
	negl	%r9d
	movq	%r8, 56(%rsp)
	jmp	.L23
.L104:
	movq	56(%rsp), %r8
	movslq	%r9d, %r13
	addq	%r13, %r8
	leaq	4+c(%rip), %r13
	movl	0(%r13,%r10,4), %r13d
	addl	(%rsi,%r8,4), %r13d
	cmpl	%ebx, %r13d
	cmovg	%ebx, %r13d
	leaq	1(%rcx), %rbx
	addl	$1, %r9d
	movl	%r13d, (%rdi,%rcx,4)
	cmpq	(%rsp), %rcx
	je	.L26
.L21:
	movq	%rbx, %rcx
.L23:
	movl	(%r12,%rcx,4), %ebx
	cmpl	%ecx, %ebp
	jle	.L104
	movl	%ebx, (%rdi,%rcx,4)
	addl	$1, %r9d
	leaq	1(%rcx), %rbx
	cmpq	(%rsp), %rcx
	jne	.L21
	jmp	.L26
.L38:
	xorl	%r8d, %r8d
	jmp	.L17
.L2:
	movl	$0, maxasum(%rip)
	movl	$0, maxbsum(%rip)
	testl	%edx, %edx
	je	.L105
	movl	$0, DP(%rip)
	movl	%edx, %r14d
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L13
.L37:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	movl	$1, %esi
	jmp	.L4
.L39:
	orl	$-1, %r8d
	jmp	.L28
.L102:
	movslq	%edi, %rcx
	movslq	%esi, %r8
	movl	%esi, %r9d
	imulq	$401, %rcx, %rcx
	addq	%r8, %rcx
	movslq	%r14d, %r8
	imulq	$160801, %r8, %r8
	leaq	0(,%rcx,4), %rbx
	addq	%r8, %rcx
	leaq	DP(%rip), %r8
	leaq	(%r8,%rcx,4), %r10
	movl	%edi, %ecx
	movl	$1000000, %r8d
	jmp	.L30
.L106:
	cmpl	%ecx, %edx
	jl	.L32
.L30:
	movl	(%r10), %r11d
	cmpl	%r11d, %r8d
	cmovg	%r11d, %r8d
	addl	%esi, %r9d
	addl	%edi, %ecx
	addq	%rbx, %r10
	cmpl	%eax, %r9d
	jle	.L106
	jmp	.L32
.L105:
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	jmp	.L35
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	DP
	.bss
	.align 32
	.type	DP, @object
	.size	DP, 26371364
DP:
	.zero	26371364
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 164
c:
	.zero	164
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 164
b:
	.zero	164
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 164
a:
	.zero	164
	.globl	maxbsum
	.align 4
	.type	maxbsum, @object
	.size	maxbsum, 4
maxbsum:
	.zero	4
	.globl	maxasum
	.align 4
	.type	maxasum, @object
	.size	maxasum, 4
maxasum:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	Mb
	.align 4
	.type	Mb, @object
	.size	Mb, 4
Mb:
	.zero	4
	.globl	Ma
	.align 4
	.type	Ma, @object
	.size	Ma, 4
Ma:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1000000
	.long	1000000
	.long	1000000
	.long	1000000
	.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 INF 1000000
#define MIN(A,B) ((A) <= (B) ? (A) : (B))

int Ma,Mb,N,maxasum,maxbsum;
int a[41],b[41],c[41];
int DP[41][401][401];

int main(void){
    int i,j,k;


    scanf("%d %d %d",&N,&Ma,&Mb);

    for(i = 1;i <= N;i++)
        scanf("%d %d %d",&a[i],&b[i],&c[i]);

    j = 0;k = 0;
    for(i = 1;i <= N;i++){
        if(j < a[i])
            j = a[i];
        if(k < b[i])
            k = b[i];
    }
    maxasum = j * N;
    maxbsum = k * N;

    for(i = 0;i <= N;i++)
        for(j = 0;j <= 400;j++)
            for(k = 0;k <= 400;k++)
                DP[i][j][k] = INF;

    DP[0][0][0] = 0;
    for(i = 1;i <= N;i++){
        for(j = 0;j <= maxasum;j++ ){
            for(k = 0;k <= maxbsum;k++){
                if(a[i] <= j && b[i] <= k)
                    DP[i][j][k] = MIN(DP[i - 1][j - a[i]][k - b[i]] + c[i],DP[i - 1][j][k]);
                else
                    DP[i][j][k] = DP[i - 1][j][k];
            }
        }
    }

    i = Ma;j = Mb;k = INF;
    while(i <= maxasum && j <= maxbsum){
        if(k > DP[N][i][j])
            k = DP[N][i][j];
        i += Ma;j += Mb;
    }
    printf("%d\n",k < INF ? k : -1);
    return 0;

}
1 0 10
10 10 10
 3 1 1
1 2 2
2 1 2
3 3 10
 3 1 1
1 2 2
2 1 4
0 3 16
 3 1 1
1 2 1
2 0 2
3 3 10
 3 1 2
0 2 2
2 1 2
0 3 16
 3 1 1
1 2 2
2 1 5
0 3 16
 3 1 1
1 2 1
2 0 2
3 5 10
 3 2 1
1 2 4
2 1 2
3 3 10
 3 1 1
2 0 2
2 1 2
0 3 10
 3 1 1
1 2 1
3 0 2
3 5 10

-1
 4
 6
 10
 18
 7
 12
 2
 14
 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 INF 1000000
#define MIN(A,B) ((A) <= (B) ? (A) : (B))

int Ma,Mb,N,maxasum,maxbsum;
int a[41],b[41],c[41];
int DP[41][401][401];

int main(void){
    int i,j,k;


    scanf("%d %d %d",&N,&Ma,&Mb);

    for(i = 1;i <= N;i++)
        scanf("%d %d %d",&a[i],&b[i],&c[i]);

    j = 0;k = 0;
    for(i = 1;i <= N;i++){
        if(j < a[i])
            j = a[i];
        if(k < b[i])
            k = b[i];
    }
    maxasum = j * N;
    maxbsum = k * N;

    for(i = 0;i <= N;i++)
        for(j = 0;j <= 400;j++)
            for(k = 0;k <= 400;k++)
                DP[i][j][k] = INF;

    DP[0][0][0] = 0;
    for(i = 1;i <= N;i++){
        for(j = 0;j <= maxasum;j++ ){
            for(k = 0;k <= maxbsum;k++){
                if(a[i] <= j && b[i] <= k)
                    DP[i][j][k] = MIN(DP[i - 1][j - a[i]][k - b[i]] + c[i],DP[i - 1][j][k]);
                else
                    DP[i][j][k] = DP[i - 1][j][k];
            }
        }
    }

    i = Ma;j = Mb;k = INF;
    while(i <= maxasum && j <= maxbsum){
        if(k > DP[N][i][j])
            k = DP[N][i][j];
        i += Ma;j += Mb;
    }
    printf("%d\n",k < INF ? k : -1);
    return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	Ma
	.bss
	.align 4
	.type	Ma, @object
	.size	Ma, 4
Ma:
	.zero	4
	.globl	Mb
	.align 4
	.type	Mb, @object
	.size	Mb, 4
Mb:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	maxasum
	.align 4
	.type	maxasum, @object
	.size	maxasum, 4
maxasum:
	.zero	4
	.globl	maxbsum
	.align 4
	.type	maxbsum, @object
	.size	maxbsum, 4
maxbsum:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 164
a:
	.zero	164
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 164
b:
	.zero	164
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 164
c:
	.zero	164
	.globl	DP
	.align 32
	.type	DP, @object
	.size	DP, 26371364
DP:
	.zero	26371364
	.section	.rodata
.LC0:
	.string	"%d %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
	subq	$16, %rsp
	leaq	Mb(%rip), %rax
	movq	%rax, %rcx
	leaq	Ma(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	a(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L4
.L7:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L6
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L6:
	addl	$1, -12(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L7
	movl	N(%rip), %eax
	imull	-8(%rbp), %eax
	movl	%eax, maxasum(%rip)
	movl	N(%rip), %eax
	imull	-4(%rbp), %eax
	movl	%eax, maxbsum(%rip)
	movl	$0, -12(%rbp)
	jmp	.L8
.L13:
	movl	$0, -8(%rbp)
	jmp	.L9
.L12:
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	$1000000, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L10:
	cmpl	$400, -4(%rbp)
	jle	.L11
	addl	$1, -8(%rbp)
.L9:
	cmpl	$400, -8(%rbp)
	jle	.L12
	addl	$1, -12(%rbp)
.L8:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L13
	movl	$0, DP(%rip)
	movl	$1, -12(%rbp)
	jmp	.L14
.L21:
	movl	$0, -8(%rbp)
	jmp	.L15
.L20:
	movl	$0, -4(%rbp)
	jmp	.L16
.L19:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L17
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	-12(%rbp), %eax
	leal	-1(%rax), %esi
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	subl	%edx, %eax
	movslq	%eax, %rdi
	movslq	%esi, %rdx
	movslq	%ecx, %rax
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rcx,%rax), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	DP(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rsi
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	DP(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L18
.L17:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rsi
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	DP(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L18:
	addl	$1, -4(%rbp)
.L16:
	movl	maxbsum(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L19
	addl	$1, -8(%rbp)
.L15:
	movl	maxasum(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L20
	addl	$1, -12(%rbp)
.L14:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L21
	movl	Ma(%rip), %eax
	movl	%eax, -12(%rbp)
	movl	Mb(%rip), %eax
	movl	%eax, -8(%rbp)
	movl	$1000000, -4(%rbp)
	jmp	.L22
.L25:
	movl	N(%rip), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L23
	movl	N(%rip), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L23:
	movl	Ma(%rip), %eax
	addl	%eax, -12(%rbp)
	movl	Mb(%rip), %eax
	addl	%eax, -8(%rbp)
.L22:
	movl	maxasum(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L24
	movl	maxbsum(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L25
.L24:
	cmpl	$999999, -4(%rbp)
	jg	.L26
	movl	-4(%rbp), %eax
	jmp	.L27
.L26:
	movl	$-1, %eax
.L27:
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	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
	.globl	Ma
	.bss
	.align 4
	.type	Ma, @object
	.size	Ma, 4
Ma:
	.zero	4
	.globl	Mb
	.align 4
	.type	Mb, @object
	.size	Mb, 4
Mb:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	maxasum
	.align 4
	.type	maxasum, @object
	.size	maxasum, 4
maxasum:
	.zero	4
	.globl	maxbsum
	.align 4
	.type	maxbsum, @object
	.size	maxbsum, 4
maxbsum:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 164
a:
	.zero	164
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 164
b:
	.zero	164
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 164
c:
	.zero	164
	.globl	DP
	.align 32
	.type	DP, @object
	.size	DP, 26371364
DP:
	.zero	26371364
	.section	.rodata
.LC0:
	.string	"%d %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
	subq	$16, %rsp
	leaq	Mb(%rip), %rax
	movq	%rax, %rcx
	leaq	Ma(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	a(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L4
.L7:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L6
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L6:
	addl	$1, -12(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L7
	movl	N(%rip), %eax
	imull	-8(%rbp), %eax
	movl	%eax, maxasum(%rip)
	movl	N(%rip), %eax
	imull	-4(%rbp), %eax
	movl	%eax, maxbsum(%rip)
	movl	$0, -12(%rbp)
	jmp	.L8
.L13:
	movl	$0, -8(%rbp)
	jmp	.L9
.L12:
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	$1000000, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L10:
	cmpl	$400, -4(%rbp)
	jle	.L11
	addl	$1, -8(%rbp)
.L9:
	cmpl	$400, -8(%rbp)
	jle	.L12
	addl	$1, -12(%rbp)
.L8:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L13
	movl	$0, DP(%rip)
	movl	$1, -12(%rbp)
	jmp	.L14
.L21:
	movl	$0, -8(%rbp)
	jmp	.L15
.L20:
	movl	$0, -4(%rbp)
	jmp	.L16
.L19:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L17
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	-12(%rbp), %eax
	leal	-1(%rax), %esi
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	subl	%edx, %eax
	movslq	%eax, %rdi
	movslq	%esi, %rdx
	movslq	%ecx, %rax
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rcx,%rax), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	DP(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rsi
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	DP(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L18
.L17:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rsi
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$160801, %rcx, %rcx
	imulq	$401, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	DP(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L18:
	addl	$1, -4(%rbp)
.L16:
	movl	maxbsum(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L19
	addl	$1, -8(%rbp)
.L15:
	movl	maxasum(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L20
	addl	$1, -12(%rbp)
.L14:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L21
	movl	Ma(%rip), %eax
	movl	%eax, -12(%rbp)
	movl	Mb(%rip), %eax
	movl	%eax, -8(%rbp)
	movl	$1000000, -4(%rbp)
	jmp	.L22
.L25:
	movl	N(%rip), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L23
	movl	N(%rip), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$160801, %rdx, %rdx
	imulq	$401, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	DP(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L23:
	movl	Ma(%rip), %eax
	addl	%eax, -12(%rbp)
	movl	Mb(%rip), %eax
	addl	%eax, -8(%rbp)
.L22:
	movl	maxasum(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L24
	movl	maxbsum(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L25
.L24:
	cmpl	$999999, -4(%rbp)
	jg	.L26
	movl	-4(%rbp), %eax
	jmp	.L27
.L26:
	movl	$-1, %eax
.L27:
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	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:
