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

```c
#include<stdio.h>
#include<stdlib.h>

int main(){
  int m,n,max=0,total=0,i,j,**array;

  while(1){
    scanf("%d %d",&m,&n);
    if(m==0 && n==0)break;

    array = malloc(n*sizeof(int *));
    for(i=0;i<n;i++){
      array[i] = malloc(m*sizeof(int));
    }

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        scanf("%d",&array[i][j]);
      }
    }
        for(j=0;j<m;j++){
      for(i=0;i<n;i++){
        total += array[i][j];
      }
      if(max <= total){
        max = total;
      }
      total = 0;
    }
    printf("%d\n",max);
    max=0;

    for(j=0;j<n;j++){
      free(array[j]);
    }
    free(array);
  }
  return 0;
}


```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	movl	20(%rsp), %r13d
	movl	%r14d, %eax
	orl	%r13d, %eax
	je	.L2
	movslq	%r13d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r13d, %r13d
	jle	.L3
	movslq	%r14d, %r12
	movl	%r13d, %r13d
	movq	%rax, %r15
	salq	$2, %r12
	leaq	(%rax,%r13,8), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rdi
	addq	$8, %r15
	call	malloc@PLT
	movq	%rax, -8(%r15)
	cmpq	%r13, %r15
	jne	.L4
	movl	$1, %r12d
	testl	%r14d, %r14d
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movq	-8(%rbp,%r12,8), %r15
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	addq	$4, %r15
	cmpl	%r13d, %r14d
	jg	.L6
	movl	20(%rsp), %r13d
	cmpl	%r12d, %r13d
	jle	.L3
	addq	$1, %r12
	testl	%r14d, %r14d
	jg	.L8
.L18:
	xorl	%r9d, %r9d
.L9:
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movq	%rbp, %r13
	movl	$1, %edi
	call	__printf_chk@PLT
	movl	20(%rsp), %eax
	leaq	0(%rbp,%rax,8), %r12
	testl	%eax, %eax
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L15:
	movq	0(%r13), %rdi
	addq	$8, %r13
	call	free@PLT
	cmpq	%r13, %r12
	jne	.L15
.L16:
	movq	%rbp, %rdi
	call	free@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%r14d, %r14d
	jle	.L18
	movslq	%r14d, %rcx
	leal	-1(%r13), %eax
	xorl	%edi, %edi
	xorl	%r9d, %r9d
	salq	$2, %rcx
	leaq	8(%rbp,%rax,8), %r8
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rbp, %rax
	xorl	%edx, %edx
	testl	%r13d, %r13d
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L11:
	movq	(%rax), %rsi
	addq	$8, %rax
	addl	(%rsi,%rdi), %edx
	cmpq	%rax, %r8
	jne	.L11
.L12:
	cmpl	%edx, %r9d
	cmovl	%edx, %r9d
	addq	$4, %rdi
	cmpq	%rdi, %rcx
	jne	.L10
	jmp	.L9
.L2:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	movl	20(%rsp), %r13d
	movl	%r14d, %eax
	orl	%r13d, %eax
	je	.L2
	movslq	%r13d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r13d, %r13d
	jle	.L3
	movslq	%r14d, %r12
	movl	%r13d, %r13d
	movq	%rax, %r15
	salq	$2, %r12
	leaq	(%rax,%r13,8), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rdi
	addq	$8, %r15
	call	malloc@PLT
	movq	%rax, -8(%r15)
	cmpq	%r13, %r15
	jne	.L4
	movl	$1, %r12d
	testl	%r14d, %r14d
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movq	-8(%rbp,%r12,8), %r15
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	addq	$4, %r15
	cmpl	%r13d, %r14d
	jg	.L6
	movl	20(%rsp), %r13d
	cmpl	%r12d, %r13d
	jle	.L3
	addq	$1, %r12
	testl	%r14d, %r14d
	jg	.L8
.L18:
	xorl	%r9d, %r9d
.L9:
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movq	%rbp, %r13
	movl	$1, %edi
	call	__printf_chk@PLT
	movl	20(%rsp), %eax
	leaq	0(%rbp,%rax,8), %r12
	testl	%eax, %eax
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L15:
	movq	0(%r13), %rdi
	addq	$8, %r13
	call	free@PLT
	cmpq	%r13, %r12
	jne	.L15
.L16:
	movq	%rbp, %rdi
	call	free@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%r14d, %r14d
	jle	.L18
	movslq	%r14d, %rcx
	leal	-1(%r13), %eax
	xorl	%edi, %edi
	xorl	%r9d, %r9d
	salq	$2, %rcx
	leaq	8(%rbp,%rax,8), %r8
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rbp, %rax
	xorl	%edx, %edx
	testl	%r13d, %r13d
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L11:
	movq	(%rax), %rsi
	addq	$8, %rax
	addl	(%rsi,%rdi), %edx
	cmpq	%rax, %r8
	jne	.L11
.L12:
	cmpl	%edx, %r9d
	cmovl	%edx, %r9d
	addq	$4, %rdi
	cmpq	%rdi, %rcx
	jne	.L10
	jmp	.L9
.L2:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	movl	20(%rsp), %r13d
	movl	%r14d, %eax
	orl	%r13d, %eax
	je	.L2
	movslq	%r13d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r13d, %r13d
	jle	.L3
	movslq	%r14d, %r12
	movl	%r13d, %r13d
	movq	%rax, %r15
	salq	$2, %r12
	leaq	(%rax,%r13,8), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rdi
	addq	$8, %r15
	call	malloc@PLT
	movq	%rax, -8(%r15)
	cmpq	%r13, %r15
	jne	.L4
	movl	$1, %r12d
	testl	%r14d, %r14d
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movq	-8(%rbp,%r12,8), %r15
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	addq	$4, %r15
	cmpl	%r13d, %r14d
	jg	.L6
	movl	20(%rsp), %r13d
	cmpl	%r12d, %r13d
	jle	.L3
	addq	$1, %r12
	testl	%r14d, %r14d
	jg	.L8
.L18:
	xorl	%r9d, %r9d
.L9:
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movq	%rbp, %r13
	movl	$1, %edi
	call	__printf_chk@PLT
	movl	20(%rsp), %eax
	leaq	0(%rbp,%rax,8), %r12
	testl	%eax, %eax
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L15:
	movq	0(%r13), %rdi
	addq	$8, %r13
	call	free@PLT
	cmpq	%r13, %r12
	jne	.L15
.L16:
	movq	%rbp, %rdi
	call	free@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%r14d, %r14d
	jle	.L18
	movslq	%r14d, %rcx
	leal	-1(%r13), %eax
	xorl	%edi, %edi
	xorl	%r9d, %r9d
	salq	$2, %rcx
	leaq	8(%rbp,%rax,8), %r8
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rbp, %rax
	xorl	%edx, %edx
	testl	%r13d, %r13d
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L11:
	movq	(%rax), %rsi
	addq	$8, %rax
	addl	(%rsi,%rdi), %edx
	cmpq	%rax, %r8
	jne	.L11
.L12:
	cmpl	%edx, %r9d
	cmovl	%edx, %r9d
	addq	$4, %rdi
	cmpq	%rdi, %rcx
	jne	.L10
	jmp	.L9
.L2:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:
```
```c
#include<stdio.h>
#include<stdlib.h>

int main(){
  int m,n,max=0,total=0,i,j,**array;

  while(1){
    scanf("%d %d",&m,&n);
    if(m==0 && n==0)break;

    array = malloc(n*sizeof(int *));
    for(i=0;i<n;i++){
      array[i] = malloc(m*sizeof(int));
    }

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        scanf("%d",&array[i][j]);
      }
    }
        for(j=0;j<m;j++){
      for(i=0;i<n;i++){
        total += array[i][j];
      }
      if(max <= total){
        max = total;
      }
      total = 0;
    }
    printf("%d\n",max);
    max=0;

    for(j=0;j<n;j++){
      free(array[j]);
    }
    free(array);
  }
  return 0;
}


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

```c
#include<stdio.h>
#include<stdlib.h>

int main(){
  int m,n,max=0,total=0,i,j,**array;

  while(1){
    scanf("%d %d",&m,&n);
    if(m==0 && n==0)break;

    array = malloc(n*sizeof(int *));
    for(i=0;i<n;i++){
      array[i] = malloc(m*sizeof(int));
    }

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        scanf("%d",&array[i][j]);
      }
    }
        for(j=0;j<m;j++){
      for(i=0;i<n;i++){
        total += array[i][j];
      }
      if(max <= total){
        max = total;
      }
      total = 0;
    }
    printf("%d\n",max);
    max=0;

    for(j=0;j<n;j++){
      free(array[j]);
    }
    free(array);
  }
  return 0;
}


```

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.
Optimized Assembly Code:

5 2
10 20 30 40 50
15 25 35 45 55
6 3
10 20 30 15 25 35
21 34 11 52 20 0
31 15 42 10 21 19
4 2
0 0 0 0
0 0 0 0
0 0
 5 2
10 20 30 40 50
15 25 35 85 55
6 3
10 20 30 15 25 35
21 34 11 52 20 0
31 15 42 10 21 10
4 2
0 0 0 0
0 0 0 0
0 0
 5 2
10 20 30 40 50
15 25 35 85 55
6 3
10 20 30 15 25 35
21 34 11 52 20 0
27 15 2 10 21 10
4 2
0 0 0 0
0 0 0 0
0 0
 5 2
10 20 30 40 50
15 25 35 85 55
6 3
10 20 30 15 25 35
21 34 11 28 20 0
27 15 2 10 21 10
4 2
0 0 0 0
0 0 0 0
0 0
 5 2
8 20 30 74 50
15 25 35 85 55
6 3
10 20 30 15 25 35
21 34 11 52 20 0
27 15 42 10 21 10
4 2
0 0 0 0
0 0 0 0
0 0
 5 2
10 22 30 40 50
15 25 35 45 55
6 3
10 20 16 13 25 35
21 34 11 52 20 18
31 15 42 10 21 19
4 2
0 0 0 0
0 0 0 0
0 0
 5 2
10 20 30 40 50
15 25 35 45 55
6 3
10 20 30 15 25 35
21 34 8 52 20 0
31 15 42 10 28 19
4 2
0 0 0 0
0 0 -1 0
0 0
 5 2
10 20 30 40 50
15 25 35 45 55
6 3
10 20 30 15 25 35
21 34 8 52 20 0
31 15 34 10 28 19
4 2
0 0 0 0
0 0 -1 0
0 0
 5 2
8 20 30 74 50
15 25 35 85 55
6 3
10 20 30 15 25 35
21 34 11 52 20 0
27 15 42 10 21 10
4 2
-1 0 0 0
0 1 0 0
0 0
 5 2
10 20 59 40 50
15 32 35 85 55
6 3
10 20 30 15 21 35
21 29 11 28 20 0
27 15 2 10 21 10
4 2
0 0 0 0
0 0 0 0
0 0

105
83
0
 125
83
0
 125
77
0
 125
69
0
 159
83
0
 105
75
0
 105
80
0
 105
77
0
 159
83
1
 125
64
0

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

```c
#include<stdio.h>
#include<stdlib.h>

int main(){
  int m,n,max=0,total=0,i,j,**array;

  while(1){
    scanf("%d %d",&m,&n);
    if(m==0 && n==0)break;

    array = malloc(n*sizeof(int *));
    for(i=0;i<n;i++){
      array[i] = malloc(m*sizeof(int));
    }

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        scanf("%d",&array[i][j]);
      }
    }
        for(j=0;j<m;j++){
      for(i=0;i<n;i++){
        total += array[i][j];
      }
      if(max <= total){
        max = total;
      }
      total = 0;
    }
    printf("%d\n",max);
    max=0;

    for(j=0;j<n;j++){
      free(array[j]);
    }
    free(array);
  }
  return 0;
}


```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	movl	20(%rsp), %r13d
	movl	%r14d, %eax
	orl	%r13d, %eax
	je	.L2
	movslq	%r13d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r13d, %r13d
	jle	.L3
	movslq	%r14d, %r12
	movl	%r13d, %r13d
	movq	%rax, %r15
	salq	$2, %r12
	leaq	(%rax,%r13,8), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rdi
	addq	$8, %r15
	call	malloc@PLT
	movq	%rax, -8(%r15)
	cmpq	%r13, %r15
	jne	.L4
	movl	$1, %r12d
	testl	%r14d, %r14d
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movq	-8(%rbp,%r12,8), %r15
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	addq	$4, %r15
	cmpl	%r13d, %r14d
	jg	.L6
	movl	20(%rsp), %r13d
	cmpl	%r12d, %r13d
	jle	.L3
	addq	$1, %r12
	testl	%r14d, %r14d
	jg	.L8
.L18:
	xorl	%r9d, %r9d
.L9:
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movq	%rbp, %r13
	movl	$1, %edi
	call	__printf_chk@PLT
	movl	20(%rsp), %eax
	leaq	0(%rbp,%rax,8), %r12
	testl	%eax, %eax
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L15:
	movq	0(%r13), %rdi
	addq	$8, %r13
	call	free@PLT
	cmpq	%r13, %r12
	jne	.L15
.L16:
	movq	%rbp, %rdi
	call	free@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%r14d, %r14d
	jle	.L18
	movslq	%r14d, %rcx
	leal	-1(%r13), %eax
	xorl	%edi, %edi
	xorl	%r9d, %r9d
	salq	$2, %rcx
	leaq	8(%rbp,%rax,8), %r8
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rbp, %rax
	xorl	%edx, %edx
	testl	%r13d, %r13d
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L11:
	movq	(%rax), %rsi
	addq	$8, %rax
	addl	(%rsi,%rdi), %edx
	cmpq	%rax, %r8
	jne	.L11
.L12:
	cmpl	%edx, %r9d
	cmovl	%edx, %r9d
	addq	$4, %rdi
	cmpq	%rdi, %rcx
	jne	.L10
	jmp	.L9
.L2:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	movl	20(%rsp), %r13d
	movl	%r14d, %eax
	orl	%r13d, %eax
	je	.L2
	movslq	%r13d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r13d, %r13d
	jle	.L3
	movslq	%r14d, %r12
	movl	%r13d, %r13d
	movq	%rax, %r15
	salq	$2, %r12
	leaq	(%rax,%r13,8), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rdi
	addq	$8, %r15
	call	malloc@PLT
	movq	%rax, -8(%r15)
	cmpq	%r13, %r15
	jne	.L4
	movl	$1, %r12d
	testl	%r14d, %r14d
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movq	-8(%rbp,%r12,8), %r15
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %r14d
	addq	$4, %r15
	cmpl	%r13d, %r14d
	jg	.L6
	movl	20(%rsp), %r13d
	cmpl	%r12d, %r13d
	jle	.L3
	addq	$1, %r12
	testl	%r14d, %r14d
	jg	.L8
.L18:
	xorl	%r9d, %r9d
.L9:
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movq	%rbp, %r13
	movl	$1, %edi
	call	__printf_chk@PLT
	movl	20(%rsp), %eax
	leaq	0(%rbp,%rax,8), %r12
	testl	%eax, %eax
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L15:
	movq	0(%r13), %rdi
	addq	$8, %r13
	call	free@PLT
	cmpq	%r13, %r12
	jne	.L15
.L16:
	movq	%rbp, %rdi
	call	free@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%r14d, %r14d
	jle	.L18
	movslq	%r14d, %rcx
	leal	-1(%r13), %eax
	xorl	%edi, %edi
	xorl	%r9d, %r9d
	salq	$2, %rcx
	leaq	8(%rbp,%rax,8), %r8
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rbp, %rax
	xorl	%edx, %edx
	testl	%r13d, %r13d
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L11:
	movq	(%rax), %rsi
	addq	$8, %rax
	addl	(%rsi,%rdi), %edx
	cmpq	%rax, %r8
	jne	.L11
.L12:
	cmpl	%edx, %r9d
	cmovl	%edx, %r9d
	addq	$4, %rdi
	cmpq	%rdi, %rcx
	jne	.L10
	jmp	.L9
.L2:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:
```