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 sum_taro,sum_hanako;
  int card_taro[100],card_hanako[100];
  short n,m;
  short i,j;
  int difference_sum;
  char k;
  int answer_taro,answer_hanako,answer_sum;
  short a = -1;

  while(1){
    sum_taro = 0;
    sum_hanako = 0;
    k = 0;
    scanf("%hd %hd",&n,&m);

    if(n == 0 && m == 0){
      break;
    }

    for(i = 0;i < n;i++){
      scanf("%d",&card_taro[i]);
      sum_taro = sum_taro + card_taro[i];
    }

    for(i = 0;i < m;i++){
      scanf("%d",&card_hanako[i]);
      sum_hanako = sum_hanako + card_hanako[i];
    }

    if(sum_taro >= sum_hanako){
      difference_sum = sum_taro - sum_hanako;

      for(i = 0;i < n;i++){
        for(j = 0;j < m;j++){
          if(difference_sum % 2 == 0 && difference_sum/2 == card_taro[i] - card_hanako[j]){
            if(k == 0){
              answer_sum = card_taro[i] + card_hanako[j];
              answer_taro = card_taro[i];
              answer_hanako = card_hanako[j];
              k = 1;
            }
            else{
              if(answer_sum > card_taro[i] + card_hanako[j]){
                answer_sum = card_taro[i] + card_hanako[j];
                answer_taro = card_taro[i];
                answer_hanako = card_hanako[j];
              }
            }
          }
        }
      }
    }
    else{
      difference_sum = sum_hanako - sum_taro;

      for(i = 0;i < m;i++){
        for(j = 0;j < n;j++){
          if(difference_sum % 2 == 0 && difference_sum/2 == card_hanako[i] - card_taro[j]){
            if(k == 0){
              answer_sum = card_taro[j] + card_hanako[i];
              answer_taro = card_taro[j];
              answer_hanako = card_hanako[i];
              k = 1;
            }
            else{
              if(answer_sum > card_taro[j] + card_hanako[i]){
                answer_sum = card_taro[j] + card_hanako[i];
                answer_taro = card_taro[j];
                answer_hanako = card_hanako[i];
              }
            }
          }
        }
      }
    }

    if(k == 0){
      printf("%hd\n",a);
    }
    else{
      printf("%d %d\n",answer_taro,answer_hanako);
    }
  }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%hd %hd"
.LC1:
	.string	"%d"
.LC2:
	.string	"%hd\n"
.LC3:
	.string	"%d %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	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movw	$-1, -842(%rbp)
.L24:
	movl	$0, -840(%rbp)
	movl	$0, -836(%rbp)
	movb	$0, -851(%rbp)
	leaq	-848(%rbp), %rdx
	leaq	-850(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzwl	-850(%rbp), %eax
	testw	%ax, %ax
	jne	.L2
	movzwl	-848(%rbp), %eax
	testw	%ax, %ax
	je	.L28
.L2:
	movw	$0, -846(%rbp)
	jmp	.L4
.L5:
	movswl	-846(%rbp), %eax
	leaq	-816(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -840(%rbp)
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L4:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L5
	movw	$0, -846(%rbp)
	jmp	.L6
.L7:
	movswl	-846(%rbp), %eax
	leaq	-416(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -836(%rbp)
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L6:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L7
	movl	-840(%rbp), %eax
	cmpl	-836(%rbp), %eax
	jl	.L8
	movl	-840(%rbp), %eax
	subl	-836(%rbp), %eax
	movl	%eax, -820(%rbp)
	movw	$0, -846(%rbp)
	jmp	.L9
.L14:
	movw	$0, -844(%rbp)
	jmp	.L10
.L13:
	movl	-820(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L11
	movl	-820(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cmpl	%eax, %esi
	jne	.L11
	cmpb	$0, -851(%rbp)
	jne	.L12
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
	movb	$1, -851(%rbp)
	jmp	.L11
.L12:
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -824(%rbp)
	jle	.L11
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
.L11:
	movzwl	-844(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -844(%rbp)
.L10:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -844(%rbp)
	jl	.L13
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L9:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L14
	jmp	.L15
.L8:
	movl	-836(%rbp), %eax
	subl	-840(%rbp), %eax
	movl	%eax, -820(%rbp)
	movw	$0, -846(%rbp)
	jmp	.L16
.L21:
	movw	$0, -844(%rbp)
	jmp	.L17
.L20:
	movl	-820(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L18
	movl	-820(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cmpl	%eax, %esi
	jne	.L18
	cmpb	$0, -851(%rbp)
	jne	.L19
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
	movb	$1, -851(%rbp)
	jmp	.L18
.L19:
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -824(%rbp)
	jle	.L18
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
.L18:
	movzwl	-844(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -844(%rbp)
.L17:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -844(%rbp)
	jl	.L20
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L16:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L21
.L15:
	cmpb	$0, -851(%rbp)
	jne	.L22
	movswl	-842(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L22:
	movl	-828(%rbp), %edx
	movl	-832(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L28:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	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	"%hd %hd"
.LC1:
	.string	"%d"
.LC2:
	.string	"%hd\n"
.LC3:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$872, %rsp
	.cfi_def_cfa_offset 928
	movq	%fs:40, %rax
	movq	%rax, 856(%rsp)
	xorl	%eax, %eax
	leaq	46(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	44(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpw	$0, 44(%rsp)
	jne	.L45
	cmpw	$0, 46(%rsp)
	je	.L46
	jle	.L10
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r15
.L8:
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	leaq	448(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movswq	%r14w, %rax
	movq	%r15, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzwl	46(%rsp), %esi
	movswq	%r14w, %rax
	addl	$1, %r14d
	addl	448(%rsp,%rax,4), %r13d
	cmpw	%r14w, %si
	jg	.L11
	cmpl	%r13d, %ebx
	jl	.L12
	subl	%r13d, %ebx
.L29:
	movzwl	44(%rsp), %eax
	testw	%ax, %ax
	jle	.L10
	subl	$1, %eax
	movl	%ebx, %r11d
	movl	8(%rsp), %r13d
	movl	12(%rsp), %r14d
	movzwl	%ax, %eax
	andl	$1, %r11d
	sarl	%ebx
	leaq	48(%rsp), %r10
	leaq	52(%rsp,%rax,4), %r15
	leal	-1(%rsi), %eax
	xorl	%r8d, %r8d
	movzwl	%ax, %eax
	leaq	448(%rsp), %rbp
	leaq	452(%rsp,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L13:
	testw	%si, %si
	jle	.L14
	testl	%r11d, %r11d
	jne	.L14
	movl	(%r10), %edi
	movq	%rbp, %rax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L15:
	addq	$4, %rax
	cmpq	%r9, %rax
	je	.L14
.L17:
	movl	(%rax), %edx
	movl	%edi, %ecx
	subl	%edx, %ecx
	cmpl	%ecx, %ebx
	jne	.L15
	testb	%r8b, %r8b
	jne	.L16
	addq	$4, %rax
	leal	(%rdx,%rdi), %r12d
	movl	%edx, %r14d
	movl	%edi, %r13d
	movl	$1, %r8d
	cmpq	%r9, %rax
	jne	.L17
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$4, %r10
	cmpq	%r15, %r10
	jne	.L13
.L42:
	movl	%r13d, 8(%rsp)
	movl	%r14d, 12(%rsp)
	testb	%r8b, %r8b
	je	.L10
	movl	12(%rsp), %ecx
	movl	8(%rsp), %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L16:
	leal	(%rdx,%rdi), %ecx
	cmpl	%r12d, %ecx
	jge	.L15
	movl	%ecx, %r12d
	movl	%edx, %r14d
	movl	%edi, %r13d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L45:
	jle	.L47
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	leaq	48(%rsp), %rbp
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L4:
	movswq	%r13w, %rax
	movq	%r15, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movswq	%r13w, %rax
	addl	$1, %r13d
	addl	48(%rsp,%rax,4), %ebx
	cmpw	%r13w, 44(%rsp)
	jg	.L4
	movzwl	46(%rsp), %esi
	testw	%si, %si
	jg	.L8
	testl	%ebx, %ebx
	jns	.L29
	.p2align 4,,10
	.p2align 3
.L10:
	movl	$-1, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%r13d, %ecx
	subl	%ebx, %ecx
	testw	%si, %si
	jle	.L10
	movzwl	44(%rsp), %r10d
	leal	-1(%rsi), %eax
	movl	%ecx, %r11d
	movq	%rbp, %rbx
	movzwl	%ax, %eax
	movl	8(%rsp), %r13d
	movl	12(%rsp), %r14d
	sarl	%ecx
	leaq	452(%rsp,%rax,4), %r15
	leal	-1(%r10), %eax
	andl	$1, %r11d
	xorl	%r8d, %r8d
	movzwl	%ax, %eax
	leaq	48(%rsp), %rbp
	leaq	52(%rsp,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L21:
	testw	%r10w, %r10w
	jle	.L22
	testl	%r11d, %r11d
	jne	.L22
	movl	(%rbx), %edi
	movq	%rbp, %rax
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L23:
	addq	$4, %rax
	cmpq	%rax, %r9
	je	.L22
.L25:
	movl	(%rax), %edx
	movl	%edi, %esi
	subl	%edx, %esi
	cmpl	%esi, %ecx
	jne	.L23
	testb	%r8b, %r8b
	jne	.L24
	addq	$4, %rax
	leal	(%rdi,%rdx), %r12d
	movl	%edi, %r14d
	movl	%edx, %r13d
	movl	$1, %r8d
	cmpq	%rax, %r9
	jne	.L25
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rbx
	cmpq	%r15, %rbx
	jne	.L21
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L24:
	leal	(%rdi,%rdx), %esi
	cmpl	%esi, %r12d
	jle	.L23
	movl	%esi, %r12d
	movl	%edi, %r14d
	movl	%edx, %r13d
	jmp	.L23
.L46:
	movq	856(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	addq	$872, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L47:
	.cfi_restore_state
	xorl	%ebx, %ebx
	cmpw	$0, 46(%rsp)
	leaq	.LC1(%rip), %r15
	jg	.L8
	jmp	.L10
.L48:
	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	"%hd %hd"
.LC1:
	.string	"%d"
.LC2:
	.string	"%hd\n"
.LC3:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$872, %rsp
	.cfi_def_cfa_offset 928
	movq	%fs:40, %rax
	movq	%rax, 856(%rsp)
	xorl	%eax, %eax
	leaq	46(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	44(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpw	$0, 44(%rsp)
	jne	.L45
	cmpw	$0, 46(%rsp)
	je	.L46
	jle	.L10
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r15
.L8:
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	leaq	448(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movswq	%r14w, %rax
	movq	%r15, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzwl	46(%rsp), %esi
	movswq	%r14w, %rax
	addl	$1, %r14d
	addl	448(%rsp,%rax,4), %r13d
	cmpw	%r14w, %si
	jg	.L11
	cmpl	%r13d, %ebx
	jl	.L12
	subl	%r13d, %ebx
.L29:
	movzwl	44(%rsp), %eax
	testw	%ax, %ax
	jle	.L10
	subl	$1, %eax
	movl	%ebx, %r11d
	movl	8(%rsp), %r13d
	movl	12(%rsp), %r14d
	movzwl	%ax, %eax
	andl	$1, %r11d
	sarl	%ebx
	leaq	48(%rsp), %r10
	leaq	52(%rsp,%rax,4), %r15
	leal	-1(%rsi), %eax
	xorl	%r8d, %r8d
	movzwl	%ax, %eax
	leaq	448(%rsp), %rbp
	leaq	452(%rsp,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L13:
	testw	%si, %si
	jle	.L14
	testl	%r11d, %r11d
	jne	.L14
	movl	(%r10), %edi
	movq	%rbp, %rax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L15:
	addq	$4, %rax
	cmpq	%r9, %rax
	je	.L14
.L17:
	movl	(%rax), %edx
	movl	%edi, %ecx
	subl	%edx, %ecx
	cmpl	%ecx, %ebx
	jne	.L15
	testb	%r8b, %r8b
	jne	.L16
	addq	$4, %rax
	leal	(%rdx,%rdi), %r12d
	movl	%edx, %r14d
	movl	%edi, %r13d
	movl	$1, %r8d
	cmpq	%r9, %rax
	jne	.L17
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$4, %r10
	cmpq	%r15, %r10
	jne	.L13
.L42:
	movl	%r13d, 8(%rsp)
	movl	%r14d, 12(%rsp)
	testb	%r8b, %r8b
	je	.L10
	movl	12(%rsp), %ecx
	movl	8(%rsp), %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L16:
	leal	(%rdx,%rdi), %ecx
	cmpl	%r12d, %ecx
	jge	.L15
	movl	%ecx, %r12d
	movl	%edx, %r14d
	movl	%edi, %r13d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L45:
	jle	.L47
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	leaq	48(%rsp), %rbp
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L4:
	movswq	%r13w, %rax
	movq	%r15, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movswq	%r13w, %rax
	addl	$1, %r13d
	addl	48(%rsp,%rax,4), %ebx
	cmpw	%r13w, 44(%rsp)
	jg	.L4
	movzwl	46(%rsp), %esi
	testw	%si, %si
	jg	.L8
	testl	%ebx, %ebx
	jns	.L29
	.p2align 4,,10
	.p2align 3
.L10:
	movl	$-1, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%r13d, %ecx
	subl	%ebx, %ecx
	testw	%si, %si
	jle	.L10
	movzwl	44(%rsp), %r10d
	leal	-1(%rsi), %eax
	movl	%ecx, %r11d
	movq	%rbp, %rbx
	movzwl	%ax, %eax
	movl	8(%rsp), %r13d
	movl	12(%rsp), %r14d
	sarl	%ecx
	leaq	452(%rsp,%rax,4), %r15
	leal	-1(%r10), %eax
	andl	$1, %r11d
	xorl	%r8d, %r8d
	movzwl	%ax, %eax
	leaq	48(%rsp), %rbp
	leaq	52(%rsp,%rax,4), %r9
	.p2align 4,,10
	.p2align 3
.L21:
	testw	%r10w, %r10w
	jle	.L22
	testl	%r11d, %r11d
	jne	.L22
	movl	(%rbx), %edi
	movq	%rbp, %rax
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L23:
	addq	$4, %rax
	cmpq	%rax, %r9
	je	.L22
.L25:
	movl	(%rax), %edx
	movl	%edi, %esi
	subl	%edx, %esi
	cmpl	%esi, %ecx
	jne	.L23
	testb	%r8b, %r8b
	jne	.L24
	addq	$4, %rax
	leal	(%rdi,%rdx), %r12d
	movl	%edi, %r14d
	movl	%edx, %r13d
	movl	$1, %r8d
	cmpq	%rax, %r9
	jne	.L25
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rbx
	cmpq	%r15, %rbx
	jne	.L21
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L24:
	leal	(%rdi,%rdx), %esi
	cmpl	%esi, %r12d
	jle	.L23
	movl	%esi, %r12d
	movl	%edi, %r14d
	movl	%edx, %r13d
	jmp	.L23
.L46:
	movq	856(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	addq	$872, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L47:
	.cfi_restore_state
	xorl	%ebx, %ebx
	cmpw	$0, 46(%rsp)
	leaq	.LC1(%rip), %r15
	jg	.L8
	jmp	.L10
.L48:
	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 sum_taro,sum_hanako;
  int card_taro[100],card_hanako[100];
  short n,m;
  short i,j;
  int difference_sum;
  char k;
  int answer_taro,answer_hanako,answer_sum;
  short a = -1;

  while(1){
    sum_taro = 0;
    sum_hanako = 0;
    k = 0;
    scanf("%hd %hd",&n,&m);

    if(n == 0 && m == 0){
      break;
    }

    for(i = 0;i < n;i++){
      scanf("%d",&card_taro[i]);
      sum_taro = sum_taro + card_taro[i];
    }

    for(i = 0;i < m;i++){
      scanf("%d",&card_hanako[i]);
      sum_hanako = sum_hanako + card_hanako[i];
    }

    if(sum_taro >= sum_hanako){
      difference_sum = sum_taro - sum_hanako;

      for(i = 0;i < n;i++){
        for(j = 0;j < m;j++){
          if(difference_sum % 2 == 0 && difference_sum/2 == card_taro[i] - card_hanako[j]){
            if(k == 0){
              answer_sum = card_taro[i] + card_hanako[j];
              answer_taro = card_taro[i];
              answer_hanako = card_hanako[j];
              k = 1;
            }
            else{
              if(answer_sum > card_taro[i] + card_hanako[j]){
                answer_sum = card_taro[i] + card_hanako[j];
                answer_taro = card_taro[i];
                answer_hanako = card_hanako[j];
              }
            }
          }
        }
      }
    }
    else{
      difference_sum = sum_hanako - sum_taro;

      for(i = 0;i < m;i++){
        for(j = 0;j < n;j++){
          if(difference_sum % 2 == 0 && difference_sum/2 == card_hanako[i] - card_taro[j]){
            if(k == 0){
              answer_sum = card_taro[j] + card_hanako[i];
              answer_taro = card_taro[j];
              answer_hanako = card_hanako[i];
              k = 1;
            }
            else{
              if(answer_sum > card_taro[j] + card_hanako[i]){
                answer_sum = card_taro[j] + card_hanako[i];
                answer_taro = card_taro[j];
                answer_hanako = card_hanako[i];
              }
            }
          }
        }
      }
    }

    if(k == 0){
      printf("%hd\n",a);
    }
    else{
      printf("%d %d\n",answer_taro,answer_hanako);
    }
  }

  return 0;
}
2 2
1
5
4
7
6 5
3
9
5
2
3
3
12
2
7
3
5
4 5
10
0
3
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
3
2 3
1
1
2
2
2
0 0
 2 2
1
5
4
7
6 5
3
9
5
2
3
3
12
2
7
3
5
4 5
10
0
3
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
6
2 3
1
1
2
2
2
0 0
 2 2
1
5
4
7
6 5
3
9
7
2
3
3
12
2
7
3
5
4 5
10
0
3
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
6
2 3
1
1
2
2
2
0 0
 2 2
1
5
4
7
6 5
3
9
7
2
3
3
12
2
7
3
5
4 5
10
0
2
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
6
2 3
1
1
2
2
2
0 0
 2 2
1
5
7
7
6 5
2
9
7
2
3
3
12
2
7
3
5
4 5
10
0
2
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
6
2 3
1
1
2
2
2
0 0
 2 2
1
5
4
7
6 5
3
9
5
2
3
3
11
2
7
3
5
4 5
10
0
3
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
6
2 3
1
1
2
2
2
0 0
 2 2
1
5
3
7
6 5
2
9
7
2
3
3
24
2
7
3
5
4 5
10
0
2
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
3
4
6
2 3
1
1
2
2
2
0 0
 2 2
1
5
3
7
6 5
2
9
7
2
3
3
24
2
7
3
5
4 5
10
0
2
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
2
4
6
2 3
1
1
2
2
2
0 0
 2 2
1
5
11
7
6 5
2
9
7
2
3
3
24
2
7
3
1
4 5
10
0
2
8
1
9
6
0
6
7 4
1
1
2
1
0
1
6
2
3
4
6
2 3
1
1
2
2
2
0 0
 2 2
1
5
3
7
6 5
2
9
7
2
3
3
24
2
7
3
5
4 5
10
0
2
8
1
9
6
0
6
7 4
1
1
2
1
2
1
4
2
2
4
6
2 3
1
1
4
2
2
0 0

-1
3 5
-1
2 2
-1
 -1
3 5
-1
-1
-1
 -1
2 3
-1
-1
-1
 -1
2 3
0 1
-1
-1
 -1
-1
0 1
-1
-1
 -1
-1
-1
-1
-1
 1 3
-1
0 1
-1
-1
 1 3
-1
0 1
1 2
-1
 1 7
-1
0 1
-1
-1
 1 3
-1
0 1
1 2
1 4

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 sum_taro,sum_hanako;
  int card_taro[100],card_hanako[100];
  short n,m;
  short i,j;
  int difference_sum;
  char k;
  int answer_taro,answer_hanako,answer_sum;
  short a = -1;

  while(1){
    sum_taro = 0;
    sum_hanako = 0;
    k = 0;
    scanf("%hd %hd",&n,&m);

    if(n == 0 && m == 0){
      break;
    }

    for(i = 0;i < n;i++){
      scanf("%d",&card_taro[i]);
      sum_taro = sum_taro + card_taro[i];
    }

    for(i = 0;i < m;i++){
      scanf("%d",&card_hanako[i]);
      sum_hanako = sum_hanako + card_hanako[i];
    }

    if(sum_taro >= sum_hanako){
      difference_sum = sum_taro - sum_hanako;

      for(i = 0;i < n;i++){
        for(j = 0;j < m;j++){
          if(difference_sum % 2 == 0 && difference_sum/2 == card_taro[i] - card_hanako[j]){
            if(k == 0){
              answer_sum = card_taro[i] + card_hanako[j];
              answer_taro = card_taro[i];
              answer_hanako = card_hanako[j];
              k = 1;
            }
            else{
              if(answer_sum > card_taro[i] + card_hanako[j]){
                answer_sum = card_taro[i] + card_hanako[j];
                answer_taro = card_taro[i];
                answer_hanako = card_hanako[j];
              }
            }
          }
        }
      }
    }
    else{
      difference_sum = sum_hanako - sum_taro;

      for(i = 0;i < m;i++){
        for(j = 0;j < n;j++){
          if(difference_sum % 2 == 0 && difference_sum/2 == card_hanako[i] - card_taro[j]){
            if(k == 0){
              answer_sum = card_taro[j] + card_hanako[i];
              answer_taro = card_taro[j];
              answer_hanako = card_hanako[i];
              k = 1;
            }
            else{
              if(answer_sum > card_taro[j] + card_hanako[i]){
                answer_sum = card_taro[j] + card_hanako[i];
                answer_taro = card_taro[j];
                answer_hanako = card_hanako[i];
              }
            }
          }
        }
      }
    }

    if(k == 0){
      printf("%hd\n",a);
    }
    else{
      printf("%d %d\n",answer_taro,answer_hanako);
    }
  }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%hd %hd"
.LC1:
	.string	"%d"
.LC2:
	.string	"%hd\n"
.LC3:
	.string	"%d %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	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movw	$-1, -842(%rbp)
.L24:
	movl	$0, -840(%rbp)
	movl	$0, -836(%rbp)
	movb	$0, -851(%rbp)
	leaq	-848(%rbp), %rdx
	leaq	-850(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzwl	-850(%rbp), %eax
	testw	%ax, %ax
	jne	.L2
	movzwl	-848(%rbp), %eax
	testw	%ax, %ax
	je	.L28
.L2:
	movw	$0, -846(%rbp)
	jmp	.L4
.L5:
	movswl	-846(%rbp), %eax
	leaq	-816(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -840(%rbp)
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L4:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L5
	movw	$0, -846(%rbp)
	jmp	.L6
.L7:
	movswl	-846(%rbp), %eax
	leaq	-416(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -836(%rbp)
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L6:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L7
	movl	-840(%rbp), %eax
	cmpl	-836(%rbp), %eax
	jl	.L8
	movl	-840(%rbp), %eax
	subl	-836(%rbp), %eax
	movl	%eax, -820(%rbp)
	movw	$0, -846(%rbp)
	jmp	.L9
.L14:
	movw	$0, -844(%rbp)
	jmp	.L10
.L13:
	movl	-820(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L11
	movl	-820(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cmpl	%eax, %esi
	jne	.L11
	cmpb	$0, -851(%rbp)
	jne	.L12
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
	movb	$1, -851(%rbp)
	jmp	.L11
.L12:
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -824(%rbp)
	jle	.L11
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
.L11:
	movzwl	-844(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -844(%rbp)
.L10:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -844(%rbp)
	jl	.L13
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L9:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L14
	jmp	.L15
.L8:
	movl	-836(%rbp), %eax
	subl	-840(%rbp), %eax
	movl	%eax, -820(%rbp)
	movw	$0, -846(%rbp)
	jmp	.L16
.L21:
	movw	$0, -844(%rbp)
	jmp	.L17
.L20:
	movl	-820(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L18
	movl	-820(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cmpl	%eax, %esi
	jne	.L18
	cmpb	$0, -851(%rbp)
	jne	.L19
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
	movb	$1, -851(%rbp)
	jmp	.L18
.L19:
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -824(%rbp)
	jle	.L18
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
.L18:
	movzwl	-844(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -844(%rbp)
.L17:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -844(%rbp)
	jl	.L20
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L16:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L21
.L15:
	cmpb	$0, -851(%rbp)
	jne	.L22
	movswl	-842(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L22:
	movl	-828(%rbp), %edx
	movl	-832(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L28:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	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	"%hd %hd"
.LC1:
	.string	"%d"
.LC2:
	.string	"%hd\n"
.LC3:
	.string	"%d %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	$864, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movw	$-1, -842(%rbp)
.L24:
	movl	$0, -840(%rbp)
	movl	$0, -836(%rbp)
	movb	$0, -851(%rbp)
	leaq	-848(%rbp), %rdx
	leaq	-850(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzwl	-850(%rbp), %eax
	testw	%ax, %ax
	jne	.L2
	movzwl	-848(%rbp), %eax
	testw	%ax, %ax
	je	.L28
.L2:
	movw	$0, -846(%rbp)
	jmp	.L4
.L5:
	movswl	-846(%rbp), %eax
	leaq	-816(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -840(%rbp)
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L4:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L5
	movw	$0, -846(%rbp)
	jmp	.L6
.L7:
	movswl	-846(%rbp), %eax
	leaq	-416(%rbp), %rdx
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -836(%rbp)
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L6:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L7
	movl	-840(%rbp), %eax
	cmpl	-836(%rbp), %eax
	jl	.L8
	movl	-840(%rbp), %eax
	subl	-836(%rbp), %eax
	movl	%eax, -820(%rbp)
	movw	$0, -846(%rbp)
	jmp	.L9
.L14:
	movw	$0, -844(%rbp)
	jmp	.L10
.L13:
	movl	-820(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L11
	movl	-820(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cmpl	%eax, %esi
	jne	.L11
	cmpb	$0, -851(%rbp)
	jne	.L12
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
	movb	$1, -851(%rbp)
	jmp	.L11
.L12:
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -824(%rbp)
	jle	.L11
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
.L11:
	movzwl	-844(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -844(%rbp)
.L10:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -844(%rbp)
	jl	.L13
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L9:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L14
	jmp	.L15
.L8:
	movl	-836(%rbp), %eax
	subl	-840(%rbp), %eax
	movl	%eax, -820(%rbp)
	movw	$0, -846(%rbp)
	jmp	.L16
.L21:
	movw	$0, -844(%rbp)
	jmp	.L17
.L20:
	movl	-820(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L18
	movl	-820(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %esi
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cmpl	%eax, %esi
	jne	.L18
	cmpb	$0, -851(%rbp)
	jne	.L19
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
	movb	$1, -851(%rbp)
	jmp	.L18
.L19:
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -824(%rbp)
	jle	.L18
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -824(%rbp)
	movswl	-844(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -832(%rbp)
	movswl	-846(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -828(%rbp)
.L18:
	movzwl	-844(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -844(%rbp)
.L17:
	movzwl	-850(%rbp), %eax
	cmpw	%ax, -844(%rbp)
	jl	.L20
	movzwl	-846(%rbp), %eax
	addl	$1, %eax
	movw	%ax, -846(%rbp)
.L16:
	movzwl	-848(%rbp), %eax
	cmpw	%ax, -846(%rbp)
	jl	.L21
.L15:
	cmpb	$0, -851(%rbp)
	jne	.L22
	movswl	-842(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L22:
	movl	-828(%rbp), %edx
	movl	-832(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L28:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	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:
