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>
int main()
{
    int n,i;
    scanf("%d",&n);
    long long int a[n+5],sum=0,k,min,j;
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    if(n==1)
        printf("%lld\n",a[0]);
    else{
    min=a[0];
    for(i=1;i<n;i++)
    {
        if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%min==0)sum++;
    }
    if(sum==n)printf("%lld\n",min);
    else
    {
        for(j=0;j<999;j++)
        {
        sum=0;
        for(i=0;i<n;i++)
       {
           k=a[i]%min;
           if(k==0)a[i]=min;
           else
           a[i]=k;
       }
       min=a[0];
    for(i=1;i<n;i++)
    {
        if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%min==0)sum++;
    }
    if(sum==n){
            printf("%lld\n",min);
            k=1;
    break;
    }
        }
    }
    }
    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:
.LFB0:
	.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	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	addl	$5, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %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	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movq	$0, -104(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L5
.L6:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -108(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L6
	movl	-112(%rbp), %eax
	cmpl	$1, %eax
	jne	.L7
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L7:
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -96(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L9
.L11:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cmpq	%rax, -96(%rbp)
	jle	.L10
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, -96(%rbp)
.L10:
	addl	$1, -108(%rbp)
.L9:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movl	$0, -108(%rbp)
	jmp	.L12
.L14:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L13
	addq	$1, -104(%rbp)
.L13:
	addl	$1, -108(%rbp)
.L12:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L14
	movl	-112(%rbp), %eax
	cltq
	cmpq	%rax, -104(%rbp)
	jne	.L15
	movq	-96(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L15:
	movq	$0, -88(%rbp)
	jmp	.L16
.L28:
	movq	$0, -104(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L17
.L20:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, -64(%rbp)
	cmpq	$0, -64(%rbp)
	jne	.L18
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	-96(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
	jmp	.L19
.L18:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	-64(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
.L19:
	addl	$1, -108(%rbp)
.L17:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L20
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -96(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L21
.L23:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cmpq	%rax, -96(%rbp)
	jle	.L22
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, -96(%rbp)
.L22:
	addl	$1, -108(%rbp)
.L21:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L23
	movl	$0, -108(%rbp)
	jmp	.L24
.L26:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L25
	addq	$1, -104(%rbp)
.L25:
	addl	$1, -108(%rbp)
.L24:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L26
	movl	-112(%rbp), %eax
	cltq
	cmpq	%rax, -104(%rbp)
	jne	.L27
	movq	-96(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	$1, -64(%rbp)
	jmp	.L8
.L27:
	addq	$1, -88(%rbp)
.L16:
	cmpq	$998, -88(%rbp)
	jle	.L28
.L8:
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %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
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %esi
	movq	%rsp, %rcx
	leal	5(%rsi), %eax
	cltq
	leaq	15(,%rax,8), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L43:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L43
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L44
.L4:
	leaq	7(%rsp), %rbx
	movq	%rbx, %r14
	andq	$-8, %rbx
	shrq	$3, %r14
	testl	%esi, %esi
	jle	.L5
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %esi
	addq	$8, %r15
	cmpl	%r12d, %esi
	jg	.L6
	movq	0(,%r14,8), %r8
	cmpl	$1, %esi
	je	.L41
.L7:
	cmpl	$1, %esi
	jle	.L25
	leal	-2(%rsi), %edx
	leaq	8(%rbx), %rax
	leaq	16(%rbx,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%rax), %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$8, %rax
	cmpq	%rcx, %rax
	jne	.L10
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%rbx,%rcx,8), %rax
	cqto
	idivq	%r8
	cmpq	$1, %rdx
	adcq	$0, %rdi
	addq	$1, %rcx
	cmpl	%ecx, %esi
	jg	.L12
.L9:
	movslq	%esi, %r10
	cmpq	%rdi, %r10
	je	.L41
	leal	-1(%rsi), %eax
	movq	(%rbx), %r11
	movl	$999, %r9d
	leaq	8(%rbx,%rax,8), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbx, %rcx
	testl	%esi, %esi
	jle	.L45
	.p2align 4,,10
	.p2align 3
.L18:
	movq	(%rcx), %rax
	cqto
	idivq	%r8
	testq	%rdx, %rdx
	jne	.L15
	movq	%r8, (%rcx)
	addq	$8, %rcx
	cmpq	%rcx, %rdi
	jne	.L18
.L17:
	movq	(%rbx), %r11
	movl	$1, %eax
	movq	%r11, %r8
	.p2align 4,,10
	.p2align 3
.L19:
	movq	(%rbx,%rax,8), %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$1, %rax
	cmpl	%eax, %esi
	jg	.L19
	xorl	%ecx, %ecx
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L21:
	movq	(%rbx,%rcx,8), %rax
	cqto
	idivq	%r8
	cmpq	$1, %rdx
	adcq	$0, %r12
	addq	$1, %rcx
	cmpl	%ecx, %esi
	jg	.L21
	cmpq	%r12, %r10
	je	.L41
.L22:
	subq	$1, %r9
	jne	.L14
	.p2align 4,,10
	.p2align 3
.L8:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L46
	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
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	movq	%rdx, (%rcx)
	addq	$8, %rcx
	cmpq	%rdi, %rcx
	jne	.L18
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L45:
	xorl	%r12d, %r12d
	movq	%r11, %r8
	cmpq	%r12, %r10
	jne	.L22
	.p2align 4,,10
	.p2align 3
.L41:
	movq	%r8, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L44:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movq	0(,%r14,8), %r8
	jmp	.L7
.L25:
	xorl	%edi, %edi
	jmp	.L9
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %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
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %esi
	movq	%rsp, %rcx
	leal	5(%rsi), %eax
	cltq
	leaq	15(,%rax,8), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L43:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L43
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L44
.L4:
	leaq	7(%rsp), %rbx
	movq	%rbx, %r14
	andq	$-8, %rbx
	shrq	$3, %r14
	testl	%esi, %esi
	jle	.L5
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %esi
	addq	$8, %r15
	cmpl	%r12d, %esi
	jg	.L6
	movq	0(,%r14,8), %r8
	cmpl	$1, %esi
	je	.L41
.L7:
	cmpl	$1, %esi
	jle	.L25
	leal	-2(%rsi), %edx
	leaq	8(%rbx), %rax
	leaq	16(%rbx,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%rax), %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$8, %rax
	cmpq	%rcx, %rax
	jne	.L10
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%rbx,%rcx,8), %rax
	cqto
	idivq	%r8
	cmpq	$1, %rdx
	adcq	$0, %rdi
	addq	$1, %rcx
	cmpl	%ecx, %esi
	jg	.L12
.L9:
	movslq	%esi, %r10
	cmpq	%rdi, %r10
	je	.L41
	leal	-1(%rsi), %eax
	movq	(%rbx), %r11
	movl	$999, %r9d
	leaq	8(%rbx,%rax,8), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbx, %rcx
	testl	%esi, %esi
	jle	.L45
	.p2align 4,,10
	.p2align 3
.L18:
	movq	(%rcx), %rax
	cqto
	idivq	%r8
	testq	%rdx, %rdx
	jne	.L15
	movq	%r8, (%rcx)
	addq	$8, %rcx
	cmpq	%rcx, %rdi
	jne	.L18
.L17:
	movq	(%rbx), %r11
	movl	$1, %eax
	movq	%r11, %r8
	.p2align 4,,10
	.p2align 3
.L19:
	movq	(%rbx,%rax,8), %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$1, %rax
	cmpl	%eax, %esi
	jg	.L19
	xorl	%ecx, %ecx
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L21:
	movq	(%rbx,%rcx,8), %rax
	cqto
	idivq	%r8
	cmpq	$1, %rdx
	adcq	$0, %r12
	addq	$1, %rcx
	cmpl	%ecx, %esi
	jg	.L21
	cmpq	%r12, %r10
	je	.L41
.L22:
	subq	$1, %r9
	jne	.L14
	.p2align 4,,10
	.p2align 3
.L8:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L46
	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
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	movq	%rdx, (%rcx)
	addq	$8, %rcx
	cmpq	%rdi, %rcx
	jne	.L18
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L45:
	xorl	%r12d, %r12d
	movq	%r11, %r8
	cmpq	%r12, %r10
	jne	.L22
	.p2align 4,,10
	.p2align 3
.L41:
	movq	%r8, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L44:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L5:
	movq	0(,%r14,8), %r8
	jmp	.L7
.L25:
	xorl	%edi, %edi
	jmp	.L9
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>
int main()
{
    int n,i;
    scanf("%d",&n);
    long long int a[n+5],sum=0,k,min,j;
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    if(n==1)
        printf("%lld\n",a[0]);
    else{
    min=a[0];
    for(i=1;i<n;i++)
    {
        if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%min==0)sum++;
    }
    if(sum==n)printf("%lld\n",min);
    else
    {
        for(j=0;j<999;j++)
        {
        sum=0;
        for(i=0;i<n;i++)
       {
           k=a[i]%min;
           if(k==0)a[i]=min;
           else
           a[i]=k;
       }
       min=a[0];
    for(i=1;i<n;i++)
    {
        if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%min==0)sum++;
    }
    if(sum==n){
            printf("%lld\n",min);
            k=1;
    break;
    }
        }
    }
    }
    return 0;
}

3
1000000100 1000000000 1000000000
 4
5 13 8 1000010000

100
 1

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>
int main()
{
    int n,i;
    scanf("%d",&n);
    long long int a[n+5],sum=0,k,min,j;
    for(i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }
    if(n==1)
        printf("%lld\n",a[0]);
    else{
    min=a[0];
    for(i=1;i<n;i++)
    {
        if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%min==0)sum++;
    }
    if(sum==n)printf("%lld\n",min);
    else
    {
        for(j=0;j<999;j++)
        {
        sum=0;
        for(i=0;i<n;i++)
       {
           k=a[i]%min;
           if(k==0)a[i]=min;
           else
           a[i]=k;
       }
       min=a[0];
    for(i=1;i<n;i++)
    {
        if(min>a[i])min=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]%min==0)sum++;
    }
    if(sum==n){
            printf("%lld\n",min);
            k=1;
    break;
    }
        }
    }
    }
    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:
.LFB0:
	.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	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	addl	$5, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %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	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movq	$0, -104(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L5
.L6:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -108(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L6
	movl	-112(%rbp), %eax
	cmpl	$1, %eax
	jne	.L7
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L7:
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -96(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L9
.L11:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cmpq	%rax, -96(%rbp)
	jle	.L10
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, -96(%rbp)
.L10:
	addl	$1, -108(%rbp)
.L9:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movl	$0, -108(%rbp)
	jmp	.L12
.L14:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L13
	addq	$1, -104(%rbp)
.L13:
	addl	$1, -108(%rbp)
.L12:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L14
	movl	-112(%rbp), %eax
	cltq
	cmpq	%rax, -104(%rbp)
	jne	.L15
	movq	-96(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L15:
	movq	$0, -88(%rbp)
	jmp	.L16
.L28:
	movq	$0, -104(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L17
.L20:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, -64(%rbp)
	cmpq	$0, -64(%rbp)
	jne	.L18
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	-96(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
	jmp	.L19
.L18:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	-64(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
.L19:
	addl	$1, -108(%rbp)
.L17:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L20
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -96(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L21
.L23:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cmpq	%rax, -96(%rbp)
	jle	.L22
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, -96(%rbp)
.L22:
	addl	$1, -108(%rbp)
.L21:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L23
	movl	$0, -108(%rbp)
	jmp	.L24
.L26:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L25
	addq	$1, -104(%rbp)
.L25:
	addl	$1, -108(%rbp)
.L24:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L26
	movl	-112(%rbp), %eax
	cltq
	cmpq	%rax, -104(%rbp)
	jne	.L27
	movq	-96(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	$1, -64(%rbp)
	jmp	.L8
.L27:
	addq	$1, -88(%rbp)
.L16:
	cmpq	$998, -88(%rbp)
	jle	.L28
.L8:
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
.LFB0:
	.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	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	addl	$5, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %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	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -72(%rbp)
	movq	$0, -104(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L5
.L6:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -108(%rbp)
.L5:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L6
	movl	-112(%rbp), %eax
	cmpl	$1, %eax
	jne	.L7
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L7:
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -96(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L9
.L11:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cmpq	%rax, -96(%rbp)
	jle	.L10
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, -96(%rbp)
.L10:
	addl	$1, -108(%rbp)
.L9:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movl	$0, -108(%rbp)
	jmp	.L12
.L14:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L13
	addq	$1, -104(%rbp)
.L13:
	addl	$1, -108(%rbp)
.L12:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L14
	movl	-112(%rbp), %eax
	cltq
	cmpq	%rax, -104(%rbp)
	jne	.L15
	movq	-96(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L15:
	movq	$0, -88(%rbp)
	jmp	.L16
.L28:
	movq	$0, -104(%rbp)
	movl	$0, -108(%rbp)
	jmp	.L17
.L20:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, -64(%rbp)
	cmpq	$0, -64(%rbp)
	jne	.L18
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	-96(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
	jmp	.L19
.L18:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	-64(%rbp), %rcx
	movq	%rcx, (%rax,%rdx,8)
.L19:
	addl	$1, -108(%rbp)
.L17:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L20
	movq	-72(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -96(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L21
.L23:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cmpq	%rax, -96(%rbp)
	jle	.L22
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	%rax, -96(%rbp)
.L22:
	addl	$1, -108(%rbp)
.L21:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L23
	movl	$0, -108(%rbp)
	jmp	.L24
.L26:
	movq	-72(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	cqto
	idivq	-96(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L25
	addq	$1, -104(%rbp)
.L25:
	addl	$1, -108(%rbp)
.L24:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L26
	movl	-112(%rbp), %eax
	cltq
	cmpq	%rax, -104(%rbp)
	jne	.L27
	movq	-96(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	$1, -64(%rbp)
	jmp	.L8
.L27:
	addq	$1, -88(%rbp)
.L16:
	cmpq	$998, -88(%rbp)
	jle	.L28
.L8:
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
