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

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

int main()
{
    int n,min,max=-1000000000;
    scanf("%d",&n);
    int R[n];
    scanf("%d",&R[0]);
    min = R[0];
    for(int i=1;i<n;i++)
    {
        scanf("%d",&R[i]);
        (R[i]-min)<max ? (max = max) : (max = R[i]-min);
        (R[i])<min ? (min = R[i]) : (min = min);
    }
    printf("%d\n",max);
    return 0;
}
```

Assembly Code:

```assembly
	.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	%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	$24, %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, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L15:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L15
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L16
.L4:
	leaq	3(%rsp), %rbx
	xorl	%eax, %eax
	movq	%r13, %rdi
	movq	%rbx, %r12
	andq	$-4, %rbx
	movq	%rbx, %rsi
	shrq	$2, %r12
	call	__isoc99_scanf@PLT
	cmpl	$1, -60(%rbp)
	movl	0(,%r12,4), %r12d
	jle	.L8
	addq	$4, %rbx
	movl	$1, %r15d
	movl	$-1000000000, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	movl	%eax, %edx
	subl	%r12d, %edx
	cmpl	%edx, %r14d
	cmovl	%edx, %r14d
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
	addl	$1, %r15d
	addq	$4, %rbx
	cmpl	%r15d, -60(%rbp)
	jg	.L6
.L5:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L17
	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
.L16:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L8:
	movl	$-1000000000, %r14d
	jmp	.L5
.L17:
	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:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.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	%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	$24, %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, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L15:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L15
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L16
.L4:
	leaq	3(%rsp), %rbx
	xorl	%eax, %eax
	movq	%r13, %rdi
	movq	%rbx, %r12
	andq	$-4, %rbx
	movq	%rbx, %rsi
	shrq	$2, %r12
	call	__isoc99_scanf@PLT
	cmpl	$1, -60(%rbp)
	movl	0(,%r12,4), %r12d
	jle	.L8
	addq	$4, %rbx
	movl	$1, %r15d
	movl	$-1000000000, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	movl	%eax, %edx
	subl	%r12d, %edx
	cmpl	%edx, %r14d
	cmovl	%edx, %r14d
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
	addl	$1, %r15d
	addq	$4, %rbx
	cmpl	%r15d, -60(%rbp)
	jg	.L6
.L5:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L17
	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
.L16:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L8:
	movl	$-1000000000, %r14d
	jmp	.L5
.L17:
	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
```assembly
	.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	%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	$24, %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, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L15:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L15
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L16
.L4:
	leaq	3(%rsp), %rbx
	xorl	%eax, %eax
	movq	%r13, %rdi
	movq	%rbx, %r12
	andq	$-4, %rbx
	movq	%rbx, %rsi
	shrq	$2, %r12
	call	__isoc99_scanf@PLT
	cmpl	$1, -60(%rbp)
	movl	0(,%r12,4), %r12d
	jle	.L8
	addq	$4, %rbx
	movl	$1, %r15d
	movl	$-1000000000, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	movl	%eax, %edx
	subl	%r12d, %edx
	cmpl	%edx, %r14d
	cmovl	%edx, %r14d
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
	addl	$1, %r15d
	addq	$4, %rbx
	cmpl	%r15d, -60(%rbp)
	jg	.L6
.L5:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L17
	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
.L16:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L8:
	movl	$-1000000000, %r14d
	jmp	.L5
.L17:
	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:
```
```c
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,min,max=-1000000000;
    scanf("%d",&n);
    int R[n];
    scanf("%d",&R[0]);
    min = R[0];
    for(int i=1;i<n;i++)
    {
        scanf("%d",&R[i]);
        (R[i]-min)<max ? (max = max) : (max = R[i]-min);
        (R[i])<min ? (min = R[i]) : (min = min);
    }
    printf("%d\n",max);
    return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

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

int main()
{
    int n,min,max=-1000000000;
    scanf("%d",&n);
    int R[n];
    scanf("%d",&R[0]);
    min = R[0];
    for(int i=1;i<n;i++)
    {
        scanf("%d",&R[i]);
        (R[i]-min)<max ? (max = max) : (max = R[i]-min);
        (R[i])<min ? (min = R[i]) : (min = min);
    }
    printf("%d\n",max);
    return 0;
}
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

3
4
1
2
 6
5
3
0
3
4
3
 3
4
1
3
 6
5
3
0
2
0
3
 3
5
0
6
 3
5
0
10
 6
5
2
-1
4
1
3
 6
5
2
-1
7
1
3
 3
3
0
9
 6
5
2
-1
14
1
3

1
 4
 2
 3
 6
 10
 5
 8
 9
 15

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

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

int main()
{
    int n,min,max=-1000000000;
    scanf("%d",&n);
    int R[n];
    scanf("%d",&R[0]);
    min = R[0];
    for(int i=1;i<n;i++)
    {
        scanf("%d",&R[i]);
        (R[i]-min)<max ? (max = max) : (max = R[i]-min);
        (R[i])<min ? (min = R[i]) : (min = min);
    }
    printf("%d\n",max);
    return 0;
}
```

Assembly Code:

```assembly
	.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	%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	$24, %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, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L15:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L15
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L16
.L4:
	leaq	3(%rsp), %rbx
	xorl	%eax, %eax
	movq	%r13, %rdi
	movq	%rbx, %r12
	andq	$-4, %rbx
	movq	%rbx, %rsi
	shrq	$2, %r12
	call	__isoc99_scanf@PLT
	cmpl	$1, -60(%rbp)
	movl	0(,%r12,4), %r12d
	jle	.L8
	addq	$4, %rbx
	movl	$1, %r15d
	movl	$-1000000000, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	movl	%eax, %edx
	subl	%r12d, %edx
	cmpl	%edx, %r14d
	cmovl	%edx, %r14d
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
	addl	$1, %r15d
	addq	$4, %rbx
	cmpl	%r15d, -60(%rbp)
	jg	.L6
.L5:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L17
	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
.L16:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L8:
	movl	$-1000000000, %r14d
	jmp	.L5
.L17:
	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:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.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	%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	$24, %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, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L15:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L15
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L16
.L4:
	leaq	3(%rsp), %rbx
	xorl	%eax, %eax
	movq	%r13, %rdi
	movq	%rbx, %r12
	andq	$-4, %rbx
	movq	%rbx, %rsi
	shrq	$2, %r12
	call	__isoc99_scanf@PLT
	cmpl	$1, -60(%rbp)
	movl	0(,%r12,4), %r12d
	jle	.L8
	addq	$4, %rbx
	movl	$1, %r15d
	movl	$-1000000000, %r14d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	(%rbx), %eax
	movl	%eax, %edx
	subl	%r12d, %edx
	cmpl	%edx, %r14d
	cmovl	%edx, %r14d
	cmpl	%eax, %r12d
	cmovg	%eax, %r12d
	addl	$1, %r15d
	addq	$4, %rbx
	cmpl	%r15d, -60(%rbp)
	jg	.L6
.L5:
	xorl	%eax, %eax
	movl	%r14d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L17
	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
.L16:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L8:
	movl	$-1000000000, %r14d
	jmp	.L5
.L17:
	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:
```