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

#define TRUE 1
#define FALSE 0

void shift_num(int *num) {
	int i = 0;
	while (*(num + i) != -1) {
		*(num + i) = *(num + i + 1);
		i++;
	}
}

int main(void) {
	int n, sw;
	int *num, *answer;
	scanf("%d", &n);
	num = (int *)malloc(sizeof(int)*(n+1));
	answer = (int *)malloc(sizeof(int)*n);
	for (int i = 0; i < n; i++) {
		scanf("%d", num + i);
	}
	num[n] = -1;
	for (int i = 0; i < n; i++) {
		sw = FALSE;
		for (int j = n - 1 - i; j >= 0; j--) {
			if (num[j] == j + 1) {
				answer[i] = j + 1;
				shift_num(num + j);
				sw = TRUE;
				break;
			}
		}
		if (sw == FALSE) {
			break;
		}
	}
	if (sw == TRUE) {
		for (int i = n - 1; i >= 0; i--) {
			printf("%d\n", answer[i]);
		}
	}
	else if (sw == FALSE) {
		printf("%d\n", -1);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	shift_num
	.type	shift_num, @function
shift_num:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	shift_num, .-shift_num
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-48(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L5
.L6:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L5:
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L6
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	$0, -36(%rbp)
	jmp	.L7
.L14:
	movl	$0, -44(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	subl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L8
.L11:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	jne	.L9
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	shift_num
	movl	$1, -44(%rbp)
	jmp	.L10
.L9:
	subl	$1, -32(%rbp)
.L8:
	cmpl	$0, -32(%rbp)
	jns	.L11
.L10:
	cmpl	$0, -44(%rbp)
	je	.L21
	addl	$1, -36(%rbp)
.L7:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L14
	jmp	.L13
.L21:
	nop
.L13:
	cmpl	$1, -44(%rbp)
	jne	.L15
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L17:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	subl	$1, -28(%rbp)
.L16:
	cmpl	$0, -28(%rbp)
	jns	.L17
	jmp	.L18
.L15:
	cmpl	$0, -44(%rbp)
	jne	.L18
	movl	$-1, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	shift_num
	.type	shift_num, @function
shift_num:
.LFB51:
	.cfi_startproc
	endbr64
	cmpl	$-1, (%rdi)
	je	.L1
	.p2align 4,,10
	.p2align 3
.L3:
	movl	4(%rdi), %eax
	addq	$4, %rdi
	movl	%eax, -4(%rdi)
	cmpl	$-1, %eax
	jne	.L3
.L1:
	ret
	.cfi_endproc
.LFE51:
	.size	shift_num, .-shift_num
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	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	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r13d
	leal	1(%r13), %r12d
	movslq	%r12d, %r12
	salq	$2, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	leaq	-4(%r12), %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	testl	%r13d, %r13d
	jle	.L7
	movq	%rax, %rbx
	movq	%rbp, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r8d
	addq	$4, %r13
	cmpl	%r12d, %r8d
	jg	.L8
	movslq	%r8d, %rax
	leal	-1(%r8), %edi
	movl	$-1, 0(%rbp,%rax,4)
	testl	%r8d, %r8d
	jle	.L19
	movl	%edi, %eax
	xorl	%esi, %esi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L12:
	subl	$1, %eax
	jb	.L11
.L9:
	movslq	%eax, %rdx
	leal	1(%rax), %ecx
	leaq	0(%rbp,%rdx,4), %rdx
	cmpl	%ecx, (%rdx)
	jne	.L12
	movslq	%esi, %rax
	movl	%ecx, (%rbx,%rax,4)
	.p2align 4,,10
	.p2align 3
.L13:
	movl	4(%rdx), %eax
	addq	$4, %rdx
	movl	%eax, -4(%rdx)
	cmpl	$-1, %eax
	jne	.L13
	addl	$1, %esi
	cmpl	%esi, %r8d
	jle	.L29
	movl	%edi, %eax
	subl	%esi, %eax
	jns	.L9
	.p2align 4,,10
	.p2align 3
.L11:
	movl	$-1, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L19:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$16, %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
.L29:
	.cfi_restore_state
	movslq	%edi, %rbp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rbx,%rbp,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subq	$1, %rbp
	call	__printf_chk@PLT
	testl	%ebp, %ebp
	jns	.L16
	jmp	.L19
.L7:
	movl	$-1, -4(%rbp,%r12)
	jmp	.L19
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	shift_num
	.type	shift_num, @function
shift_num:
.LFB51:
	.cfi_startproc
	endbr64
	cmpl	$-1, (%rdi)
	je	.L1
	.p2align 4,,10
	.p2align 3
.L3:
	movl	4(%rdi), %eax
	addq	$4, %rdi
	movl	%eax, -4(%rdi)
	cmpl	$-1, %eax
	jne	.L3
.L1:
	ret
	.cfi_endproc
.LFE51:
	.size	shift_num, .-shift_num
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	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	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r13d
	leal	1(%r13), %r12d
	movslq	%r12d, %r12
	salq	$2, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	leaq	-4(%r12), %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	testl	%r13d, %r13d
	jle	.L7
	movq	%rax, %rbx
	movq	%rbp, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r8d
	addq	$4, %r13
	cmpl	%r12d, %r8d
	jg	.L8
	movslq	%r8d, %rax
	leal	-1(%r8), %edi
	movl	$-1, 0(%rbp,%rax,4)
	testl	%r8d, %r8d
	jle	.L19
	movl	%edi, %eax
	xorl	%esi, %esi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L12:
	subl	$1, %eax
	jb	.L11
.L9:
	movslq	%eax, %rdx
	leal	1(%rax), %ecx
	leaq	0(%rbp,%rdx,4), %rdx
	cmpl	%ecx, (%rdx)
	jne	.L12
	movslq	%esi, %rax
	movl	%ecx, (%rbx,%rax,4)
	.p2align 4,,10
	.p2align 3
.L13:
	movl	4(%rdx), %eax
	addq	$4, %rdx
	movl	%eax, -4(%rdx)
	cmpl	$-1, %eax
	jne	.L13
	addl	$1, %esi
	cmpl	%esi, %r8d
	jle	.L29
	movl	%edi, %eax
	subl	%esi, %eax
	jns	.L9
	.p2align 4,,10
	.p2align 3
.L11:
	movl	$-1, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L19:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$16, %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
.L29:
	.cfi_restore_state
	movslq	%edi, %rbp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rbx,%rbp,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subq	$1, %rbp
	call	__printf_chk@PLT
	testl	%ebp, %ebp
	jns	.L16
	jmp	.L19
.L7:
	movl	$-1, -4(%rbp,%r12)
	jmp	.L19
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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 <math.h>
#include <string.h>

#define TRUE 1
#define FALSE 0

void shift_num(int *num) {
	int i = 0;
	while (*(num + i) != -1) {
		*(num + i) = *(num + i + 1);
		i++;
	}
}

int main(void) {
	int n, sw;
	int *num, *answer;
	scanf("%d", &n);
	num = (int *)malloc(sizeof(int)*(n+1));
	answer = (int *)malloc(sizeof(int)*n);
	for (int i = 0; i < n; i++) {
		scanf("%d", num + i);
	}
	num[n] = -1;
	for (int i = 0; i < n; i++) {
		sw = FALSE;
		for (int j = n - 1 - i; j >= 0; j--) {
			if (num[j] == j + 1) {
				answer[i] = j + 1;
				shift_num(num + j);
				sw = TRUE;
				break;
			}
		}
		if (sw == FALSE) {
			break;
		}
	}
	if (sw == TRUE) {
		for (int i = n - 1; i >= 0; i--) {
			printf("%d\n", answer[i]);
		}
	}
	else if (sw == FALSE) {
		printf("%d\n", -1);
	}
	return 0;
}
3
1 3 1
 9
1 1 1 1 2 1 2 3 2
 3
1 1 1
 2
1 1
 2
1 2
 9
1 1 1 2 1 1 2 3 2
 3
1 2 2
 9
1 1 1 1 2 1 4 3 2
 9
1 1 1 2 2 1 4 3 2
 9
1 1 1 2 2 1 4 1 2

-1
 1
2
2
3
1
2
1
1
1
 1
1
1
 1
1
 1
2
 1
2
2
3
1
1
2
1
1
 1
2
2
 1
2
1
3
2
4
1
1
1
 1
2
1
3
2
4
2
1
1
 1
2
1
1
2
4
2
1
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 <math.h>
#include <string.h>

#define TRUE 1
#define FALSE 0

void shift_num(int *num) {
	int i = 0;
	while (*(num + i) != -1) {
		*(num + i) = *(num + i + 1);
		i++;
	}
}

int main(void) {
	int n, sw;
	int *num, *answer;
	scanf("%d", &n);
	num = (int *)malloc(sizeof(int)*(n+1));
	answer = (int *)malloc(sizeof(int)*n);
	for (int i = 0; i < n; i++) {
		scanf("%d", num + i);
	}
	num[n] = -1;
	for (int i = 0; i < n; i++) {
		sw = FALSE;
		for (int j = n - 1 - i; j >= 0; j--) {
			if (num[j] == j + 1) {
				answer[i] = j + 1;
				shift_num(num + j);
				sw = TRUE;
				break;
			}
		}
		if (sw == FALSE) {
			break;
		}
	}
	if (sw == TRUE) {
		for (int i = n - 1; i >= 0; i--) {
			printf("%d\n", answer[i]);
		}
	}
	else if (sw == FALSE) {
		printf("%d\n", -1);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	shift_num
	.type	shift_num, @function
shift_num:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	shift_num, .-shift_num
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-48(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L5
.L6:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L5:
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L6
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	$0, -36(%rbp)
	jmp	.L7
.L14:
	movl	$0, -44(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	subl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L8
.L11:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	jne	.L9
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	shift_num
	movl	$1, -44(%rbp)
	jmp	.L10
.L9:
	subl	$1, -32(%rbp)
.L8:
	cmpl	$0, -32(%rbp)
	jns	.L11
.L10:
	cmpl	$0, -44(%rbp)
	je	.L21
	addl	$1, -36(%rbp)
.L7:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L14
	jmp	.L13
.L21:
	nop
.L13:
	cmpl	$1, -44(%rbp)
	jne	.L15
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L17:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	subl	$1, -28(%rbp)
.L16:
	cmpl	$0, -28(%rbp)
	jns	.L17
	jmp	.L18
.L15:
	cmpl	$0, -44(%rbp)
	jne	.L18
	movl	$-1, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	shift_num
	.type	shift_num, @function
shift_num:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	jne	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	shift_num, .-shift_num
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-48(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L5
.L6:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L5:
	movl	-48(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L6
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	$0, -36(%rbp)
	jmp	.L7
.L14:
	movl	$0, -44(%rbp)
	movl	-48(%rbp), %eax
	subl	$1, %eax
	subl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L8
.L11:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	jne	.L9
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	shift_num
	movl	$1, -44(%rbp)
	jmp	.L10
.L9:
	subl	$1, -32(%rbp)
.L8:
	cmpl	$0, -32(%rbp)
	jns	.L11
.L10:
	cmpl	$0, -44(%rbp)
	je	.L21
	addl	$1, -36(%rbp)
.L7:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L14
	jmp	.L13
.L21:
	nop
.L13:
	cmpl	$1, -44(%rbp)
	jne	.L15
	movl	-48(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L17:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	subl	$1, -28(%rbp)
.L16:
	cmpl	$0, -28(%rbp)
	jns	.L17
	jmp	.L18
.L15:
	cmpl	$0, -44(%rbp)
	jne	.L18
	movl	$-1, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L18:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
