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>
#define N 100

int m[N][N];
int p[N+1];
int n;


void matrixChainOrder();

int main(){
  int A[N][2];
  int r,c,i;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&A[i][0],&A[i][1]);
  }

  p[0] = A[0][0];
  for(i=1;i<=n+1;i++){
    p[i] = A[i-1][1];
  }

  matrixChainOrder();

  return 0;

}

void matrixChainOrder(){
  int a,i,j,k,l,q;
  a=n;
  if(a == 1){
    printf("%d\n",0);
    return;
  }
  for(i=1;i<=a;i++){
    m[i][i] = 0;
  }
  for(l=2;l<=a;l++){
    for(i=1;i<=a-l+1;i++){
      j=i+l-1;
      m[i][j] = 1000000;
      for(k=i;k<=j-1;k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j]=min(m[i][j],q);
	if(l == a && k == j-1){
	  printf("%d\n",m[i][j]);
	}
      }
    }
  }
}

int min(int a,int b){
  if(a>b){
    return b;
  }
  if(b>a){
    return a;
  }
  if(a == b){ 
    return a;
  }
}


```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 40000
m:
	.zero	40000
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$832, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -820(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-820(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	$4, %rax
	addq	%rax, %rdx
	leaq	-816(%rbp), %rcx
	movl	-820(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -820(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -820(%rbp)
	jl	.L3
	movl	-816(%rbp), %eax
	movl	%eax, p(%rip)
	movl	$1, -820(%rbp)
	jmp	.L4
.L5:
	movl	-820(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	movl	-820(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -820(%rbp)
.L4:
	movl	n(%rip), %eax
	addl	$1, %eax
	cmpl	%eax, -820(%rbp)
	jle	.L5
	movl	$0, %eax
	call	matrixChainOrder
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
.LC2:
	.string	"%d\n"
	.text
	.globl	matrixChainOrder
	.type	matrixChainOrder, @function
matrixChainOrder:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	n(%rip), %eax
	movl	%eax, -12(%rbp)
	cmpl	$1, -12(%rbp)
	jne	.L9
	movl	$0, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L9:
	movl	$1, -24(%rbp)
	jmp	.L11
.L12:
	movl	-24(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	leaq	m(%rip), %rdx
	movl	$0, (%rax,%rdx)
	addl	$1, -24(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L12
	movl	$2, -16(%rbp)
	jmp	.L13
.L19:
	movl	$1, -24(%rbp)
	jmp	.L14
.L18:
	movl	-24(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	$1000000, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L15
.L17:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rcx,%rax), %esi
	movl	-24(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	imull	%eax, %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	imull	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	min
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	m(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L16
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -20(%rbp)
	jne	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	addl	$1, -20(%rbp)
.L15:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L17
	addl	$1, -24(%rbp)
.L14:
	movl	-12(%rbp), %eax
	subl	-16(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -24(%rbp)
	jle	.L18
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L19
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	matrixChainOrder, .-matrixChainOrder
	.globl	min
	.type	min, @function
min:
.LFB2:
	.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	.L21
	movl	-8(%rbp), %eax
	jmp	.L20
.L21:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L23
	movl	-4(%rbp), %eax
	jmp	.L20
.L23:
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jne	.L24
	movl	-4(%rbp), %eax
	jmp	.L20
.L24:
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	min, .-min
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	matrixChainOrder
	.type	matrixChainOrder, @function
matrixChainOrder:
.LFB24:
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movl	n(%rip), %eax
	movl	%eax, 4(%rsp)
	cmpl	$1, %eax
	je	.L2
	testl	%eax, %eax
	jle	.L1
	movl	%eax, %ebx
	leaq	404+m(%rip), %rax
	leal	-1(%rbx), %edx
	leaq	404(%rax), %rcx
	imulq	$404, %rdx, %rdx
	addq	%rcx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$0, (%rax)
	addq	$404, %rax
	cmpq	%rdx, %rax
	jne	.L5
	movl	4(%rsp), %eax
	leaq	p(%rip), %rbx
	movq	$2, 16(%rsp)
	subl	$2, %eax
	movl	%eax, (%rsp)
	leaq	8+p(%rip), %rax
	movq	%rax, 8(%rsp)
	leaq	408+m(%rip), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%rsp), %eax
	addl	$1, %eax
	testl	%eax, %eax
	jle	.L14
	movq	16(%rsp), %rax
	movq	24(%rsp), %r9
	leaq	400+m(%rip), %r10
	xorl	%r12d, %r12d
	movl	$1, %r13d
	movl	%eax, %r14d
	movl	%eax, %r15d
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%r14d, %ebp
	movl	$1000000, (%r9)
	addl	$1, %r14d
	cmpl	%r13d, %ebp
	jle	.L7
	movq	8(%rsp), %rdi
	movl	%r12d, %eax
	movl	(%rdi,%r12,4), %r8d
	cmpl	%r15d, 4(%rsp)
	je	.L8
	movl	(%rbx,%r12,4), %r11d
	movq	%r9, %rdi
	movq	%r13, %rdx
	movl	$1000000, %ecx
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rbx,%rdx,4), %eax
	movl	(%r10,%rdx,4), %esi
	addl	400(%rdi), %esi
	imull	%r11d, %eax
	imull	%r8d, %eax
	addl	%esi, %eax
	cmpl	%eax, %ecx
	cmovg	%eax, %ecx
	addq	$1, %rdx
	addq	$400, %rdi
	movl	%ecx, (%r9)
	cmpl	%edx, %ebp
	jg	.L9
.L7:
	addq	$1, %r12
	addq	$1, %r13
	addq	$404, %r9
	addq	$400, %r10
	cmpl	%r12d, (%rsp)
	jge	.L11
.L14:
	addq	$1, 16(%rsp)
	movq	16(%rsp), %rax
	subl	$1, (%rsp)
	addq	$4, 8(%rsp)
	addq	$4, 24(%rsp)
	cmpl	%eax, 4(%rsp)
	jge	.L12
.L1:
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%r13d, %r12
	movslq	%ebp, %r9
	leaq	m(%rip), %rdi
	movslq	%eax, %r14
	leaq	(%r12,%r12,4), %rdx
	movl	%ebp, %eax
	leal	-1(%rbp), %r10d
	leaq	(%rdx,%rdx,4), %r15
	movl	$1000000, %edx
	leaq	(%r9,%r15,4), %r13
	salq	$4, %r15
	leaq	(%rdi,%r13,4), %rcx
	addq	%rdi, %r15
	movq	%rcx, %rbp
	movl	%eax, %ecx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$1, %r12
	addq	$400, %rbp
	cmpl	%r12d, %ecx
	jle	.L14
	leaq	m(%rip), %rax
	movl	(%rbx,%r9,4), %r8d
	movl	(%rax,%r13,4), %edx
.L15:
	movl	(%rbx,%r14,4), %eax
	imull	(%rbx,%r12,4), %eax
	movl	400(%rbp), %esi
	addl	(%r15,%r12,4), %esi
	imull	%r8d, %eax
	addl	%esi, %eax
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	leaq	m(%rip), %rax
	movl	%edx, (%rax,%r13,4)
	cmpl	%r12d, %r10d
	jne	.L10
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%ecx, 32(%rsp)
	movq	%r9, 40(%rsp)
	movl	%r10d, 36(%rsp)
	call	__printf_chk@PLT
	movl	32(%rsp), %ecx
	movl	36(%rsp), %r10d
	movq	40(%rsp), %r9
	jmp	.L10
.L2:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	xorl	%edx, %edx
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$1, %edi
	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
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE24:
	.size	matrixChainOrder, .-matrixChainOrder
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	n(%rip), %rsi
	leaq	.LC1(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$816, %rsp
	.cfi_def_cfa_offset 848
	movq	%fs:40, %rax
	movq	%rax, 808(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L24
	movq	%rsp, %rbx
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L25:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, %edx
	jg	.L25
.L24:
	movl	(%rsp), %eax
	movl	%eax, p(%rip)
	testl	%edx, %edx
	js	.L29
	cmpl	$3, %edx
	jbe	.L31
	movl	%edx, %esi
	leaq	4(%rsp), %rax
	leaq	4+p(%rip), %rcx
	shrl	$2, %esi
	subl	$1, %esi
	salq	$5, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L28:
	movdqu	(%rax), %xmm0
	movdqu	16(%rax), %xmm1
	addq	$32, %rax
	addq	$16, %rcx
	shufps	$136, %xmm1, %xmm0
	movups	%xmm0, -16(%rcx)
	cmpq	%rsi, %rax
	jne	.L28
	movl	%edx, %eax
	andl	$-4, %eax
	addl	$1, %eax
.L27:
	leal	-1(%rax), %esi
	leaq	p(%rip), %rcx
	movslq	%eax, %rdi
	movslq	%esi, %rsi
	movl	4(%rsp,%rsi,8), %esi
	movl	%esi, (%rcx,%rdi,4)
	leal	1(%rax), %esi
	cmpl	%edx, %eax
	jg	.L29
	movl	4(%rsp,%rdi,8), %edi
	movslq	%esi, %r8
	movl	%edi, (%rcx,%r8,4)
	leal	2(%rax), %edi
	cmpl	%esi, %edx
	jl	.L29
	movl	4(%rsp,%r8,8), %r8d
	movslq	%edi, %rsi
	addl	$3, %eax
	movl	%r8d, (%rcx,%rsi,4)
	cmpl	%edi, %edx
	jl	.L29
	movl	4(%rsp,%rsi,8), %edx
	cltq
	movl	%edx, (%rcx,%rax,4)
.L29:
	xorl	%eax, %eax
	call	matrixChainOrder
	movq	808(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$816, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L31:
	.cfi_restore_state
	movl	$1, %eax
	jmp	.L27
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB25:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	min, .-min
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 40000
m:
	.zero	40000
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	matrixChainOrder
	.type	matrixChainOrder, @function
matrixChainOrder:
.LFB24:
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movl	n(%rip), %eax
	movl	%eax, 4(%rsp)
	cmpl	$1, %eax
	je	.L2
	testl	%eax, %eax
	jle	.L1
	movl	%eax, %ebx
	leaq	404+m(%rip), %rax
	leal	-1(%rbx), %edx
	leaq	404(%rax), %rcx
	imulq	$404, %rdx, %rdx
	addq	%rcx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$0, (%rax)
	addq	$404, %rax
	cmpq	%rdx, %rax
	jne	.L5
	movl	4(%rsp), %eax
	leaq	p(%rip), %rbx
	movq	$2, 16(%rsp)
	subl	$2, %eax
	movl	%eax, (%rsp)
	leaq	8+p(%rip), %rax
	movq	%rax, 8(%rsp)
	leaq	408+m(%rip), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%rsp), %eax
	addl	$1, %eax
	testl	%eax, %eax
	jle	.L14
	movq	16(%rsp), %rax
	movq	24(%rsp), %r9
	leaq	400+m(%rip), %r10
	xorl	%r12d, %r12d
	movl	$1, %r13d
	movl	%eax, %r14d
	movl	%eax, %r15d
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%r14d, %ebp
	movl	$1000000, (%r9)
	addl	$1, %r14d
	cmpl	%r13d, %ebp
	jle	.L7
	movq	8(%rsp), %rdi
	movl	%r12d, %eax
	movl	(%rdi,%r12,4), %r8d
	cmpl	%r15d, 4(%rsp)
	je	.L8
	movl	(%rbx,%r12,4), %r11d
	movq	%r9, %rdi
	movq	%r13, %rdx
	movl	$1000000, %ecx
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rbx,%rdx,4), %eax
	movl	(%r10,%rdx,4), %esi
	addl	400(%rdi), %esi
	imull	%r11d, %eax
	imull	%r8d, %eax
	addl	%esi, %eax
	cmpl	%eax, %ecx
	cmovg	%eax, %ecx
	addq	$1, %rdx
	addq	$400, %rdi
	movl	%ecx, (%r9)
	cmpl	%edx, %ebp
	jg	.L9
.L7:
	addq	$1, %r12
	addq	$1, %r13
	addq	$404, %r9
	addq	$400, %r10
	cmpl	%r12d, (%rsp)
	jge	.L11
.L14:
	addq	$1, 16(%rsp)
	movq	16(%rsp), %rax
	subl	$1, (%rsp)
	addq	$4, 8(%rsp)
	addq	$4, 24(%rsp)
	cmpl	%eax, 4(%rsp)
	jge	.L12
.L1:
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	movslq	%r13d, %r12
	movslq	%ebp, %r9
	leaq	m(%rip), %rdi
	movslq	%eax, %r14
	leaq	(%r12,%r12,4), %rdx
	movl	%ebp, %eax
	leal	-1(%rbp), %r10d
	leaq	(%rdx,%rdx,4), %r15
	movl	$1000000, %edx
	leaq	(%r9,%r15,4), %r13
	salq	$4, %r15
	leaq	(%rdi,%r13,4), %rcx
	addq	%rdi, %r15
	movq	%rcx, %rbp
	movl	%eax, %ecx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$1, %r12
	addq	$400, %rbp
	cmpl	%r12d, %ecx
	jle	.L14
	leaq	m(%rip), %rax
	movl	(%rbx,%r9,4), %r8d
	movl	(%rax,%r13,4), %edx
.L15:
	movl	(%rbx,%r14,4), %eax
	imull	(%rbx,%r12,4), %eax
	movl	400(%rbp), %esi
	addl	(%r15,%r12,4), %esi
	imull	%r8d, %eax
	addl	%esi, %eax
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	leaq	m(%rip), %rax
	movl	%edx, (%rax,%r13,4)
	cmpl	%r12d, %r10d
	jne	.L10
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%ecx, 32(%rsp)
	movq	%r9, 40(%rsp)
	movl	%r10d, 36(%rsp)
	call	__printf_chk@PLT
	movl	32(%rsp), %ecx
	movl	36(%rsp), %r10d
	movq	40(%rsp), %r9
	jmp	.L10
.L2:
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	xorl	%edx, %edx
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$1, %edi
	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
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE24:
	.size	matrixChainOrder, .-matrixChainOrder
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	n(%rip), %rsi
	leaq	.LC1(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$816, %rsp
	.cfi_def_cfa_offset 848
	movq	%fs:40, %rax
	movq	%rax, 808(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L24
	movq	%rsp, %rbx
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L25:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, %edx
	jg	.L25
.L24:
	movl	(%rsp), %eax
	movl	%eax, p(%rip)
	testl	%edx, %edx
	js	.L29
	cmpl	$3, %edx
	jbe	.L31
	movl	%edx, %esi
	leaq	4(%rsp), %rax
	leaq	4+p(%rip), %rcx
	shrl	$2, %esi
	subl	$1, %esi
	salq	$5, %rsi
	leaq	36(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L28:
	movdqu	(%rax), %xmm0
	movdqu	16(%rax), %xmm1
	addq	$32, %rax
	addq	$16, %rcx
	shufps	$136, %xmm1, %xmm0
	movups	%xmm0, -16(%rcx)
	cmpq	%rsi, %rax
	jne	.L28
	movl	%edx, %eax
	andl	$-4, %eax
	addl	$1, %eax
.L27:
	leal	-1(%rax), %esi
	leaq	p(%rip), %rcx
	movslq	%eax, %rdi
	movslq	%esi, %rsi
	movl	4(%rsp,%rsi,8), %esi
	movl	%esi, (%rcx,%rdi,4)
	leal	1(%rax), %esi
	cmpl	%edx, %eax
	jg	.L29
	movl	4(%rsp,%rdi,8), %edi
	movslq	%esi, %r8
	movl	%edi, (%rcx,%r8,4)
	leal	2(%rax), %edi
	cmpl	%esi, %edx
	jl	.L29
	movl	4(%rsp,%r8,8), %r8d
	movslq	%edi, %rsi
	addl	$3, %eax
	movl	%r8d, (%rcx,%rsi,4)
	cmpl	%edi, %edx
	jl	.L29
	movl	4(%rsp,%rsi,8), %edx
	cltq
	movl	%edx, (%rcx,%rax,4)
.L29:
	xorl	%eax, %eax
	call	matrixChainOrder
	movq	808(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$816, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L31:
	.cfi_restore_state
	movl	$1, %eax
	jmp	.L27
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB25:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	min, .-min
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 40000
m:
	.zero	40000
	.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>
#define N 100

int m[N][N];
int p[N+1];
int n;


void matrixChainOrder();

int main(){
  int A[N][2];
  int r,c,i;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&A[i][0],&A[i][1]);
  }

  p[0] = A[0][0];
  for(i=1;i<=n+1;i++){
    p[i] = A[i-1][1];
  }

  matrixChainOrder();

  return 0;

}

void matrixChainOrder(){
  int a,i,j,k,l,q;
  a=n;
  if(a == 1){
    printf("%d\n",0);
    return;
  }
  for(i=1;i<=a;i++){
    m[i][i] = 0;
  }
  for(l=2;l<=a;l++){
    for(i=1;i<=a-l+1;i++){
      j=i+l-1;
      m[i][j] = 1000000;
      for(k=i;k<=j-1;k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j]=min(m[i][j],q);
	if(l == a && k == j-1){
	  printf("%d\n",m[i][j]);
	}
      }
    }
  }
}

int min(int a,int b){
  if(a>b){
    return b;
  }
  if(b>a){
    return a;
  }
  if(a == b){ 
    return a;
  }
}



6
10 35
35 15
15 5
5 10
10 20
20 25
 6
1 35
35 15
15 5
5 10
10 20
20 25
 6
30 35
35 15
15 5
5 10
10 20
20 29
 6
2 35
35 15
15 5
5 10
10 20
20 25
 6
2 35
35 15
15 5
5 10
10 20
20 24
 6
30 35
35 15
15 5
5 10
10 20
20 27
 6
30 35
35 15
15 5
5 10
10 20
20 8
 6
30 35
35 15
15 5
5 10
10 20
20 7
 6
2 35
35 15
15 5
5 10
10 20
20 34
 6
29 35
35 15
15 5
5 10
10 20
20 7

9125
 1350
 16125
 2700
 2660
 15625
 10875
 10625
 3060
 10415

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>
#define N 100

int m[N][N];
int p[N+1];
int n;


void matrixChainOrder();

int main(){
  int A[N][2];
  int r,c,i;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d%d",&A[i][0],&A[i][1]);
  }

  p[0] = A[0][0];
  for(i=1;i<=n+1;i++){
    p[i] = A[i-1][1];
  }

  matrixChainOrder();

  return 0;

}

void matrixChainOrder(){
  int a,i,j,k,l,q;
  a=n;
  if(a == 1){
    printf("%d\n",0);
    return;
  }
  for(i=1;i<=a;i++){
    m[i][i] = 0;
  }
  for(l=2;l<=a;l++){
    for(i=1;i<=a-l+1;i++){
      j=i+l-1;
      m[i][j] = 1000000;
      for(k=i;k<=j-1;k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j]=min(m[i][j],q);
	if(l == a && k == j-1){
	  printf("%d\n",m[i][j]);
	}
      }
    }
  }
}

int min(int a,int b){
  if(a>b){
    return b;
  }
  if(b>a){
    return a;
  }
  if(a == b){ 
    return a;
  }
}


```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 40000
m:
	.zero	40000
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$832, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -820(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-820(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	$4, %rax
	addq	%rax, %rdx
	leaq	-816(%rbp), %rcx
	movl	-820(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -820(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -820(%rbp)
	jl	.L3
	movl	-816(%rbp), %eax
	movl	%eax, p(%rip)
	movl	$1, -820(%rbp)
	jmp	.L4
.L5:
	movl	-820(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	movl	-820(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -820(%rbp)
.L4:
	movl	n(%rip), %eax
	addl	$1, %eax
	cmpl	%eax, -820(%rbp)
	jle	.L5
	movl	$0, %eax
	call	matrixChainOrder
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
.LC2:
	.string	"%d\n"
	.text
	.globl	matrixChainOrder
	.type	matrixChainOrder, @function
matrixChainOrder:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	n(%rip), %eax
	movl	%eax, -12(%rbp)
	cmpl	$1, -12(%rbp)
	jne	.L9
	movl	$0, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L9:
	movl	$1, -24(%rbp)
	jmp	.L11
.L12:
	movl	-24(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	leaq	m(%rip), %rdx
	movl	$0, (%rax,%rdx)
	addl	$1, -24(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L12
	movl	$2, -16(%rbp)
	jmp	.L13
.L19:
	movl	$1, -24(%rbp)
	jmp	.L14
.L18:
	movl	-24(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	$1000000, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L15
.L17:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rcx,%rax), %esi
	movl	-24(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	imull	%eax, %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	imull	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	min
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	m(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L16
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -20(%rbp)
	jne	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	addl	$1, -20(%rbp)
.L15:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L17
	addl	$1, -24(%rbp)
.L14:
	movl	-12(%rbp), %eax
	subl	-16(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -24(%rbp)
	jle	.L18
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L19
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	matrixChainOrder, .-matrixChainOrder
	.globl	min
	.type	min, @function
min:
.LFB2:
	.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	.L21
	movl	-8(%rbp), %eax
	jmp	.L20
.L21:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L23
	movl	-4(%rbp), %eax
	jmp	.L20
.L23:
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jne	.L24
	movl	-4(%rbp), %eax
	jmp	.L20
.L24:
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	min, .-min
	.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	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 40000
m:
	.zero	40000
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$832, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -820(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-820(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	$4, %rax
	addq	%rax, %rdx
	leaq	-816(%rbp), %rcx
	movl	-820(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -820(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -820(%rbp)
	jl	.L3
	movl	-816(%rbp), %eax
	movl	%eax, p(%rip)
	movl	$1, -820(%rbp)
	jmp	.L4
.L5:
	movl	-820(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-812(%rbp,%rax,8), %eax
	movl	-820(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -820(%rbp)
.L4:
	movl	n(%rip), %eax
	addl	$1, %eax
	cmpl	%eax, -820(%rbp)
	jle	.L5
	movl	$0, %eax
	call	matrixChainOrder
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
.LC2:
	.string	"%d\n"
	.text
	.globl	matrixChainOrder
	.type	matrixChainOrder, @function
matrixChainOrder:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	n(%rip), %eax
	movl	%eax, -12(%rbp)
	cmpl	$1, -12(%rbp)
	jne	.L9
	movl	$0, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L9:
	movl	$1, -24(%rbp)
	jmp	.L11
.L12:
	movl	-24(%rbp), %eax
	cltq
	imulq	$404, %rax, %rax
	leaq	m(%rip), %rdx
	movl	$0, (%rax,%rdx)
	addl	$1, -24(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L12
	movl	$2, -16(%rbp)
	jmp	.L13
.L19:
	movl	$1, -24(%rbp)
	jmp	.L14
.L18:
	movl	-24(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	$1000000, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L15
.L17:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rcx,%rax), %esi
	movl	-24(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	imull	%eax, %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rax
	movl	(%rcx,%rax), %eax
	imull	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	min
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	m(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L16
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -20(%rbp)
	jne	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	addl	$1, -20(%rbp)
.L15:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L17
	addl	$1, -24(%rbp)
.L14:
	movl	-12(%rbp), %eax
	subl	-16(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -24(%rbp)
	jle	.L18
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L19
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	matrixChainOrder, .-matrixChainOrder
	.globl	min
	.type	min, @function
min:
.LFB2:
	.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	.L21
	movl	-8(%rbp), %eax
	jmp	.L20
.L21:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L23
	movl	-4(%rbp), %eax
	jmp	.L20
.L23:
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jne	.L24
	movl	-4(%rbp), %eax
	jmp	.L20
.L24:
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	min, .-min
	.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:
