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 sum_c(int t[],int h[],int n,int m,int i,int j){
	int a,st=0,sh=0;
	for(a=0;a<n;a++){
		if(a==i)
			st+=h[j];
		else
			st+=t[a];
	}
	for(a=0;a<m;a++){
		if(a==j)
			sh+=t[i];
		else
			sh+=h[a];
	}
	return st==sh;
}
int main(void){
	int n,m,i,j,k,t[100],h[100],sum,anst,ansh;
	while(1){
		scanf("%d %d",&n,&m);
		if(!(n+m))
			break;
		sum=201;
		anst=ansh=101;
		for(i=0;i<n;i++)
			scanf("%d",&t[i]);
		for(i=0;i<m;i++)
			scanf("%d",&h[i]);
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				if(sum_c(t,h,n,m,i,j)&&sum>t[i]+h[j]){
					anst=t[i];
					ansh=h[j];
					sum=anst+ansh;
				}
			}
		}
		if(sum!=201)
			printf("%d %d\n",anst,ansh);
		else
			puts("-1");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sum_c
	.type	sum_c, @function
sum_c:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	%ecx, -40(%rbp)
	movl	%r8d, -44(%rbp)
	movl	%r9d, -48(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	movl	-12(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jne	.L3
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -8(%rbp)
	jmp	.L4
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -8(%rbp)
.L4:
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L5
	movl	$0, -12(%rbp)
	jmp	.L6
.L9:
	movl	-12(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jne	.L7
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -4(%rbp)
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -4(%rbp)
.L8:
	addl	$1, -12(%rbp)
.L6:
	movl	-12(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jl	.L9
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sum_c, .-sum_c
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"-1"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L25:
	leaq	-840(%rbp), %rdx
	leaq	-844(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-844(%rbp), %edx
	movl	-840(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	je	.L29
	movl	$201, -828(%rbp)
	movl	$101, -820(%rbp)
	movl	-820(%rbp), %eax
	movl	%eax, -824(%rbp)
	movl	$0, -836(%rbp)
	jmp	.L14
.L15:
	leaq	-816(%rbp), %rdx
	movl	-836(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -836(%rbp)
.L14:
	movl	-844(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L15
	movl	$0, -836(%rbp)
	jmp	.L16
.L17:
	leaq	-416(%rbp), %rdx
	movl	-836(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -836(%rbp)
.L16:
	movl	-840(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L17
	movl	$0, -836(%rbp)
	jmp	.L18
.L22:
	movl	$0, -832(%rbp)
	jmp	.L19
.L21:
	movl	-840(%rbp), %ecx
	movl	-844(%rbp), %edx
	movl	-832(%rbp), %r8d
	movl	-836(%rbp), %edi
	leaq	-416(%rbp), %rsi
	leaq	-816(%rbp), %rax
	movl	%r8d, %r9d
	movl	%edi, %r8d
	movq	%rax, %rdi
	call	sum_c
	testl	%eax, %eax
	je	.L20
	movl	-836(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-832(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -828(%rbp)
	jle	.L20
	movl	-836(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -820(%rbp)
	movl	-824(%rbp), %edx
	movl	-820(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -828(%rbp)
.L20:
	addl	$1, -832(%rbp)
.L19:
	movl	-840(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L21
	addl	$1, -836(%rbp)
.L18:
	movl	-844(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L22
	cmpl	$201, -828(%rbp)
	je	.L23
	movl	-820(%rbp), %edx
	movl	-824(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L25
.L23:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L25
.L29:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.globl	sum_c
	.type	sum_c, @function
sum_c:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%ecx, %r10d
	testl	%edx, %edx
	jle	.L10
	movslq	%r9d, %rax
	movslq	%edx, %rdx
	xorl	%ecx, %ecx
	leaq	(%rsi,%rax,4), %r11
	xorl	%eax, %eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	addl	(%rdi,%rax,4), %ecx
	addq	$1, %rax
	cmpq	%rax, %rdx
	je	.L2
.L5:
	cmpl	%eax, %r8d
	jne	.L3
	addq	$1, %rax
	addl	(%r11), %ecx
	cmpq	%rax, %rdx
	jne	.L5
.L2:
	testl	%r10d, %r10d
	jle	.L11
.L15:
	movslq	%r8d, %r8
	xorl	%eax, %eax
	xorl	%edx, %edx
	leaq	(%rdi,%r8,4), %r8
	movslq	%r10d, %rdi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	addl	(%rsi,%rax,4), %edx
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L6
.L9:
	cmpl	%eax, %r9d
	jne	.L7
	addq	$1, %rax
	addl	(%r8), %edx
	cmpq	%rax, %rdi
	jne	.L9
.L6:
	xorl	%eax, %eax
	cmpl	%edx, %ecx
	sete	%al
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%ecx, %ecx
	testl	%r10d, %r10d
	jg	.L15
.L11:
	xorl	%edx, %edx
	xorl	%eax, %eax
	cmpl	%edx, %ecx
	sete	%al
	ret
	.cfi_endproc
.LFE23:
	.size	sum_c, .-sum_c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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
	leaq	.LC1(%rip), %rbx
	subq	$856, %rsp
	.cfi_def_cfa_offset 912
	movq	%fs:40, %rax
	movq	%rax, 840(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, (%rsp)
.L17:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %edx
	movl	28(%rsp), %eax
	movl	%edx, %edi
	addl	%eax, %edi
	je	.L18
	testl	%edx, %edx
	jle	.L19
	leaq	32(%rsp), %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %ebp
	addq	$4, %r13
	cmpl	%r12d, %ebp
	jg	.L20
	movl	28(%rsp), %r12d
	testl	%r12d, %r12d
	jle	.L21
.L37:
	leaq	432(%rsp), %r13
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r12d
	addq	$4, %r13
	cmpl	%ebp, %r12d
	jg	.L22
	movl	24(%rsp), %ebp
.L21:
	testl	%ebp, %ebp
	jle	.L23
	leaq	32(%rsp), %r9
	movl	$101, %r14d
	xorl	%edi, %edi
	movslq	%r12d, %rsi
	movq	%r9, %r10
	movl	$101, %r13d
	movl	$201, %r11d
	movslq	%ebp, %r8
	.p2align 4,,10
	.p2align 3
.L24:
	xorl	%ecx, %ecx
	testl	%r12d, %r12d
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L32:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L25:
	addl	(%r9,%rax,4), %edx
	addq	$1, %rax
	cmpq	%rax, %r8
	je	.L52
.L27:
	cmpl	%eax, %edi
	jne	.L25
	addq	$1, %rax
	addl	432(%rsp,%rcx,4), %edx
	cmpq	%rax, %r8
	jne	.L27
.L52:
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L28:
	addl	432(%rsp,%rax,4), %r15d
	addq	$1, %rax
	cmpq	%rsi, %rax
	je	.L53
.L30:
	cmpl	%ecx, %eax
	jne	.L28
	addq	$1, %rax
	addl	(%r10), %r15d
	cmpq	%rsi, %rax
	jne	.L30
.L53:
	cmpl	%r15d, %edx
	jne	.L31
	movl	(%r10), %edx
	movl	432(%rsp,%rcx,4), %r15d
	leal	(%rdx,%r15), %eax
	cmpl	%r11d, %eax
	jge	.L31
	movl	%r15d, %r14d
	movl	%edx, %r13d
	movl	%eax, %r11d
.L31:
	addq	$1, %rcx
	cmpq	%rcx, %rsi
	jne	.L32
.L35:
	addl	$1, %edi
	addq	$4, %r10
	cmpl	%edi, %ebp
	jne	.L24
	cmpl	$201, %r11d
	je	.L23
	movl	%r14d, %ecx
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L17
.L19:
	testl	%eax, %eax
	jg	.L37
.L23:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L17
.L18:
	movq	840(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$856, %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
.L54:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
	.p2align 4
	.globl	sum_c
	.type	sum_c, @function
sum_c:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%ecx, %r10d
	testl	%edx, %edx
	jle	.L10
	movslq	%r9d, %rax
	movslq	%edx, %rdx
	xorl	%ecx, %ecx
	leaq	(%rsi,%rax,4), %r11
	xorl	%eax, %eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	addl	(%rdi,%rax,4), %ecx
	addq	$1, %rax
	cmpq	%rax, %rdx
	je	.L2
.L5:
	cmpl	%eax, %r8d
	jne	.L3
	addq	$1, %rax
	addl	(%r11), %ecx
	cmpq	%rax, %rdx
	jne	.L5
.L2:
	testl	%r10d, %r10d
	jle	.L11
.L15:
	movslq	%r8d, %r8
	xorl	%eax, %eax
	xorl	%edx, %edx
	leaq	(%rdi,%r8,4), %r8
	movslq	%r10d, %rdi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	addl	(%rsi,%rax,4), %edx
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L6
.L9:
	cmpl	%eax, %r9d
	jne	.L7
	addq	$1, %rax
	addl	(%r8), %edx
	cmpq	%rax, %rdi
	jne	.L9
.L6:
	xorl	%eax, %eax
	cmpl	%edx, %ecx
	sete	%al
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%ecx, %ecx
	testl	%r10d, %r10d
	jg	.L15
.L11:
	xorl	%edx, %edx
	xorl	%eax, %eax
	cmpl	%edx, %ecx
	sete	%al
	ret
	.cfi_endproc
.LFE23:
	.size	sum_c, .-sum_c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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
	leaq	.LC1(%rip), %rbx
	subq	$856, %rsp
	.cfi_def_cfa_offset 912
	movq	%fs:40, %rax
	movq	%rax, 840(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, (%rsp)
.L17:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %edx
	movl	28(%rsp), %eax
	movl	%edx, %edi
	addl	%eax, %edi
	je	.L18
	testl	%edx, %edx
	jle	.L19
	leaq	32(%rsp), %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %ebp
	addq	$4, %r13
	cmpl	%r12d, %ebp
	jg	.L20
	movl	28(%rsp), %r12d
	testl	%r12d, %r12d
	jle	.L21
.L37:
	leaq	432(%rsp), %r13
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r12d
	addq	$4, %r13
	cmpl	%ebp, %r12d
	jg	.L22
	movl	24(%rsp), %ebp
.L21:
	testl	%ebp, %ebp
	jle	.L23
	leaq	32(%rsp), %r9
	movl	$101, %r14d
	xorl	%edi, %edi
	movslq	%r12d, %rsi
	movq	%r9, %r10
	movl	$101, %r13d
	movl	$201, %r11d
	movslq	%ebp, %r8
	.p2align 4,,10
	.p2align 3
.L24:
	xorl	%ecx, %ecx
	testl	%r12d, %r12d
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L32:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L25:
	addl	(%r9,%rax,4), %edx
	addq	$1, %rax
	cmpq	%rax, %r8
	je	.L52
.L27:
	cmpl	%eax, %edi
	jne	.L25
	addq	$1, %rax
	addl	432(%rsp,%rcx,4), %edx
	cmpq	%rax, %r8
	jne	.L27
.L52:
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L28:
	addl	432(%rsp,%rax,4), %r15d
	addq	$1, %rax
	cmpq	%rsi, %rax
	je	.L53
.L30:
	cmpl	%ecx, %eax
	jne	.L28
	addq	$1, %rax
	addl	(%r10), %r15d
	cmpq	%rsi, %rax
	jne	.L30
.L53:
	cmpl	%r15d, %edx
	jne	.L31
	movl	(%r10), %edx
	movl	432(%rsp,%rcx,4), %r15d
	leal	(%rdx,%r15), %eax
	cmpl	%r11d, %eax
	jge	.L31
	movl	%r15d, %r14d
	movl	%edx, %r13d
	movl	%eax, %r11d
.L31:
	addq	$1, %rcx
	cmpq	%rcx, %rsi
	jne	.L32
.L35:
	addl	$1, %edi
	addq	$4, %r10
	cmpl	%edi, %ebp
	jne	.L24
	cmpl	$201, %r11d
	je	.L23
	movl	%r14d, %ecx
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L17
.L19:
	testl	%eax, %eax
	jg	.L37
.L23:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L17
.L18:
	movq	840(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	addq	$856, %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
.L54:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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 sum_c(int t[],int h[],int n,int m,int i,int j){
	int a,st=0,sh=0;
	for(a=0;a<n;a++){
		if(a==i)
			st+=h[j];
		else
			st+=t[a];
	}
	for(a=0;a<m;a++){
		if(a==j)
			sh+=t[i];
		else
			sh+=h[a];
	}
	return st==sh;
}
int main(void){
	int n,m,i,j,k,t[100],h[100],sum,anst,ansh;
	while(1){
		scanf("%d %d",&n,&m);
		if(!(n+m))
			break;
		sum=201;
		anst=ansh=101;
		for(i=0;i<n;i++)
			scanf("%d",&t[i]);
		for(i=0;i<m;i++)
			scanf("%d",&h[i]);
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				if(sum_c(t,h,n,m,i,j)&&sum>t[i]+h[j]){
					anst=t[i];
					ansh=h[j];
					sum=anst+ansh;
				}
			}
		}
		if(sum!=201)
			printf("%d %d\n",anst,ansh);
		else
			puts("-1");
	}
	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 sum_c(int t[],int h[],int n,int m,int i,int j){
	int a,st=0,sh=0;
	for(a=0;a<n;a++){
		if(a==i)
			st+=h[j];
		else
			st+=t[a];
	}
	for(a=0;a<m;a++){
		if(a==j)
			sh+=t[i];
		else
			sh+=h[a];
	}
	return st==sh;
}
int main(void){
	int n,m,i,j,k,t[100],h[100],sum,anst,ansh;
	while(1){
		scanf("%d %d",&n,&m);
		if(!(n+m))
			break;
		sum=201;
		anst=ansh=101;
		for(i=0;i<n;i++)
			scanf("%d",&t[i]);
		for(i=0;i<m;i++)
			scanf("%d",&h[i]);
		for(i=0;i<n;i++){
			for(j=0;j<m;j++){
				if(sum_c(t,h,n,m,i,j)&&sum>t[i]+h[j]){
					anst=t[i];
					ansh=h[j];
					sum=anst+ansh;
				}
			}
		}
		if(sum!=201)
			printf("%d %d\n",anst,ansh);
		else
			puts("-1");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sum_c
	.type	sum_c, @function
sum_c:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	%ecx, -40(%rbp)
	movl	%r8d, -44(%rbp)
	movl	%r9d, -48(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	movl	-12(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jne	.L3
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -8(%rbp)
	jmp	.L4
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -8(%rbp)
.L4:
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L5
	movl	$0, -12(%rbp)
	jmp	.L6
.L9:
	movl	-12(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jne	.L7
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -4(%rbp)
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -4(%rbp)
.L8:
	addl	$1, -12(%rbp)
.L6:
	movl	-12(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jl	.L9
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sum_c, .-sum_c
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"-1"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L25:
	leaq	-840(%rbp), %rdx
	leaq	-844(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-844(%rbp), %edx
	movl	-840(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	je	.L29
	movl	$201, -828(%rbp)
	movl	$101, -820(%rbp)
	movl	-820(%rbp), %eax
	movl	%eax, -824(%rbp)
	movl	$0, -836(%rbp)
	jmp	.L14
.L15:
	leaq	-816(%rbp), %rdx
	movl	-836(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -836(%rbp)
.L14:
	movl	-844(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L15
	movl	$0, -836(%rbp)
	jmp	.L16
.L17:
	leaq	-416(%rbp), %rdx
	movl	-836(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -836(%rbp)
.L16:
	movl	-840(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L17
	movl	$0, -836(%rbp)
	jmp	.L18
.L22:
	movl	$0, -832(%rbp)
	jmp	.L19
.L21:
	movl	-840(%rbp), %ecx
	movl	-844(%rbp), %edx
	movl	-832(%rbp), %r8d
	movl	-836(%rbp), %edi
	leaq	-416(%rbp), %rsi
	leaq	-816(%rbp), %rax
	movl	%r8d, %r9d
	movl	%edi, %r8d
	movq	%rax, %rdi
	call	sum_c
	testl	%eax, %eax
	je	.L20
	movl	-836(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-832(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -828(%rbp)
	jle	.L20
	movl	-836(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -820(%rbp)
	movl	-824(%rbp), %edx
	movl	-820(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -828(%rbp)
.L20:
	addl	$1, -832(%rbp)
.L19:
	movl	-840(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L21
	addl	$1, -836(%rbp)
.L18:
	movl	-844(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L22
	cmpl	$201, -828(%rbp)
	je	.L23
	movl	-820(%rbp), %edx
	movl	-824(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L25
.L23:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L25
.L29:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	sum_c
	.type	sum_c, @function
sum_c:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	%ecx, -40(%rbp)
	movl	%r8d, -44(%rbp)
	movl	%r9d, -48(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	movl	-12(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jne	.L3
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -8(%rbp)
	jmp	.L4
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -8(%rbp)
.L4:
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L5
	movl	$0, -12(%rbp)
	jmp	.L6
.L9:
	movl	-12(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jne	.L7
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -4(%rbp)
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	%eax, -4(%rbp)
.L8:
	addl	$1, -12(%rbp)
.L6:
	movl	-12(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jl	.L9
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	sete	%al
	movzbl	%al, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	sum_c, .-sum_c
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d\n"
.LC3:
	.string	"-1"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L25:
	leaq	-840(%rbp), %rdx
	leaq	-844(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-844(%rbp), %edx
	movl	-840(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	je	.L29
	movl	$201, -828(%rbp)
	movl	$101, -820(%rbp)
	movl	-820(%rbp), %eax
	movl	%eax, -824(%rbp)
	movl	$0, -836(%rbp)
	jmp	.L14
.L15:
	leaq	-816(%rbp), %rdx
	movl	-836(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -836(%rbp)
.L14:
	movl	-844(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L15
	movl	$0, -836(%rbp)
	jmp	.L16
.L17:
	leaq	-416(%rbp), %rdx
	movl	-836(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -836(%rbp)
.L16:
	movl	-840(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L17
	movl	$0, -836(%rbp)
	jmp	.L18
.L22:
	movl	$0, -832(%rbp)
	jmp	.L19
.L21:
	movl	-840(%rbp), %ecx
	movl	-844(%rbp), %edx
	movl	-832(%rbp), %r8d
	movl	-836(%rbp), %edi
	leaq	-416(%rbp), %rsi
	leaq	-816(%rbp), %rax
	movl	%r8d, %r9d
	movl	%edi, %r8d
	movq	%rax, %rdi
	call	sum_c
	testl	%eax, %eax
	je	.L20
	movl	-836(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-832(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	cmpl	%eax, -828(%rbp)
	jle	.L20
	movl	-836(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -824(%rbp)
	movl	-832(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movl	%eax, -820(%rbp)
	movl	-824(%rbp), %edx
	movl	-820(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -828(%rbp)
.L20:
	addl	$1, -832(%rbp)
.L19:
	movl	-840(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L21
	addl	$1, -836(%rbp)
.L18:
	movl	-844(%rbp), %eax
	cmpl	%eax, -836(%rbp)
	jl	.L22
	cmpl	$201, -828(%rbp)
	je	.L23
	movl	-820(%rbp), %edx
	movl	-824(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L25
.L23:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L25
.L29:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
