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 infinity 1000000000
int max(int a,int b){
    return a>b?a:b;
}
int main()
{
    int n,ans=0;
    scanf("%d",&n);
    int dp[n][3],a[n][3];
    for(int i=0;i<n;i++){
        scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
        dp[i][0]=0,dp[i][1]=0,dp[i][2]=0;
    }
    dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                if(j!=k)
                dp[i][k]=max(dp[i][k],dp[i-1][j]+a[i][k]);
            }
        }
    }
    for(int i=0;i<3;i++)
    ans=max(ans,dp[n-1][i]);
    printf("%d",ans);
}```

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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
	.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	%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, %rbx
	movl	$0, -112(%rbp)
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	-144(%rbp), %r10
	movq	-136(%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, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%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
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-116(%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, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L7:
	cmpq	%rdx, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L8:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L9
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L9:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L10
.L11:
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	8(%rax), %rdx
	movq	-64(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	4(%rax), %rdx
	movq	-64(%rbp), %rax
	addq	%rax, %rdx
	movl	-108(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	-64(%rbp), %rsi
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$0, (%rax)
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	$0, (%rax)
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	$0, (%rax)
	addl	$1, -108(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movq	-64(%rbp), %rax
	movl	(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, (%rax)
	movq	-64(%rbp), %rax
	movl	4(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, 4(%rax)
	movq	-64(%rbp), %rax
	movl	8(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, 8(%rax)
	movl	$1, -104(%rbp)
	jmp	.L12
.L18:
	movl	$0, -100(%rbp)
	jmp	.L13
.L17:
	movl	$0, -96(%rbp)
	jmp	.L14
.L16:
	movl	-100(%rbp), %eax
	cmpl	-96(%rbp), %eax
	je	.L15
	movl	-104(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rdx
	movl	-100(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	movl	(%rdx,%rax,4), %esi
	movq	-64(%rbp), %rdx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rdi, %rax
	movl	(%rdx,%rax,4), %eax
	leal	(%rsi,%rax), %edx
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	addq	%rdi, %rax
	movl	(%rcx,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	addq	%rdi, %rax
	movl	%edx, (%rcx,%rax,4)
.L15:
	addl	$1, -96(%rbp)
.L14:
	cmpl	$2, -96(%rbp)
	jle	.L16
	addl	$1, -100(%rbp)
.L13:
	cmpl	$2, -100(%rbp)
	jle	.L17
	addl	$1, -104(%rbp)
.L12:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L18
	movl	$0, -92(%rbp)
	jmp	.L19
.L20:
	movl	-116(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rdx
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	movl	(%rdx,%rax,4), %edx
	movl	-112(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -112(%rbp)
	addl	$1, -92(%rbp)
.L19:
	cmpl	$2, -92(%rbp)
	jle	.L20
	movl	-112(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, %rcx
	leaq	(%rax,%rax,2), %rax
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rsi
	cmpq	%rsi, %rsp
	je	.L5
.L31:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L31
.L5:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L32
.L6:
	leaq	3(%rsp), %r12
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rax
	movq	%r12, %rbx
	andq	$-4, %r12
	andq	$-16, %rdx
	subq	%rax, %rsi
	shrq	$2, %rbx
	movq	%r12, -72(%rbp)
	movq	%rbx, -80(%rbp)
.L7:
	cmpq	%rsi, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L32:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L6
.L8:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L33
.L9:
	leaq	3(%rsp), %rax
	movq	%rax, %rbx
	andq	$-4, %rax
	shrq	$2, %rbx
	movq	%rax, -96(%rbp)
	movq	%rax, %r12
	movq	%rbx, -88(%rbp)
	testl	%ecx, %ecx
	jle	.L10
	movq	-72(%rbp), %r15
	xorl	%r14d, %r14d
	leaq	.LC1(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L11:
	leaq	8(%r12), %rcx
	leaq	4(%r12), %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	addq	$12, %r12
	addq	$12, %r15
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %ecx
	movq	$0, -12(%r15)
	movl	$0, -4(%r15)
	cmpl	%r14d, %ecx
	jg	.L11
	movq	-88(%rbp), %rax
	movq	-80(%rbp), %rbx
	movq	0(,%rax,4), %xmm0
	movl	8(,%rax,4), %r8d
	movq	%xmm0, 0(,%rbx,4)
	movl	%r8d, 8(,%rbx,4)
	cmpl	$1, %ecx
	jle	.L16
	cmpl	$3, %ecx
	jle	.L19
	movq	-96(%rbp), %rbx
	leal	-4(%rcx), %esi
	pshufd	$0xe5, %xmm0, %xmm1
	movd	%xmm0, %eax
	andl	$-2, %esi
	movd	%xmm1, %edx
	movl	$1, %r11d
	leaq	12(%rbx), %r9
	movq	-72(%rbp), %rbx
	addl	$3, %esi
	leaq	12(%rbx), %rdi
.L14:
	movl	4(%r9), %ebx
	movl	4(%rdi), %r10d
	addl	%eax, %ebx
	cmpl	%r10d, %ebx
	cmovl	%r10d, %ebx
	movl	8(%r9), %r10d
	addl	8(%r9), %eax
	addl	%edx, %r10d
	movd	%ebx, %xmm2
	cmpl	%r10d, %eax
	cmovl	%r10d, %eax
	movl	8(%rdi), %r10d
	cmpl	%r10d, %eax
	cmovge	%eax, %r10d
	movl	(%r9), %eax
	addl	(%r9), %edx
	addl	%r8d, %eax
	movl	%r10d, 8(%rdi)
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movl	(%rdi), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	4(%r9), %edx
	addl	%r8d, %edx
	movl	16(%rdi), %r8d
	movd	%eax, %xmm0
	cmpl	%ebx, %edx
	punpckldq	%xmm2, %xmm0
	cmovl	%ebx, %edx
	movl	16(%r9), %ebx
	movq	%xmm0, (%rdi)
	addl	%eax, %ebx
	movl	%edx, 4(%rdi)
	cmpl	%r8d, %ebx
	cmovl	%r8d, %ebx
	movl	20(%r9), %r8d
	addl	20(%r9), %eax
	addl	%edx, %r8d
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	movl	20(%rdi), %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	movl	12(%r9), %eax
	addl	12(%r9), %edx
	addl	%r10d, %eax
	movl	%r8d, 20(%rdi)
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movl	12(%rdi), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	16(%r9), %edx
	addl	%r10d, %edx
	movl	%eax, 12(%rdi)
	cmpl	%ebx, %edx
	cmovl	%ebx, %edx
	addl	$2, %r11d
	addq	$24, %r9
	addq	$24, %rdi
	movl	%edx, -8(%rdi)
	cmpl	%esi, %r11d
	jne	.L14
.L13:
	movslq	%esi, %rdi
	movq	-72(%rbp), %rax
	imulq	$12, %rdi, %rdi
	addq	%rdi, %rax
	addq	-96(%rbp), %rdi
	.p2align 4,,10
	.p2align 3
.L15:
	movl	4(%rax), %edx
	movl	4(%rdi), %r8d
	addl	-12(%rax), %r8d
	movl	8(%rdi), %r9d
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	-12(%rax), %r9d
	movl	-8(%rax), %edx
	addl	8(%rdi), %edx
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	movl	8(%rax), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	movl	(%rdi), %r9d
	addl	-8(%rax), %r9d
	movl	%edx, 8(%rax)
	movl	-4(%rax), %edx
	addl	(%rdi), %edx
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	movl	(%rax), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	movl	%edx, (%rax)
	movl	-4(%rax), %edx
	addl	4(%rdi), %edx
	cmpl	%r8d, %edx
	cmovl	%r8d, %edx
	addl	$1, %esi
	addq	$12, %rax
	addq	$12, %rdi
	movl	%edx, -8(%rax)
	cmpl	%esi, %ecx
	jg	.L15
.L16:
	leal	-1(%rcx), %eax
	movq	-72(%rbp), %rbx
	movq	%r13, %rsi
	movl	$1, %edi
	cltq
	leaq	(%rax,%rax,2), %rax
	leaq	(%rbx,%rax,4), %rdx
	movl	4(%rdx), %ecx
	movl	(%rdx), %eax
	movl	8(%rdx), %edx
	cmpl	%ecx, %eax
	cmovl	%ecx, %eax
	xorl	%ecx, %ecx
	testl	%eax, %eax
	cmovs	%ecx, %eax
	cmpl	%edx, %eax
	cmovge	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L34
	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
.L10:
	.cfi_restore_state
	movq	-88(%rbp), %rbx
	movq	-80(%rbp), %rsi
	movq	0(,%rbx,4), %rax
	movq	%rax, 0(,%rsi,4)
	movl	8(,%rbx,4), %eax
	movl	%eax, 8(,%rsi,4)
	jmp	.L16
.L19:
	movl	$1, %esi
	jmp	.L13
.L33:
	orq	$0, -8(%rsp,%rax)
	jmp	.L9
.L34:
	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
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, %rcx
	leaq	(%rax,%rax,2), %rax
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rsi
	cmpq	%rsi, %rsp
	je	.L5
.L31:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L31
.L5:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L32
.L6:
	leaq	3(%rsp), %r12
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rax
	movq	%r12, %rbx
	andq	$-4, %r12
	andq	$-16, %rdx
	subq	%rax, %rsi
	shrq	$2, %rbx
	movq	%r12, -72(%rbp)
	movq	%rbx, -80(%rbp)
.L7:
	cmpq	%rsi, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L32:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L6
.L8:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L33
.L9:
	leaq	3(%rsp), %rax
	movq	%rax, %rbx
	andq	$-4, %rax
	shrq	$2, %rbx
	movq	%rax, -96(%rbp)
	movq	%rax, %r12
	movq	%rbx, -88(%rbp)
	testl	%ecx, %ecx
	jle	.L10
	movq	-72(%rbp), %r15
	xorl	%r14d, %r14d
	leaq	.LC1(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L11:
	leaq	8(%r12), %rcx
	leaq	4(%r12), %rdx
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	addq	$12, %r12
	addq	$12, %r15
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %ecx
	movq	$0, -12(%r15)
	movl	$0, -4(%r15)
	cmpl	%r14d, %ecx
	jg	.L11
	movq	-88(%rbp), %rax
	movq	-80(%rbp), %rbx
	movq	0(,%rax,4), %xmm0
	movl	8(,%rax,4), %r8d
	movq	%xmm0, 0(,%rbx,4)
	movl	%r8d, 8(,%rbx,4)
	cmpl	$1, %ecx
	jle	.L16
	cmpl	$3, %ecx
	jle	.L19
	movq	-96(%rbp), %rbx
	leal	-4(%rcx), %esi
	pshufd	$0xe5, %xmm0, %xmm1
	movd	%xmm0, %eax
	andl	$-2, %esi
	movd	%xmm1, %edx
	movl	$1, %r11d
	leaq	12(%rbx), %r9
	movq	-72(%rbp), %rbx
	addl	$3, %esi
	leaq	12(%rbx), %rdi
.L14:
	movl	4(%r9), %ebx
	movl	4(%rdi), %r10d
	addl	%eax, %ebx
	cmpl	%r10d, %ebx
	cmovl	%r10d, %ebx
	movl	8(%r9), %r10d
	addl	8(%r9), %eax
	addl	%edx, %r10d
	movd	%ebx, %xmm2
	cmpl	%r10d, %eax
	cmovl	%r10d, %eax
	movl	8(%rdi), %r10d
	cmpl	%r10d, %eax
	cmovge	%eax, %r10d
	movl	(%r9), %eax
	addl	(%r9), %edx
	addl	%r8d, %eax
	movl	%r10d, 8(%rdi)
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movl	(%rdi), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	4(%r9), %edx
	addl	%r8d, %edx
	movl	16(%rdi), %r8d
	movd	%eax, %xmm0
	cmpl	%ebx, %edx
	punpckldq	%xmm2, %xmm0
	cmovl	%ebx, %edx
	movl	16(%r9), %ebx
	movq	%xmm0, (%rdi)
	addl	%eax, %ebx
	movl	%edx, 4(%rdi)
	cmpl	%r8d, %ebx
	cmovl	%r8d, %ebx
	movl	20(%r9), %r8d
	addl	20(%r9), %eax
	addl	%edx, %r8d
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	movl	20(%rdi), %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	movl	12(%r9), %eax
	addl	12(%r9), %edx
	addl	%r10d, %eax
	movl	%r8d, 20(%rdi)
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movl	12(%rdi), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	16(%r9), %edx
	addl	%r10d, %edx
	movl	%eax, 12(%rdi)
	cmpl	%ebx, %edx
	cmovl	%ebx, %edx
	addl	$2, %r11d
	addq	$24, %r9
	addq	$24, %rdi
	movl	%edx, -8(%rdi)
	cmpl	%esi, %r11d
	jne	.L14
.L13:
	movslq	%esi, %rdi
	movq	-72(%rbp), %rax
	imulq	$12, %rdi, %rdi
	addq	%rdi, %rax
	addq	-96(%rbp), %rdi
	.p2align 4,,10
	.p2align 3
.L15:
	movl	4(%rax), %edx
	movl	4(%rdi), %r8d
	addl	-12(%rax), %r8d
	movl	8(%rdi), %r9d
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	-12(%rax), %r9d
	movl	-8(%rax), %edx
	addl	8(%rdi), %edx
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	movl	8(%rax), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	movl	(%rdi), %r9d
	addl	-8(%rax), %r9d
	movl	%edx, 8(%rax)
	movl	-4(%rax), %edx
	addl	(%rdi), %edx
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	movl	(%rax), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	movl	%edx, (%rax)
	movl	-4(%rax), %edx
	addl	4(%rdi), %edx
	cmpl	%r8d, %edx
	cmovl	%r8d, %edx
	addl	$1, %esi
	addq	$12, %rax
	addq	$12, %rdi
	movl	%edx, -8(%rax)
	cmpl	%esi, %ecx
	jg	.L15
.L16:
	leal	-1(%rcx), %eax
	movq	-72(%rbp), %rbx
	movq	%r13, %rsi
	movl	$1, %edi
	cltq
	leaq	(%rax,%rax,2), %rax
	leaq	(%rbx,%rax,4), %rdx
	movl	4(%rdx), %ecx
	movl	(%rdx), %eax
	movl	8(%rdx), %edx
	cmpl	%ecx, %eax
	cmovl	%ecx, %eax
	xorl	%ecx, %ecx
	testl	%eax, %eax
	cmovs	%ecx, %eax
	cmpl	%edx, %eax
	cmovge	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L34
	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
.L10:
	.cfi_restore_state
	movq	-88(%rbp), %rbx
	movq	-80(%rbp), %rsi
	movq	0(,%rbx,4), %rax
	movq	%rax, 0(,%rsi,4)
	movl	8(,%rbx,4), %eax
	movl	%eax, 8(,%rsi,4)
	jmp	.L16
.L19:
	movl	$1, %esi
	jmp	.L13
.L33:
	orq	$0, -8(%rsp,%rax)
	jmp	.L9
.L34:
	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 infinity 1000000000
int max(int a,int b){
    return a>b?a:b;
}
int main()
{
    int n,ans=0;
    scanf("%d",&n);
    int dp[n][3],a[n][3];
    for(int i=0;i<n;i++){
        scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
        dp[i][0]=0,dp[i][1]=0,dp[i][2]=0;
    }
    dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                if(j!=k)
                dp[i][k]=max(dp[i][k],dp[i-1][j]+a[i][k]);
            }
        }
    }
    for(int i=0;i<3;i++)
    ans=max(ans,dp[n-1][i]);
    printf("%d",ans);
}
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>
#include<stdlib.h>
#define infinity 1000000000
int max(int a,int b){
    return a>b?a:b;
}
int main()
{
    int n,ans=0;
    scanf("%d",&n);
    int dp[n][3],a[n][3];
    for(int i=0;i<n;i++){
        scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
        dp[i][0]=0,dp[i][1]=0,dp[i][2]=0;
    }
    dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                if(j!=k)
                dp[i][k]=max(dp[i][k],dp[i-1][j]+a[i][k]);
            }
        }
    }
    for(int i=0;i<3;i++)
    ans=max(ans,dp[n-1][i]);
    printf("%d",ans);
}```

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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
	.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	%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, %rbx
	movl	$0, -112(%rbp)
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	-144(%rbp), %r10
	movq	-136(%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, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%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
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-116(%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, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L7:
	cmpq	%rdx, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L8:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L9
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L9:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L10
.L11:
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	8(%rax), %rdx
	movq	-64(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	4(%rax), %rdx
	movq	-64(%rbp), %rax
	addq	%rax, %rdx
	movl	-108(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	-64(%rbp), %rsi
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$0, (%rax)
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	$0, (%rax)
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	$0, (%rax)
	addl	$1, -108(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movq	-64(%rbp), %rax
	movl	(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, (%rax)
	movq	-64(%rbp), %rax
	movl	4(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, 4(%rax)
	movq	-64(%rbp), %rax
	movl	8(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, 8(%rax)
	movl	$1, -104(%rbp)
	jmp	.L12
.L18:
	movl	$0, -100(%rbp)
	jmp	.L13
.L17:
	movl	$0, -96(%rbp)
	jmp	.L14
.L16:
	movl	-100(%rbp), %eax
	cmpl	-96(%rbp), %eax
	je	.L15
	movl	-104(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rdx
	movl	-100(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	movl	(%rdx,%rax,4), %esi
	movq	-64(%rbp), %rdx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rdi, %rax
	movl	(%rdx,%rax,4), %eax
	leal	(%rsi,%rax), %edx
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	addq	%rdi, %rax
	movl	(%rcx,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	addq	%rdi, %rax
	movl	%edx, (%rcx,%rax,4)
.L15:
	addl	$1, -96(%rbp)
.L14:
	cmpl	$2, -96(%rbp)
	jle	.L16
	addl	$1, -100(%rbp)
.L13:
	cmpl	$2, -100(%rbp)
	jle	.L17
	addl	$1, -104(%rbp)
.L12:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L18
	movl	$0, -92(%rbp)
	jmp	.L19
.L20:
	movl	-116(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rdx
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	movl	(%rdx,%rax,4), %edx
	movl	-112(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -112(%rbp)
	addl	$1, -92(%rbp)
.L19:
	cmpl	$2, -92(%rbp)
	jle	.L20
	movl	-112(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
	.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	%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, %rbx
	movl	$0, -112(%rbp)
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %ecx
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	-144(%rbp), %r10
	movq	-136(%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, -160(%rbp)
	movq	$0, -152(%rbp)
	movq	-160(%rbp), %r8
	movq	-152(%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
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-116(%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, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L7:
	cmpq	%rdx, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L8:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L9
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L9:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L10
.L11:
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	8(%rax), %rdx
	movq	-64(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	4(%rax), %rdx
	movq	-64(%rbp), %rax
	addq	%rax, %rdx
	movl	-108(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	-64(%rbp), %rsi
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movl	$0, (%rax)
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$4, %rax
	movl	$0, (%rax)
	movq	-80(%rbp), %rcx
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	$8, %rax
	movl	$0, (%rax)
	addl	$1, -108(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movq	-64(%rbp), %rax
	movl	(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, (%rax)
	movq	-64(%rbp), %rax
	movl	4(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, 4(%rax)
	movq	-64(%rbp), %rax
	movl	8(%rax), %edx
	movq	-80(%rbp), %rax
	movl	%edx, 8(%rax)
	movl	$1, -104(%rbp)
	jmp	.L12
.L18:
	movl	$0, -100(%rbp)
	jmp	.L13
.L17:
	movl	$0, -96(%rbp)
	jmp	.L14
.L16:
	movl	-100(%rbp), %eax
	cmpl	-96(%rbp), %eax
	je	.L15
	movl	-104(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rdx
	movl	-100(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	movl	(%rdx,%rax,4), %esi
	movq	-64(%rbp), %rdx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rdi, %rax
	movl	(%rdx,%rax,4), %eax
	leal	(%rsi,%rax), %edx
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	addq	%rdi, %rax
	movl	(%rcx,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movq	-80(%rbp), %rcx
	movl	-96(%rbp), %eax
	movslq	%eax, %rdi
	movl	-104(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	addq	%rdi, %rax
	movl	%edx, (%rcx,%rax,4)
.L15:
	addl	$1, -96(%rbp)
.L14:
	cmpl	$2, -96(%rbp)
	jle	.L16
	addl	$1, -100(%rbp)
.L13:
	cmpl	$2, -100(%rbp)
	jle	.L17
	addl	$1, -104(%rbp)
.L12:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L18
	movl	$0, -92(%rbp)
	jmp	.L19
.L20:
	movl	-116(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rdx
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	addq	%rsi, %rax
	movl	(%rdx,%rax,4), %edx
	movl	-112(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -112(%rbp)
	addl	$1, -92(%rbp)
.L19:
	cmpl	$2, -92(%rbp)
	jle	.L20
	movl	-112(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
