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(void)
{
  int n = 0, i, flag = 0;
  int a[200];

  scanf(" %d", &n);
  for (i = 0;i < n; i++)
    scanf(" %d", &a[i]);
  while(1)
  {
    i = 0;
    while (a[i] % 2 == 0)
    {
      a[i] = a[i] / 2;
      i++;
    }
    if (i >= n)
      flag++;
    else
      break ;
  }
  printf("%d\n", flag);
  return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	" %d"
.LC1:
	.string	"%d\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
	subq	$832, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -828(%rbp)
	movl	$0, -820(%rbp)
	leaq	-828(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -824(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-824(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -824(%rbp)
.L2:
	movl	-828(%rbp), %eax
	cmpl	%eax, -824(%rbp)
	jl	.L3
.L9:
	movl	$0, -824(%rbp)
	jmp	.L4
.L5:
	movl	-824(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-824(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -824(%rbp)
.L4:
	movl	-824(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-828(%rbp), %eax
	cmpl	%eax, -824(%rbp)
	jl	.L12
	addl	$1, -820(%rbp)
	jmp	.L9
.L12:
	nop
	movl	-820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.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	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$832, %rsp
	.cfi_def_cfa_offset 864
	movq	%fs:40, %rax
	movq	%rax, 824(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	movl	$0, 12(%rsp)
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edi
	testl	%edi, %edi
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.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), %edi
	addq	$4, %rbp
	cmpl	%ebx, %edi
	jg	.L3
.L2:
	movl	16(%rsp), %edx
	xorl	%r8d, %r8d
	testb	$1, %dl
	jne	.L4
	.p2align 4,,10
	.p2align 3
.L20:
	leaq	16(%rsp), %rcx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%edx, %eax
	addl	$1, %esi
	addq	$4, %rcx
	shrl	$31, %eax
	addl	%edx, %eax
	movl	(%rcx), %edx
	sarl	%eax
	movl	%eax, -4(%rcx)
	testb	$1, %dl
	je	.L5
	cmpl	%edi, %esi
	jl	.L10
	movl	16(%rsp), %edx
	addl	$1, %r8d
	testb	$1, %dl
	je	.L20
.L4:
	testl	%edi, %edi
	jg	.L10
.L7:
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	824(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$832, %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
.L21:
	.cfi_restore_state
	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	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$832, %rsp
	.cfi_def_cfa_offset 864
	movq	%fs:40, %rax
	movq	%rax, 824(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	movl	$0, 12(%rsp)
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edi
	testl	%edi, %edi
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.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), %edi
	addq	$4, %rbp
	cmpl	%ebx, %edi
	jg	.L3
.L2:
	movl	16(%rsp), %edx
	xorl	%r8d, %r8d
	testb	$1, %dl
	jne	.L4
	.p2align 4,,10
	.p2align 3
.L20:
	leaq	16(%rsp), %rcx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%edx, %eax
	addl	$1, %esi
	addq	$4, %rcx
	shrl	$31, %eax
	addl	%edx, %eax
	movl	(%rcx), %edx
	sarl	%eax
	movl	%eax, -4(%rcx)
	testb	$1, %dl
	je	.L5
	cmpl	%edi, %esi
	jl	.L10
	movl	16(%rsp), %edx
	addl	$1, %r8d
	testb	$1, %dl
	je	.L20
.L4:
	testl	%edi, %edi
	jg	.L10
.L7:
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	824(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$832, %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
.L21:
	.cfi_restore_state
	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(void)
{
  int n = 0, i, flag = 0;
  int a[200];

  scanf(" %d", &n);
  for (i = 0;i < n; i++)
    scanf(" %d", &a[i]);
  while(1)
  {
    i = 0;
    while (a[i] % 2 == 0)
    {
      a[i] = a[i] / 2;
      i++;
    }
    if (i >= n)
      flag++;
    else
      break ;
  }
  printf("%d\n", flag);
  return (0);
}
6
382253568 723152896 37802240 379425024 590201381 471526144
 3
10 12 40
 3
16 36 16
 4
5 6 13 10
 6
382253568 723152896 32183854 379425024 590201381 471526144
 4
5 6 22 10
 3
10 12 27
 6
348324507 723152896 32183854 379425024 590201381 471526144
 4
5 6 24 10
 3
10 12 31

0
 1
 2
 0
 0
 0
 0
 0
 0
 0

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(void)
{
  int n = 0, i, flag = 0;
  int a[200];

  scanf(" %d", &n);
  for (i = 0;i < n; i++)
    scanf(" %d", &a[i]);
  while(1)
  {
    i = 0;
    while (a[i] % 2 == 0)
    {
      a[i] = a[i] / 2;
      i++;
    }
    if (i >= n)
      flag++;
    else
      break ;
  }
  printf("%d\n", flag);
  return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	" %d"
.LC1:
	.string	"%d\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
	subq	$832, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -828(%rbp)
	movl	$0, -820(%rbp)
	leaq	-828(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -824(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-824(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -824(%rbp)
.L2:
	movl	-828(%rbp), %eax
	cmpl	%eax, -824(%rbp)
	jl	.L3
.L9:
	movl	$0, -824(%rbp)
	jmp	.L4
.L5:
	movl	-824(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-824(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -824(%rbp)
.L4:
	movl	-824(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-828(%rbp), %eax
	cmpl	%eax, -824(%rbp)
	jl	.L12
	addl	$1, -820(%rbp)
	jmp	.L9
.L12:
	nop
	movl	-820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.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	"%d\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
	subq	$832, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -828(%rbp)
	movl	$0, -820(%rbp)
	leaq	-828(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -824(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-824(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -824(%rbp)
.L2:
	movl	-828(%rbp), %eax
	cmpl	%eax, -824(%rbp)
	jl	.L3
.L9:
	movl	$0, -824(%rbp)
	jmp	.L4
.L5:
	movl	-824(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-824(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -824(%rbp)
.L4:
	movl	-824(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L5
	movl	-828(%rbp), %eax
	cmpl	%eax, -824(%rbp)
	jl	.L12
	addl	$1, -820(%rbp)
	jmp	.L9
.L12:
	nop
	movl	-820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.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:
