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

```c
/*
 * ID: ITP2_1_C
 * Problem: List
 */

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

struct _list {
    int value;
    struct _list* next;
    struct _list* prev;
};

typedef struct _list list_t;

int main(void)
{
    list_t *p;

    p = malloc(sizeof(list_t));
    p->value = 999;
    p->prev = NULL;
    p->next = NULL;

    int n_command;
    scanf("%d", &n_command);

    int n;
    for (n = 0; n < n_command; n++) {
        list_t *q, *r;
        int command;
        scanf("%d", &command);

        int v, move, i;
        switch (command) {
            case 0:
                scanf("%d", &v);

                q = malloc(sizeof(list_t));
                q->value = v;
                q->prev = p;
                q->next = p->next;
                if (p->next)
                    (p->next)->prev = q;
                p->next = q;
                p = q;
                break;
            case 1:
                scanf("%d", &move);

                if (move > 0)
                    for (i = 0; i < move; i++)
                        p = p -> prev;
                else
                    for (i = 0; i < -move; i++)
                        p = p -> next;
                break;
            case 2:
                q = p->next;
                r = p->prev;
                if (r)
                    r->next = q;
                if (q)
                    q->prev = r;
                free(p);
                p = r;
                break;
        }
    }

    for (; p -> next; p = p->next)
        ;
    for (; p -> prev; p = p->prev)
        printf("%d\n", p->value);

    return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	$999, (%rax)
	movq	-32(%rbp), %rax
	movq	$0, 16(%rax)
	movq	-32(%rbp), %rax
	movq	$0, 8(%rax)
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L2
.L16:
	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
	cmpl	$2, %eax
	je	.L3
	cmpl	$2, %eax
	jg	.L4
	testl	%eax, %eax
	je	.L5
	cmpl	$1, %eax
	je	.L6
	jmp	.L4
.L5:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-44(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, 16(%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	je	.L7
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L7:
	movq	-32(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	-24(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L4
.L6:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.L8
	movl	$0, -36(%rbp)
	jmp	.L9
.L10:
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L9:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L10
	jmp	.L4
.L8:
	movl	$0, -36(%rbp)
	jmp	.L12
.L13:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L12:
	movl	-44(%rbp), %eax
	negl	%eax
	cmpl	%eax, -36(%rbp)
	jl	.L13
	jmp	.L4
.L3:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	je	.L14
	movq	-16(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 8(%rax)
.L14:
	cmpq	$0, -24(%rbp)
	je	.L15
	movq	-24(%rbp), %rax
	movq	-16(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L15:
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, -32(%rbp)
	nop
.L4:
	addl	$1, -40(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L16
	jmp	.L17
.L18:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -32(%rbp)
.L17:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L18
	jmp	.L19
.L20:
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -32(%rbp)
.L19:
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	testq	%rax, %rax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$24, %edi
	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
	leaq	.LC0(%rip), %r12
	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
	call	malloc@PLT
	pxor	%xmm0, %xmm0
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	movl	$999, (%rax)
	movq	%rax, %rbp
	movups	%xmm0, 8(%rax)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L12
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	20(%rsp), %r14
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%eax, %eax
	je	.L36
.L5:
	addl	$1, %ebx
	cmpl	%ebx, 12(%rsp)
	jle	.L12
.L11:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	cmpl	$1, %eax
	je	.L3
	cmpl	$2, %eax
	jne	.L37
	movq	16(%rbp), %r15
	movq	8(%rbp), %rax
	testq	%r15, %r15
	je	.L9
	movq	%rax, 8(%r15)
.L9:
	testq	%rax, %rax
	je	.L10
	movq	%r15, 16(%rax)
.L10:
	movq	%rbp, %rdi
	addl	$1, %ebx
	movq	%r15, %rbp
	call	free@PLT
	cmpl	%ebx, 12(%rsp)
	jg	.L11
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rbp, %rbx
	movq	8(%rbp), %rbp
	testq	%rbp, %rbp
	jne	.L12
	cmpq	$0, 16(%rbx)
	je	.L13
	leaq	.LC1(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rbx), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	16(%rbx), %rbx
	cmpq	$0, 16(%rbx)
	jne	.L14
.L13:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	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
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	$24, %edi
	call	malloc@PLT
	movq	8(%rbp), %xmm0
	movl	20(%rsp), %edx
	movq	%rbp, %xmm1
	punpcklqdq	%xmm1, %xmm0
	movl	%edx, (%rax)
	movups	%xmm0, 8(%rax)
	movq	8(%rbp), %rdx
	testq	%rdx, %rdx
	je	.L6
	movq	%rax, 16(%rdx)
.L6:
	movq	%rax, 8(%rbp)
	movq	%rax, %rbp
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L39
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %eax
	movq	16(%rbp), %rbp
	cmpl	%eax, %edx
	jne	.L7
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L39:
	movl	%edx, %ecx
	negl	%ecx
	testl	%edx, %edx
	je	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %eax
	movq	8(%rbp), %rbp
	cmpl	%ecx, %eax
	jl	.L8
	jmp	.L5
.L38:
	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
	.file	"temp.c"
	.text
	.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:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$24, %edi
	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
	leaq	.LC0(%rip), %r12
	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
	call	malloc@PLT
	pxor	%xmm0, %xmm0
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	movl	$999, (%rax)
	movq	%rax, %rbp
	movups	%xmm0, 8(%rax)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L12
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	20(%rsp), %r14
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%eax, %eax
	je	.L36
.L5:
	addl	$1, %ebx
	cmpl	%ebx, 12(%rsp)
	jle	.L12
.L11:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	cmpl	$1, %eax
	je	.L3
	cmpl	$2, %eax
	jne	.L37
	movq	16(%rbp), %r15
	movq	8(%rbp), %rax
	testq	%r15, %r15
	je	.L9
	movq	%rax, 8(%r15)
.L9:
	testq	%rax, %rax
	je	.L10
	movq	%r15, 16(%rax)
.L10:
	movq	%rbp, %rdi
	addl	$1, %ebx
	movq	%r15, %rbp
	call	free@PLT
	cmpl	%ebx, 12(%rsp)
	jg	.L11
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rbp, %rbx
	movq	8(%rbp), %rbp
	testq	%rbp, %rbp
	jne	.L12
	cmpq	$0, 16(%rbx)
	je	.L13
	leaq	.LC1(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rbx), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	16(%rbx), %rbx
	cmpq	$0, 16(%rbx)
	jne	.L14
.L13:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	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
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	$24, %edi
	call	malloc@PLT
	movq	8(%rbp), %xmm0
	movl	20(%rsp), %edx
	movq	%rbp, %xmm1
	punpcklqdq	%xmm1, %xmm0
	movl	%edx, (%rax)
	movups	%xmm0, 8(%rax)
	movq	8(%rbp), %rdx
	testq	%rdx, %rdx
	je	.L6
	movq	%rax, 16(%rdx)
.L6:
	movq	%rax, 8(%rbp)
	movq	%rax, %rbp
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L39
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %eax
	movq	16(%rbp), %rbp
	cmpl	%eax, %edx
	jne	.L7
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L39:
	movl	%edx, %ecx
	negl	%ecx
	testl	%edx, %edx
	je	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %eax
	movq	8(%rbp), %rbp
	cmpl	%ecx, %eax
	jl	.L8
	jmp	.L5
.L38:
	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:

/*
 * ID: ITP2_1_C
 * Problem: List
 */

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

struct _list {
    int value;
    struct _list* next;
    struct _list* prev;
};

typedef struct _list list_t;

int main(void)
{
    list_t *p;

    p = malloc(sizeof(list_t));
    p->value = 999;
    p->prev = NULL;
    p->next = NULL;

    int n_command;
    scanf("%d", &n_command);

    int n;
    for (n = 0; n < n_command; n++) {
        list_t *q, *r;
        int command;
        scanf("%d", &command);

        int v, move, i;
        switch (command) {
            case 0:
                scanf("%d", &v);

                q = malloc(sizeof(list_t));
                q->value = v;
                q->prev = p;
                q->next = p->next;
                if (p->next)
                    (p->next)->prev = q;
                p->next = q;
                p = q;
                break;
            case 1:
                scanf("%d", &move);

                if (move > 0)
                    for (i = 0; i < move; i++)
                        p = p -> prev;
                else
                    for (i = 0; i < -move; i++)
                        p = p -> next;
                break;
            case 2:
                q = p->next;
                r = p->prev;
                if (r)
                    r->next = q;
                if (q)
                    q->prev = r;
                free(p);
                p = r;
                break;
        }
    }

    for (; p -> next; p = p->next)
        ;
    for (; p -> prev; p = p->prev)
        printf("%d\n", p->value);

    return 0;
}


5
0 1
0 2
0 2
1 1
2
 5
0 1
0 2
0 2
0 1
2
 5
0 1
0 2
0 3
0 1
2
 5
0 1
0 2
0 4
1 1
2
 5
0 1
0 2
0 4
0 0
2
 5
0 1
0 0
0 2
0 0
2
 5
0 1
0 0
0 1
0 0
2
 5
0 1
0 0
0 1
1 0
2
 5
0 1
0 -1
0 1
1 0
2

2
1
 2
2
1
 3
2
1
 4
1
 4
2
1
 2
0
1
 1
0
1
 0
1
 -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
/*
 * ID: ITP2_1_C
 * Problem: List
 */

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

struct _list {
    int value;
    struct _list* next;
    struct _list* prev;
};

typedef struct _list list_t;

int main(void)
{
    list_t *p;

    p = malloc(sizeof(list_t));
    p->value = 999;
    p->prev = NULL;
    p->next = NULL;

    int n_command;
    scanf("%d", &n_command);

    int n;
    for (n = 0; n < n_command; n++) {
        list_t *q, *r;
        int command;
        scanf("%d", &command);

        int v, move, i;
        switch (command) {
            case 0:
                scanf("%d", &v);

                q = malloc(sizeof(list_t));
                q->value = v;
                q->prev = p;
                q->next = p->next;
                if (p->next)
                    (p->next)->prev = q;
                p->next = q;
                p = q;
                break;
            case 1:
                scanf("%d", &move);

                if (move > 0)
                    for (i = 0; i < move; i++)
                        p = p -> prev;
                else
                    for (i = 0; i < -move; i++)
                        p = p -> next;
                break;
            case 2:
                q = p->next;
                r = p->prev;
                if (r)
                    r->next = q;
                if (q)
                    q->prev = r;
                free(p);
                p = r;
                break;
        }
    }

    for (; p -> next; p = p->next)
        ;
    for (; p -> prev; p = p->prev)
        printf("%d\n", p->value);

    return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	$999, (%rax)
	movq	-32(%rbp), %rax
	movq	$0, 16(%rax)
	movq	-32(%rbp), %rax
	movq	$0, 8(%rax)
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L2
.L16:
	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
	cmpl	$2, %eax
	je	.L3
	cmpl	$2, %eax
	jg	.L4
	testl	%eax, %eax
	je	.L5
	cmpl	$1, %eax
	je	.L6
	jmp	.L4
.L5:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-44(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, 16(%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	je	.L7
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L7:
	movq	-32(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	-24(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L4
.L6:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.L8
	movl	$0, -36(%rbp)
	jmp	.L9
.L10:
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L9:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L10
	jmp	.L4
.L8:
	movl	$0, -36(%rbp)
	jmp	.L12
.L13:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L12:
	movl	-44(%rbp), %eax
	negl	%eax
	cmpl	%eax, -36(%rbp)
	jl	.L13
	jmp	.L4
.L3:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	je	.L14
	movq	-16(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 8(%rax)
.L14:
	cmpq	$0, -24(%rbp)
	je	.L15
	movq	-24(%rbp), %rax
	movq	-16(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L15:
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, -32(%rbp)
	nop
.L4:
	addl	$1, -40(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L16
	jmp	.L17
.L18:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -32(%rbp)
.L17:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L18
	jmp	.L19
.L20:
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -32(%rbp)
.L19:
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	testq	%rax, %rax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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.
val
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	$999, (%rax)
	movq	-32(%rbp), %rax
	movq	$0, 16(%rax)
	movq	-32(%rbp), %rax
	movq	$0, 8(%rax)
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L2
.L16:
	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
	cmpl	$2, %eax
	je	.L3
	cmpl	$2, %eax
	jg	.L4
	testl	%eax, %eax
	je	.L5
	cmpl	$1, %eax
	je	.L6
	jmp	.L4
.L5:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$24, %edi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-44(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movq	-32(%rbp), %rdx
	movq	%rdx, 16(%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	je	.L7
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L7:
	movq	-32(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	-24(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L4
.L6:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.L8
	movl	$0, -36(%rbp)
	jmp	.L9
.L10:
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L9:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L10
	jmp	.L4
.L8:
	movl	$0, -36(%rbp)
	jmp	.L12
.L13:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L12:
	movl	-44(%rbp), %eax
	negl	%eax
	cmpl	%eax, -36(%rbp)
	jl	.L13
	jmp	.L4
.L3:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	je	.L14
	movq	-16(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 8(%rax)
.L14:
	cmpq	$0, -24(%rbp)
	je	.L15
	movq	-24(%rbp), %rax
	movq	-16(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L15:
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, -32(%rbp)
	nop
.L4:
	addl	$1, -40(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L16
	jmp	.L17
.L18:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -32(%rbp)
.L17:
	movq	-32(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L18
	jmp	.L19
.L20:
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -32(%rbp)
.L19:
	movq	-32(%rbp), %rax
	movq	16(%rax), %rax
	testq	%rax, %rax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
