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 N,ans=0,alice=0,bob=0,turn=0;

int main(){
  scanf("%d",&N);
  int aN[N];
  for (int i = 0; i < N; i++)
  {
    scanf("%d",&aN[i]);
  }
  int n = N;
  while (n > 0)
  {
    if(turn == 0){
      int max=0;
      int del=0;
      for (int i = 0; i < N; i++)
      {
        if(max < aN[i]){
          max = aN[i];
          del = i;
        }
      }
      alice += max;
      aN[del] = 0;
      turn = 1;
    }else if (turn == 1)
    {
      int max = 0;
      int del = 0;
      for (int i = 0; i < N; i++)
      {
        if(max < aN[i]){
          max = aN[i];
          del = i;
        }
      }
      bob += max;
      aN[del] = 0;
      turn = 0;
    }
    n--;
  }
  ans = alice - bob;
  printf("%d",ans);
  return 0;
}




```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	alice
	.align 4
	.type	alice, @object
	.size	alice, 4
alice:
	.zero	4
	.globl	bob
	.align 4
	.type	bob, @object
	.size	bob, 4
bob:
	.zero	4
	.globl	turn
	.align 4
	.type	turn, @object
	.size	turn, 4
turn:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
	.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	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %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, -104(%rbp)
	jmp	.L5
.L6:
	movl	-104(%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
	addl	$1, -104(%rbp)
.L5:
	movl	N(%rip), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L6
	movl	N(%rip), %eax
	movl	%eax, -100(%rbp)
	jmp	.L7
.L16:
	movl	turn(%rip), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, -96(%rbp)
	movl	$0, -92(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L9
.L11:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -96(%rbp)
	jge	.L10
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -96(%rbp)
	movl	-88(%rbp), %eax
	movl	%eax, -92(%rbp)
.L10:
	addl	$1, -88(%rbp)
.L9:
	movl	N(%rip), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L11
	movl	alice(%rip), %edx
	movl	-96(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, alice(%rip)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movl	$1, turn(%rip)
	jmp	.L12
.L8:
	movl	turn(%rip), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	$0, -84(%rbp)
	movl	$0, -80(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L13
.L15:
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -84(%rbp)
	jge	.L14
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -84(%rbp)
	movl	-76(%rbp), %eax
	movl	%eax, -80(%rbp)
.L14:
	addl	$1, -76(%rbp)
.L13:
	movl	N(%rip), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L15
	movl	bob(%rip), %edx
	movl	-84(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, bob(%rip)
	movq	-64(%rbp), %rax
	movl	-80(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movl	$0, turn(%rip)
.L12:
	subl	$1, -100(%rbp)
.L7:
	cmpl	$0, -100(%rbp)
	jg	.L16
	movl	alice(%rip), %eax
	movl	bob(%rip), %edx
	subl	%edx, %eax
	movl	%eax, ans(%rip)
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%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	.L18
	call	__stack_chk_fail@PLT
.L18:
	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"
	.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	N(%rip), %rsi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	pushq	%r13
	movq	%r14, %rdi
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	N(%rip), %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
.L40:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L40
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L41
.L4:
	movq	%rsp, %rbx
	movl	alice(%rip), %edx
	xorl	%r12d, %r12d
	movq	%rbx, %r13
	testl	%ecx, %ecx
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edi
	addq	$4, %r13
	cmpl	%r12d, %edi
	jg	.L7
	movl	alice(%rip), %edx
	movl	bob(%rip), %r11d
	movl	%edx, %r10d
	testl	%edi, %edi
	jle	.L6
	movl	turn(%rip), %ecx
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	movslq	%edi, %r8
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	$1, %ecx
	je	.L42
.L12:
	subl	$1, %edi
	je	.L43
.L15:
	testl	%ecx, %ecx
	jne	.L9
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	movl	(%rbx,%rax,4), %esi
	cmpl	%esi, %ecx
	jge	.L10
	movslq	%eax, %r9
	movl	%esi, %ecx
.L10:
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L11
	addl	%ecx, %r10d
	movl	$1, %r12d
	movl	$1, %eax
	movl	$0, (%rbx,%r9,4)
	movl	$1, %ecx
	subl	$1, %edi
	jne	.L15
.L43:
	testb	%r13b, %r13b
	je	.L16
	movl	%r11d, bob(%rip)
.L16:
	testb	%r12b, %r12b
	je	.L17
	movl	%r10d, alice(%rip)
	movl	%r10d, %edx
.L17:
	testb	%al, %al
	je	.L6
	movl	%ecx, turn(%rip)
.L6:
	subl	bob(%rip), %edx
	xorl	%eax, %eax
	movq	%r14, %rsi
	movl	$1, %edi
	movl	%edx, ans(%rip)
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L44
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L42:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rbx,%rax,4), %ecx
	cmpl	%ecx, %esi
	jge	.L13
	movslq	%eax, %r9
	movl	%ecx, %esi
.L13:
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L14
	addl	%esi, %r11d
	movl	$1, %r13d
	movl	$1, %eax
	xorl	%ecx, %ecx
	movl	$0, (%rbx,%r9,4)
	jmp	.L12
.L41:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L44:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	turn
	.bss
	.align 4
	.type	turn, @object
	.size	turn, 4
turn:
	.zero	4
	.globl	bob
	.align 4
	.type	bob, @object
	.size	bob, 4
bob:
	.zero	4
	.globl	alice
	.align 4
	.type	alice, @object
	.size	alice, 4
alice:
	.zero	4
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	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
.LC0:
	.string	"%d"
	.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	N(%rip), %rsi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	pushq	%r13
	movq	%r14, %rdi
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	N(%rip), %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
.L40:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L40
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L41
.L4:
	movq	%rsp, %rbx
	movl	alice(%rip), %edx
	xorl	%r12d, %r12d
	movq	%rbx, %r13
	testl	%ecx, %ecx
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edi
	addq	$4, %r13
	cmpl	%r12d, %edi
	jg	.L7
	movl	alice(%rip), %edx
	movl	bob(%rip), %r11d
	movl	%edx, %r10d
	testl	%edi, %edi
	jle	.L6
	movl	turn(%rip), %ecx
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	movslq	%edi, %r8
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	$1, %ecx
	je	.L42
.L12:
	subl	$1, %edi
	je	.L43
.L15:
	testl	%ecx, %ecx
	jne	.L9
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	movl	(%rbx,%rax,4), %esi
	cmpl	%esi, %ecx
	jge	.L10
	movslq	%eax, %r9
	movl	%esi, %ecx
.L10:
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L11
	addl	%ecx, %r10d
	movl	$1, %r12d
	movl	$1, %eax
	movl	$0, (%rbx,%r9,4)
	movl	$1, %ecx
	subl	$1, %edi
	jne	.L15
.L43:
	testb	%r13b, %r13b
	je	.L16
	movl	%r11d, bob(%rip)
.L16:
	testb	%r12b, %r12b
	je	.L17
	movl	%r10d, alice(%rip)
	movl	%r10d, %edx
.L17:
	testb	%al, %al
	je	.L6
	movl	%ecx, turn(%rip)
.L6:
	subl	bob(%rip), %edx
	xorl	%eax, %eax
	movq	%r14, %rsi
	movl	$1, %edi
	movl	%edx, ans(%rip)
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L44
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L42:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rbx,%rax,4), %ecx
	cmpl	%ecx, %esi
	jge	.L13
	movslq	%eax, %r9
	movl	%ecx, %esi
.L13:
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L14
	addl	%esi, %r11d
	movl	$1, %r13d
	movl	$1, %eax
	xorl	%ecx, %ecx
	movl	$0, (%rbx,%r9,4)
	jmp	.L12
.L41:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L44:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	turn
	.bss
	.align 4
	.type	turn, @object
	.size	turn, 4
turn:
	.zero	4
	.globl	bob
	.align 4
	.type	bob, @object
	.size	bob, 4
bob:
	.zero	4
	.globl	alice
	.align 4
	.type	alice, @object
	.size	alice, 4
alice:
	.zero	4
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	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>


int N,ans=0,alice=0,bob=0,turn=0;

int main(){
  scanf("%d",&N);
  int aN[N];
  for (int i = 0; i < N; i++)
  {
    scanf("%d",&aN[i]);
  }
  int n = N;
  while (n > 0)
  {
    if(turn == 0){
      int max=0;
      int del=0;
      for (int i = 0; i < N; i++)
      {
        if(max < aN[i]){
          max = aN[i];
          del = i;
        }
      }
      alice += max;
      aN[del] = 0;
      turn = 1;
    }else if (turn == 1)
    {
      int max = 0;
      int del = 0;
      for (int i = 0; i < N; i++)
      {
        if(max < aN[i]){
          max = aN[i];
          del = i;
        }
      }
      bob += max;
      aN[del] = 0;
      turn = 0;
    }
    n--;
  }
  ans = alice - bob;
  printf("%d",ans);
  return 0;
}





4
20 18 2 12
 2
2 1
 3
3 7 4
 4
20 1 2 12
 2
2 0
 3
3 9 4
 4
20 1 4 12
 2
2 -1
 2
4 -1
 4
20 2 0 12

12 1 6 9 2 8 11 2 4 10
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 N,ans=0,alice=0,bob=0,turn=0;

int main(){
  scanf("%d",&N);
  int aN[N];
  for (int i = 0; i < N; i++)
  {
    scanf("%d",&aN[i]);
  }
  int n = N;
  while (n > 0)
  {
    if(turn == 0){
      int max=0;
      int del=0;
      for (int i = 0; i < N; i++)
      {
        if(max < aN[i]){
          max = aN[i];
          del = i;
        }
      }
      alice += max;
      aN[del] = 0;
      turn = 1;
    }else if (turn == 1)
    {
      int max = 0;
      int del = 0;
      for (int i = 0; i < N; i++)
      {
        if(max < aN[i]){
          max = aN[i];
          del = i;
        }
      }
      bob += max;
      aN[del] = 0;
      turn = 0;
    }
    n--;
  }
  ans = alice - bob;
  printf("%d",ans);
  return 0;
}




```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	alice
	.align 4
	.type	alice, @object
	.size	alice, 4
alice:
	.zero	4
	.globl	bob
	.align 4
	.type	bob, @object
	.size	bob, 4
bob:
	.zero	4
	.globl	turn
	.align 4
	.type	turn, @object
	.size	turn, 4
turn:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
	.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	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %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, -104(%rbp)
	jmp	.L5
.L6:
	movl	-104(%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
	addl	$1, -104(%rbp)
.L5:
	movl	N(%rip), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L6
	movl	N(%rip), %eax
	movl	%eax, -100(%rbp)
	jmp	.L7
.L16:
	movl	turn(%rip), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, -96(%rbp)
	movl	$0, -92(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L9
.L11:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -96(%rbp)
	jge	.L10
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -96(%rbp)
	movl	-88(%rbp), %eax
	movl	%eax, -92(%rbp)
.L10:
	addl	$1, -88(%rbp)
.L9:
	movl	N(%rip), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L11
	movl	alice(%rip), %edx
	movl	-96(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, alice(%rip)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movl	$1, turn(%rip)
	jmp	.L12
.L8:
	movl	turn(%rip), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	$0, -84(%rbp)
	movl	$0, -80(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L13
.L15:
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -84(%rbp)
	jge	.L14
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -84(%rbp)
	movl	-76(%rbp), %eax
	movl	%eax, -80(%rbp)
.L14:
	addl	$1, -76(%rbp)
.L13:
	movl	N(%rip), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L15
	movl	bob(%rip), %edx
	movl	-84(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, bob(%rip)
	movq	-64(%rbp), %rax
	movl	-80(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movl	$0, turn(%rip)
.L12:
	subl	$1, -100(%rbp)
.L7:
	cmpl	$0, -100(%rbp)
	jg	.L16
	movl	alice(%rip), %eax
	movl	bob(%rip), %edx
	subl	%edx, %eax
	movl	%eax, ans(%rip)
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%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	.L18
	call	__stack_chk_fail@PLT
.L18:
	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
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	alice
	.align 4
	.type	alice, @object
	.size	alice, 4
alice:
	.zero	4
	.globl	bob
	.align 4
	.type	bob, @object
	.size	bob, 4
bob:
	.zero	4
	.globl	turn
	.align 4
	.type	turn, @object
	.size	turn, 4
turn:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
	.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	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %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, -104(%rbp)
	jmp	.L5
.L6:
	movl	-104(%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
	addl	$1, -104(%rbp)
.L5:
	movl	N(%rip), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L6
	movl	N(%rip), %eax
	movl	%eax, -100(%rbp)
	jmp	.L7
.L16:
	movl	turn(%rip), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, -96(%rbp)
	movl	$0, -92(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L9
.L11:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -96(%rbp)
	jge	.L10
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -96(%rbp)
	movl	-88(%rbp), %eax
	movl	%eax, -92(%rbp)
.L10:
	addl	$1, -88(%rbp)
.L9:
	movl	N(%rip), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L11
	movl	alice(%rip), %edx
	movl	-96(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, alice(%rip)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movl	$1, turn(%rip)
	jmp	.L12
.L8:
	movl	turn(%rip), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	$0, -84(%rbp)
	movl	$0, -80(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L13
.L15:
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -84(%rbp)
	jge	.L14
	movq	-64(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -84(%rbp)
	movl	-76(%rbp), %eax
	movl	%eax, -80(%rbp)
.L14:
	addl	$1, -76(%rbp)
.L13:
	movl	N(%rip), %eax
	cmpl	%eax, -76(%rbp)
	jl	.L15
	movl	bob(%rip), %edx
	movl	-84(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, bob(%rip)
	movq	-64(%rbp), %rax
	movl	-80(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movl	$0, turn(%rip)
.L12:
	subl	$1, -100(%rbp)
.L7:
	cmpl	$0, -100(%rbp)
	jg	.L16
	movl	alice(%rip), %eax
	movl	bob(%rip), %edx
	subl	%edx, %eax
	movl	%eax, ans(%rip)
	movl	ans(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%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	.L18
	call	__stack_chk_fail@PLT
.L18:
	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:
