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,m,t[128],h[128],ts,hs,i,cn,dif,yn;
	while(scanf("%d%d",&n,&m) , n != 0){
		yn = 0;
		for(i = 0;i <= 127;i++){
			t[i] = 0;h[i] = 0;
		}
		ts=0;hs=0;
		for(i = 1;i <= n;i++){
			scanf("%d",&cn);
			t[cn]++;
			ts+=cn;
		}
		for(i = 1;i <= m;i++){
			scanf("%d",&cn);
			h[cn]++;
			hs+=cn;
		}
		if((ts - hs) % 2 != 0){printf("-1\n");continue;}
		if(ts >= hs){
			dif = (ts - hs) / 2;
			for(i = 0;i + dif <= 100;i++){
				if(t[i+dif] && h[i]){
					printf("%d %d\n",i+dif,i);yn = 1;break;
				}
			}
		}
		if(ts < hs){
			dif = (hs - ts) / 2;
			for(i = 0;i + dif <= 100;i++){
				if(t[i] && h[i+dif]){
					printf("%d %d\n",i,i+dif);yn = 1;break;
				}
			}
		}
		if(yn == 0){printf("-1\n");}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"-1"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"%d%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
	subq	$1072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L18:
	movl	$0, -1048(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L3
.L4:
	movl	-1052(%rbp), %eax
	cltq
	movl	$0, -1040(%rbp,%rax,4)
	movl	-1052(%rbp), %eax
	cltq
	movl	$0, -528(%rbp,%rax,4)
	addl	$1, -1052(%rbp)
.L3:
	cmpl	$127, -1052(%rbp)
	jle	.L4
	movl	$0, -1060(%rbp)
	movl	$0, -1056(%rbp)
	movl	$1, -1052(%rbp)
	jmp	.L5
.L6:
	leaq	-1064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1040(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	movl	-1064(%rbp), %eax
	addl	%eax, -1060(%rbp)
	addl	$1, -1052(%rbp)
.L5:
	movl	-1072(%rbp), %eax
	cmpl	%eax, -1052(%rbp)
	jle	.L6
	movl	$1, -1052(%rbp)
	jmp	.L7
.L8:
	leaq	-1064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	movl	-1064(%rbp), %eax
	addl	%eax, -1056(%rbp)
	addl	$1, -1052(%rbp)
.L7:
	movl	-1068(%rbp), %eax
	cmpl	%eax, -1052(%rbp)
	jle	.L8
	movl	-1060(%rbp), %eax
	subl	-1056(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L9:
	movl	-1060(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jl	.L10
	movl	-1060(%rbp), %eax
	subl	-1056(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1044(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L11
.L13:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1052(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-1052(%rbp), %eax
	movl	%eax, %edx
	movl	%ecx, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -1048(%rbp)
	jmp	.L10
.L12:
	addl	$1, -1052(%rbp)
.L11:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cmpl	$100, %eax
	jle	.L13
.L10:
	movl	-1060(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jge	.L14
	movl	-1056(%rbp), %eax
	subl	-1060(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1044(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L15
.L17:
	movl	-1052(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%eax, %edx
	movl	-1052(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -1048(%rbp)
	jmp	.L14
.L16:
	addl	$1, -1052(%rbp)
.L15:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cmpl	$100, %eax
	jle	.L17
.L14:
	cmpl	$0, -1048(%rbp)
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	-1068(%rbp), %rdx
	leaq	-1072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1072(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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	"-1"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"%d%d"
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1096, %rsp
	.cfi_def_cfa_offset 1152
	movq	%fs:40, %rax
	movq	%rax, 1080(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	48(%rsp), %r13
	movq	%rax, 24(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 16(%rsp)
.L2:
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %edx
	testl	%edx, %edx
	je	.L30
	movl	$0, %eax
	movl	$64, %ecx
	movq	%r13, %rdi
	rep stosq
	leaq	560(%rsp), %rdi
	movl	$64, %ecx
	movq	%rdi, 8(%rsp)
	rep stosq
	jle	.L3
	movl	$1, %r14d
	xorl	%ebx, %ebx
	leaq	44(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %rcx
	addl	$1, 48(%rsp,%rcx,4)
	addl	%ecx, %ebx
	cmpl	%r14d, 36(%rsp)
	jge	.L4
	movl	40(%rsp), %r14d
	testl	%r14d, %r14d
	jle	.L21
.L18:
	movl	$1, %r14d
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %rcx
	addl	$1, 560(%rsp,%rcx,4)
	addl	%ecx, %r15d
	cmpl	%r14d, 40(%rsp)
	jge	.L6
	movl	%ebx, %eax
	subl	%r15d, %eax
.L5:
	testb	$1, %al
	jne	.L17
	cmpl	%r15d, %ebx
	jge	.L9
	movl	%r15d, %r8d
	subl	%ebx, %r8d
	movl	%r8d, %edx
	sarl	%edx
	cmpl	$201, %r8d
	jg	.L17
	movq	8(%rsp), %rbx
	movslq	%edx, %rax
	movl	$101, %ecx
	subl	%edx, %ecx
	leaq	(%rbx,%rax,4), %rsi
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L15:
	movl	0(%r13,%rax,4), %r10d
	leal	(%rdx,%rax), %r9d
	testl	%r10d, %r10d
	je	.L14
	movl	(%rsi,%rax,4), %edi
	testl	%edi, %edi
	jne	.L31
.L14:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L15
.L17:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L2
.L9:
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%eax, %edx
	sarl	%edx
	cmpl	$201, %eax
	jg	.L17
.L19:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rcx,%rax,4), %ebx
	testl	%ebx, %ebx
	je	.L12
	movq	8(%rsp), %rbx
	movl	(%rbx,%rax,4), %r11d
	testl	%r11d, %r11d
	jne	.L32
.L12:
	addl	$1, %edx
	addq	$1, %rax
	cmpl	$100, %edx
	jle	.L13
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L2
.L30:
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L33
	addq	$1096, %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
.L3:
	.cfi_restore_state
	movl	40(%rsp), %eax
	xorl	%ebx, %ebx
	leaq	44(%rsp), %rbp
	xorl	%edx, %edx
	testl	%eax, %eax
	jg	.L18
	jmp	.L19
.L21:
	movl	%ebx, %eax
	xorl	%r15d, %r15d
	jmp	.L5
.L32:
	movl	%eax, %ecx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L31:
	movl	%eax, %edx
	movl	%r9d, %ecx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L2
.L33:
	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	"-1"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"%d%d"
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1096, %rsp
	.cfi_def_cfa_offset 1152
	movq	%fs:40, %rax
	movq	%rax, 1080(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	48(%rsp), %r13
	movq	%rax, 24(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 16(%rsp)
.L2:
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %edx
	testl	%edx, %edx
	je	.L30
	movl	$0, %eax
	movl	$64, %ecx
	movq	%r13, %rdi
	rep stosq
	leaq	560(%rsp), %rdi
	movl	$64, %ecx
	movq	%rdi, 8(%rsp)
	rep stosq
	jle	.L3
	movl	$1, %r14d
	xorl	%ebx, %ebx
	leaq	44(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %rcx
	addl	$1, 48(%rsp,%rcx,4)
	addl	%ecx, %ebx
	cmpl	%r14d, 36(%rsp)
	jge	.L4
	movl	40(%rsp), %r14d
	testl	%r14d, %r14d
	jle	.L21
.L18:
	movl	$1, %r14d
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %rcx
	addl	$1, 560(%rsp,%rcx,4)
	addl	%ecx, %r15d
	cmpl	%r14d, 40(%rsp)
	jge	.L6
	movl	%ebx, %eax
	subl	%r15d, %eax
.L5:
	testb	$1, %al
	jne	.L17
	cmpl	%r15d, %ebx
	jge	.L9
	movl	%r15d, %r8d
	subl	%ebx, %r8d
	movl	%r8d, %edx
	sarl	%edx
	cmpl	$201, %r8d
	jg	.L17
	movq	8(%rsp), %rbx
	movslq	%edx, %rax
	movl	$101, %ecx
	subl	%edx, %ecx
	leaq	(%rbx,%rax,4), %rsi
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L15:
	movl	0(%r13,%rax,4), %r10d
	leal	(%rdx,%rax), %r9d
	testl	%r10d, %r10d
	je	.L14
	movl	(%rsi,%rax,4), %edi
	testl	%edi, %edi
	jne	.L31
.L14:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L15
.L17:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L2
.L9:
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%eax, %edx
	sarl	%edx
	cmpl	$201, %eax
	jg	.L17
.L19:
	movslq	%edx, %rax
	leaq	0(%r13,%rax,4), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rcx,%rax,4), %ebx
	testl	%ebx, %ebx
	je	.L12
	movq	8(%rsp), %rbx
	movl	(%rbx,%rax,4), %r11d
	testl	%r11d, %r11d
	jne	.L32
.L12:
	addl	$1, %edx
	addq	$1, %rax
	cmpl	$100, %edx
	jle	.L13
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L2
.L30:
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L33
	addq	$1096, %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
.L3:
	.cfi_restore_state
	movl	40(%rsp), %eax
	xorl	%ebx, %ebx
	leaq	44(%rsp), %rbp
	xorl	%edx, %edx
	testl	%eax, %eax
	jg	.L18
	jmp	.L19
.L21:
	movl	%ebx, %eax
	xorl	%r15d, %r15d
	jmp	.L5
.L32:
	movl	%eax, %ecx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L31:
	movl	%eax, %edx
	movl	%r9d, %ecx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L2
.L33:
	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,m,t[128],h[128],ts,hs,i,cn,dif,yn;
	while(scanf("%d%d",&n,&m) , n != 0){
		yn = 0;
		for(i = 0;i <= 127;i++){
			t[i] = 0;h[i] = 0;
		}
		ts=0;hs=0;
		for(i = 1;i <= n;i++){
			scanf("%d",&cn);
			t[cn]++;
			ts+=cn;
		}
		for(i = 1;i <= m;i++){
			scanf("%d",&cn);
			h[cn]++;
			hs+=cn;
		}
		if((ts - hs) % 2 != 0){printf("-1\n");continue;}
		if(ts >= hs){
			dif = (ts - hs) / 2;
			for(i = 0;i + dif <= 100;i++){
				if(t[i+dif] && h[i]){
					printf("%d %d\n",i+dif,i);yn = 1;break;
				}
			}
		}
		if(ts < hs){
			dif = (hs - ts) / 2;
			for(i = 0;i + dif <= 100;i++){
				if(t[i] && h[i+dif]){
					printf("%d %d\n",i,i+dif);yn = 1;break;
				}
			}
		}
		if(yn == 0){printf("-1\n");}
	}
	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(void) {
	int n,m,t[128],h[128],ts,hs,i,cn,dif,yn;
	while(scanf("%d%d",&n,&m) , n != 0){
		yn = 0;
		for(i = 0;i <= 127;i++){
			t[i] = 0;h[i] = 0;
		}
		ts=0;hs=0;
		for(i = 1;i <= n;i++){
			scanf("%d",&cn);
			t[cn]++;
			ts+=cn;
		}
		for(i = 1;i <= m;i++){
			scanf("%d",&cn);
			h[cn]++;
			hs+=cn;
		}
		if((ts - hs) % 2 != 0){printf("-1\n");continue;}
		if(ts >= hs){
			dif = (ts - hs) / 2;
			for(i = 0;i + dif <= 100;i++){
				if(t[i+dif] && h[i]){
					printf("%d %d\n",i+dif,i);yn = 1;break;
				}
			}
		}
		if(ts < hs){
			dif = (hs - ts) / 2;
			for(i = 0;i + dif <= 100;i++){
				if(t[i] && h[i+dif]){
					printf("%d %d\n",i,i+dif);yn = 1;break;
				}
			}
		}
		if(yn == 0){printf("-1\n");}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"-1"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"%d%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
	subq	$1072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L18:
	movl	$0, -1048(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L3
.L4:
	movl	-1052(%rbp), %eax
	cltq
	movl	$0, -1040(%rbp,%rax,4)
	movl	-1052(%rbp), %eax
	cltq
	movl	$0, -528(%rbp,%rax,4)
	addl	$1, -1052(%rbp)
.L3:
	cmpl	$127, -1052(%rbp)
	jle	.L4
	movl	$0, -1060(%rbp)
	movl	$0, -1056(%rbp)
	movl	$1, -1052(%rbp)
	jmp	.L5
.L6:
	leaq	-1064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1040(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	movl	-1064(%rbp), %eax
	addl	%eax, -1060(%rbp)
	addl	$1, -1052(%rbp)
.L5:
	movl	-1072(%rbp), %eax
	cmpl	%eax, -1052(%rbp)
	jle	.L6
	movl	$1, -1052(%rbp)
	jmp	.L7
.L8:
	leaq	-1064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	movl	-1064(%rbp), %eax
	addl	%eax, -1056(%rbp)
	addl	$1, -1052(%rbp)
.L7:
	movl	-1068(%rbp), %eax
	cmpl	%eax, -1052(%rbp)
	jle	.L8
	movl	-1060(%rbp), %eax
	subl	-1056(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L9:
	movl	-1060(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jl	.L10
	movl	-1060(%rbp), %eax
	subl	-1056(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1044(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L11
.L13:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1052(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-1052(%rbp), %eax
	movl	%eax, %edx
	movl	%ecx, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -1048(%rbp)
	jmp	.L10
.L12:
	addl	$1, -1052(%rbp)
.L11:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cmpl	$100, %eax
	jle	.L13
.L10:
	movl	-1060(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jge	.L14
	movl	-1056(%rbp), %eax
	subl	-1060(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1044(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L15
.L17:
	movl	-1052(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%eax, %edx
	movl	-1052(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -1048(%rbp)
	jmp	.L14
.L16:
	addl	$1, -1052(%rbp)
.L15:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cmpl	$100, %eax
	jle	.L17
.L14:
	cmpl	$0, -1048(%rbp)
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	-1068(%rbp), %rdx
	leaq	-1072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1072(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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	"-1"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"%d%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
	subq	$1072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L18:
	movl	$0, -1048(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L3
.L4:
	movl	-1052(%rbp), %eax
	cltq
	movl	$0, -1040(%rbp,%rax,4)
	movl	-1052(%rbp), %eax
	cltq
	movl	$0, -528(%rbp,%rax,4)
	addl	$1, -1052(%rbp)
.L3:
	cmpl	$127, -1052(%rbp)
	jle	.L4
	movl	$0, -1060(%rbp)
	movl	$0, -1056(%rbp)
	movl	$1, -1052(%rbp)
	jmp	.L5
.L6:
	leaq	-1064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1040(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -1040(%rbp,%rax,4)
	movl	-1064(%rbp), %eax
	addl	%eax, -1060(%rbp)
	addl	$1, -1052(%rbp)
.L5:
	movl	-1072(%rbp), %eax
	cmpl	%eax, -1052(%rbp)
	jle	.L6
	movl	$1, -1052(%rbp)
	jmp	.L7
.L8:
	leaq	-1064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	movl	-1064(%rbp), %eax
	addl	%eax, -1056(%rbp)
	addl	$1, -1052(%rbp)
.L7:
	movl	-1068(%rbp), %eax
	cmpl	%eax, -1052(%rbp)
	jle	.L8
	movl	-1060(%rbp), %eax
	subl	-1056(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L9:
	movl	-1060(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jl	.L10
	movl	-1060(%rbp), %eax
	subl	-1056(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1044(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L11
.L13:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1052(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-1052(%rbp), %eax
	movl	%eax, %edx
	movl	%ecx, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -1048(%rbp)
	jmp	.L10
.L12:
	addl	$1, -1052(%rbp)
.L11:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cmpl	$100, %eax
	jle	.L13
.L10:
	movl	-1060(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jge	.L14
	movl	-1056(%rbp), %eax
	subl	-1060(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1044(%rbp)
	movl	$0, -1052(%rbp)
	jmp	.L15
.L17:
	movl	-1052(%rbp), %eax
	cltq
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%eax, %edx
	movl	-1052(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -1048(%rbp)
	jmp	.L14
.L16:
	addl	$1, -1052(%rbp)
.L15:
	movl	-1052(%rbp), %edx
	movl	-1044(%rbp), %eax
	addl	%edx, %eax
	cmpl	$100, %eax
	jle	.L17
.L14:
	cmpl	$0, -1048(%rbp)
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	-1068(%rbp), %rdx
	leaq	-1072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1072(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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:
