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>
#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;
}```

Assembly Code:

```assembly
	.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:
```

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
	.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
```assembly
	.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:
```
```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;
}```
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>
#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;
}```

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:

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 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;
}```

Assembly Code:

```assembly
	.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:
```

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
	.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:
```