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<string.h>
#include<stdlib.h>
#include<math.h>
int main(void){
    int n,l,b=0;
    scanf("%d%d",&n,&l);
    int app[n],sum=0;
    for(int i=0;n>i;++i){
        app[i]=l+i;
        sum+=app[i];
        if(app[i]==0)
        ++b;
    }
    int min=app[0],max;
    for(int i=1;n>i;++i)
    min=min<app[i]?min:app[i];
    if(app[n-1]<0)
    max=app[n-1];
    if(b==1)
    printf("%d",sum);
    else if(app[n-1]<0)
    printf("%d",sum-max);
    else{printf("%d",sum-min);}
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.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
	movl	$0, -96(%rbp)
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-104(%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	$0, -92(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L5
.L7:
	movl	-100(%rbp), %edx
	movl	-88(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -92(%rbp)
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L6
	addl	$1, -96(%rbp)
.L6:
	addl	$1, -88(%rbp)
.L5:
	movl	-104(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L7
	movq	-64(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -84(%rbp)
	movl	$1, -76(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	-84(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -84(%rbp)
	addl	$1, -76(%rbp)
.L8:
	movl	-104(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L9
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L10
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -80(%rbp)
.L10:
	cmpl	$1, -96(%rbp)
	jne	.L11
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L11:
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L13
	movl	-92(%rbp), %eax
	subl	-80(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L13:
	movl	-92(%rbp), %eax
	subl	-84(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L12:
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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
.LC1:
	.string	"%d%d"
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC1(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rsi
	subq	$24, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-32(%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
.L51:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L51
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L52
.L4:
	leaq	3(%rsp), %rdi
	movq	%rdi, %r10
	andq	$-4, %rdi
	shrq	$2, %r10
	testl	%ecx, %ecx
	jle	.L5
	leal	-1(%rcx), %esi
	movl	-28(%rbp), %r11d
	cmpl	$3, %esi
	jbe	.L30
	movl	%ecx, %edx
	movd	%r11d, %xmm4
	pxor	%xmm1, %xmm1
	movq	%rdi, %rax
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm6
	movdqa	%xmm1, %xmm2
	movdqa	.LC0(%rip), %xmm3
	salq	$4, %rdx
	movdqa	.LC2(%rip), %xmm5
	movdqa	%xmm1, %xmm4
	addq	%rdi, %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movdqa	%xmm3, %xmm0
	addq	$16, %rax
	paddd	%xmm5, %xmm3
	paddd	%xmm6, %xmm0
	movups	%xmm0, -16(%rax)
	paddd	%xmm0, %xmm1
	pcmpeqd	%xmm4, %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L7
	movdqa	%xmm2, %xmm0
	movl	%ecx, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %r9d
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %r8d
	testb	$3, %cl
	je	.L11
.L6:
	movslq	%edx, %rbx
	leal	(%r11,%rdx), %eax
	leaq	(%rdi,%rbx,4), %rbx
	addl	%eax, %r8d
	cmpl	$1, %eax
	movl	%eax, (%rbx)
	leal	1(%rdx), %eax
	adcl	$0, %r9d
	cmpl	%ecx, %eax
	jge	.L13
	addl	%r11d, %eax
	addl	%eax, %r8d
	movl	%eax, 4(%rbx)
	cmpl	$1, %eax
	leal	2(%rdx), %eax
	adcl	$0, %r9d
	cmpl	%eax, %ecx
	jle	.L11
	addl	%r11d, %eax
	addl	%eax, %r8d
	cmpl	$1, %eax
	movl	%eax, 8(%rbx)
	adcl	$0, %r9d
	addl	$3, %edx
	cmpl	%edx, %ecx
	jle	.L11
	leal	(%r11,%rdx), %eax
	movl	%eax, 12(%rbx)
	addl	%eax, %r8d
	cmpl	$1, %eax
	adcl	$0, %r9d
.L11:
	movl	0(,%r10,4), %eax
.L9:
	leal	-2(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L31
	movl	%esi, %edx
	movd	%eax, %xmm5
	leaq	4(%rdi), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm5, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%rdi,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%rax), %xmm1
	movdqu	(%rax), %xmm7
	addq	$16, %rax
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm7, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L19
	movdqa	%xmm0, %xmm2
	movl	%esi, %r10d
	psrldq	$8, %xmm2
	andl	$-4, %r10d
	movdqa	%xmm2, %xmm1
	leal	1(%r10), %edx
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r10d, %esi
	je	.L21
.L18:
	movslq	%edx, %r10
	leaq	(%rdi,%r10,4), %r10
	movl	(%r10), %r11d
	cmpl	%r11d, %eax
	cmovg	%r11d, %eax
	leal	1(%rdx), %r11d
	cmpl	%ecx, %r11d
	jge	.L21
	movl	4(%r10), %r11d
	cmpl	%r11d, %eax
	cmovg	%r11d, %eax
	addl	$2, %edx
	cmpl	%edx, %ecx
	jle	.L21
	movl	8(%r10), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
.L21:
	movslq	%esi, %rsi
	movl	(%rdi,%rsi,4), %edx
	testl	%edx, %edx
	js	.L53
	subl	$1, %r9d
	je	.L49
	movl	%r8d, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	subl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L25:
	movq	-24(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L54
	movq	-8(%rbp), %rbx
	xorl	%eax, %eax
	leave
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L53:
	.cfi_restore_state
	subl	$1, %r9d
	je	.L49
	subl	%edx, %r8d
.L49:
	movl	%r8d, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L25
.L52:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L13:
	movl	0(,%r10,4), %eax
	cmpl	$1, %ecx
	jg	.L9
	jmp	.L21
.L5:
	movl	0(,%r10,4), %eax
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	leal	-1(%rcx), %esi
	jmp	.L21
.L30:
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	jmp	.L6
.L31:
	movl	$1, %edx
	jmp	.L18
.L54:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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
.LC1:
	.string	"%d%d"
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC1(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rsi
	subq	$24, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-32(%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
.L51:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L51
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L52
.L4:
	leaq	3(%rsp), %rdi
	movq	%rdi, %r10
	andq	$-4, %rdi
	shrq	$2, %r10
	testl	%ecx, %ecx
	jle	.L5
	leal	-1(%rcx), %esi
	movl	-28(%rbp), %r11d
	cmpl	$3, %esi
	jbe	.L30
	movl	%ecx, %edx
	movd	%r11d, %xmm4
	pxor	%xmm1, %xmm1
	movq	%rdi, %rax
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm6
	movdqa	%xmm1, %xmm2
	movdqa	.LC0(%rip), %xmm3
	salq	$4, %rdx
	movdqa	.LC2(%rip), %xmm5
	movdqa	%xmm1, %xmm4
	addq	%rdi, %rdx
	.p2align 4,,10
	.p2align 3
.L7:
	movdqa	%xmm3, %xmm0
	addq	$16, %rax
	paddd	%xmm5, %xmm3
	paddd	%xmm6, %xmm0
	movups	%xmm0, -16(%rax)
	paddd	%xmm0, %xmm1
	pcmpeqd	%xmm4, %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L7
	movdqa	%xmm2, %xmm0
	movl	%ecx, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %r9d
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %r8d
	testb	$3, %cl
	je	.L11
.L6:
	movslq	%edx, %rbx
	leal	(%r11,%rdx), %eax
	leaq	(%rdi,%rbx,4), %rbx
	addl	%eax, %r8d
	cmpl	$1, %eax
	movl	%eax, (%rbx)
	leal	1(%rdx), %eax
	adcl	$0, %r9d
	cmpl	%ecx, %eax
	jge	.L13
	addl	%r11d, %eax
	addl	%eax, %r8d
	movl	%eax, 4(%rbx)
	cmpl	$1, %eax
	leal	2(%rdx), %eax
	adcl	$0, %r9d
	cmpl	%eax, %ecx
	jle	.L11
	addl	%r11d, %eax
	addl	%eax, %r8d
	cmpl	$1, %eax
	movl	%eax, 8(%rbx)
	adcl	$0, %r9d
	addl	$3, %edx
	cmpl	%edx, %ecx
	jle	.L11
	leal	(%r11,%rdx), %eax
	movl	%eax, 12(%rbx)
	addl	%eax, %r8d
	cmpl	$1, %eax
	adcl	$0, %r9d
.L11:
	movl	0(,%r10,4), %eax
.L9:
	leal	-2(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L31
	movl	%esi, %edx
	movd	%eax, %xmm5
	leaq	4(%rdi), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm5, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%rdi,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%rax), %xmm1
	movdqu	(%rax), %xmm7
	addq	$16, %rax
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm7, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L19
	movdqa	%xmm0, %xmm2
	movl	%esi, %r10d
	psrldq	$8, %xmm2
	andl	$-4, %r10d
	movdqa	%xmm2, %xmm1
	leal	1(%r10), %edx
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r10d, %esi
	je	.L21
.L18:
	movslq	%edx, %r10
	leaq	(%rdi,%r10,4), %r10
	movl	(%r10), %r11d
	cmpl	%r11d, %eax
	cmovg	%r11d, %eax
	leal	1(%rdx), %r11d
	cmpl	%ecx, %r11d
	jge	.L21
	movl	4(%r10), %r11d
	cmpl	%r11d, %eax
	cmovg	%r11d, %eax
	addl	$2, %edx
	cmpl	%edx, %ecx
	jle	.L21
	movl	8(%r10), %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
.L21:
	movslq	%esi, %rsi
	movl	(%rdi,%rsi,4), %edx
	testl	%edx, %edx
	js	.L53
	subl	$1, %r9d
	je	.L49
	movl	%r8d, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	subl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L25:
	movq	-24(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L54
	movq	-8(%rbp), %rbx
	xorl	%eax, %eax
	leave
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L53:
	.cfi_restore_state
	subl	$1, %r9d
	je	.L49
	subl	%edx, %r8d
.L49:
	movl	%r8d, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L25
.L52:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L13:
	movl	0(,%r10,4), %eax
	cmpl	$1, %ecx
	jg	.L9
	jmp	.L21
.L5:
	movl	0(,%r10,4), %eax
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	leal	-1(%rcx), %esi
	jmp	.L21
.L30:
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	jmp	.L6
.L31:
	movl	$1, %edx
	jmp	.L18
.L54:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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<string.h>
#include<stdlib.h>
#include<math.h>
int main(void){
    int n,l,b=0;
    scanf("%d%d",&n,&l);
    int app[n],sum=0;
    for(int i=0;n>i;++i){
        app[i]=l+i;
        sum+=app[i];
        if(app[i]==0)
        ++b;
    }
    int min=app[0],max;
    for(int i=1;n>i;++i)
    min=min<app[i]?min:app[i];
    if(app[n-1]<0)
    max=app[n-1];
    if(b==1)
    printf("%d",sum);
    else if(app[n-1]<0)
    printf("%d",sum-max);
    else{printf("%d",sum-min);}
    return 0;
}
5 4
 13 -50
 3 -2
 5 7
 16 -50
 5 -2
 5 9
 23 -50
 4 -2
 8 9

26 -534 -3 38 -645 0 46 -869 -2 91
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<string.h>
#include<stdlib.h>
#include<math.h>
int main(void){
    int n,l,b=0;
    scanf("%d%d",&n,&l);
    int app[n],sum=0;
    for(int i=0;n>i;++i){
        app[i]=l+i;
        sum+=app[i];
        if(app[i]==0)
        ++b;
    }
    int min=app[0],max;
    for(int i=1;n>i;++i)
    min=min<app[i]?min:app[i];
    if(app[n-1]<0)
    max=app[n-1];
    if(b==1)
    printf("%d",sum);
    else if(app[n-1]<0)
    printf("%d",sum-max);
    else{printf("%d",sum-min);}
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.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
	movl	$0, -96(%rbp)
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-104(%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	$0, -92(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L5
.L7:
	movl	-100(%rbp), %edx
	movl	-88(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -92(%rbp)
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L6
	addl	$1, -96(%rbp)
.L6:
	addl	$1, -88(%rbp)
.L5:
	movl	-104(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L7
	movq	-64(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -84(%rbp)
	movl	$1, -76(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	-84(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -84(%rbp)
	addl	$1, -76(%rbp)
.L8:
	movl	-104(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L9
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L10
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -80(%rbp)
.L10:
	cmpl	$1, -96(%rbp)
	jne	.L11
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L11:
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L13
	movl	-92(%rbp), %eax
	subl	-80(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L13:
	movl	-92(%rbp), %eax
	subl	-84(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L12:
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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%d"
.LC1:
	.string	"%d"
	.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
	movl	$0, -96(%rbp)
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-104(%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	$0, -92(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L5
.L7:
	movl	-100(%rbp), %edx
	movl	-88(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -92(%rbp)
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L6
	addl	$1, -96(%rbp)
.L6:
	addl	$1, -88(%rbp)
.L5:
	movl	-104(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L7
	movq	-64(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -84(%rbp)
	movl	$1, -76(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	-84(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -84(%rbp)
	addl	$1, -76(%rbp)
.L8:
	movl	-104(%rbp), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L9
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L10
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -80(%rbp)
.L10:
	cmpl	$1, -96(%rbp)
	jne	.L11
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L11:
	movl	-104(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jns	.L13
	movl	-92(%rbp), %eax
	subl	-80(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L13:
	movl	-92(%rbp), %eax
	subl	-84(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L12:
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
