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>
#define int long long
#define inf (int)(1e18)

int max(int a, int b){
	return a >= b ? a : b;
}

signed main(){
	int N, i, j, k;
	scanf("%lld", &N);
	int **a = (int **)malloc(sizeof(int *) * N);
	for(i = 0; i < N; i++){
		a[i] = (int *)malloc(sizeof(int) * N);
		for(j = 0; j < N; j++){
			scanf("%lld", &a[i][j]);
		}
	}
	int *dp = (int *)malloc(sizeof(int) * (1 << N));
	for(i = 0; i < (1 << N); i++){
		dp[i] = 0;
		for(j = 0; j < N; j++){
			for(k = j + 1; k < N; k++){
				if((i | (1 << j)) == i && (i | (1 << k)) == i){
					dp[i] += a[j][k];
				}
			}
		}
		for(j = ((i - 1) & i); j > 0; j = ((j - 1) & i)){
			dp[i] = max(dp[i], dp[j] + dp[i ^ j]);
		}
	}
	printf("%lld\n", dp[(1 << N) - 1]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB6:
	.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
.LFE6:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L4
.L7:
	movq	-72(%rbp), %rax
	salq	$3, %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	$0, -56(%rbp)
	jmp	.L5
.L6:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-56(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -56(%rbp)
.L5:
	movq	-72(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jl	.L6
	addq	$1, -64(%rbp)
.L4:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jl	.L7
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L8
.L16:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movq	$0, -56(%rbp)
	jmp	.L9
.L13:
	movq	-56(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -48(%rbp)
	jmp	.L10
.L12:
	movq	-56(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	orq	-64(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jne	.L11
	movq	-48(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	orq	-64(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jne	.L11
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-48(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
.L11:
	addq	$1, -48(%rbp)
.L10:
	movq	-72(%rbp), %rax
	cmpq	%rax, -48(%rbp)
	jl	.L12
	addq	$1, -56(%rbp)
.L9:
	movq	-72(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jl	.L13
	movq	-64(%rbp), %rax
	subq	$1, %rax
	andq	-64(%rbp), %rax
	movq	%rax, -56(%rbp)
	jmp	.L14
.L15:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-64(%rbp), %rax
	xorq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	addq	%rax, %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	-64(%rbp), %rcx
	leaq	0(,%rcx,8), %rsi
	movq	-32(%rbp), %rcx
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	max
	movq	%rax, (%rbx)
	movq	-56(%rbp), %rax
	subq	$1, %rax
	andq	-64(%rbp), %rax
	movq	%rax, -56(%rbp)
.L14:
	cmpq	$0, -56(%rbp)
	jg	.L15
	addq	$1, -64(%rbp)
.L8:
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jl	.L16
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
.LFB39:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovge	%rdi, %rax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rbp
	leaq	0(,%rbp,8), %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	testq	%rbp, %rbp
	jle	.L4
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	0(,%rbp,8), %rdi
	xorl	%r15d, %r15d
	call	malloc@PLT
	movq	%rax, (%rbx,%r14,8)
	movq	%rax, %r12
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$1, %r15
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rbp
	addq	$8, %r12
	cmpq	%r15, %rbp
	jg	.L5
	addq	$1, %r14
	cmpq	%r14, %rbp
	jg	.L18
.L4:
	movl	%ebp, %ecx
	movl	$1, %eax
	sall	%cl, %eax
	movslq	%eax, %r12
	leaq	0(,%r12,8), %r13
	movq	%r13, %rdi
	call	malloc@PLT
	xorl	%edx, %edx
	movl	$1, %esi
	movq	%rax, %r8
	movq	%rax, %rdi
	testq	%r12, %r12
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	$0, (%rdi)
	cmpq	$1, %rbp
	jle	.L8
	movl	$1, %r9d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$1, %r9
	cmpq	%rbp, %r9
	je	.L8
.L12:
	leal	-1(%r9), %ecx
	movl	%esi, %eax
	sall	%cl, %eax
	cltq
	orq	%rdx, %rax
	cmpq	%rdx, %rax
	jne	.L9
	movq	%r9, %rcx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$1, %rcx
	cmpq	%rbp, %rcx
	jge	.L9
.L11:
	movl	%esi, %eax
	sall	%cl, %eax
	cltq
	orq	%rdx, %rax
	cmpq	%rdx, %rax
	jne	.L10
	movq	-8(%rbx,%r9,8), %rax
	movq	(%rax,%rcx,8), %rax
	addq	%rax, (%rdi)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	-1(%rdx), %rax
	andq	%rdx, %rax
	je	.L17
	movq	(%rdi), %r9
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rdx, %r10
	movq	(%r8,%rax,8), %rcx
	xorq	%rax, %r10
	addq	(%r8,%r10,8), %rcx
	cmpq	%rcx, %r9
	cmovl	%rcx, %r9
	subq	$1, %rax
	movq	%r9, (%rdi)
	andq	%rdx, %rax
	jne	.L16
.L17:
	addq	$1, %rdx
	addq	$8, %rdi
	cmpq	%r12, %rdx
	jne	.L14
.L15:
	movq	-8(%r8,%r13), %rdx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$24, %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
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB39:
	.cfi_startproc
	endbr64
	cmpq	%rsi, %rdi
	movq	%rsi, %rax
	cmovge	%rdi, %rax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rbp
	leaq	0(,%rbp,8), %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	testq	%rbp, %rbp
	jle	.L4
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	0(,%rbp,8), %rdi
	xorl	%r15d, %r15d
	call	malloc@PLT
	movq	%rax, (%rbx,%r14,8)
	movq	%rax, %r12
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$1, %r15
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rbp
	addq	$8, %r12
	cmpq	%r15, %rbp
	jg	.L5
	addq	$1, %r14
	cmpq	%r14, %rbp
	jg	.L18
.L4:
	movl	%ebp, %ecx
	movl	$1, %eax
	sall	%cl, %eax
	movslq	%eax, %r12
	leaq	0(,%r12,8), %r13
	movq	%r13, %rdi
	call	malloc@PLT
	xorl	%edx, %edx
	movl	$1, %esi
	movq	%rax, %r8
	movq	%rax, %rdi
	testq	%r12, %r12
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	$0, (%rdi)
	cmpq	$1, %rbp
	jle	.L8
	movl	$1, %r9d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$1, %r9
	cmpq	%rbp, %r9
	je	.L8
.L12:
	leal	-1(%r9), %ecx
	movl	%esi, %eax
	sall	%cl, %eax
	cltq
	orq	%rdx, %rax
	cmpq	%rdx, %rax
	jne	.L9
	movq	%r9, %rcx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$1, %rcx
	cmpq	%rbp, %rcx
	jge	.L9
.L11:
	movl	%esi, %eax
	sall	%cl, %eax
	cltq
	orq	%rdx, %rax
	cmpq	%rdx, %rax
	jne	.L10
	movq	-8(%rbx,%r9,8), %rax
	movq	(%rax,%rcx,8), %rax
	addq	%rax, (%rdi)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	-1(%rdx), %rax
	andq	%rdx, %rax
	je	.L17
	movq	(%rdi), %r9
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rdx, %r10
	movq	(%r8,%rax,8), %rcx
	xorq	%rax, %r10
	addq	(%r8,%r10,8), %rcx
	cmpq	%rcx, %r9
	cmovl	%rcx, %r9
	subq	$1, %rax
	movq	%r9, (%rdi)
	andq	%rdx, %rax
	jne	.L16
.L17:
	addq	$1, %rdx
	addq	$8, %rdi
	cmpq	%r12, %rdx
	jne	.L14
.L15:
	movq	-8(%r8,%r13), %rdx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$24, %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
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:

#include <stdio.h>
#include <stdlib.h>
#define int long long
#define inf (int)(1e18)

int max(int a, int b){
	return a >= b ? a : b;
}

signed main(){
	int N, i, j, k;
	scanf("%lld", &N);
	int **a = (int **)malloc(sizeof(int *) * N);
	for(i = 0; i < N; i++){
		a[i] = (int *)malloc(sizeof(int) * N);
		for(j = 0; j < N; j++){
			scanf("%lld", &a[i][j]);
		}
	}
	int *dp = (int *)malloc(sizeof(int) * (1 << N));
	for(i = 0; i < (1 << N); i++){
		dp[i] = 0;
		for(j = 0; j < N; j++){
			for(k =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7 -6 -5 -8 7 -6 0 -9
7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0
 2
0 -3
-6 0
 16
0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7
5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9
-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9
-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1
-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3
-4 5 9 4 -5 0 -6 1 -2 2 0 -5 -2 3 1 2
7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5
2 -7 1 -1 9 1 -2 0 -6 0 -6 6 4 -1 -7 8
-4 2 4 9 1 -2 -2 -6 0 8 -6 -2 -4 8 7 7
0 -7 9 -3 -9 2 -9 0 8 0 0 1 -3 3 -6 -6
7 0 6 -5 -6 0 -3 -6 -6 0 0 5 7 -1 -5 3
0 -2 6 0 -3 -5 9 6 -2 1 5 0 -2 7 -8 0
2 -4 0 1 -8 -2 -2 4 -4 -3 7 -2 0 -9 7 1
-3 1 1 2 3 3 9 -1 8 3 -1 7 -9 0 -6 -8
7 -1 8 -4 4 1 2 -7 7 -6 -5 -8 7 -6 0 -9
7 9 9 1 3 2 -5 8 7 -6 3 0 1 -8 -9 0

132
 0
 20
 132
 0
 0
 0
 132
 0
 132

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>
#define int long long
#define inf (int)(1e18)

int max(int a, int b){
	return a >= b ? a : b;
}

signed main(){
	int N, i, j, k;
	scanf("%lld", &N);
	int **a = (int **)malloc(sizeof(int *) * N);
	for(i = 0; i < N; i++){
		a[i] = (int *)malloc(sizeof(int) * N);
		for(j = 0; j < N; j++){
			scanf("%lld", &a[i][j]);
		}
	}
	int *dp = (int *)malloc(sizeof(int) * (1 << N));
	for(i = 0; i < (1 << N); i++){
		dp[i] = 0;
		for(j = 0; j < N; j++){
			for(k = j + 1; k < N; k++){
				if((i | (1 << j)) == i && (i | (1 << k)) == i){
					dp[i] += a[j][k];
				}
			}
		}
		for(j = ((i - 1) & i); j > 0; j = ((j - 1) & i)){
			dp[i] = max(dp[i], dp[j] + dp[i ^ j]);
		}
	}
	printf("%lld\n", dp[(1 << N) - 1]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB6:
	.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
.LFE6:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L4
.L7:
	movq	-72(%rbp), %rax
	salq	$3, %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	$0, -56(%rbp)
	jmp	.L5
.L6:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-56(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -56(%rbp)
.L5:
	movq	-72(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jl	.L6
	addq	$1, -64(%rbp)
.L4:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jl	.L7
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L8
.L16:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movq	$0, -56(%rbp)
	jmp	.L9
.L13:
	movq	-56(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -48(%rbp)
	jmp	.L10
.L12:
	movq	-56(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	orq	-64(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jne	.L11
	movq	-48(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	orq	-64(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jne	.L11
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-48(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
.L11:
	addq	$1, -48(%rbp)
.L10:
	movq	-72(%rbp), %rax
	cmpq	%rax, -48(%rbp)
	jl	.L12
	addq	$1, -56(%rbp)
.L9:
	movq	-72(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jl	.L13
	movq	-64(%rbp), %rax
	subq	$1, %rax
	andq	-64(%rbp), %rax
	movq	%rax, -56(%rbp)
	jmp	.L14
.L15:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-64(%rbp), %rax
	xorq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	addq	%rax, %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	-64(%rbp), %rcx
	leaq	0(,%rcx,8), %rsi
	movq	-32(%rbp), %rcx
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	max
	movq	%rax, (%rbx)
	movq	-56(%rbp), %rax
	subq	$1, %rax
	andq	-64(%rbp), %rax
	movq	%rax, -56(%rbp)
.L14:
	cmpq	$0, -56(%rbp)
	jg	.L15
	addq	$1, -64(%rbp)
.L8:
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jl	.L16
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
.LFB6:
	.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
.LFE6:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L4
.L7:
	movq	-72(%rbp), %rax
	salq	$3, %rax
	movq	-64(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	$0, -56(%rbp)
	jmp	.L5
.L6:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-56(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -56(%rbp)
.L5:
	movq	-72(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jl	.L6
	addq	$1, -64(%rbp)
.L4:
	movq	-72(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jl	.L7
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L8
.L16:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	$0, (%rax)
	movq	$0, -56(%rbp)
	jmp	.L9
.L13:
	movq	-56(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -48(%rbp)
	jmp	.L10
.L12:
	movq	-56(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	orq	-64(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jne	.L11
	movq	-48(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	orq	-64(%rbp), %rax
	cmpq	%rax, -64(%rbp)
	jne	.L11
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-48(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	movq	-32(%rbp), %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
.L11:
	addq	$1, -48(%rbp)
.L10:
	movq	-72(%rbp), %rax
	cmpq	%rax, -48(%rbp)
	jl	.L12
	addq	$1, -56(%rbp)
.L9:
	movq	-72(%rbp), %rax
	cmpq	%rax, -56(%rbp)
	jl	.L13
	movq	-64(%rbp), %rax
	subq	$1, %rax
	andq	-64(%rbp), %rax
	movq	%rax, -56(%rbp)
	jmp	.L14
.L15:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movq	-64(%rbp), %rax
	xorq	-56(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	addq	%rax, %rdx
	movq	-64(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	movq	-64(%rbp), %rcx
	leaq	0(,%rcx,8), %rsi
	movq	-32(%rbp), %rcx
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	max
	movq	%rax, (%rbx)
	movq	-56(%rbp), %rax
	subq	$1, %rax
	andq	-64(%rbp), %rax
	movq	%rax, -56(%rbp)
.L14:
	cmpq	$0, -56(%rbp)
	jg	.L15
	addq	$1, -64(%rbp)
.L8:
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	cmpq	%rax, -64(%rbp)
	jl	.L16
	movq	-72(%rbp), %rax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
