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>
#include <string.h>
#include <math.h>

void show(int **L,int N,int *ln){
	for(int i=0;i<N;i++){
		for(int j=0;j<ln[i];j++){
			printf("%d ",L[i][j]);
		}printf("\n");
	}printf("\n");
}

void calc(int N,int M,int *lane,int *number){
	int **list;
	int *lane_number;
	int min;

	list=(int**)malloc(N*sizeof(int*));
	lane_number=(int*)malloc(N*sizeof(int));
	for(int i=0;i<N;i++){
		lane_number[i]=0;
		list[i]=(int*)malloc(M*sizeof(int));
		for(int j=0;j<M;j++){
			list[i][j]=-1;
		}
	}

	for(int i=0;i<M;i++){
		switch(lane[i]){
		case 0:
			printf("%d\n",list[number[i]-1][0]);
			for(int j=0;j<lane_number[number[i]-1];j++){
				list[number[i]-1][j]=list[number[i]-1][j+1];
			}
			lane_number[number[i]-1]--;
			break;
		case 1:
			min=0;
			for(int j=1;j<N;j++){
				if(lane_number[min] > lane_number[j]){
					min=j;
				}
			}
			list[min][lane_number[min]]=number[i];
			lane_number[min]++;
			break;
		}
	}
}

int main(void){
	int N,M;
	int *lane,*number;

	scanf("%d %d",&N,&M);
	lane=(int*)malloc(M*sizeof(int));
	number=(int*)malloc(M*sizeof(int));
	for(int i=0;i<M;i++){
		scanf("%d %d",&lane[i],&number[i]);
	}

	calc(N,M,lane,number);

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d "
	.text
	.globl	show
	.type	show, @function
show:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L2
.L5:
	movl	$0, -4(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L4
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	$10, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	show, .-show
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 3, -24
	movl	%edi, -68(%rbp)
	movl	%esi, -72(%rbp)
	movq	%rdx, -80(%rbp)
	movq	%rcx, -88(%rbp)
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L7
.L10:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-72(%rbp), %eax
	cltq
	salq	$2, %rax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movl	$0, -48(%rbp)
	jmp	.L8
.L9:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -48(%rbp)
.L8:
	movl	-48(%rbp), %eax
	cmpl	-72(%rbp), %eax
	jl	.L9
	addl	$1, -52(%rbp)
.L7:
	movl	-52(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jl	.L10
	movl	$0, -44(%rbp)
	jmp	.L11
.L20:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L12
	cmpl	$1, %eax
	je	.L13
	jmp	.L14
.L12:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -40(%rbp)
	jmp	.L15
.L16:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-88(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	leaq	-8(%rdx), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -40(%rbp)
.L15:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L16
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	jmp	.L14
.L13:
	movl	$0, -56(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L17
.L19:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	-36(%rbp), %eax
	movl	%eax, -56(%rbp)
.L18:
	addl	$1, -36(%rbp)
.L17:
	movl	-36(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jl	.L19
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	nop
.L14:
	addl	$1, -44(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	-72(%rbp), %eax
	jl	.L20
	nop
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	calc, .-calc
	.section	.rodata
.LC2:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L22
.L23:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L22:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L23
	movl	-32(%rbp), %esi
	movl	-36(%rbp), %eax
	movq	-16(%rbp), %rcx
	movq	-24(%rbp), %rdx
	movl	%eax, %edi
	call	calc
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d "
	.text
	.p2align 4
	.globl	show
	.type	show, @function
show:
.LFB51:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L10
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leal	-1(%rsi), %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	4(%rdx,%rax,4), %r14
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	.p2align 4,,10
	.p2align 3
.L3:
	movl	0(%rbp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	(%r12), %rax
	movq	%r13, %rsi
	movl	$1, %edi
	movl	(%rax,%rbx,4), %edx
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 0(%rbp)
	jg	.L4
.L5:
	movl	$10, %edi
	addq	$4, %rbp
	addq	$8, %r12
	call	putchar@PLT
	cmpq	%r14, %rbp
	jne	.L3
	popq	%rbx
	.cfi_restore 3
	.cfi_def_cfa_offset 40
	movl	$10, %edi
	popq	%rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_restore 12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_restore 13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_restore 14
	.cfi_def_cfa_offset 8
	jmp	putchar@PLT
.L10:
	movl	$10, %edi
	jmp	putchar@PLT
	.cfi_endproc
.LFE51:
	.size	show, .-show
	.section	.rodata.str1.1
.LC1:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB52:
	.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
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movslq	%edi, %rbx
	leaq	0(,%rbx,8), %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdx, 32(%rsp)
	movq	%rcx, 40(%rsp)
	movl	%ebx, 28(%rsp)
	call	malloc@PLT
	leaq	0(,%rbx,4), %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rax, %r13
	testl	%ebx, %ebx
	jle	.L20
	leal	-1(%r12), %eax
	movl	%r12d, %esi
	movslq	%r12d, %r14
	xorl	%r15d, %r15d
	movl	%eax, 24(%rsp)
	movl	%r12d, %eax
	andl	$-4, %esi
	salq	$2, %r14
	shrl	$2, %eax
	movl	%esi, 8(%rsp)
	subl	$1, %eax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, 16(%rsp)
	movl	%r12d, %eax
	movq	%r15, %r12
	movq	%r14, %r15
	movl	%eax, %r14d
	.p2align 4,,10
	.p2align 3
.L19:
	movl	$0, 0(%r13,%r12,4)
	movq	%r15, %rdi
	call	malloc@PLT
	testl	%r14d, %r14d
	pcmpeqd	%xmm0, %xmm0
	movq	%rax, 0(%rbp,%r12,8)
	movq	%rax, %rdx
	jle	.L24
	cmpl	$2, 24(%rsp)
	jbe	.L35
	movq	16(%rsp), %rsi
	leaq	(%rsi,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L22:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rax, %rcx
	jne	.L22
	movl	8(%rsp), %eax
	cmpl	%r14d, %eax
	je	.L24
.L21:
	movslq	%eax, %rcx
	movl	$-1, (%rdx,%rcx,4)
	leaq	0(,%rcx,4), %rdi
	leal	1(%rax), %ecx
	cmpl	%ecx, %r14d
	jle	.L24
	addl	$2, %eax
	movl	$-1, 4(%rdx,%rdi)
	cmpl	%r14d, %eax
	jge	.L24
	movl	$-1, 8(%rdx,%rdi)
.L24:
	addq	$1, %r12
	cmpq	%r12, %rbx
	jne	.L19
	movl	%r14d, %r12d
.L20:
	testl	%r12d, %r12d
	jle	.L14
	movq	32(%rsp), %r14
	leal	-1(%r12), %eax
	movq	40(%rsp), %r15
	leaq	4(%r14,%rax,4), %r12
	movq	%rbx, %rax
	movq	%r13, %rbx
	movq	%rax, %r13
	.p2align 4,,10
	.p2align 3
.L34:
	movl	(%r14), %eax
	testl	%eax, %eax
	je	.L26
	cmpl	$1, %eax
	jne	.L27
	xorl	%r9d, %r9d
	cmpl	$1, 28(%rsp)
	movl	(%rbx), %esi
	leaq	4(%rbx), %rdx
	movl	$1, %eax
	jg	.L33
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L45:
	movslq	%r9d, %rcx
	addq	$1, %rax
	addq	$4, %rdx
	leaq	(%rbx,%rcx,4), %rdi
	cmpq	%r13, %rax
	je	.L44
.L33:
	movl	(%rdx), %ecx
	movq	%rdx, %rdi
	cmpl	%ecx, %esi
	jle	.L45
	movl	%ecx, %esi
	movl	%eax, %r9d
	movq	%rax, %rcx
	addq	$1, %rax
	addq	$4, %rdx
	cmpq	%r13, %rax
	jne	.L33
.L44:
	leaq	0(%rbp,%rcx,8), %rax
.L29:
	movq	(%rax), %rax
	movl	(%r15), %ecx
	movslq	%esi, %rdx
	addl	$1, %esi
	movl	%esi, (%rdi)
	movl	%ecx, (%rax,%rdx,4)
.L27:
	addq	$4, %r14
	addq	$4, %r15
	cmpq	%r14, %r12
	jne	.L34
.L14:
	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
.L26:
	.cfi_restore_state
	movslq	(%r15), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movq	-8(%rbp,%rax,8), %rax
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movslq	(%r15), %rax
	leaq	-4(%rbx,%rax,4), %r9
	movl	(%r9), %ecx
	testl	%ecx, %ecx
	jle	.L31
	movq	-8(%rbp,%rax,8), %rdi
	movslq	%ecx, %rdx
	movq	%r9, 8(%rsp)
	salq	$2, %rdx
	movl	%ecx, 24(%rsp)
	leaq	4(%rdi), %rsi
	call	memmove@PLT
	movl	24(%rsp), %ecx
	movq	8(%rsp), %r9
.L31:
	subl	$1, %ecx
	addq	$4, %r14
	addq	$4, %r15
	movl	%ecx, (%r9)
	cmpq	%r14, %r12
	jne	.L34
	jmp	.L14
.L35:
	xorl	%eax, %eax
	jmp	.L21
.L43:
	movq	%rbx, %rdi
	movq	%rbp, %rax
	jmp	.L29
	.cfi_endproc
.LFE52:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC2:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.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
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	leaq	20(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rbp
	movl	%ebp, 12(%rsp)
	salq	$2, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movl	12(%rsp), %esi
	movq	%rax, %r15
	testl	%esi, %esi
	jle	.L47
	movq	%r14, %r12
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L48:
	movq	%r12, %rsi
	movq	%rbp, %rdx
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %esi
	addl	$1, %ebx
	addq	$4, %r12
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L48
.L47:
	movl	16(%rsp), %edi
	movq	%r15, %rcx
	movq	%r14, %rdx
	call	calc
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L52
	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
.L52:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d "
	.text
	.p2align 4
	.globl	show
	.type	show, @function
show:
.LFB51:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L10
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leal	-1(%rsi), %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	4(%rdx,%rax,4), %r14
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	.p2align 4,,10
	.p2align 3
.L3:
	movl	0(%rbp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	(%r12), %rax
	movq	%r13, %rsi
	movl	$1, %edi
	movl	(%rax,%rbx,4), %edx
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 0(%rbp)
	jg	.L4
.L5:
	movl	$10, %edi
	addq	$4, %rbp
	addq	$8, %r12
	call	putchar@PLT
	cmpq	%r14, %rbp
	jne	.L3
	popq	%rbx
	.cfi_restore 3
	.cfi_def_cfa_offset 40
	movl	$10, %edi
	popq	%rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_restore 12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_restore 13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_restore 14
	.cfi_def_cfa_offset 8
	jmp	putchar@PLT
.L10:
	movl	$10, %edi
	jmp	putchar@PLT
	.cfi_endproc
.LFE51:
	.size	show, .-show
	.section	.rodata.str1.1
.LC1:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB52:
	.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
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movslq	%edi, %rbx
	leaq	0(,%rbx,8), %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%rdx, 32(%rsp)
	movq	%rcx, 40(%rsp)
	movl	%ebx, 28(%rsp)
	call	malloc@PLT
	leaq	0(,%rbx,4), %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rax, %r13
	testl	%ebx, %ebx
	jle	.L20
	leal	-1(%r12), %eax
	movl	%r12d, %esi
	movslq	%r12d, %r14
	xorl	%r15d, %r15d
	movl	%eax, 24(%rsp)
	movl	%r12d, %eax
	andl	$-4, %esi
	salq	$2, %r14
	shrl	$2, %eax
	movl	%esi, 8(%rsp)
	subl	$1, %eax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, 16(%rsp)
	movl	%r12d, %eax
	movq	%r15, %r12
	movq	%r14, %r15
	movl	%eax, %r14d
	.p2align 4,,10
	.p2align 3
.L19:
	movl	$0, 0(%r13,%r12,4)
	movq	%r15, %rdi
	call	malloc@PLT
	testl	%r14d, %r14d
	pcmpeqd	%xmm0, %xmm0
	movq	%rax, 0(%rbp,%r12,8)
	movq	%rax, %rdx
	jle	.L24
	cmpl	$2, 24(%rsp)
	jbe	.L35
	movq	16(%rsp), %rsi
	leaq	(%rsi,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L22:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rax, %rcx
	jne	.L22
	movl	8(%rsp), %eax
	cmpl	%r14d, %eax
	je	.L24
.L21:
	movslq	%eax, %rcx
	movl	$-1, (%rdx,%rcx,4)
	leaq	0(,%rcx,4), %rdi
	leal	1(%rax), %ecx
	cmpl	%ecx, %r14d
	jle	.L24
	addl	$2, %eax
	movl	$-1, 4(%rdx,%rdi)
	cmpl	%r14d, %eax
	jge	.L24
	movl	$-1, 8(%rdx,%rdi)
.L24:
	addq	$1, %r12
	cmpq	%r12, %rbx
	jne	.L19
	movl	%r14d, %r12d
.L20:
	testl	%r12d, %r12d
	jle	.L14
	movq	32(%rsp), %r14
	leal	-1(%r12), %eax
	movq	40(%rsp), %r15
	leaq	4(%r14,%rax,4), %r12
	movq	%rbx, %rax
	movq	%r13, %rbx
	movq	%rax, %r13
	.p2align 4,,10
	.p2align 3
.L34:
	movl	(%r14), %eax
	testl	%eax, %eax
	je	.L26
	cmpl	$1, %eax
	jne	.L27
	xorl	%r9d, %r9d
	cmpl	$1, 28(%rsp)
	movl	(%rbx), %esi
	leaq	4(%rbx), %rdx
	movl	$1, %eax
	jg	.L33
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L45:
	movslq	%r9d, %rcx
	addq	$1, %rax
	addq	$4, %rdx
	leaq	(%rbx,%rcx,4), %rdi
	cmpq	%r13, %rax
	je	.L44
.L33:
	movl	(%rdx), %ecx
	movq	%rdx, %rdi
	cmpl	%ecx, %esi
	jle	.L45
	movl	%ecx, %esi
	movl	%eax, %r9d
	movq	%rax, %rcx
	addq	$1, %rax
	addq	$4, %rdx
	cmpq	%r13, %rax
	jne	.L33
.L44:
	leaq	0(%rbp,%rcx,8), %rax
.L29:
	movq	(%rax), %rax
	movl	(%r15), %ecx
	movslq	%esi, %rdx
	addl	$1, %esi
	movl	%esi, (%rdi)
	movl	%ecx, (%rax,%rdx,4)
.L27:
	addq	$4, %r14
	addq	$4, %r15
	cmpq	%r14, %r12
	jne	.L34
.L14:
	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
.L26:
	.cfi_restore_state
	movslq	(%r15), %rax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movq	-8(%rbp,%rax,8), %rax
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movslq	(%r15), %rax
	leaq	-4(%rbx,%rax,4), %r9
	movl	(%r9), %ecx
	testl	%ecx, %ecx
	jle	.L31
	movq	-8(%rbp,%rax,8), %rdi
	movslq	%ecx, %rdx
	movq	%r9, 8(%rsp)
	salq	$2, %rdx
	movl	%ecx, 24(%rsp)
	leaq	4(%rdi), %rsi
	call	memmove@PLT
	movl	24(%rsp), %ecx
	movq	8(%rsp), %r9
.L31:
	subl	$1, %ecx
	addq	$4, %r14
	addq	$4, %r15
	movl	%ecx, (%r9)
	cmpq	%r14, %r12
	jne	.L34
	jmp	.L14
.L35:
	xorl	%eax, %eax
	jmp	.L21
.L43:
	movq	%rbx, %rdi
	movq	%rbp, %rax
	jmp	.L29
	.cfi_endproc
.LFE52:
	.size	calc, .-calc
	.section	.rodata.str1.1
.LC2:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.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
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	leaq	20(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rbp
	movl	%ebp, 12(%rsp)
	salq	$2, %rbp
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movl	12(%rsp), %esi
	movq	%rax, %r15
	testl	%esi, %esi
	jle	.L47
	movq	%r14, %r12
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L48:
	movq	%r12, %rsi
	movq	%rbp, %rdx
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %esi
	addl	$1, %ebx
	addq	$4, %r12
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L48
.L47:
	movl	16(%rsp), %edi
	movq	%r15, %rcx
	movq	%r14, %rdx
	call	calc
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L52
	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
.L52:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.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>
#include <string.h>
#include <math.h>

void show(int **L,int N,int *ln){
	for(int i=0;i<N;i++){
		for(int j=0;j<ln[i];j++){
			printf("%d ",L[i][j]);
		}printf("\n");
	}printf("\n");
}

void calc(int N,int M,int *lane,int *number){
	int **list;
	int *lane_number;
	int min;

	list=(int**)malloc(N*sizeof(int*));
	lane_number=(int*)malloc(N*sizeof(int));
	for(int i=0;i<N;i++){
		lane_number[i]=0;
		list[i]=(int*)malloc(M*sizeof(int));
		for(int j=0;j<M;j++){
			list[i][j]=-1;
		}
	}

	for(int i=0;i<M;i++){
		switch(lane[i]){
		case 0:
			printf("%d\n",list[number[i]-1][0]);
			for(int j=0;j<lane_number[number[i]-1];j++){
				list[number[i]-1][j]=list[number[i]-1][j+1];
			}
			lane_number[number[i]-1]--;
			break;
		case 1:
			min=0;
			for(int j=1;j<N;j++){
				if(lane_number[min] > lane_number[j]){
					min=j;
				}
			}
			list[min][lane_number[min]]=number[i];
			lane_number[min]++;
			break;
		}
	}
}

int main(void){
	int N,M;
	int *lane,*number;

	scanf("%d %d",&N,&M);
	lane=(int*)malloc(M*sizeof(int));
	number=(int*)malloc(M*sizeof(int));
	for(int i=0;i<M;i++){
		scanf("%d %d",&lane[i],&number[i]);
	}

	calc(N,M,lane,number);

    return 0;
}

2 7
1 999
1 1000
0 2
1 1001
1 1002
0 1
1 1
 2 7
1 999
1 1000
0 2
1 1001
1 1002
0 2
1 1
 2 7
1 999
1 1000
0 2
1 1001
1 1002
1 2
1 1
 2 7
1 999
1 1000
0 2
1 1000
1 1002
0 1
0 1
 2 7
1 999
1 1001
0 2
1 1001
1 1002
1 2
1 1
 4 7
1 999
1 1000
0 2
1 0000
1 1002
0 1
0 1
 2 7
1 999
1 1001
0 1
1 1001
1 1002
1 2
1 1
 2 7
1 999
1 1000
0 2
1 1000
1 1953
0 1
0 1
 2 7
1 999
1 0001
0 2
1 1001
1 1002
1 2
1 1
 6 7
1 999
1 1010
0 2
1 0000
1 1002
0 1
0 1

1000
999
 1000
1001
 1000
 1000
999
1002
 1001
 1000
999
-1
 999
 1000
999
1953
 1
 1010
999
-1

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>
#include <string.h>
#include <math.h>

void show(int **L,int N,int *ln){
	for(int i=0;i<N;i++){
		for(int j=0;j<ln[i];j++){
			printf("%d ",L[i][j]);
		}printf("\n");
	}printf("\n");
}

void calc(int N,int M,int *lane,int *number){
	int **list;
	int *lane_number;
	int min;

	list=(int**)malloc(N*sizeof(int*));
	lane_number=(int*)malloc(N*sizeof(int));
	for(int i=0;i<N;i++){
		lane_number[i]=0;
		list[i]=(int*)malloc(M*sizeof(int));
		for(int j=0;j<M;j++){
			list[i][j]=-1;
		}
	}

	for(int i=0;i<M;i++){
		switch(lane[i]){
		case 0:
			printf("%d\n",list[number[i]-1][0]);
			for(int j=0;j<lane_number[number[i]-1];j++){
				list[number[i]-1][j]=list[number[i]-1][j+1];
			}
			lane_number[number[i]-1]--;
			break;
		case 1:
			min=0;
			for(int j=1;j<N;j++){
				if(lane_number[min] > lane_number[j]){
					min=j;
				}
			}
			list[min][lane_number[min]]=number[i];
			lane_number[min]++;
			break;
		}
	}
}

int main(void){
	int N,M;
	int *lane,*number;

	scanf("%d %d",&N,&M);
	lane=(int*)malloc(M*sizeof(int));
	number=(int*)malloc(M*sizeof(int));
	for(int i=0;i<M;i++){
		scanf("%d %d",&lane[i],&number[i]);
	}

	calc(N,M,lane,number);

    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d "
	.text
	.globl	show
	.type	show, @function
show:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L2
.L5:
	movl	$0, -4(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L4
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	$10, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	show, .-show
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 3, -24
	movl	%edi, -68(%rbp)
	movl	%esi, -72(%rbp)
	movq	%rdx, -80(%rbp)
	movq	%rcx, -88(%rbp)
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L7
.L10:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-72(%rbp), %eax
	cltq
	salq	$2, %rax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movl	$0, -48(%rbp)
	jmp	.L8
.L9:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -48(%rbp)
.L8:
	movl	-48(%rbp), %eax
	cmpl	-72(%rbp), %eax
	jl	.L9
	addl	$1, -52(%rbp)
.L7:
	movl	-52(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jl	.L10
	movl	$0, -44(%rbp)
	jmp	.L11
.L20:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L12
	cmpl	$1, %eax
	je	.L13
	jmp	.L14
.L12:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -40(%rbp)
	jmp	.L15
.L16:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-88(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	leaq	-8(%rdx), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -40(%rbp)
.L15:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L16
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	jmp	.L14
.L13:
	movl	$0, -56(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L17
.L19:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	-36(%rbp), %eax
	movl	%eax, -56(%rbp)
.L18:
	addl	$1, -36(%rbp)
.L17:
	movl	-36(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jl	.L19
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	nop
.L14:
	addl	$1, -44(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	-72(%rbp), %eax
	jl	.L20
	nop
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	calc, .-calc
	.section	.rodata
.LC2:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L22
.L23:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L22:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L23
	movl	-32(%rbp), %esi
	movl	-36(%rbp), %eax
	movq	-16(%rbp), %rcx
	movq	-24(%rbp), %rdx
	movl	%eax, %edi
	call	calc
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.section	.rodata
.LC0:
	.string	"%d "
	.text
	.globl	show
	.type	show, @function
show:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L2
.L5:
	movl	$0, -4(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L4
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L5
	movl	$10, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	show, .-show
	.section	.rodata
.LC1:
	.string	"%d\n"
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 3, -24
	movl	%edi, -68(%rbp)
	movl	%esi, -72(%rbp)
	movq	%rdx, -80(%rbp)
	movq	%rcx, -88(%rbp)
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L7
.L10:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-72(%rbp), %eax
	cltq
	salq	$2, %rax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movl	$0, -48(%rbp)
	jmp	.L8
.L9:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -48(%rbp)
.L8:
	movl	-48(%rbp), %eax
	cmpl	-72(%rbp), %eax
	jl	.L9
	addl	$1, -52(%rbp)
.L7:
	movl	-52(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jl	.L10
	movl	$0, -44(%rbp)
	jmp	.L11
.L20:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L12
	cmpl	$1, %eax
	je	.L13
	jmp	.L14
.L12:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -40(%rbp)
	jmp	.L15
.L16:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-88(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	leaq	-8(%rdx), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -40(%rbp)
.L15:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L16
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	jmp	.L14
.L13:
	movl	$0, -56(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L17
.L19:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	-36(%rbp), %eax
	movl	%eax, -56(%rbp)
.L18:
	addl	$1, -36(%rbp)
.L17:
	movl	-36(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jl	.L19
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	movq	-24(%rbp), %rdx
	addq	%rsi, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	nop
.L14:
	addl	$1, -44(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	-72(%rbp), %eax
	jl	.L20
	nop
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	calc, .-calc
	.section	.rodata
.LC2:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L22
.L23:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L22:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L23
	movl	-32(%rbp), %esi
	movl	-36(%rbp), %eax
	movq	-16(%rbp), %rcx
	movq	-24(%rbp), %rdx
	movl	%eax, %edi
	call	calc
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
