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>

long long int max(long long int a, long long int b){return a<b?b:a;}

int N, A[3000], dif, i, j;
long long int d[3000][3000];

int main(){
	scanf("%d", &N);
	for(i=0; i<N; i++){
		scanf("%d", A+i);
		d[i][i] = A[i];
	}
	for(dif=1; dif<N; dif++){
		for(i=0; i<N-dif; i++){
			j=i+dif;
			d[i][j] = max(A[i]-d[i+1][j], A[j]-d[i][j-1]);
		}
	}
	printf("%lld\n", d[0][N-1]);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 12000
A:
	.zero	12000
	.globl	dif
	.align 4
	.type	dif, @object
	.size	dif, 4
dif:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 72000000
d:
	.zero	72000000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L4
.L5:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	i(%rip), %ecx
	cltq
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L5
	movl	$1, dif(%rip)
	jmp	.L6
.L9:
	movl	$0, i(%rip)
	jmp	.L7
.L8:
	movl	i(%rip), %edx
	movl	dif(%rip), %eax
	addl	%edx, %eax
	movl	%eax, j(%rip)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	i(%rip), %edx
	movl	j(%rip), %ecx
	subl	$1, %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	movl	i(%rip), %ecx
	leal	1(%rcx), %esi
	movl	j(%rip), %ecx
	movslq	%ecx, %rdi
	movslq	%esi, %rcx
	imulq	$3000, %rcx, %rcx
	addq	%rdi, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	d(%rip), %rcx
	movq	(%rsi,%rcx), %rcx
	subq	%rcx, %rax
	movl	i(%rip), %ebx
	movl	j(%rip), %r12d
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	max
	movslq	%r12d, %rcx
	movslq	%ebx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	N(%rip), %eax
	movl	dif(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L8
	movl	dif(%rip), %eax
	addl	$1, %eax
	movl	%eax, dif(%rip)
.L6:
	movl	dif(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	N(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovge	%rdi, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rdi
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r11d
	movl	$0, i(%rip)
	testl	%r11d, %r11d
	jle	.L4
	xorl	%eax, %eax
	leaq	A(%rip), %r12
	leaq	d(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L5:
	cltq
	movq	%rbp, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rdx
	movl	N(%rip), %r11d
	imulq	$24008, %rdx, %rcx
	movq	%rdx, %rax
	movslq	(%r12,%rdx,4), %rdx
	addl	$1, %eax
	movl	%eax, i(%rip)
	movq	%rdx, (%rbx,%rcx)
	cmpl	%r11d, %eax
	jl	.L5
	movl	$1, dif(%rip)
	cmpl	$1, %r11d
	jle	.L16
	leaq	8+d(%rip), %r10
	movslq	%r11d, %r13
	leal	-1(%r11), %ebp
	movl	$1, %r8d
	leaq	4+A(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%ebp, %eax
	movq	-8(%r10), %rdi
	leaq	A(%rip), %rdx
	movq	%r10, %rsi
	subl	%r8d, %eax
	leaq	(%r12,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L8:
	movslq	(%rdx,%r8,4), %rcx
	movslq	(%rdx), %rax
	subq	%rdi, %rcx
	movq	24000(%rsi), %rdi
	subq	%rdi, %rax
	cmpq	%rcx, %rax
	cmovl	%rcx, %rax
	addq	$4, %rdx
	addq	$24008, %rsi
	movq	%rax, -24008(%rsi)
	cmpq	%rdx, %r9
	jne	.L8
	addq	$1, %r8
	addq	$8, %r10
	cmpq	%r8, %r13
	jne	.L9
	movl	%ebp, j(%rip)
	movl	$1, i(%rip)
	movl	%r11d, dif(%rip)
.L7:
	movslq	%ebp, %rbp
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movq	(%rbx,%rbp,8), %rdx
	call	__printf_chk@PLT
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	movl	$1, dif(%rip)
	leaq	d(%rip), %rbx
.L16:
	leal	-1(%r11), %ebp
	jmp	.L7
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 72000000
d:
	.zero	72000000
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	dif
	.align 4
	.type	dif, @object
	.size	dif, 4
dif:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 12000
A:
	.zero	12000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovge	%rdi, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rdi
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	N(%rip), %r11d
	movl	$0, i(%rip)
	testl	%r11d, %r11d
	jle	.L4
	xorl	%eax, %eax
	leaq	A(%rip), %r12
	leaq	d(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L5:
	cltq
	movq	%rbp, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rdx
	movl	N(%rip), %r11d
	imulq	$24008, %rdx, %rcx
	movq	%rdx, %rax
	movslq	(%r12,%rdx,4), %rdx
	addl	$1, %eax
	movl	%eax, i(%rip)
	movq	%rdx, (%rbx,%rcx)
	cmpl	%r11d, %eax
	jl	.L5
	movl	$1, dif(%rip)
	cmpl	$1, %r11d
	jle	.L16
	leaq	8+d(%rip), %r10
	movslq	%r11d, %r13
	leal	-1(%r11), %ebp
	movl	$1, %r8d
	leaq	4+A(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%ebp, %eax
	movq	-8(%r10), %rdi
	leaq	A(%rip), %rdx
	movq	%r10, %rsi
	subl	%r8d, %eax
	leaq	(%r12,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L8:
	movslq	(%rdx,%r8,4), %rcx
	movslq	(%rdx), %rax
	subq	%rdi, %rcx
	movq	24000(%rsi), %rdi
	subq	%rdi, %rax
	cmpq	%rcx, %rax
	cmovl	%rcx, %rax
	addq	$4, %rdx
	addq	$24008, %rsi
	movq	%rax, -24008(%rsi)
	cmpq	%rdx, %r9
	jne	.L8
	addq	$1, %r8
	addq	$8, %r10
	cmpq	%r8, %r13
	jne	.L9
	movl	%ebp, j(%rip)
	movl	$1, i(%rip)
	movl	%r11d, dif(%rip)
.L7:
	movslq	%ebp, %rbp
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movq	(%rbx,%rbp,8), %rdx
	call	__printf_chk@PLT
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	movl	$1, dif(%rip)
	leaq	d(%rip), %rbx
.L16:
	leal	-1(%r11), %ebp
	jmp	.L7
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 72000000
d:
	.zero	72000000
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	dif
	.align 4
	.type	dif, @object
	.size	dif, 4
dif:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 12000
A:
	.zero	12000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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>

long long int max(long long int a, long long int b){return a<b?b:a;}

int N, A[3000], dif, i, j;
long long int d[3000][3000];

int main(){
	scanf("%d", &N);
	for(i=0; i<N; i++){
		scanf("%d", A+i);
		d[i][i] = A[i];
	}
	for(dif=1; dif<N; dif++){
		for(i=0; i<N-dif; i++){
			j=i+dif;
			d[i][j] = max(A[i]-d[i+1][j], A[j]-d[i][j-1]);
		}
	}
	printf("%lld\n", d[0][N-1]);
}

4
10 103 90 30
 10
1000000000 0 1000000000 1 1000000000 1 1000000000 1 1000000000 1
 3
10 101 10
 1
8
 6
4 0 9 7 1 5
 4
10 103 1 30
 3
10 101 2
 6
4 0 9 7 2 5
 4
5 103 1 30
 3
10 100 2

33
 4999999996
 -81
 8
 4
 122
 -89
 5
 127
 -88

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>

long long int max(long long int a, long long int b){return a<b?b:a;}

int N, A[3000], dif, i, j;
long long int d[3000][3000];

int main(){
	scanf("%d", &N);
	for(i=0; i<N; i++){
		scanf("%d", A+i);
		d[i][i] = A[i];
	}
	for(dif=1; dif<N; dif++){
		for(i=0; i<N-dif; i++){
			j=i+dif;
			d[i][j] = max(A[i]-d[i+1][j], A[j]-d[i][j-1]);
		}
	}
	printf("%lld\n", d[0][N-1]);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 12000
A:
	.zero	12000
	.globl	dif
	.align 4
	.type	dif, @object
	.size	dif, 4
dif:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 72000000
d:
	.zero	72000000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L4
.L5:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	i(%rip), %ecx
	cltq
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L5
	movl	$1, dif(%rip)
	jmp	.L6
.L9:
	movl	$0, i(%rip)
	jmp	.L7
.L8:
	movl	i(%rip), %edx
	movl	dif(%rip), %eax
	addl	%edx, %eax
	movl	%eax, j(%rip)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	i(%rip), %edx
	movl	j(%rip), %ecx
	subl	$1, %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	movl	i(%rip), %ecx
	leal	1(%rcx), %esi
	movl	j(%rip), %ecx
	movslq	%ecx, %rdi
	movslq	%esi, %rcx
	imulq	$3000, %rcx, %rcx
	addq	%rdi, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	d(%rip), %rcx
	movq	(%rsi,%rcx), %rcx
	subq	%rcx, %rax
	movl	i(%rip), %ebx
	movl	j(%rip), %r12d
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	max
	movslq	%r12d, %rcx
	movslq	%ebx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	N(%rip), %eax
	movl	dif(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L8
	movl	dif(%rip), %eax
	addl	$1, %eax
	movl	%eax, dif(%rip)
.L6:
	movl	dif(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	N(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 12000
A:
	.zero	12000
	.globl	dif
	.align 4
	.type	dif, @object
	.size	dif, 4
dif:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 72000000
d:
	.zero	72000000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L4
.L5:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	i(%rip), %ecx
	cltq
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L5
	movl	$1, dif(%rip)
	jmp	.L6
.L9:
	movl	$0, i(%rip)
	jmp	.L7
.L8:
	movl	i(%rip), %edx
	movl	dif(%rip), %eax
	addl	%edx, %eax
	movl	%eax, j(%rip)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	i(%rip), %edx
	movl	j(%rip), %ecx
	subl	$1, %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	cltq
	movl	i(%rip), %ecx
	leal	1(%rcx), %esi
	movl	j(%rip), %ecx
	movslq	%ecx, %rdi
	movslq	%esi, %rcx
	imulq	$3000, %rcx, %rcx
	addq	%rdi, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	d(%rip), %rcx
	movq	(%rsi,%rcx), %rcx
	subq	%rcx, %rax
	movl	i(%rip), %ebx
	movl	j(%rip), %r12d
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	max
	movslq	%r12d, %rcx
	movslq	%ebx, %rdx
	imulq	$3000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L7:
	movl	N(%rip), %eax
	movl	dif(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L8
	movl	dif(%rip), %eax
	addl	$1, %eax
	movl	%eax, dif(%rip)
.L6:
	movl	dif(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	N(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
