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 N,M,K;
  long long int *A,*B;
  int i,j;
  long long int input;
  int result;
  scanf("%d %d %d", &N, &M, &K);
  A = (long long int*)malloc(sizeof(long long int)*N+1);
  B = (long long int*)malloc(sizeof(long long int)*M+1);
  A[0] = 0;
  B[0] = 0;
  for ( i = 1; i <= N; i++ ) {
    scanf("%lld", &input);
    A[i] = A[i-1]+input;
  }
  for ( i = 1; i <= M; i++ ) {
    scanf("%lld", &input);
    B[i] = B[i-1]+input;
  }
  
  result = 0;
  /*
  for ( i = N; i >= 0; i-- ) {
    // printf("i = %d\n", i);
    for ( j = M; j >= 0; j-- ) {
      // printf("j = %d\n", j);
      if ( A[i] + B[j] <= K ) {
        result = result>(i+j)?result:(i+j);
        // printf("i = %d, j = %d, res = %d\n", i,j,result);
        break;
      }
    }
    if ( j == M ) {
      break;
    }
  }
  */
  for ( i = 0; i <= N; i++ ) {
    if ( i == 0 ) j = M;
    for ( ; j >= 0; j-- ) {
      if ( A[i] + B[j] <= K ) {
        result = result>(i+j)?result:(i+j);
        break;
      }
    }
  }
  
  printf("%d\n", result);

  free(A);
  free(B);
  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%rax, %r12
	movslq	8(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	call	malloc@PLT
	movq	$0, (%r12)
	movq	$0, (%rax)
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L2
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%r12,%rbx,8), %rax
	movq	%rax, (%r12,%rbx,8)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jge	.L3
.L2:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%rbp,%rbx,8), %rax
	movq	%rax, 0(%rbp,%rbx,8)
	movl	8(%rsp), %eax
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jge	.L5
.L4:
	movl	4(%rsp), %r11d
	testl	%r11d, %r11d
	js	.L13
	movslq	12(%rsp), %rdi
	movq	%r12, %r9
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	testl	%eax, %eax
	js	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movslq	%eax, %rdx
	movq	(%r9), %rsi
	leaq	0(%rbp,%rdx,8), %rdx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	subl	$1, %eax
	subq	$8, %rdx
	cmpl	$-1, %eax
	je	.L8
.L9:
	movq	(%rdx), %rcx
	addq	%rsi, %rcx
	cmpq	%rdi, %rcx
	jg	.L7
	leal	(%r8,%rax), %edx
	cmpl	%edx, %r10d
	cmovl	%edx, %r10d
.L8:
	addl	$1, %r8d
	cmpl	%r8d, %r11d
	jl	.L6
	addq	$8, %r9
	testl	%eax, %eax
	jns	.L20
.L6:
	movl	%r10d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L6
.L21:
	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 %d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%rax, %r12
	movslq	8(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	call	malloc@PLT
	movq	$0, (%r12)
	movq	$0, (%rax)
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L2
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%r12,%rbx,8), %rax
	movq	%rax, (%r12,%rbx,8)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jge	.L3
.L2:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%rbp,%rbx,8), %rax
	movq	%rax, 0(%rbp,%rbx,8)
	movl	8(%rsp), %eax
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jge	.L5
.L4:
	movl	4(%rsp), %r11d
	testl	%r11d, %r11d
	js	.L13
	movslq	12(%rsp), %rdi
	movq	%r12, %r9
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	testl	%eax, %eax
	js	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movslq	%eax, %rdx
	movq	(%r9), %rsi
	leaq	0(%rbp,%rdx,8), %rdx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	subl	$1, %eax
	subq	$8, %rdx
	cmpl	$-1, %eax
	je	.L8
.L9:
	movq	(%rdx), %rcx
	addq	%rsi, %rcx
	cmpq	%rdi, %rcx
	jg	.L7
	leal	(%r8,%rax), %edx
	cmpl	%edx, %r10d
	cmovl	%edx, %r10d
.L8:
	addl	$1, %r8d
	cmpl	%r8d, %r11d
	jl	.L6
	addq	$8, %r9
	testl	%eax, %eax
	jns	.L20
.L6:
	movl	%r10d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L6
.L21:
	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 %d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%rax, %r12
	movslq	8(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	call	malloc@PLT
	movq	$0, (%r12)
	movq	$0, (%rax)
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L2
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%r12,%rbx,8), %rax
	movq	%rax, (%r12,%rbx,8)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jge	.L3
.L2:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%rbp,%rbx,8), %rax
	movq	%rax, 0(%rbp,%rbx,8)
	movl	8(%rsp), %eax
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jge	.L5
.L4:
	movl	4(%rsp), %r11d
	testl	%r11d, %r11d
	js	.L13
	movslq	12(%rsp), %rdi
	movq	%r12, %r9
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	testl	%eax, %eax
	js	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movslq	%eax, %rdx
	movq	(%r9), %rsi
	leaq	0(%rbp,%rdx,8), %rdx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	subl	$1, %eax
	subq	$8, %rdx
	cmpl	$-1, %eax
	je	.L8
.L9:
	movq	(%rdx), %rcx
	addq	%rsi, %rcx
	cmpq	%rdi, %rcx
	jg	.L7
	leal	(%r8,%rax), %edx
	cmpl	%edx, %r10d
	cmovl	%edx, %r10d
.L8:
	addl	$1, %r8d
	cmpl	%r8d, %r11d
	jl	.L6
	addq	$8, %r9
	testl	%eax, %eax
	jns	.L20
.L6:
	movl	%r10d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L6
.L21:
	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 N,M,K;
  long long int *A,*B;
  int i,j;
  long long int input;
  int result;
  scanf("%d %d %d", &N, &M, &K);
  A = (long long int*)malloc(sizeof(long long int)*N+1);
  B = (long long int*)malloc(sizeof(long long int)*M+1);
  A[0] = 0;
  B[0] = 0;
  for ( i = 1; i <= N; i++ ) {
    scanf("%lld", &input);
    A[i] = A[i-1]+input;
  }
  for ( i = 1; i <= M; i++ ) {
    scanf("%lld", &input);
    B[i] = B[i-1]+input;
  }
  
  result = 0;
  /*
  for ( i = N; i >= 0; i-- ) {
    // printf("i = %d\n", i);
    for ( j = M; j >= 0; j-- ) {
      // printf("j = %d\n", j);
      if ( A[i] + B[j] <= K ) {
        result = result>(i+j)?result:(i+j);
        // printf("i = %d, j = %d, res = %d\n", i,j,result);
        break;
      }
    }
    if ( j == M ) {
      break;
    }
  }
  */
  for ( i = 0; i <= N; i++ ) {
    if ( i == 0 ) j = M;
    for ( ; j >= 0; j-- ) {
      if ( A[i] + B[j] <= K ) {
        result = result>(i+j)?result:(i+j);
        break;
      }
    }
  }
  
  printf("%d\n", result);

  free(A);
  free(B);
  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 N,M,K;
  long long int *A,*B;
  int i,j;
  long long int input;
  int result;
  scanf("%d %d %d", &N, &M, &K);
  A = (long long int*)malloc(sizeof(long long int)*N+1);
  B = (long long int*)malloc(sizeof(long long int)*M+1);
  A[0] = 0;
  B[0] = 0;
  for ( i = 1; i <= N; i++ ) {
    scanf("%lld", &input);
    A[i] = A[i-1]+input;
  }
  for ( i = 1; i <= M; i++ ) {
    scanf("%lld", &input);
    B[i] = B[i-1]+input;
  }
  
  result = 0;
  /*
  for ( i = N; i >= 0; i-- ) {
    // printf("i = %d\n", i);
    for ( j = M; j >= 0; j-- ) {
      // printf("j = %d\n", j);
      if ( A[i] + B[j] <= K ) {
        result = result>(i+j)?result:(i+j);
        // printf("i = %d, j = %d, res = %d\n", i,j,result);
        break;
      }
    }
    if ( j == M ) {
      break;
    }
  }
  */
  for ( i = 0; i <= N; i++ ) {
    if ( i == 0 ) j = M;
    for ( ; j >= 0; j-- ) {
      if ( A[i] + B[j] <= K ) {
        result = result>(i+j)?result:(i+j);
        break;
      }
    }
  }
  
  printf("%d\n", result);

  free(A);
  free(B);
  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 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000010 1000000000
 3 4 194
60 90 120
80 150 80 150
 3 4 730
60 9 120
80 150 80 150
 3 4 194
60 90 120
80 34 80 150
 3 4 376
60 9 120
80 150 80 150
 3 4 449
60 9 120
80 150 80 150
 3 3 100
96 16 120
30 94 80 150
 3 4 730
60 90 120
85 150 80 150
 3 4 194
60 90 120
80 35 80 150
 3 4 100
60 9 120
80 150 80 150

0
 2
 7
 3
 4
 5
 1
 6
 3
 2

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 N,M,K;
  long long int *A,*B;
  int i,j;
  long long int input;
  int result;
  scanf("%d %d %d", &N, &M, &K);
  A = (long long int*)malloc(sizeof(long long int)*N+1);
  B = (long long int*)malloc(sizeof(long long int)*M+1);
  A[0] = 0;
  B[0] = 0;
  for ( i = 1; i <= N; i++ ) {
    scanf("%lld", &input);
    A[i] = A[i-1]+input;
  }
  for ( i = 1; i <= M; i++ ) {
    scanf("%lld", &input);
    B[i] = B[i-1]+input;
  }
  
  result = 0;
  /*
  for ( i = N; i >= 0; i-- ) {
    // printf("i = %d\n", i);
    for ( j = M; j >= 0; j-- ) {
      // printf("j = %d\n", j);
      if ( A[i] + B[j] <= K ) {
        result = result>(i+j)?result:(i+j);
        // printf("i = %d, j = %d, res = %d\n", i,j,result);
        break;
      }
    }
    if ( j == M ) {
      break;
    }
  }
  */
  for ( i = 0; i <= N; i++ ) {
    if ( i == 0 ) j = M;
    for ( ; j >= 0; j-- ) {
      if ( A[i] + B[j] <= K ) {
        result = result>(i+j)?result:(i+j);
        break;
      }
    }
  }
  
  printf("%d\n", result);

  free(A);
  free(B);
  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%rax, %r12
	movslq	8(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	call	malloc@PLT
	movq	$0, (%r12)
	movq	$0, (%rax)
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L2
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%r12,%rbx,8), %rax
	movq	%rax, (%r12,%rbx,8)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jge	.L3
.L2:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%rbp,%rbx,8), %rax
	movq	%rax, 0(%rbp,%rbx,8)
	movl	8(%rsp), %eax
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jge	.L5
.L4:
	movl	4(%rsp), %r11d
	testl	%r11d, %r11d
	js	.L13
	movslq	12(%rsp), %rdi
	movq	%r12, %r9
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	testl	%eax, %eax
	js	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movslq	%eax, %rdx
	movq	(%r9), %rsi
	leaq	0(%rbp,%rdx,8), %rdx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	subl	$1, %eax
	subq	$8, %rdx
	cmpl	$-1, %eax
	je	.L8
.L9:
	movq	(%rdx), %rcx
	addq	%rsi, %rcx
	cmpq	%rdi, %rcx
	jg	.L7
	leal	(%r8,%rax), %edx
	cmpl	%edx, %r10d
	cmovl	%edx, %r10d
.L8:
	addl	$1, %r8d
	cmpl	%r8d, %r11d
	jl	.L6
	addq	$8, %r9
	testl	%eax, %eax
	jns	.L20
.L6:
	movl	%r10d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L6
.L21:
	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 %d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	movq	%rax, %rbx
	call	malloc@PLT
	movq	%rax, %r12
	movslq	8(%rsp), %rax
	leaq	1(,%rax,8), %rdi
	call	malloc@PLT
	movq	$0, (%r12)
	movq	$0, (%rax)
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L2
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%r12,%rbx,8), %rax
	movq	%rax, (%r12,%rbx,8)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jge	.L3
.L2:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	movl	$1, %ebx
	leaq	16(%rsp), %r14
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rax
	addq	-8(%rbp,%rbx,8), %rax
	movq	%rax, 0(%rbp,%rbx,8)
	movl	8(%rsp), %eax
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jge	.L5
.L4:
	movl	4(%rsp), %r11d
	testl	%r11d, %r11d
	js	.L13
	movslq	12(%rsp), %rdi
	movq	%r12, %r9
	xorl	%r10d, %r10d
	xorl	%r8d, %r8d
	testl	%eax, %eax
	js	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movslq	%eax, %rdx
	movq	(%r9), %rsi
	leaq	0(%rbp,%rdx,8), %rdx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	subl	$1, %eax
	subq	$8, %rdx
	cmpl	$-1, %eax
	je	.L8
.L9:
	movq	(%rdx), %rcx
	addq	%rsi, %rcx
	cmpq	%rdi, %rcx
	jg	.L7
	leal	(%r8,%rax), %edx
	cmpl	%edx, %r10d
	cmovl	%edx, %r10d
.L8:
	addl	$1, %r8d
	cmpl	%r8d, %r11d
	jl	.L6
	addq	$8, %r9
	testl	%eax, %eax
	jns	.L20
.L6:
	movl	%r10d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L6
.L21:
	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:
```