Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
//dp[i][j][k] = i枚目までのカードでj枚選んで合計がkである組合せ
//カードを選ばない　dp[i + 1][j][k] += dp[i][j][k]
//カードを選ぶ　　　dp[i + 1][j + 1][k + x[i]] += dp[i][j][k]

#include<stdio.h>
long long int dp[51][51][2510] = { { { 1 } } };
int main() {
	int N, A;
	scanf("%d%d", &N, &A);
	int *X = (int *)malloc(sizeof(int)*N);
	for (int i = 1; i <= N; i++)
	{
		scanf("%d", &X[i]);
	}

	for (int i = 1; i <= N; i++)
	{
		for (int j = 0; j <= N; j++)
		{
			for (int k = 0; k <= 2500; k++)//
			{
				if (k < X[i]) {
					dp[i][j][k] = dp[i - 1][j][k];
				}
				else if (j >= 1) {
					dp[i][j][k] = dp[i - 1][j - 1][k - X[i]] + dp[i - 1][j][k];
				}
			}
		}
	}
		long long int ans = 0;
		for (int j = 1; j <= N; j++) {
			ans += dp[N][j][j*A];
		}
		printf("%lld\n", ans);
		return 0;
	}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dp
	.data
	.align 32
	.type	dp, @object
	.size	dp, 52228080
dp:
	.quad	1
	.zero	20072
	.zero	1004000
	.zero	51204000
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%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, -16(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L2
.L3:
	movl	-44(%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, -44(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L3
	movl	$1, -40(%rbp)
	jmp	.L4
.L11:
	movl	$0, -36(%rbp)
	jmp	.L5
.L10:
	movl	$0, -32(%rbp)
	jmp	.L6
.L9:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L7
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$128010, %rcx, %rcx
	imulq	$2510, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	dp(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L8
.L7:
	cmpl	$0, -36(%rbp)
	jle	.L8
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-16(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-32(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movslq	%ecx, %rax
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L8:
	addl	$1, -32(%rbp)
.L6:
	cmpl	$2500, -32(%rbp)
	jle	.L9
	addl	$1, -36(%rbp)
.L5:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L10
	addl	$1, -40(%rbp)
.L4:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L11
	movq	$0, -24(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L12
.L13:
	movl	-52(%rbp), %edx
	movl	-48(%rbp), %eax
	imull	-28(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L12:
	movl	-52(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L13
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	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
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\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	.LC0(%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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rdx
	leaq	32(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	32(%rsp), %rdi
	movq	%rdi, %rbx
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rsp)
	testl	%ebx, %ebx
	jle	.L2
	leaq	4(%rax), %rbp
	movl	$1, %ebx
	leaq	.LC1(%rip), %r12
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %r14d
	addq	$4, %rbp
	cmpl	%ebx, %r14d
	jge	.L3
	testl	%r14d, %r14d
	jle	.L2
	leal	-1(%r14), %eax
	xorl	%r9d, %r9d
	movq	$0, (%rsp)
	movl	$1024080, %r8d
	movq	%rax, 16(%rsp)
	movl	%r14d, %eax
	leaq	dp(%rip), %rbx
	movq	%rax, 24(%rsp)
.L4:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rax
	movl	$-1, %esi
	leaq	(%rbx,%r8), %r12
	movl	%esi, %r13d
	movl	4(%rdi,%rax,4), %ecx
	leaq	-1024080+dp(%rip), %rdi
	movslq	%eax, %r15
	imulq	$128010, %r15, %r15
	leaq	(%rdi,%r8), %rbp
	movl	$2501, %edi
	subl	%ecx, %edi
	addl	$1, %r13d
	je	.L21
.L32:
	movslq	%esi, %r11
	movl	%ecx, %eax
	movq	%rbp, %rdx
	imulq	$2510, %r11, %r11
	negl	%eax
	addq	%r15, %r11
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	movslq	%eax, %rsi
	leaq	(%rdx,%r9), %r10
	addl	$1, %eax
	addq	$8, %rdx
	addq	%r11, %rsi
	movq	(%rbx,%rsi,8), %rsi
	addq	-8(%rdx), %rsi
	movq	%rsi, (%r10,%r8)
	cmpl	%edi, %eax
	je	.L31
.L7:
	leal	(%rax,%rcx), %esi
	cmpl	%esi, %ecx
	jle	.L5
	movq	(%rdx), %r10
	leaq	(%rdx,%r9), %rsi
	addl	$1, %eax
	addq	$8, %rdx
	movq	%r10, (%rsi,%r8)
	cmpl	%edi, %eax
	jne	.L7
.L31:
	addq	$20080, %rbp
	addq	$20080, %r12
	cmpl	%r14d, %r13d
	je	.L8
.L19:
	movl	%r13d, %esi
	movl	%esi, %r13d
	addl	$1, %r13d
	jne	.L32
.L21:
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	%eax, %ecx
	jle	.L10
	movq	0(%rbp,%rax,8), %rdx
	movq	%rdx, (%r12,%rax,8)
.L10:
	addq	$1, %rax
	cmpq	$2501, %rax
	jne	.L9
	addq	$20080, %rbp
	addq	$20080, %r12
	jmp	.L19
.L8:
	addq	$1, (%rsp)
	addq	$1024080, %r8
	movq	(%rsp), %rax
	subq	$1024080, %r9
	cmpq	24(%rsp), %rax
	jne	.L4
	movslq	36(%rsp), %rdx
	cmpl	$1, %edx
	jne	.L33
	imulq	$20088, 16(%rsp), %rdx
	movslq	%r13d, %rax
	imulq	$1024080, %rax, %rax
	leaq	20088(%rbx,%rax), %rcx
	leaq	40176(%rbx,%rax), %rax
	addq	%rdx, %rax
	xorl	%edx, %edx
.L17:
	addq	(%rcx), %rdx
	addq	$20088, %rcx
	cmpq	%rax, %rcx
	jne	.L17
.L18:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L18
.L33:
	movslq	%r13d, %rax
	leaq	20080(,%rdx,8), %rsi
	addl	$1, %r13d
	imulq	$128010, %rax, %rax
	addq	%rdx, %rax
	xorl	%edx, %edx
	leaq	(%rbx,%rax,8), %rcx
	movl	$1, %eax
.L15:
	addl	$1, %eax
	addq	20080(%rcx), %rdx
	addq	%rsi, %rcx
	cmpl	%r13d, %eax
	jne	.L15
	jmp	.L18
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	dp
	.data
	.align 32
	.type	dp, @object
	.size	dp, 52228080
dp:
	.quad	1
	.zero	20072
	.zero	1004000
	.zero	51204000
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\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	.LC0(%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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rdx
	leaq	32(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	32(%rsp), %rdi
	movq	%rdi, %rbx
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, 8(%rsp)
	testl	%ebx, %ebx
	jle	.L2
	leaq	4(%rax), %rbp
	movl	$1, %ebx
	leaq	.LC1(%rip), %r12
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %r14d
	addq	$4, %rbp
	cmpl	%ebx, %r14d
	jge	.L3
	testl	%r14d, %r14d
	jle	.L2
	leal	-1(%r14), %eax
	xorl	%r9d, %r9d
	movq	$0, (%rsp)
	movl	$1024080, %r8d
	movq	%rax, 16(%rsp)
	movl	%r14d, %eax
	leaq	dp(%rip), %rbx
	movq	%rax, 24(%rsp)
.L4:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rax
	movl	$-1, %esi
	leaq	(%rbx,%r8), %r12
	movl	%esi, %r13d
	movl	4(%rdi,%rax,4), %ecx
	leaq	-1024080+dp(%rip), %rdi
	movslq	%eax, %r15
	imulq	$128010, %r15, %r15
	leaq	(%rdi,%r8), %rbp
	movl	$2501, %edi
	subl	%ecx, %edi
	addl	$1, %r13d
	je	.L21
.L32:
	movslq	%esi, %r11
	movl	%ecx, %eax
	movq	%rbp, %rdx
	imulq	$2510, %r11, %r11
	negl	%eax
	addq	%r15, %r11
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	movslq	%eax, %rsi
	leaq	(%rdx,%r9), %r10
	addl	$1, %eax
	addq	$8, %rdx
	addq	%r11, %rsi
	movq	(%rbx,%rsi,8), %rsi
	addq	-8(%rdx), %rsi
	movq	%rsi, (%r10,%r8)
	cmpl	%edi, %eax
	je	.L31
.L7:
	leal	(%rax,%rcx), %esi
	cmpl	%esi, %ecx
	jle	.L5
	movq	(%rdx), %r10
	leaq	(%rdx,%r9), %rsi
	addl	$1, %eax
	addq	$8, %rdx
	movq	%r10, (%rsi,%r8)
	cmpl	%edi, %eax
	jne	.L7
.L31:
	addq	$20080, %rbp
	addq	$20080, %r12
	cmpl	%r14d, %r13d
	je	.L8
.L19:
	movl	%r13d, %esi
	movl	%esi, %r13d
	addl	$1, %r13d
	jne	.L32
.L21:
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	%eax, %ecx
	jle	.L10
	movq	0(%rbp,%rax,8), %rdx
	movq	%rdx, (%r12,%rax,8)
.L10:
	addq	$1, %rax
	cmpq	$2501, %rax
	jne	.L9
	addq	$20080, %rbp
	addq	$20080, %r12
	jmp	.L19
.L8:
	addq	$1, (%rsp)
	addq	$1024080, %r8
	movq	(%rsp), %rax
	subq	$1024080, %r9
	cmpq	24(%rsp), %rax
	jne	.L4
	movslq	36(%rsp), %rdx
	cmpl	$1, %edx
	jne	.L33
	imulq	$20088, 16(%rsp), %rdx
	movslq	%r13d, %rax
	imulq	$1024080, %rax, %rax
	leaq	20088(%rbx,%rax), %rcx
	leaq	40176(%rbx,%rax), %rax
	addq	%rdx, %rax
	xorl	%edx, %edx
.L17:
	addq	(%rcx), %rdx
	addq	$20088, %rcx
	cmpq	%rax, %rcx
	jne	.L17
.L18:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L18
.L33:
	movslq	%r13d, %rax
	leaq	20080(,%rdx,8), %rsi
	addl	$1, %r13d
	imulq	$128010, %rax, %rax
	addq	%rdx, %rax
	xorl	%edx, %edx
	leaq	(%rbx,%rax,8), %rcx
	movl	$1, %eax
.L15:
	addl	$1, %eax
	addq	20080(%rcx), %rdx
	addq	%rsi, %rcx
	cmpl	%r13d, %eax
	jne	.L15
	jmp	.L18
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	dp
	.data
	.align 32
	.type	dp, @object
	.size	dp, 52228080
dp:
	.quad	1
	.zero	20072
	.zero	1004000
	.zero	51204000
	.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:

//dp[i][j][k] = i枚目までのカードでj枚選んで合計がkである組合せ
//カードを選ばない　dp[i + 1][j][k] += dp[i][j][k]
//カードを選ぶ　　　dp[i + 1][j + 1][k + x[i]] += dp[i][j][k]

#include<stdio.h>
long long int dp[51][51][2510] = { { { 1 } } };
int main() {
	int N, A;
	scanf("%d%d", &N, &A);
	int *X = (int *)malloc(sizeof(int)*N);
	for (int i = 1; i <= N; i++)
	{
		scanf("%d", &X[i]);
	}

	for (int i = 1; i <= N; i++)
	{
		for (int j = 0; j <= N; j++)
		{
			for (int k = 0; k <= 2500; k++)//
			{
				if (k < X[i]) {
					dp[i][j][k] = dp[i - 1][j][k];
				}
				else if (j >= 1) {
					dp[i][j][k] = dp[i - 1][j - 1][k - X[i]] + dp[i - 1][j][k];
				}
			}
		}
	}
		long long int ans = 0;
		for (int j = 1; j <= N; j++) {
			ans += dp[N][j][j*A];
		}
		printf("%lld\n", ans);
		return 0;
	}
4 8
7 12 8 9
 3 8
9 6 9
 33 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3
 8 5
3 6 2 8 7 2 5 9
 3 8
15 6 9
 33 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3
 8 5
3 6 2 8 7 2 5 16
 33 3
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 0 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3
 8 5
3 6 2 8 3 2 5 16
 8 8
3 6 2 8 3 2 5 16

3
 1
 4294967295
 25
 0
 2147483647
 17
 1073725440
 7
 9

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
//dp[i][j][k] = i枚目までのカードでj枚選んで合計がkである組合せ
//カードを選ばない　dp[i + 1][j][k] += dp[i][j][k]
//カードを選ぶ　　　dp[i + 1][j + 1][k + x[i]] += dp[i][j][k]

#include<stdio.h>
long long int dp[51][51][2510] = { { { 1 } } };
int main() {
	int N, A;
	scanf("%d%d", &N, &A);
	int *X = (int *)malloc(sizeof(int)*N);
	for (int i = 1; i <= N; i++)
	{
		scanf("%d", &X[i]);
	}

	for (int i = 1; i <= N; i++)
	{
		for (int j = 0; j <= N; j++)
		{
			for (int k = 0; k <= 2500; k++)//
			{
				if (k < X[i]) {
					dp[i][j][k] = dp[i - 1][j][k];
				}
				else if (j >= 1) {
					dp[i][j][k] = dp[i - 1][j - 1][k - X[i]] + dp[i - 1][j][k];
				}
			}
		}
	}
		long long int ans = 0;
		for (int j = 1; j <= N; j++) {
			ans += dp[N][j][j*A];
		}
		printf("%lld\n", ans);
		return 0;
	}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dp
	.data
	.align 32
	.type	dp, @object
	.size	dp, 52228080
dp:
	.quad	1
	.zero	20072
	.zero	1004000
	.zero	51204000
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%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, -16(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L2
.L3:
	movl	-44(%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, -44(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L3
	movl	$1, -40(%rbp)
	jmp	.L4
.L11:
	movl	$0, -36(%rbp)
	jmp	.L5
.L10:
	movl	$0, -32(%rbp)
	jmp	.L6
.L9:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L7
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$128010, %rcx, %rcx
	imulq	$2510, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	dp(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L8
.L7:
	cmpl	$0, -36(%rbp)
	jle	.L8
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-16(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-32(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movslq	%ecx, %rax
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L8:
	addl	$1, -32(%rbp)
.L6:
	cmpl	$2500, -32(%rbp)
	jle	.L9
	addl	$1, -36(%rbp)
.L5:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L10
	addl	$1, -40(%rbp)
.L4:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L11
	movq	$0, -24(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L12
.L13:
	movl	-52(%rbp), %edx
	movl	-48(%rbp), %eax
	imull	-28(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L12:
	movl	-52(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L13
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	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
.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	dp
	.data
	.align 32
	.type	dp, @object
	.size	dp, 52228080
dp:
	.quad	1
	.zero	20072
	.zero	1004000
	.zero	51204000
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld\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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%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, -16(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L2
.L3:
	movl	-44(%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, -44(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jle	.L3
	movl	$1, -40(%rbp)
	jmp	.L4
.L11:
	movl	$0, -36(%rbp)
	jmp	.L5
.L10:
	movl	$0, -32(%rbp)
	jmp	.L6
.L9:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -32(%rbp)
	jge	.L7
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-32(%rbp), %edx
	movslq	%edx, %rsi
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$128010, %rcx, %rcx
	imulq	$2510, %rdx, %rdx
	addq	%rcx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	dp(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L8
.L7:
	cmpl	$0, -36(%rbp)
	jle	.L8
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-16(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %esi
	movl	-32(%rbp), %eax
	subl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movslq	%ecx, %rax
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L8:
	addl	$1, -32(%rbp)
.L6:
	cmpl	$2500, -32(%rbp)
	jle	.L9
	addl	$1, -36(%rbp)
.L5:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L10
	addl	$1, -40(%rbp)
.L4:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jle	.L11
	movq	$0, -24(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L12
.L13:
	movl	-52(%rbp), %edx
	movl	-48(%rbp), %eax
	imull	-28(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$128010, %rdx, %rdx
	imulq	$2510, %rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L12:
	movl	-52(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L13
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	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
.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:
