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>

int max(int a, int b);

int main(void)
{
	int N;
	scanf("%i", &N);
	int t[N][3];
	for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			scanf("%i", &t[i][j]);
		}
	}
	int table[N][3];
	for(int k = 0; k < 3; k++)
	{
		table[0][k] = t[0][k];
	}
	
	for(int i = 1; i < N; i++)
	{	
		{
			table[i][0] = (t[i][0] + max(table[i - 1][1], table[i - 1][2]));
		}

		{
			table[i][1] = (t[i][1] + max(table[i - 1][2], table[i - 1][0]));
		}

		{
			table[i][2] = (t[i][2] + max(table[i - 1][0], table[i - 1][1]));
		}
	}

	int maxima = max(max(table[N - 1][0], table[N - 1][1]), table[N - 1][2]);
	printf("%i", maxima);
}

int max(int a, int b)
{
	if(a > b)
	{
		return a;
	}
	else
	{
		return b;
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%i"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -152(%rbp)
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -128(%rbp)
	movq	$0, -120(%rbp)
	movq	-128(%rbp), %r10
	movq	-120(%rbp), %r11
	imulq	$96, %r11, %rdx
	imulq	$0, %r10, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r10
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	-144(%rbp), %r8
	movq	-136(%rbp), %r9
	imulq	$96, %r9, %rdx
	imulq	$0, %r8, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r8
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L5
.L8:
	movl	$0, -104(%rbp)
	jmp	.L6
.L7:
	movl	-104(%rbp), %eax
	movslq	%eax, %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -104(%rbp)
.L6:
	cmpl	$2, -104(%rbp)
	jle	.L7
	addl	$1, -108(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L8
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$96, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$96, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r12
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -100(%rbp)
	jmp	.L12
.L13:
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L12:
	cmpl	$2, -100(%rbp)
	jle	.L13
	movl	$1, -96(%rbp)
	jmp	.L14
.L15:
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$4, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%ecx, (%rax)
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$8, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$4, %rax
	movl	%ecx, (%rax)
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$8, %rax
	movl	%ecx, (%rax)
	addl	$1, -96(%rbp)
.L14:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L15
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %ebx
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%ebx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -92(%rbp)
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-152(%rbp), %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	max
	.type	max, @function
max:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L19
	movl	-4(%rbp), %eax
	jmp	.L20
.L19:
	movl	-8(%rbp), %eax
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	max, .-max
	.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	"%i"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	leaq	.LC0(%rip), %r12
	pushq	%rbx
	movq	%r12, %rdi
	subq	$40, %rsp
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rcx
	movq	%rsp, %rdi
	leaq	(%rcx,%rcx,2), %rdx
	movq	%rcx, %rax
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rsi
	andq	$-4096, %rdx
	subq	%rdx, %rdi
	andq	$-16, %rsi
	cmpq	%rdi, %rsp
	je	.L3
.L36:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L36
.L3:
	andl	$4095, %esi
	subq	%rsi, %rsp
	testq	%rsi, %rsi
	jne	.L37
.L4:
	leaq	3(%rsp), %rbx
	movq	%rbx, %r13
	andq	$-4, %rbx
	shrq	$2, %r13
	testl	%eax, %eax
	jle	.L5
	movq	%rbx, %r14
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	leaq	4(%r14), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	8(%r14), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	addq	$12, %r14
	cmpl	%r15d, %eax
	jg	.L6
	movslq	%eax, %rdx
	movq	%rsp, %rsi
	leaq	(%rdx,%rdx,2), %rdx
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L7:
	cmpq	%rsi, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L8:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L38
.L9:
	leaq	3(%rsp), %r15
	movl	8(,%r13,4), %r11d
	movq	0(,%r13,4), %xmm0
	movq	%r15, %rdx
	andq	$-4, %r15
	shrq	$2, %rdx
	movq	%r15, -72(%rbp)
	movl	%r11d, 8(,%rdx,4)
	movq	%xmm0, 0(,%rdx,4)
	cmpl	$1, %eax
	jle	.L14
	cmpl	$3, %eax
	jle	.L20
	leal	-4(%rax), %edx
	movl	%eax, -76(%rbp)
	movd	%xmm0, %edi
	leaq	12(%rbx), %r9
	andl	$-2, %edx
	pshufd	$0xe5, %xmm0, %xmm2
	leaq	12(%r15), %r10
	movd	%xmm2, %ecx
	addl	$3, %edx
	movl	$1, %r13d
.L12:
	cmpl	%ecx, %r11d
	movl	%ecx, %r8d
	movl	(%r9), %esi
	movl	4(%r9), %r14d
	cmovge	%r11d, %r8d
	movdqu	(%r9), %xmm4
	addl	%r8d, %esi
	cmpl	%r11d, %edi
	cmovge	%edi, %r11d
	addl	%r11d, %r14d
	cmpl	%ecx, %edi
	movd	%r11d, %xmm3
	cmovl	%ecx, %edi
	movl	8(%r9), %ecx
	movl	%r14d, %r11d
	addl	%edi, %ecx
	movd	%edi, %xmm1
	cmpl	%ecx, %r14d
	movl	%ecx, %eax
	cmovge	%r14d, %eax
	cmpl	%ecx, %esi
	cmovge	%esi, %ecx
	addl	16(%r9), %ecx
	cmpl	%r14d, %esi
	movd	%eax, %xmm0
	cmovge	%esi, %r11d
	addl	$2, %r13d
	movl	%ecx, 16(%r10)
	punpckldq	%xmm0, %xmm1
	movd	%r8d, %xmm0
	addl	20(%r9), %r11d
	punpckldq	%xmm3, %xmm0
	movl	%r11d, 20(%r10)
	addq	$24, %r9
	addq	$24, %r10
	punpcklqdq	%xmm1, %xmm0
	paddd	%xmm4, %xmm0
	pshufd	$255, %xmm0, %xmm1
	movups	%xmm0, -24(%r10)
	movd	%xmm1, %edi
	cmpl	%edx, %r13d
	jne	.L12
	movl	-76(%rbp), %eax
.L11:
	movslq	%edx, %rdi
	imulq	$12, %rdi, %rdi
	addq	%rdi, %rbx
	addq	%r15, %rdi
	.p2align 4,,10
	.p2align 3
.L13:
	movl	-4(%rdi), %esi
	movl	-8(%rdi), %r8d
	movl	%esi, %ecx
	cmpl	%esi, %r8d
	cmovge	%r8d, %ecx
	addl	(%rbx), %ecx
	movl	%ecx, (%rdi)
	movl	-12(%rdi), %ecx
	cmpl	%esi, %ecx
	cmovge	%ecx, %esi
	addl	4(%rbx), %esi
	cmpl	%r8d, %ecx
	cmovl	%r8d, %ecx
	addl	$1, %edx
	addl	8(%rbx), %ecx
	movl	%esi, 4(%rdi)
	movl	%ecx, 8(%rdi)
	addq	$12, %rbx
	addq	$12, %rdi
	cmpl	%edx, %eax
	jg	.L13
.L14:
	subl	$1, %eax
	movq	-72(%rbp), %rbx
	movq	%r12, %rsi
	movl	$1, %edi
	cltq
	leaq	(%rax,%rax,2), %rax
	leaq	(%rbx,%rax,4), %rax
	movl	8(%rax), %edx
	movl	4(%rax), %ecx
	movl	(%rax), %eax
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L37:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rsi)
	jmp	.L4
.L38:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L9
.L5:
	imulq	$12, %rcx, %rdx
	movq	%rsp, %rsi
	addq	$15, %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L15:
	cmpq	%rsi, %rsp
	je	.L16
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L15
.L20:
	movl	$1, %edx
	jmp	.L11
.L16:
	movq	%rcx, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L17
	orq	$0, -8(%rsp,%rdx)
.L17:
	leaq	3(%rsp), %rcx
	movq	%rcx, %rdx
	andq	$-4, %rcx
	movq	%rcx, -72(%rbp)
	movq	0(,%r13,4), %rcx
	shrq	$2, %rdx
	movq	%rcx, 0(,%rdx,4)
	movl	8(,%r13,4), %ecx
	movl	%ecx, 8(,%rdx,4)
	jmp	.L14
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB24:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	max, .-max
	.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	"%i"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	leaq	.LC0(%rip), %r12
	pushq	%rbx
	movq	%r12, %rdi
	subq	$40, %rsp
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rcx
	movq	%rsp, %rdi
	leaq	(%rcx,%rcx,2), %rdx
	movq	%rcx, %rax
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rsi
	andq	$-4096, %rdx
	subq	%rdx, %rdi
	andq	$-16, %rsi
	cmpq	%rdi, %rsp
	je	.L3
.L36:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L36
.L3:
	andl	$4095, %esi
	subq	%rsi, %rsp
	testq	%rsi, %rsi
	jne	.L37
.L4:
	leaq	3(%rsp), %rbx
	movq	%rbx, %r13
	andq	$-4, %rbx
	shrq	$2, %r13
	testl	%eax, %eax
	jle	.L5
	movq	%rbx, %r14
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	leaq	4(%r14), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	8(%r14), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	addq	$12, %r14
	cmpl	%r15d, %eax
	jg	.L6
	movslq	%eax, %rdx
	movq	%rsp, %rsi
	leaq	(%rdx,%rdx,2), %rdx
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L7:
	cmpq	%rsi, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L8:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L38
.L9:
	leaq	3(%rsp), %r15
	movl	8(,%r13,4), %r11d
	movq	0(,%r13,4), %xmm0
	movq	%r15, %rdx
	andq	$-4, %r15
	shrq	$2, %rdx
	movq	%r15, -72(%rbp)
	movl	%r11d, 8(,%rdx,4)
	movq	%xmm0, 0(,%rdx,4)
	cmpl	$1, %eax
	jle	.L14
	cmpl	$3, %eax
	jle	.L20
	leal	-4(%rax), %edx
	movl	%eax, -76(%rbp)
	movd	%xmm0, %edi
	leaq	12(%rbx), %r9
	andl	$-2, %edx
	pshufd	$0xe5, %xmm0, %xmm2
	leaq	12(%r15), %r10
	movd	%xmm2, %ecx
	addl	$3, %edx
	movl	$1, %r13d
.L12:
	cmpl	%ecx, %r11d
	movl	%ecx, %r8d
	movl	(%r9), %esi
	movl	4(%r9), %r14d
	cmovge	%r11d, %r8d
	movdqu	(%r9), %xmm4
	addl	%r8d, %esi
	cmpl	%r11d, %edi
	cmovge	%edi, %r11d
	addl	%r11d, %r14d
	cmpl	%ecx, %edi
	movd	%r11d, %xmm3
	cmovl	%ecx, %edi
	movl	8(%r9), %ecx
	movl	%r14d, %r11d
	addl	%edi, %ecx
	movd	%edi, %xmm1
	cmpl	%ecx, %r14d
	movl	%ecx, %eax
	cmovge	%r14d, %eax
	cmpl	%ecx, %esi
	cmovge	%esi, %ecx
	addl	16(%r9), %ecx
	cmpl	%r14d, %esi
	movd	%eax, %xmm0
	cmovge	%esi, %r11d
	addl	$2, %r13d
	movl	%ecx, 16(%r10)
	punpckldq	%xmm0, %xmm1
	movd	%r8d, %xmm0
	addl	20(%r9), %r11d
	punpckldq	%xmm3, %xmm0
	movl	%r11d, 20(%r10)
	addq	$24, %r9
	addq	$24, %r10
	punpcklqdq	%xmm1, %xmm0
	paddd	%xmm4, %xmm0
	pshufd	$255, %xmm0, %xmm1
	movups	%xmm0, -24(%r10)
	movd	%xmm1, %edi
	cmpl	%edx, %r13d
	jne	.L12
	movl	-76(%rbp), %eax
.L11:
	movslq	%edx, %rdi
	imulq	$12, %rdi, %rdi
	addq	%rdi, %rbx
	addq	%r15, %rdi
	.p2align 4,,10
	.p2align 3
.L13:
	movl	-4(%rdi), %esi
	movl	-8(%rdi), %r8d
	movl	%esi, %ecx
	cmpl	%esi, %r8d
	cmovge	%r8d, %ecx
	addl	(%rbx), %ecx
	movl	%ecx, (%rdi)
	movl	-12(%rdi), %ecx
	cmpl	%esi, %ecx
	cmovge	%ecx, %esi
	addl	4(%rbx), %esi
	cmpl	%r8d, %ecx
	cmovl	%r8d, %ecx
	addl	$1, %edx
	addl	8(%rbx), %ecx
	movl	%esi, 4(%rdi)
	movl	%ecx, 8(%rdi)
	addq	$12, %rbx
	addq	$12, %rdi
	cmpl	%edx, %eax
	jg	.L13
.L14:
	subl	$1, %eax
	movq	-72(%rbp), %rbx
	movq	%r12, %rsi
	movl	$1, %edi
	cltq
	leaq	(%rax,%rax,2), %rax
	leaq	(%rbx,%rax,4), %rax
	movl	8(%rax), %edx
	movl	4(%rax), %ecx
	movl	(%rax), %eax
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L37:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rsi)
	jmp	.L4
.L38:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L9
.L5:
	imulq	$12, %rcx, %rdx
	movq	%rsp, %rsi
	addq	$15, %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L15:
	cmpq	%rsi, %rsp
	je	.L16
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L15
.L20:
	movl	$1, %edx
	jmp	.L11
.L16:
	movq	%rcx, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L17
	orq	$0, -8(%rsp,%rdx)
.L17:
	leaq	3(%rsp), %rcx
	movq	%rcx, %rdx
	andq	$-4, %rcx
	movq	%rcx, -72(%rbp)
	movq	0(,%r13,4), %rcx
	shrq	$2, %rdx
	movq	%rcx, 0(,%rdx,4)
	movl	8(,%r13,4), %ecx
	movl	%ecx, 8(,%rdx,4)
	jmp	.L14
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB24:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	max, .-max
	.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>

int max(int a, int b);

int main(void)
{
	int N;
	scanf("%i", &N);
	int t[N][3];
	for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			scanf("%i", &t[i][j]);
		}
	}
	int table[N][3];
	for(int k = 0; k < 3; k++)
	{
		table[0][k] = t[0][k];
	}
	
	for(int i = 1; i < N; i++)
	{	
		{
			table[i][0] = (t[i][0] + max(table[i - 1][1], table[i - 1][2]));
		}

		{
			table[i][1] = (t[i][1] + max(table[i - 1][2], table[i - 1][0]));
		}

		{
			table[i][2] = (t[i][2] + max(table[i - 1][0], table[i - 1][1]));
		}
	}

	int maxima = max(max(table[N - 1][0], table[N - 1][1]), table[N - 1][2]);
	printf("%i", maxima);
}

int max(int a, int b)
{
	if(a > b)
	{
		return a;
	}
	else
	{
		return b;
	}
}
3
1 40 70
20 50 80
30 60 90
 1
100 16 1
 7
6 7 8
8 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 7 1
 1
000 16 1
 7
6 7 14
8 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 7 1
 3
1 40 34
20 50 80
30 35 90
 3
1 76 34
20 50 80
30 35 90
 1
000 25 2
 7
5 7 14
7 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 7 1
 3
0 94 34
20 50 80
30 35 90

210 100 46 16 52 174 191 25 51 209
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>

int max(int a, int b);

int main(void)
{
	int N;
	scanf("%i", &N);
	int t[N][3];
	for(int i = 0; i < N; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			scanf("%i", &t[i][j]);
		}
	}
	int table[N][3];
	for(int k = 0; k < 3; k++)
	{
		table[0][k] = t[0][k];
	}
	
	for(int i = 1; i < N; i++)
	{	
		{
			table[i][0] = (t[i][0] + max(table[i - 1][1], table[i - 1][2]));
		}

		{
			table[i][1] = (t[i][1] + max(table[i - 1][2], table[i - 1][0]));
		}

		{
			table[i][2] = (t[i][2] + max(table[i - 1][0], table[i - 1][1]));
		}
	}

	int maxima = max(max(table[N - 1][0], table[N - 1][1]), table[N - 1][2]);
	printf("%i", maxima);
}

