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>

int main(void) {
    int i, j, N;
    long long a[100010], P1, P2, Tc, Tp;
    scanf("%d", &N);
    for (i=0;i<N;i++) scanf("%lld", &a[i]);
//    memmove(b, a, N*sizeof(long long));

    P1 = 0LL;
    if (a[0]<=0LL) {
        P1 += -a[0] + 1LL;
        Tc = 1LL;
    } else Tc = a[0];
    for (i=1;i<N;i++) {
        Tp = Tc;
        Tc += a[i];
        if (Tc == 0LL) {
            if (Tp > 0LL) { Tc--; }
            else { Tc++; }
            P1++;
        } else if (Tc > 0LL && Tp > 0LL) {
            P1 += Tc + 1LL;
            Tc = -1LL;
        } else if (Tc < 0LL && Tp < 0LL) {
            P1 += -Tc + 1LL;            
            Tc = 1LL;
        }
    }
    P2 = 0LL;
    if (a[0]>=0LL) {
        P2 += a[0] + 1LL;
        Tc = -1LL;
    } else Tc = a[0];
    Tp = 0LL;
    for (i=1;i<N;i++) {
        Tp = Tc;
        Tc += a[i];
        if (Tc == 0LL) {
            if (Tp > 0LL) { Tc--; }
            else { Tc++; }
            P2++;
        } else if (Tc > 0LL && Tp > 0LL) {
            P2 += Tc + 1LL;
            Tc = -1LL;
        } else if (Tc < 0LL && Tp < 0LL) {
            P2 += -Tc + 1LL;            
            Tc = 1LL;
        }
    }
    if (P1<P2) printf("%lld\n", P1);
    else printf("%lld\n", P2);
//    for (i=0;i<N;i++) printf("%lld\t", b[i]);  printf("\n");
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1424, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800132(%rbp)
	jmp	.L2
.L3:
	leaq	-800096(%rbp), %rdx
	movl	-800132(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -800132(%rbp)
.L2:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L3
	movq	$0, -800128(%rbp)
	movq	-800096(%rbp), %rax
	testq	%rax, %rax
	jg	.L4
	movq	-800096(%rbp), %rdx
	movl	$1, %eax
	subq	%rdx, %rax
	addq	%rax, -800128(%rbp)
	movq	$1, -800112(%rbp)
	jmp	.L5
.L4:
	movq	-800096(%rbp), %rax
	movq	%rax, -800112(%rbp)
.L5:
	movl	$1, -800132(%rbp)
	jmp	.L6
.L12:
	movq	-800112(%rbp), %rax
	movq	%rax, -800104(%rbp)
	movl	-800132(%rbp), %eax
	cltq
	movq	-800096(%rbp,%rax,8), %rax
	addq	%rax, -800112(%rbp)
	cmpq	$0, -800112(%rbp)
	jne	.L7
	cmpq	$0, -800104(%rbp)
	jle	.L8
	subq	$1, -800112(%rbp)
	jmp	.L9
.L8:
	addq	$1, -800112(%rbp)
.L9:
	addq	$1, -800128(%rbp)
	jmp	.L10
.L7:
	cmpq	$0, -800112(%rbp)
	jle	.L11
	cmpq	$0, -800104(%rbp)
	jle	.L11
	movq	-800112(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800128(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L10
.L11:
	cmpq	$0, -800112(%rbp)
	jns	.L10
	cmpq	$0, -800104(%rbp)
	jns	.L10
	movl	$1, %eax
	subq	-800112(%rbp), %rax
	addq	%rax, -800128(%rbp)
	movq	$1, -800112(%rbp)
.L10:
	addl	$1, -800132(%rbp)
.L6:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L12
	movq	$0, -800120(%rbp)
	movq	-800096(%rbp), %rax
	testq	%rax, %rax
	js	.L13
	movq	-800096(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800120(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L14
.L13:
	movq	-800096(%rbp), %rax
	movq	%rax, -800112(%rbp)
.L14:
	movq	$0, -800104(%rbp)
	movl	$1, -800132(%rbp)
	jmp	.L15
.L21:
	movq	-800112(%rbp), %rax
	movq	%rax, -800104(%rbp)
	movl	-800132(%rbp), %eax
	cltq
	movq	-800096(%rbp,%rax,8), %rax
	addq	%rax, -800112(%rbp)
	cmpq	$0, -800112(%rbp)
	jne	.L16
	cmpq	$0, -800104(%rbp)
	jle	.L17
	subq	$1, -800112(%rbp)
	jmp	.L18
.L17:
	addq	$1, -800112(%rbp)
.L18:
	addq	$1, -800120(%rbp)
	jmp	.L19
.L16:
	cmpq	$0, -800112(%rbp)
	jle	.L20
	cmpq	$0, -800104(%rbp)
	jle	.L20
	movq	-800112(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800120(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L19
.L20:
	cmpq	$0, -800112(%rbp)
	jns	.L19
	cmpq	$0, -800104(%rbp)
	jns	.L19
	movl	$1, %eax
	subq	-800112(%rbp), %rax
	addq	%rax, -800120(%rbp)
	movq	$1, -800112(%rbp)
.L19:
	addl	$1, -800132(%rbp)
.L15:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L21
	movq	-800128(%rbp), %rax
	cmpq	-800120(%rbp), %rax
	jge	.L22
	movq	-800128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L22:
	movq	-800120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	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
.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	"%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798752
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1392, %rsp
	.cfi_def_cfa_offset 800144
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 800104(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$8, %rbp
	cmpl	%ebx, %esi
	jg	.L3
.L2:
	movq	16(%rsp), %rax
	xorl	%r8d, %r8d
	movq	%rax, %rdx
	testq	%rax, %rax
	jg	.L4
	movl	$1, %r8d
	movl	$1, %edx
	subq	%rax, %r8
.L4:
	cmpl	$1, %esi
	jle	.L5
	leal	-2(%rsi), %edi
	leaq	24(%rsp), %rcx
	movl	$1, %r11d
	leaq	32(%rsp,%rdi,8), %r9
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L49:
	testq	%rdx, %rdx
	setle	%dl
	addq	$1, %r8
	movzbl	%dl, %edx
	leaq	-1(%rdx,%rdx), %rdx
.L8:
	addq	$8, %rcx
	cmpq	%rcx, %r9
	je	.L48
.L10:
	movq	(%rcx), %rdi
	addq	%rdx, %rdi
	testq	%rdi, %rdi
	je	.L49
	jle	.L9
	testq	%rdx, %rdx
	jle	.L9
	addq	$8, %rcx
	leaq	1(%r8,%rdi), %r8
	movq	$-1, %rdx
	cmpq	%rcx, %r9
	jne	.L10
.L48:
	xorl	%r9d, %r9d
	testq	%rax, %rax
	js	.L21
	leaq	1(%rax), %r9
	orq	$-1, %rax
.L21:
	movl	$1, %edx
	leaq	16(%rsp), %rdi
	movl	$1, %r11d
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L50:
	testq	%rax, %rax
	setle	%al
	addq	$1, %r9
	movzbl	%al, %eax
	leaq	-1(%rax,%rax), %rax
.L14:
	addq	$1, %rdx
	cmpl	%edx, %esi
	jle	.L19
.L16:
	movq	(%rdi,%rdx,8), %rcx
	addq	%rax, %rcx
	testq	%rcx, %rcx
	je	.L50
	jle	.L15
	testq	%rax, %rax
	jle	.L15
	addq	$1, %rdx
	leaq	1(%r9,%rcx), %r9
	movq	$-1, %rax
	cmpl	%edx, %esi
	jg	.L16
.L19:
	cmpq	%r8, %r9
	jle	.L17
	movq	%r8, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	800104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$800112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	andq	%rdi, %rdx
	movq	%rdi, %rdx
	jns	.L8
	movq	%r11, %rdi
	subq	%rdx, %rdi
	movl	$1, %edx
	addq	%rdi, %r8
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	andq	%rcx, %rax
	movq	%rcx, %rax
	jns	.L14
	movq	%r11, %rcx
	subq	%rax, %rcx
	movl	$1, %eax
	addq	%rcx, %r9
	jmp	.L14
.L5:
	leaq	1(%rax), %r9
	testq	%rax, %rax
	jns	.L19
	xorl	%r9d, %r9d
.L17:
	movq	%r9, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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	"%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798752
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1392, %rsp
	.cfi_def_cfa_offset 800144
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 800104(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$8, %rbp
	cmpl	%ebx, %esi
	jg	.L3
.L2:
	movq	16(%rsp), %rax
	xorl	%r8d, %r8d
	movq	%rax, %rdx
	testq	%rax, %rax
	jg	.L4
	movl	$1, %r8d
	movl	$1, %edx
	subq	%rax, %r8
.L4:
	cmpl	$1, %esi
	jle	.L5
	leal	-2(%rsi), %edi
	leaq	24(%rsp), %rcx
	movl	$1, %r11d
	leaq	32(%rsp,%rdi,8), %r9
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L49:
	testq	%rdx, %rdx
	setle	%dl
	addq	$1, %r8
	movzbl	%dl, %edx
	leaq	-1(%rdx,%rdx), %rdx
.L8:
	addq	$8, %rcx
	cmpq	%rcx, %r9
	je	.L48
.L10:
	movq	(%rcx), %rdi
	addq	%rdx, %rdi
	testq	%rdi, %rdi
	je	.L49
	jle	.L9
	testq	%rdx, %rdx
	jle	.L9
	addq	$8, %rcx
	leaq	1(%r8,%rdi), %r8
	movq	$-1, %rdx
	cmpq	%rcx, %r9
	jne	.L10
.L48:
	xorl	%r9d, %r9d
	testq	%rax, %rax
	js	.L21
	leaq	1(%rax), %r9
	orq	$-1, %rax
.L21:
	movl	$1, %edx
	leaq	16(%rsp), %rdi
	movl	$1, %r11d
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L50:
	testq	%rax, %rax
	setle	%al
	addq	$1, %r9
	movzbl	%al, %eax
	leaq	-1(%rax,%rax), %rax
.L14:
	addq	$1, %rdx
	cmpl	%edx, %esi
	jle	.L19
.L16:
	movq	(%rdi,%rdx,8), %rcx
	addq	%rax, %rcx
	testq	%rcx, %rcx
	je	.L50
	jle	.L15
	testq	%rax, %rax
	jle	.L15
	addq	$1, %rdx
	leaq	1(%r9,%rcx), %r9
	movq	$-1, %rax
	cmpl	%edx, %esi
	jg	.L16
.L19:
	cmpq	%r8, %r9
	jle	.L17
	movq	%r8, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	800104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$800112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	.cfi_restore_state
	andq	%rdi, %rdx
	movq	%rdi, %rdx
	jns	.L8
	movq	%r11, %rdi
	subq	%rdx, %rdi
	movl	$1, %edx
	addq	%rdi, %r8
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	andq	%rcx, %rax
	movq	%rcx, %rax
	jns	.L14
	movq	%r11, %rcx
	subq	%rax, %rcx
	movl	$1, %eax
	addq	%rcx, %r9
	jmp	.L14
.L5:
	leaq	1(%rax), %r9
	testq	%rax, %rax
	jns	.L19
	xorl	%r9d, %r9d
.L17:
	movq	%r9, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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>

int main(void) {
    int i, j, N;
    long long a[100010], P1, P2, Tc, Tp;
    scanf("%d", &N);
    for (i=0;i<N;i++) scanf("%lld", &a[i]);
//    memmove(b, a, N*sizeof(long long));

    P1 = 0LL;
    if (a[0]<=0LL) {
        P1 += -a[0] + 1LL;
        Tc = 1LL;
    } else Tc = a[0];
    for (i=1;i<N;i++) {
        Tp = Tc;
        Tc += a[i];
        if (Tc == 0LL) {
            if (Tp > 0LL) { Tc--; }
            else { Tc++; }
            P1++;
        } else if (Tc > 0LL && Tp > 0LL) {
            P1 += Tc + 1LL;
            Tc = -1LL;
        } else if (Tc < 0LL && Tp < 0LL) {
            P1 += -Tc + 1LL;            
            Tc = 1LL;
        }
    }
    P2 = 0LL;
    if (a[0]>=0LL) {
        P2 += a[0] + 1LL;
        Tc = -1LL;
    } else Tc = a[0];
    Tp = 0LL;
    for (i=1;i<N;i++) {
        Tp = Tc;
        Tc += a[i];
        if (Tc == 0LL) {
            if (Tp > 0LL) { Tc--; }
            else { Tc++; }
            P2++;
        } else if (Tc > 0LL && Tp > 0LL) {
            P2 += Tc + 1LL;
            Tc = -1LL;
        } else if (Tc < 0LL && Tp < 0LL) {
            P2 += -Tc + 1LL;            
            Tc = 1LL;
        }
    }
    if (P1<P2) printf("%lld\n", P1);
    else printf("%lld\n", P2);
//    for (i=0;i<N;i++) printf("%lld\t", b[i]);  printf("\n");
    return 0;
}
4
1 -3 1 0

4

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>

int main(void) {
    int i, j, N;
    long long a[100010], P1, P2, Tc, Tp;
    scanf("%d", &N);
    for (i=0;i<N;i++) scanf("%lld", &a[i]);
//    memmove(b, a, N*sizeof(long long));

    P1 = 0LL;
    if (a[0]<=0LL) {
        P1 += -a[0] + 1LL;
        Tc = 1LL;
    } else Tc = a[0];
    for (i=1;i<N;i++) {
        Tp = Tc;
        Tc += a[i];
        if (Tc == 0LL) {
            if (Tp > 0LL) { Tc--; }
            else { Tc++; }
            P1++;
        } else if (Tc > 0LL && Tp > 0LL) {
            P1 += Tc + 1LL;
            Tc = -1LL;
        } else if (Tc < 0LL && Tp < 0LL) {
            P1 += -Tc + 1LL;            
            Tc = 1LL;
        }
    }
    P2 = 0LL;
    if (a[0]>=0LL) {
        P2 += a[0] + 1LL;
        Tc = -1LL;
    } else Tc = a[0];
    Tp = 0LL;
    for (i=1;i<N;i++) {
        Tp = Tc;
        Tc += a[i];
        if (Tc == 0LL) {
            if (Tp > 0LL) { Tc--; }
            else { Tc++; }
            P2++;
        } else if (Tc > 0LL && Tp > 0LL) {
            P2 += Tc + 1LL;
            Tc = -1LL;
        } else if (Tc < 0LL && Tp < 0LL) {
            P2 += -Tc + 1LL;            
            Tc = 1LL;
        }
    }
    if (P1<P2) printf("%lld\n", P1);
    else printf("%lld\n", P2);
//    for (i=0;i<N;i++) printf("%lld\t", b[i]);  printf("\n");
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1424, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800132(%rbp)
	jmp	.L2
.L3:
	leaq	-800096(%rbp), %rdx
	movl	-800132(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -800132(%rbp)
.L2:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L3
	movq	$0, -800128(%rbp)
	movq	-800096(%rbp), %rax
	testq	%rax, %rax
	jg	.L4
	movq	-800096(%rbp), %rdx
	movl	$1, %eax
	subq	%rdx, %rax
	addq	%rax, -800128(%rbp)
	movq	$1, -800112(%rbp)
	jmp	.L5
.L4:
	movq	-800096(%rbp), %rax
	movq	%rax, -800112(%rbp)
.L5:
	movl	$1, -800132(%rbp)
	jmp	.L6
.L12:
	movq	-800112(%rbp), %rax
	movq	%rax, -800104(%rbp)
	movl	-800132(%rbp), %eax
	cltq
	movq	-800096(%rbp,%rax,8), %rax
	addq	%rax, -800112(%rbp)
	cmpq	$0, -800112(%rbp)
	jne	.L7
	cmpq	$0, -800104(%rbp)
	jle	.L8
	subq	$1, -800112(%rbp)
	jmp	.L9
.L8:
	addq	$1, -800112(%rbp)
.L9:
	addq	$1, -800128(%rbp)
	jmp	.L10
.L7:
	cmpq	$0, -800112(%rbp)
	jle	.L11
	cmpq	$0, -800104(%rbp)
	jle	.L11
	movq	-800112(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800128(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L10
.L11:
	cmpq	$0, -800112(%rbp)
	jns	.L10
	cmpq	$0, -800104(%rbp)
	jns	.L10
	movl	$1, %eax
	subq	-800112(%rbp), %rax
	addq	%rax, -800128(%rbp)
	movq	$1, -800112(%rbp)
.L10:
	addl	$1, -800132(%rbp)
.L6:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L12
	movq	$0, -800120(%rbp)
	movq	-800096(%rbp), %rax
	testq	%rax, %rax
	js	.L13
	movq	-800096(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800120(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L14
.L13:
	movq	-800096(%rbp), %rax
	movq	%rax, -800112(%rbp)
.L14:
	movq	$0, -800104(%rbp)
	movl	$1, -800132(%rbp)
	jmp	.L15
.L21:
	movq	-800112(%rbp), %rax
	movq	%rax, -800104(%rbp)
	movl	-800132(%rbp), %eax
	cltq
	movq	-800096(%rbp,%rax,8), %rax
	addq	%rax, -800112(%rbp)
	cmpq	$0, -800112(%rbp)
	jne	.L16
	cmpq	$0, -800104(%rbp)
	jle	.L17
	subq	$1, -800112(%rbp)
	jmp	.L18
.L17:
	addq	$1, -800112(%rbp)
.L18:
	addq	$1, -800120(%rbp)
	jmp	.L19
.L16:
	cmpq	$0, -800112(%rbp)
	jle	.L20
	cmpq	$0, -800104(%rbp)
	jle	.L20
	movq	-800112(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800120(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L19
.L20:
	cmpq	$0, -800112(%rbp)
	jns	.L19
	cmpq	$0, -800104(%rbp)
	jns	.L19
	movl	$1, %eax
	subq	-800112(%rbp), %rax
	addq	%rax, -800120(%rbp)
	movq	$1, -800112(%rbp)
.L19:
	addl	$1, -800132(%rbp)
.L15:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L21
	movq	-800128(%rbp), %rax
	cmpq	-800120(%rbp), %rax
	jge	.L22
	movq	-800128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L22:
	movq	-800120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	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
.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.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1424, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800132(%rbp)
	jmp	.L2
.L3:
	leaq	-800096(%rbp), %rdx
	movl	-800132(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -800132(%rbp)
.L2:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L3
	movq	$0, -800128(%rbp)
	movq	-800096(%rbp), %rax
	testq	%rax, %rax
	jg	.L4
	movq	-800096(%rbp), %rdx
	movl	$1, %eax
	subq	%rdx, %rax
	addq	%rax, -800128(%rbp)
	movq	$1, -800112(%rbp)
	jmp	.L5
.L4:
	movq	-800096(%rbp), %rax
	movq	%rax, -800112(%rbp)
.L5:
	movl	$1, -800132(%rbp)
	jmp	.L6
.L12:
	movq	-800112(%rbp), %rax
	movq	%rax, -800104(%rbp)
	movl	-800132(%rbp), %eax
	cltq
	movq	-800096(%rbp,%rax,8), %rax
	addq	%rax, -800112(%rbp)
	cmpq	$0, -800112(%rbp)
	jne	.L7
	cmpq	$0, -800104(%rbp)
	jle	.L8
	subq	$1, -800112(%rbp)
	jmp	.L9
.L8:
	addq	$1, -800112(%rbp)
.L9:
	addq	$1, -800128(%rbp)
	jmp	.L10
.L7:
	cmpq	$0, -800112(%rbp)
	jle	.L11
	cmpq	$0, -800104(%rbp)
	jle	.L11
	movq	-800112(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800128(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L10
.L11:
	cmpq	$0, -800112(%rbp)
	jns	.L10
	cmpq	$0, -800104(%rbp)
	jns	.L10
	movl	$1, %eax
	subq	-800112(%rbp), %rax
	addq	%rax, -800128(%rbp)
	movq	$1, -800112(%rbp)
.L10:
	addl	$1, -800132(%rbp)
.L6:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L12
	movq	$0, -800120(%rbp)
	movq	-800096(%rbp), %rax
	testq	%rax, %rax
	js	.L13
	movq	-800096(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800120(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L14
.L13:
	movq	-800096(%rbp), %rax
	movq	%rax, -800112(%rbp)
.L14:
	movq	$0, -800104(%rbp)
	movl	$1, -800132(%rbp)
	jmp	.L15
.L21:
	movq	-800112(%rbp), %rax
	movq	%rax, -800104(%rbp)
	movl	-800132(%rbp), %eax
	cltq
	movq	-800096(%rbp,%rax,8), %rax
	addq	%rax, -800112(%rbp)
	cmpq	$0, -800112(%rbp)
	jne	.L16
	cmpq	$0, -800104(%rbp)
	jle	.L17
	subq	$1, -800112(%rbp)
	jmp	.L18
.L17:
	addq	$1, -800112(%rbp)
.L18:
	addq	$1, -800120(%rbp)
	jmp	.L19
.L16:
	cmpq	$0, -800112(%rbp)
	jle	.L20
	cmpq	$0, -800104(%rbp)
	jle	.L20
	movq	-800112(%rbp), %rax
	addq	$1, %rax
	addq	%rax, -800120(%rbp)
	movq	$-1, -800112(%rbp)
	jmp	.L19
.L20:
	cmpq	$0, -800112(%rbp)
	jns	.L19
	cmpq	$0, -800104(%rbp)
	jns	.L19
	movl	$1, %eax
	subq	-800112(%rbp), %rax
	addq	%rax, -800120(%rbp)
	movq	$1, -800112(%rbp)
.L19:
	addl	$1, -800132(%rbp)
.L15:
	movl	-800136(%rbp), %eax
	cmpl	%eax, -800132(%rbp)
	jl	.L21
	movq	-800128(%rbp), %rax
	cmpq	-800120(%rbp), %rax
	jge	.L22
	movq	-800128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L22:
	movq	-800120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	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
.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:
