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<limits.h>
#include<stdlib.h>

int main() {
    int N;
    scanf("%d", &N);
    int A[N];
    int eo = 1;
    int min = INT_MAX;
    int num = 0;
    for(int i=0; i<N; i++) {
        scanf("%d", &A[i]);
        if(A[i] == 0) eo = 0;
        if(A[i] < 0) eo *= -1;
        if(abs(A[i]) < min) {
            num = i;
            min = abs(A[i]);
        }
    }
    long sum = 0;
    if(eo >= 0) {
        for(int i=0; i<N; i++) {
            sum += abs(A[i]);
        }
    } else if(eo == -1) {
        for(int i=0; i<N; i++) {
            if(i==num) continue;
            sum += abs(A[i]);
        }
        sum -= abs(A[num]);
    }
    printf("%ld\n", sum);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-108(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -104(%rbp)
	movl	$2147483647, -100(%rbp)
	movl	$0, -96(%rbp)
	movl	$0, -92(%rbp)
	jmp	.L5
.L9:
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$0, -104(%rbp)
.L6:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L7
	negl	-104(%rbp)
.L7:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	%eax, -100(%rbp)
	jle	.L8
	movl	-92(%rbp), %eax
	movl	%eax, -96(%rbp)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -100(%rbp)
.L8:
	addl	$1, -92(%rbp)
.L5:
	movl	-108(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L9
	movq	$0, -80(%rbp)
	cmpl	$0, -104(%rbp)
	js	.L10
	movl	$0, -88(%rbp)
	jmp	.L11
.L12:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	addq	%rax, -80(%rbp)
	addl	$1, -88(%rbp)
.L11:
	movl	-108(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L12
	jmp	.L13
.L10:
	cmpl	$-1, -104(%rbp)
	jne	.L13
	movl	$0, -84(%rbp)
	jmp	.L14
.L17:
	movl	-84(%rbp), %eax
	cmpl	-96(%rbp), %eax
	je	.L20
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	addq	%rax, -80(%rbp)
	jmp	.L16
.L20:
	nop
.L16:
	addl	$1, -84(%rbp)
.L14:
	movl	-108(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L17
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	subq	%rax, -80(%rbp)
.L13:
	movq	-80(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L3
.L31:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L31
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L32
.L4:
	movq	%rsp, -80(%rbp)
	testl	%ecx, %ecx
	jle	.L13
	movq	%rsp, %rbx
	movl	$0, -72(%rbp)
	xorl	%r14d, %r14d
	movl	$1, %r15d
	movl	$2147483647, -68(%rbp)
	movq	%rbx, %r12
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L34:
	movl	%r15d, %edx
	negl	%edx
	testl	%eax, %eax
	cmovs	%edx, %r15d
.L7:
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	-68(%rbp), %eax
	jge	.L8
	movl	%r14d, -72(%rbp)
	movl	%eax, -68(%rbp)
.L8:
	movslq	-60(%rbp), %rax
	addl	$1, %r14d
	addq	$4, %rbx
	cmpl	%r14d, %eax
	jle	.L33
.L9:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	testl	%eax, %eax
	jne	.L34
	xorl	%r15d, %r15d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L33:
	cmpl	$-1, %r15d
	je	.L35
	testl	%eax, %eax
	jle	.L13
	leal	-1(%rax), %edx
	cmpl	$2, %edx
	jbe	.L22
	movl	%eax, %edx
	pxor	%xmm1, %xmm1
	pxor	%xmm4, %xmm4
	shrl	$2, %edx
	salq	$4, %rdx
	addq	-80(%rbp), %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%r12), %xmm0
	addq	$16, %r12
	movdqa	%xmm0, %xmm2
	psrad	$31, %xmm2
	pxor	%xmm2, %xmm0
	psubd	%xmm2, %xmm0
	movdqa	%xmm4, %xmm2
	pcmpgtd	%xmm0, %xmm2
	movdqa	%xmm0, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm0
	paddq	%xmm3, %xmm1
	paddq	%xmm0, %xmm1
	cmpq	%rdx, %r12
	jne	.L15
	movdqa	%xmm1, %xmm0
	movl	%eax, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rdx
	testb	$3, %al
	je	.L6
.L14:
	movq	-80(%rbp), %rdi
	movslq	%esi, %rcx
	leaq	(%rdi,%rcx,4), %r8
	movl	(%r8), %edi
	movl	%edi, %ecx
	negl	%ecx
	cmovs	%edi, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
	leal	1(%rsi), %ecx
	cmpl	%ecx, %eax
	jle	.L6
	movl	4(%r8), %edi
	movl	%edi, %ecx
	negl	%ecx
	cmovs	%edi, %ecx
	addl	$2, %esi
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
	cmpl	%esi, %eax
	jle	.L6
	movl	8(%r8), %ecx
	movl	%ecx, %eax
	negl	%eax
	cmovs	%ecx, %eax
	cltq
	addq	%rax, %rdx
.L6:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L36
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L35:
	.cfi_restore_state
	xorl	%edx, %edx
	testl	%eax, %eax
	jle	.L12
	xorl	%ecx, %ecx
	xorl	%edx, %edx
.L19:
	cmpl	%ecx, -72(%rbp)
	je	.L18
	movq	-80(%rbp), %rdi
	movl	(%rdi,%rcx,4), %edi
	movl	%edi, %esi
	negl	%esi
	cmovs	%edi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
.L18:
	addq	$1, %rcx
	cmpq	%rax, %rcx
	jne	.L19
.L12:
	movq	-80(%rbp), %rax
	movslq	-72(%rbp), %r14
	movl	(%rax,%r14,4), %ecx
	movl	%ecx, %eax
	negl	%eax
	cmovs	%ecx, %eax
	cltq
	subq	%rax, %rdx
	jmp	.L6
.L32:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L13:
	xorl	%edx, %edx
	jmp	.L6
.L22:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L14
.L36:
	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	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	leaq	.LC0(%rip), %r13
	pushq	%r12
	movq	%r13, %rdi
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L3
.L31:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L31
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L32
.L4:
	movq	%rsp, -80(%rbp)
	testl	%ecx, %ecx
	jle	.L13
	movq	%rsp, %rbx
	movl	$0, -72(%rbp)
	xorl	%r14d, %r14d
	movl	$1, %r15d
	movl	$2147483647, -68(%rbp)
	movq	%rbx, %r12
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L34:
	movl	%r15d, %edx
	negl	%edx
	testl	%eax, %eax
	cmovs	%edx, %r15d
.L7:
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	-68(%rbp), %eax
	jge	.L8
	movl	%r14d, -72(%rbp)
	movl	%eax, -68(%rbp)
.L8:
	movslq	-60(%rbp), %rax
	addl	$1, %r14d
	addq	$4, %rbx
	cmpl	%r14d, %eax
	jle	.L33
.L9:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	testl	%eax, %eax
	jne	.L34
	xorl	%r15d, %r15d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L33:
	cmpl	$-1, %r15d
	je	.L35
	testl	%eax, %eax
	jle	.L13
	leal	-1(%rax), %edx
	cmpl	$2, %edx
	jbe	.L22
	movl	%eax, %edx
	pxor	%xmm1, %xmm1
	pxor	%xmm4, %xmm4
	shrl	$2, %edx
	salq	$4, %rdx
	addq	-80(%rbp), %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%r12), %xmm0
	addq	$16, %r12
	movdqa	%xmm0, %xmm2
	psrad	$31, %xmm2
	pxor	%xmm2, %xmm0
	psubd	%xmm2, %xmm0
	movdqa	%xmm4, %xmm2
	pcmpgtd	%xmm0, %xmm2
	movdqa	%xmm0, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm0
	paddq	%xmm3, %xmm1
	paddq	%xmm0, %xmm1
	cmpq	%rdx, %r12
	jne	.L15
	movdqa	%xmm1, %xmm0
	movl	%eax, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rdx
	testb	$3, %al
	je	.L6
.L14:
	movq	-80(%rbp), %rdi
	movslq	%esi, %rcx
	leaq	(%rdi,%rcx,4), %r8
	movl	(%r8), %edi
	movl	%edi, %ecx
	negl	%ecx
	cmovs	%edi, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
	leal	1(%rsi), %ecx
	cmpl	%ecx, %eax
	jle	.L6
	movl	4(%r8), %edi
	movl	%edi, %ecx
	negl	%ecx
	cmovs	%edi, %ecx
	addl	$2, %esi
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
	cmpl	%esi, %eax
	jle	.L6
	movl	8(%r8), %ecx
	movl	%ecx, %eax
	negl	%eax
	cmovs	%ecx, %eax
	cltq
	addq	%rax, %rdx
.L6:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L36
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L35:
	.cfi_restore_state
	xorl	%edx, %edx
	testl	%eax, %eax
	jle	.L12
	xorl	%ecx, %ecx
	xorl	%edx, %edx
.L19:
	cmpl	%ecx, -72(%rbp)
	je	.L18
	movq	-80(%rbp), %rdi
	movl	(%rdi,%rcx,4), %edi
	movl	%edi, %esi
	negl	%esi
	cmovs	%edi, %esi
	movslq	%esi, %rsi
	addq	%rsi, %rdx
.L18:
	addq	$1, %rcx
	cmpq	%rax, %rcx
	jne	.L19
.L12:
	movq	-80(%rbp), %rax
	movslq	-72(%rbp), %r14
	movl	(%rax,%r14,4), %ecx
	movl	%ecx, %eax
	negl	%eax
	cmovs	%ecx, %eax
	cltq
	subq	%rax, %rdx
	jmp	.L6
.L32:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L13:
	xorl	%edx, %edx
	jmp	.L6
.L22:
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L14
.L36:
	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:

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

int main() {
    int N;
    scanf("%d", &N);
    int A[N];
    int eo = 1;
    int min = INT_MAX;
    int num = 0;
    for(int i=0; i<N; i++) {
        scanf("%d", &A[i]);
        if(A[i] == 0) eo = 0;
        if(A[i] < 0) eo *= -1;
        if(abs(A[i]) < min) {
            num = i;
            min = abs(A[i]);
        }
    }
    long sum = 0;
    if(eo >= 0) {
        for(int i=0; i<N; i++) {
            sum += abs(A[i]);
        }
    } else if(eo == -1) {
        for(int i=0; i<N; i++) {
            if(i==num) continue;
            sum += abs(A[i]);
        }
        sum -= abs(A[num]);
    }
    printf("%ld\n", sum);
    return 0;
}

11
-1000000000 1000000000 -364513171 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000
 5
10 -4 -8 -11 5
 3
-10 5 0
 11
-1000000000 1000000000 -364513171 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000100
 5
10 -4 -4 -11 5
 3
-14 5 0
 11
-1000000000 1000000000 -364513171 1000000000 -1000000000 0 1000000000 -1000000000 1000000100 -1000000000 1000000100
 5
10 -4 -4 -14 5
 3
-14 5 1
 11
-1000000000 1000000000 -364513171 1000000000 -1382285407 0 1000000000 -1000000000 1000000000 -1000000000 1000000100

9364513171
 30
 15
 9364513271
 26
 19
 9364513371
 29
 18
 9746798678

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<limits.h>
#include<stdlib.h>

int main() {
    int N;
    scanf("%d", &N);
    int A[N];
    int eo = 1;
    int min = INT_MAX;
    int num = 0;
    for(int i=0; i<N; i++) {
        scanf("%d", &A[i]);
        if(A[i] == 0) eo = 0;
        if(A[i] < 0) eo *= -1;
        if(abs(A[i]) < min) {
            num = i;
            min = abs(A[i]);
        }
    }
    long sum = 0;
    if(eo >= 0) {
        for(int i=0; i<N; i++) {
            sum += abs(A[i]);
        }
    } else if(eo == -1) {
        for(int i=0; i<N; i++) {
            if(i==num) continue;
            sum += abs(A[i]);
        }
        sum -= abs(A[num]);
    }
    printf("%ld\n", sum);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-108(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -104(%rbp)
	movl	$2147483647, -100(%rbp)
	movl	$0, -96(%rbp)
	movl	$0, -92(%rbp)
	jmp	.L5
.L9:
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$0, -104(%rbp)
.L6:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L7
	negl	-104(%rbp)
.L7:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	%eax, -100(%rbp)
	jle	.L8
	movl	-92(%rbp), %eax
	movl	%eax, -96(%rbp)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -100(%rbp)
.L8:
	addl	$1, -92(%rbp)
.L5:
	movl	-108(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L9
	movq	$0, -80(%rbp)
	cmpl	$0, -104(%rbp)
	js	.L10
	movl	$0, -88(%rbp)
	jmp	.L11
.L12:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	addq	%rax, -80(%rbp)
	addl	$1, -88(%rbp)
.L11:
	movl	-108(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L12
	jmp	.L13
.L10:
	cmpl	$-1, -104(%rbp)
	jne	.L13
	movl	$0, -84(%rbp)
	jmp	.L14
.L17:
	movl	-84(%rbp), %eax
	cmpl	-96(%rbp), %eax
	je	.L20
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	addq	%rax, -80(%rbp)
	jmp	.L16
.L20:
	nop
.L16:
	addl	$1, -84(%rbp)
.L14:
	movl	-108(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L17
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	subq	%rax, -80(%rbp)
.L13:
	movq	-80(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	"%ld\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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-108(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -104(%rbp)
	movl	$2147483647, -100(%rbp)
	movl	$0, -96(%rbp)
	movl	$0, -92(%rbp)
	jmp	.L5
.L9:
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$0, -104(%rbp)
.L6:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L7
	negl	-104(%rbp)
.L7:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cmpl	%eax, -100(%rbp)
	jle	.L8
	movl	-92(%rbp), %eax
	movl	%eax, -96(%rbp)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -100(%rbp)
.L8:
	addl	$1, -92(%rbp)
.L5:
	movl	-108(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L9
	movq	$0, -80(%rbp)
	cmpl	$0, -104(%rbp)
	js	.L10
	movl	$0, -88(%rbp)
	jmp	.L11
.L12:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	addq	%rax, -80(%rbp)
	addl	$1, -88(%rbp)
.L11:
	movl	-108(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L12
	jmp	.L13
.L10:
	cmpl	$-1, -104(%rbp)
	jne	.L13
	movl	$0, -84(%rbp)
	jmp	.L14
.L17:
	movl	-84(%rbp), %eax
	cmpl	-96(%rbp), %eax
	je	.L20
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	addq	%rax, -80(%rbp)
	jmp	.L16
.L20:
	nop
.L16:
	addl	$1, -84(%rbp)
.L14:
	movl	-108(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L17
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	cltq
	subq	%rax, -80(%rbp)
.L13:
	movq	-80(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