int max(int a, int b)
{
	if(a > b)
	{
		return a;
	}
	else
	{
		return b;
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%i"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -152(%rbp)
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -128(%rbp)
	movq	$0, -120(%rbp)
	movq	-128(%rbp), %r10
	movq	-120(%rbp), %r11
	imulq	$96, %r11, %rdx
	imulq	$0, %r10, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r10
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	-144(%rbp), %r8
	movq	-136(%rbp), %r9
	imulq	$96, %r9, %rdx
	imulq	$0, %r8, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r8
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L5
.L8:
	movl	$0, -104(%rbp)
	jmp	.L6
.L7:
	movl	-104(%rbp), %eax
	movslq	%eax, %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -104(%rbp)
.L6:
	cmpl	$2, -104(%rbp)
	jle	.L7
	addl	$1, -108(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L8
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$96, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$96, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r12
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -100(%rbp)
	jmp	.L12
.L13:
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L12:
	cmpl	$2, -100(%rbp)
	jle	.L13
	movl	$1, -96(%rbp)
	jmp	.L14
.L15:
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$4, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%ecx, (%rax)
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$8, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$4, %rax
	movl	%ecx, (%rax)
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$8, %rax
	movl	%ecx, (%rax)
	addl	$1, -96(%rbp)
.L14:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L15
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %ebx
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%ebx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -92(%rbp)
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-152(%rbp), %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	max
	.type	max, @function
max:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L19
	movl	-4(%rbp), %eax
	jmp	.L20
.L19:
	movl	-8(%rbp), %eax
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	max, .-max
	.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
	.section	.rodata
.LC0:
	.string	"%i"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -152(%rbp)
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -128(%rbp)
	movq	$0, -120(%rbp)
	movq	-128(%rbp), %r10
	movq	-120(%rbp), %r11
	imulq	$96, %r11, %rdx
	imulq	$0, %r10, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r10
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	-144(%rbp), %r8
	movq	-136(%rbp), %r9
	imulq	$96, %r9, %rdx
	imulq	$0, %r8, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r8
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L5
.L8:
	movl	$0, -104(%rbp)
	jmp	.L6
.L7:
	movl	-104(%rbp), %eax
	movslq	%eax, %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -104(%rbp)
.L6:
	cmpl	$2, -104(%rbp)
	jle	.L7
	addl	$1, -108(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L8
	movl	-112(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	imulq	$96, %r15, %rdx
	imulq	$0, %r14, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r14
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movslq	%ecx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	imulq	$96, %r13, %rdx
	imulq	$0, %r12, %rax
	leaq	(%rdx,%rax), %rsi
	movl	$96, %eax
	mulq	%r12
	addq	%rdx, %rsi
	movq	%rsi, %rdx
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %ebx
	movl	$0, %edx
	divq	%rbx
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -100(%rbp)
	jmp	.L12
.L13:
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L12:
	cmpl	$2, -100(%rbp)
	jle	.L13
	movl	$1, -96(%rbp)
	jmp	.L14
.L15:
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$4, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	%ecx, (%rax)
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$8, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$4, %rax
	movl	%ecx, (%rax)
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %ebx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movl	-96(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	leal	(%rbx,%rax), %ecx
	movq	-64(%rbp), %rsi
	movl	-96(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	$8, %rax
	movl	%ecx, (%rax)
	addl	$1, -96(%rbp)
.L14:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L15
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	(%rax), %ebx
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	(%rax), %edx
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%ebx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -92(%rbp)
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-152(%rbp), %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	max
	.type	max, @function
max:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L19
	movl	-4(%rbp), %eax
	jmp	.L20
.L19:
	movl	-8(%rbp), %eax
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	max, .-max
	.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:
