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>
#include <string.h>

int main(void)
{
	int n, m, k;
	int a[300000], b[300000];
	int i, ans, k2, an, bn;

	scanf("%d%d%d", &n, &m, &k);

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

	k2 = k;
	an = 0;
	for (i = 0; i < n; i++)
	{
		k2 -= a[i];
		if(k2 >= 0) an++;
		else
		{
			k2 += a[i];
			break;
		}
	}
	bn = 0;
	for (i = 0; i < m; i++)
	{
		k2 -= b[i];
		if(k2 >= 0) bn++;
		else
		{
			k2 += b[i];
			break;
		}
	}
	ans = an + bn;
	for (;;)
	{
		if (an > 0)
		{
			an--;
			k2 += a[an];
		}
		else
		{
			break;
		}

		for (i = bn; i < m; i++)
		{
			k2 -= b[i];
			if(k2 >= 0) bn++;
			else
			{
				k2 += b[i];
				break;
			}
		}
		if (ans < an + bn) ans = an + bn;
	}


	printf("%d\n", ans);

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-2396160(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3888, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2400040(%rbp), %rcx
	leaq	-2400044(%rbp), %rdx
	leaq	-2400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2400036(%rbp)
	jmp	.L2
.L3:
	leaq	-2400016(%rbp), %rdx
	movl	-2400036(%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, -2400036(%rbp)
.L2:
	movl	-2400048(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L3
	movl	$0, -2400036(%rbp)
	jmp	.L4
.L5:
	leaq	-1200016(%rbp), %rdx
	movl	-2400036(%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, -2400036(%rbp)
.L4:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L5
	movl	-2400040(%rbp), %eax
	movl	%eax, -2400028(%rbp)
	movl	$0, -2400024(%rbp)
	movl	$0, -2400036(%rbp)
	jmp	.L6
.L10:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L7
	addl	$1, -2400024(%rbp)
	jmp	.L28
.L7:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L9
.L28:
	addl	$1, -2400036(%rbp)
.L6:
	movl	-2400048(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L10
.L9:
	movl	$0, -2400020(%rbp)
	movl	$0, -2400036(%rbp)
	jmp	.L11
.L15:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L12
	addl	$1, -2400020(%rbp)
	jmp	.L29
.L12:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L14
.L29:
	addl	$1, -2400036(%rbp)
.L11:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L15
.L14:
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -2400032(%rbp)
.L25:
	cmpl	$0, -2400024(%rbp)
	jle	.L31
	subl	$1, -2400024(%rbp)
	movl	-2400024(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	movl	-2400020(%rbp), %eax
	movl	%eax, -2400036(%rbp)
	jmp	.L19
.L23:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L20
	addl	$1, -2400020(%rbp)
	jmp	.L30
.L20:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L22
.L30:
	addl	$1, -2400036(%rbp)
.L19:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L23
.L22:
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -2400032(%rbp)
	jge	.L25
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -2400032(%rbp)
	jmp	.L25
.L31:
	nop
	movl	-2400032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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%d%d"
.LC1:
	.string	"%d"
.LC4:
	.string	"%d\n"
	.section	.text.unlikely,"ax",@progbits
.LCOLDB5:
	.section	.text.startup,"ax",@progbits
.LHOTB5:
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-2396160(%rsp), %r11
	.cfi_def_cfa 11, 2396192
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3872, %rsp
	.cfi_def_cfa_offset 2400064
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 2400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, 4(%rsp)
	jg	.L3
.L2:
	movl	8(%rsp), %edi
	testl	%edi, %edi
	jle	.L4
	leaq	1200016(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %edi
	addq	$4, %rbp
	cmpl	%ebx, %edi
	jg	.L5
	movslq	4(%rsp), %r8
	movl	12(%rsp), %ecx
	testl	%r8d, %r8d
	jle	.L6
.L32:
	movl	$1, %edx
	leaq	16(%rsp), %r9
	movl	%ecx, %esi
	subl	16(%rsp), %esi
	jns	.L8
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%esi, %ecx
	subl	(%r9,%rdx,4), %ecx
	addq	$1, %rdx
	testl	%ecx, %ecx
	js	.L9
	movl	%ecx, %esi
.L8:
	movl	%edx, %eax
	cmpq	%r8, %rdx
	jne	.L11
.L9:
	testl	%edi, %edi
	jle	.L36
	movl	%esi, %ecx
	subl	1200016(%rsp), %ecx
	js	.L36
.L30:
	movslq	%edi, %r9
	movl	$1, %edx
	leaq	1200016(%rsp), %r10
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%ecx, %r8d
	subl	(%r10,%rdx,4), %r8d
	addq	$1, %rdx
	testl	%r8d, %r8d
	js	.L12
	movl	%r8d, %ecx
.L10:
	movl	%edx, %esi
	cmpq	%r9, %rdx
	jne	.L13
.L12:
	leal	(%rsi,%rax), %r11d
	testl	%eax, %eax
	je	.L14
.L29:
	subl	$1, %eax
	leaq	16(%rsp), %rbx
	leaq	1200016(%rsp), %r8
	movslq	%eax, %r9
	movl	(%rbx,%r9,4), %eax
	movl	%r9d, %edx
	movl	%r9d, %r10d
	addl	%ecx, %eax
	cmpl	%edi, %esi
	jge	.L15
	.p2align 4,,10
	.p2align 3
.L56:
	movslq	%esi, %rdx
	movl	%eax, %ecx
	subl	1200016(%rsp,%rdx,4), %ecx
	js	.L35
	leal	1(%rsi), %eax
	cltq
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%ecx, %edx
	subl	(%r8,%rax,4), %edx
	addq	$1, %rax
	testl	%edx, %edx
	js	.L16
	movl	%edx, %ecx
.L17:
	movl	%eax, %esi
	cmpl	%eax, %edi
	jg	.L18
.L16:
	leal	(%rsi,%r10), %eax
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
	testl	%r9d, %r9d
	je	.L14
	subq	$1, %r9
	movl	(%rbx,%r9,4), %eax
	movl	%r9d, %edx
	movl	%r9d, %r10d
	addl	%ecx, %eax
	cmpl	%edi, %esi
	jl	.L56
.L15:
	leal	(%r9,%rsi), %eax
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
	testl	%r9d, %r9d
	je	.L14
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L24
	movd	%edx, %xmm4
	movd	%esi, %xmm5
	movl	%edx, %ecx
	xorl	%eax, %eax
	movd	%r11d, %xmm7
	pshufd	$0, %xmm4, %xmm2
	pshufd	$0, %xmm5, %xmm6
	shrl	$2, %ecx
	paddd	.LC2(%rip), %xmm2
	movdqa	.LC3(%rip), %xmm5
	pshufd	$0, %xmm7, %xmm1
	pcmpeqd	%xmm4, %xmm4
	jmp	.L19
.L4:
	movslq	4(%rsp), %r8
	movl	12(%rsp), %ecx
	testl	%r8d, %r8d
	jg	.L32
.L28:
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L14:
	xorl	%eax, %eax
	movl	%r11d, %edx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	2400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L57
	addq	$2400032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	movl	%eax, %ecx
	jmp	.L16
.L36:
	movl	%esi, %ecx
	movl	%eax, %r11d
	xorl	%esi, %esi
	jmp	.L29
.L6:
	testl	%edi, %edi
	jle	.L28
	xorl	%eax, %eax
	subl	1200016(%rsp), %ecx
	jns	.L30
	xorl	%r11d, %r11d
	jmp	.L14
.L57:
	call	__stack_chk_fail@PLT
.L24:
	leal	-1(%r10), %eax
	leal	(%rsi,%rax), %edx
	cmpl	%edx, %r11d
	cmovl	%edx, %r11d
	testl	%eax, %eax
	jne	.L51
	jmp	.L14
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	main.cold, @function
main.cold:
.LFSB35:
.L19:
	.cfi_def_cfa_offset 2400064
	.cfi_offset 3, -32
	.cfi_offset 6, -24
	.cfi_offset 12, -16
	movdqa	%xmm2, %xmm0
	addl	$1, %eax
	paddd	%xmm5, %xmm2
	paddd	%xmm4, %xmm0
	paddd	%xmm6, %xmm0
	movdqa	%xmm0, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm0
	pandn	%xmm1, %xmm3
	por	%xmm0, %xmm3
	movdqa	%xmm3, %xmm1
	cmpl	%eax, %ecx
	jne	.L19
	movdqa	%xmm3, %xmm2
	movl	%edx, %eax
	psrldq	$8, %xmm2
	andl	$-4, %eax
	movdqa	%xmm2, %xmm0
	subl	%eax, %r10d
	pcmpgtd	%xmm3, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm3, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %r11d
	cmpl	%edx, %eax
	je	.L14
	jmp	.L24
.L51:
	leal	-2(%r10), %eax
	leal	(%rsi,%rax), %edx
	cmpl	%edx, %r11d
	cmovl	%edx, %r11d
	testl	%eax, %eax
	je	.L14
	leal	-3(%r10,%rsi), %eax
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
	jmp	.L14
	.cfi_endproc
.LFE35:
	.section	.text.startup
	.size	main, .-main
	.section	.text.unlikely
	.size	main.cold, .-main.cold
.LCOLDE5:
	.section	.text.startup
.LHOTE5:
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	0
	.long	-1
	.long	-2
	.long	-3
	.align 16
.LC3:
	.long	-4
	.long	-4
	.long	-4
	.long	-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%d%d"
.LC1:
	.string	"%d"
.LC4:
	.string	"%d\n"
	.section	.text.unlikely,"ax",@progbits
.LCOLDB5:
	.section	.text.startup,"ax",@progbits
.LHOTB5:
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-2396160(%rsp), %r11
	.cfi_def_cfa 11, 2396192
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3872, %rsp
	.cfi_def_cfa_offset 2400064
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 2400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, 4(%rsp)
	jg	.L3
.L2:
	movl	8(%rsp), %edi
	testl	%edi, %edi
	jle	.L4
	leaq	1200016(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %edi
	addq	$4, %rbp
	cmpl	%ebx, %edi
	jg	.L5
	movslq	4(%rsp), %r8
	movl	12(%rsp), %ecx
	testl	%r8d, %r8d
	jle	.L6
.L32:
	movl	$1, %edx
	leaq	16(%rsp), %r9
	movl	%ecx, %esi
	subl	16(%rsp), %esi
	jns	.L8
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%esi, %ecx
	subl	(%r9,%rdx,4), %ecx
	addq	$1, %rdx
	testl	%ecx, %ecx
	js	.L9
	movl	%ecx, %esi
.L8:
	movl	%edx, %eax
	cmpq	%r8, %rdx
	jne	.L11
.L9:
	testl	%edi, %edi
	jle	.L36
	movl	%esi, %ecx
	subl	1200016(%rsp), %ecx
	js	.L36
.L30:
	movslq	%edi, %r9
	movl	$1, %edx
	leaq	1200016(%rsp), %r10
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%ecx, %r8d
	subl	(%r10,%rdx,4), %r8d
	addq	$1, %rdx
	testl	%r8d, %r8d
	js	.L12
	movl	%r8d, %ecx
.L10:
	movl	%edx, %esi
	cmpq	%r9, %rdx
	jne	.L13
.L12:
	leal	(%rsi,%rax), %r11d
	testl	%eax, %eax
	je	.L14
.L29:
	subl	$1, %eax
	leaq	16(%rsp), %rbx
	leaq	1200016(%rsp), %r8
	movslq	%eax, %r9
	movl	(%rbx,%r9,4), %eax
	movl	%r9d, %edx
	movl	%r9d, %r10d
	addl	%ecx, %eax
	cmpl	%edi, %esi
	jge	.L15
	.p2align 4,,10
	.p2align 3
.L56:
	movslq	%esi, %rdx
	movl	%eax, %ecx
	subl	1200016(%rsp,%rdx,4), %ecx
	js	.L35
	leal	1(%rsi), %eax
	cltq
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%ecx, %edx
	subl	(%r8,%rax,4), %edx
	addq	$1, %rax
	testl	%edx, %edx
	js	.L16
	movl	%edx, %ecx
.L17:
	movl	%eax, %esi
	cmpl	%eax, %edi
	jg	.L18
.L16:
	leal	(%rsi,%r10), %eax
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
	testl	%r9d, %r9d
	je	.L14
	subq	$1, %r9
	movl	(%rbx,%r9,4), %eax
	movl	%r9d, %edx
	movl	%r9d, %r10d
	addl	%ecx, %eax
	cmpl	%edi, %esi
	jl	.L56
.L15:
	leal	(%r9,%rsi), %eax
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
	testl	%r9d, %r9d
	je	.L14
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L24
	movd	%edx, %xmm4
	movd	%esi, %xmm5
	movl	%edx, %ecx
	xorl	%eax, %eax
	movd	%r11d, %xmm7
	pshufd	$0, %xmm4, %xmm2
	pshufd	$0, %xmm5, %xmm6
	shrl	$2, %ecx
	paddd	.LC2(%rip), %xmm2
	movdqa	.LC3(%rip), %xmm5
	pshufd	$0, %xmm7, %xmm1
	pcmpeqd	%xmm4, %xmm4
	jmp	.L19
.L4:
	movslq	4(%rsp), %r8
	movl	12(%rsp), %ecx
	testl	%r8d, %r8d
	jg	.L32
.L28:
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L14:
	xorl	%eax, %eax
	movl	%r11d, %edx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	2400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L57
	addq	$2400032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	movl	%eax, %ecx
	jmp	.L16
.L36:
	movl	%esi, %ecx
	movl	%eax, %r11d
	xorl	%esi, %esi
	jmp	.L29
.L6:
	testl	%edi, %edi
	jle	.L28
	xorl	%eax, %eax
	subl	1200016(%rsp), %ecx
	jns	.L30
	xorl	%r11d, %r11d
	jmp	.L14
.L57:
	call	__stack_chk_fail@PLT
.L24:
	leal	-1(%r10), %eax
	leal	(%rsi,%rax), %edx
	cmpl	%edx, %r11d
	cmovl	%edx, %r11d
	testl	%eax, %eax
	jne	.L51
	jmp	.L14
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	main.cold, @function
main.cold:
.LFSB35:
.L19:
	.cfi_def_cfa_offset 2400064
	.cfi_offset 3, -32
	.cfi_offset 6, -24
	.cfi_offset 12, -16
	movdqa	%xmm2, %xmm0
	addl	$1, %eax
	paddd	%xmm5, %xmm2
	paddd	%xmm4, %xmm0
	paddd	%xmm6, %xmm0
	movdqa	%xmm0, %xmm3
	pcmpgtd	%xmm1, %xmm3
	pand	%xmm3, %xmm0
	pandn	%xmm1, %xmm3
	por	%xmm0, %xmm3
	movdqa	%xmm3, %xmm1
	cmpl	%eax, %ecx
	jne	.L19
	movdqa	%xmm3, %xmm2
	movl	%edx, %eax
	psrldq	$8, %xmm2
	andl	$-4, %eax
	movdqa	%xmm2, %xmm0
	subl	%eax, %r10d
	pcmpgtd	%xmm3, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm3, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %r11d
	cmpl	%edx, %eax
	je	.L14
	jmp	.L24
.L51:
	leal	-2(%r10), %eax
	leal	(%rsi,%rax), %edx
	cmpl	%edx, %r11d
	cmovl	%edx, %r11d
	testl	%eax, %eax
	je	.L14
	leal	-3(%r10,%rsi), %eax
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
	jmp	.L14
	.cfi_endproc
.LFE35:
	.section	.text.startup
	.size	main, .-main
	.section	.text.unlikely
	.size	main.cold, .-main.cold
.LCOLDE5:
	.section	.text.startup
.LHOTE5:
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	0
	.long	-1
	.long	-2
	.long	-3
	.align 16
.LC3:
	.long	-4
	.long	-4
	.long	-4
	.long	-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>
#include <string.h>

int main(void)
{
	int n, m, k;
	int a[300000], b[300000];
	int i, ans, k2, an, bn;

	scanf("%d%d%d", &n, &m, &k);

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

	k2 = k;
	an = 0;
	for (i = 0; i < n; i++)
	{
		k2 -= a[i];
		if(k2 >= 0) an++;
		else
		{
			k2 += a[i];
			break;
		}
	}
	bn = 0;
	for (i = 0; i < m; i++)
	{
		k2 -= b[i];
		if(k2 >= 0) bn++;
		else
		{
			k2 += b[i];
			break;
		}
	}
	ans = an + bn;
	for (;;)
	{
		if (an > 0)
		{
			an--;
			k2 += a[an];
		}
		else
		{
			break;
		}

		for (i = bn; i < m; i++)
		{
			k2 -= b[i];
			if(k2 >= 0) bn++;
			else
			{
				k2 += b[i];
				break;
			}
		}
		if (ans < an + bn) ans = an + bn;
	}


	printf("%d\n", ans);

	return 0;
}

5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000010 1000000000
 3 4 194
60 90 120
80 150 80 150
 3 4 730
60 9 120
80 150 80 150
 3 4 194
60 90 120
80 34 80 150
 3 4 376
60 9 120
80 150 80 150
 3 4 449
60 9 120
80 150 80 150
 3 3 100
96 16 120
30 94 80 150
 3 4 730
60 90 120
85 150 80 150
 3 4 194
60 90 120
80 35 80 150
 3 4 100
60 9 120
80 150 80 150

0
 2
 7
 3
 4
 5
 1
 6
 3
 2

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>
#include <string.h>

int main(void)
{
	int n, m, k;
	int a[300000], b[300000];
	int i, ans, k2, an, bn;

	scanf("%d%d%d", &n, &m, &k);

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

	k2 = k;
	an = 0;
	for (i = 0; i < n; i++)
	{
		k2 -= a[i];
		if(k2 >= 0) an++;
		else
		{
			k2 += a[i];
			break;
		}
	}
	bn = 0;
	for (i = 0; i < m; i++)
	{
		k2 -= b[i];
		if(k2 >= 0) bn++;
		else
		{
			k2 += b[i];
			break;
		}
	}
	ans = an + bn;
	for (;;)
	{
		if (an > 0)
		{
			an--;
			k2 += a[an];
		}
		else
		{
			break;
		}

		for (i = bn; i < m; i++)
		{
			k2 -= b[i];
			if(k2 >= 0) bn++;
			else
			{
				k2 += b[i];
				break;
			}
		}
		if (ans < an + bn) ans = an + bn;
	}


	printf("%d\n", ans);

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-2396160(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3888, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2400040(%rbp), %rcx
	leaq	-2400044(%rbp), %rdx
	leaq	-2400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2400036(%rbp)
	jmp	.L2
.L3:
	leaq	-2400016(%rbp), %rdx
	movl	-2400036(%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, -2400036(%rbp)
.L2:
	movl	-2400048(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L3
	movl	$0, -2400036(%rbp)
	jmp	.L4
.L5:
	leaq	-1200016(%rbp), %rdx
	movl	-2400036(%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, -2400036(%rbp)
.L4:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L5
	movl	-2400040(%rbp), %eax
	movl	%eax, -2400028(%rbp)
	movl	$0, -2400024(%rbp)
	movl	$0, -2400036(%rbp)
	jmp	.L6
.L10:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L7
	addl	$1, -2400024(%rbp)
	jmp	.L28
.L7:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L9
.L28:
	addl	$1, -2400036(%rbp)
.L6:
	movl	-2400048(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L10
.L9:
	movl	$0, -2400020(%rbp)
	movl	$0, -2400036(%rbp)
	jmp	.L11
.L15:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L12
	addl	$1, -2400020(%rbp)
	jmp	.L29
.L12:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L14
.L29:
	addl	$1, -2400036(%rbp)
.L11:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L15
.L14:
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -2400032(%rbp)
.L25:
	cmpl	$0, -2400024(%rbp)
	jle	.L31
	subl	$1, -2400024(%rbp)
	movl	-2400024(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	movl	-2400020(%rbp), %eax
	movl	%eax, -2400036(%rbp)
	jmp	.L19
.L23:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L20
	addl	$1, -2400020(%rbp)
	jmp	.L30
.L20:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L22
.L30:
	addl	$1, -2400036(%rbp)
.L19:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L23
.L22:
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -2400032(%rbp)
	jge	.L25
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -2400032(%rbp)
	jmp	.L25
.L31:
	nop
	movl	-2400032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-2396160(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3888, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2400040(%rbp), %rcx
	leaq	-2400044(%rbp), %rdx
	leaq	-2400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2400036(%rbp)
	jmp	.L2
.L3:
	leaq	-2400016(%rbp), %rdx
	movl	-2400036(%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, -2400036(%rbp)
.L2:
	movl	-2400048(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L3
	movl	$0, -2400036(%rbp)
	jmp	.L4
.L5:
	leaq	-1200016(%rbp), %rdx
	movl	-2400036(%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, -2400036(%rbp)
.L4:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L5
	movl	-2400040(%rbp), %eax
	movl	%eax, -2400028(%rbp)
	movl	$0, -2400024(%rbp)
	movl	$0, -2400036(%rbp)
	jmp	.L6
.L10:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L7
	addl	$1, -2400024(%rbp)
	jmp	.L28
.L7:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L9
.L28:
	addl	$1, -2400036(%rbp)
.L6:
	movl	-2400048(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L10
.L9:
	movl	$0, -2400020(%rbp)
	movl	$0, -2400036(%rbp)
	jmp	.L11
.L15:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L12
	addl	$1, -2400020(%rbp)
	jmp	.L29
.L12:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L14
.L29:
	addl	$1, -2400036(%rbp)
.L11:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L15
.L14:
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -2400032(%rbp)
.L25:
	cmpl	$0, -2400024(%rbp)
	jle	.L31
	subl	$1, -2400024(%rbp)
	movl	-2400024(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	movl	-2400020(%rbp), %eax
	movl	%eax, -2400036(%rbp)
	jmp	.L19
.L23:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	subl	%eax, -2400028(%rbp)
	cmpl	$0, -2400028(%rbp)
	js	.L20
	addl	$1, -2400020(%rbp)
	jmp	.L30
.L20:
	movl	-2400036(%rbp), %eax
	cltq
	movl	-1200016(%rbp,%rax,4), %eax
	addl	%eax, -2400028(%rbp)
	jmp	.L22
.L30:
	addl	$1, -2400036(%rbp)
.L19:
	movl	-2400044(%rbp), %eax
	cmpl	%eax, -2400036(%rbp)
	jl	.L23
.L22:
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -2400032(%rbp)
	jge	.L25
	movl	-2400024(%rbp), %edx
	movl	-2400020(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -2400032(%rbp)
	jmp	.L25
.L31:
	nop
	movl	-2400032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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:
