Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
main(q,b,c,C,Q,x,y){for(;scanf("%d%d%d%d%d",&q,&b,&c,&C,&Q)>4;printf(x?"%d %d\n":"NA\n",x,y)){for(x=b/c,x=x<Q?x:Q;x;x--)if(x+(y=(b-x*c)/C)>=q)break;}exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"NA\n"
.LC2:
	.string	"%d%d%d%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	$32, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movl	%r8d, -20(%rbp)
	movl	%r9d, -24(%rbp)
	jmp	.L2
.L9:
	movl	-8(%rbp), %eax
	movl	-12(%rbp), %esi
	cltd
	idivl	%esi
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -24(%rbp)
	jmp	.L3
.L6:
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	imull	-24(%rbp), %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	-16(%rbp), %edi
	cltd
	idivl	%edi
	movl	%eax, 16(%rbp)
	movl	16(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L10
	subl	$1, -24(%rbp)
.L3:
	cmpl	$0, -24(%rbp)
	jne	.L6
	jmp	.L5
.L10:
	nop
.L5:
	cmpl	$0, -24(%rbp)
	je	.L7
	leaq	.LC0(%rip), %rax
	jmp	.L8
.L7:
	leaq	.LC1(%rip), %rax
.L8:
	movl	-24(%rbp), %ecx
	movl	16(%rbp), %edx
	movl	%ecx, %esi
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-20(%rbp), %rdi
	leaq	-16(%rbp), %rsi
	leaq	-12(%rbp), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$4, %eax
	jg	.L9
	movl	$0, %edi
	call	exit@PLT
	.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\n"
.LC1:
	.string	"NA\n"
.LC2:
	.string	"%d%d%d%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	.LC2(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	leaq	24(%rsp), %rax
	movl	%edi, 28(%rsp)
	movl	96(%rsp), %r12d
	leaq	12(%rsp), %r15
	movl	%esi, 24(%rsp)
	leaq	16(%rsp), %r14
	leaq	20(%rsp), %r13
	movl	%edx, 20(%rsp)
	leaq	28(%rsp), %rbp
	movl	%ecx, 16(%rsp)
	movl	%r8d, 12(%rsp)
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	(%rsp), %rdx
	xorl	%eax, %eax
	movq	%r15, %r9
	movq	%r14, %r8
	movq	%r13, %rcx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$4, %eax
	jle	.L12
	movl	24(%rsp), %ecx
	movl	20(%rsp), %r8d
	leaq	.LC1(%rip), %rdi
	movl	%ecx, %eax
	cltd
	idivl	%r8d
	movl	12(%rsp), %edx
	movl	%edx, %esi
	cmpl	%edx, %eax
	cmovle	%eax, %esi
	testl	%esi, %esi
	je	.L3
	movl	%r8d, %eax
	movl	16(%rsp), %edi
	movl	28(%rsp), %r9d
	imull	%esi, %eax
	subl	%eax, %ecx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L14:
	addl	%r8d, %ecx
	subl	$1, %esi
	je	.L13
.L4:
	movl	%ecx, %eax
	cltd
	idivl	%edi
	leal	(%rax,%rsi), %edx
	cmpl	%r9d, %edx
	jl	.L14
	movl	%eax, %r12d
	leaq	.LC0(%rip), %rdi
.L3:
	movl	%r12d, %edx
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%eax, %r12d
	leaq	.LC1(%rip), %rdi
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%edi, %edi
	call	exit@PLT
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"NA\n"
.LC2:
	.string	"%d%d%d%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	.LC2(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	leaq	24(%rsp), %rax
	movl	%edi, 28(%rsp)
	movl	96(%rsp), %r12d
	leaq	12(%rsp), %r15
	movl	%esi, 24(%rsp)
	leaq	16(%rsp), %r14
	leaq	20(%rsp), %r13
	movl	%edx, 20(%rsp)
	leaq	28(%rsp), %rbp
	movl	%ecx, 16(%rsp)
	movl	%r8d, 12(%rsp)
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	(%rsp), %rdx
	xorl	%eax, %eax
	movq	%r15, %r9
	movq	%r14, %r8
	movq	%r13, %rcx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$4, %eax
	jle	.L12
	movl	24(%rsp), %ecx
	movl	20(%rsp), %r8d
	leaq	.LC1(%rip), %rdi
	movl	%ecx, %eax
	cltd
	idivl	%r8d
	movl	12(%rsp), %edx
	movl	%edx, %esi
	cmpl	%edx, %eax
	cmovle	%eax, %esi
	testl	%esi, %esi
	je	.L3
	movl	%r8d, %eax
	movl	16(%rsp), %edi
	movl	28(%rsp), %r9d
	imull	%esi, %eax
	subl	%eax, %ecx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L14:
	addl	%r8d, %ecx
	subl	$1, %esi
	je	.L13
.L4:
	movl	%ecx, %eax
	cltd
	idivl	%edi
	leal	(%rax,%rsi), %edx
	cmpl	%r9d, %edx
	jl	.L14
	movl	%eax, %r12d
	leaq	.LC0(%rip), %rdi
.L3:
	movl	%r12d, %edx
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%eax, %r12d
	leaq	.LC1(%rip), %rdi
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%edi, %edi
	call	exit@PLT
	.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:

main(q,b,c,C,Q,x,y){for(;scanf("%d%d%d%d%d",&q,&b,&c,&C,&Q)>4;printf(x?"%d %d\n":"NA\n",x,y)){for(x=b/c,x=x<Q?x:Q;x;x--)if(x+(y=(b-x*c)/C)>=q)break;}exit(0);}
48 9297 240 126 32
20 3010 157 141 7
30 117002 5680 962 15
8 1673 1712 190 22
64 8478 87 54 307
23 5477 117 92 12
50 7558 1396 187 17
279 88677 2825 514 14
0
 48 9297 240 126 32
20 3010 157 141 7
30 117002 5843 962 15
8 1673 1712 190 22
64 8478 87 54 307
23 5477 117 92 12
50 7558 1396 187 17
279 88677 2825 514 14
0
 48 9297 240 126 32
20 3010 157 141 7
30 117002 5843 962 15
7 1673 1712 190 22
64 8478 160 54 307
23 5477 117 92 12
50 7558 1396 187 17
279 88677 2825 514 14
0
 48 9297 240 126 32
20 3010 157 141 7
30 117002 5843 962 15
7 1673 1712 190 22
64 8478 160 54 307
23 9941 117 92 12
50 7558 2714 187 17
279 88677 2825 514 14
0
 48 9297 240 126 32
20 3389 157 141 7
30 117002 5843 962 15
3 1673 1712 190 22
64 8478 160 54 307
23 9941 117 92 12
50 7558 2714 187 17
279 88677 2825 514 14
0
 48 9297 240 126 32
20 3389 157 141 7
30 65446 5843 962 15
3 1673 1492 190 22
64 8478 160 54 307
23 9941 117 92 12
50 7558 2714 187 17
173 88677 2825 514 14
0
 48 9297 240 126 32
20 3389 157 141 7
30 65446 6697 962 15
3 1673 1492 190 22
64 8478 160 54 307
23 9941 117 92 12
50 7558 2714 187 17
173 88677 2825 514 14
0
 48 9297 240 126 32
20 3389 177 141 7
30 65446 6697 962 15
3 1673 1779 190 22
64 8478 160 54 307
23 9941 117 92 12
50 7558 2714 187 17
173 88677 2825 514 14
0
 48 9297 240 126 32
20 3389 303 141 7
30 65446 6697 962 15
3 1673 1779 190 22
64 8478 160 54 307
23 9941 117 92 12
50 7558 2714 187 17
173 88677 2825 514 14
0
 48 5128 240 126 32
20 3389 303 141 7
30 65446 6697 962 15
3 1673 1779 111 22
64 8478 160 54 307
23 9941 118 92 12
50 7558 2714 187 17
173 88677 2825 514 14
0

28 20
7 13
15 33
NA
97 0
12 44
NA
NA
 28 20
7 13
15 30
NA
97 0
12 44
NA
NA
 28 20
7 13
15 30
NA
47 17
12 44
NA
NA
 28 20
7 13
15 30
NA
47 17
12 92
NA
NA
 28 20
7 16
15 30
NA
47 17
12 92
NA
NA
 28 20
7 16
7 25
NA
47 17
12 92
NA
NA
 28 20
7 16
6 26
NA
47 17
12 92
NA
NA
 28 20
7 15
6 26
NA
47 17
12 92
NA
NA
 28 20
3 17
6 26
NA
47 17
12 92
NA
NA
 NA
3 17
6 26
NA
47 17
12 92
NA
NA

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
main(q,b,c,C,Q,x,y){for(;scanf("%d%d%d%d%d",&q,&b,&c,&C,&Q)>4;printf(x?"%d %d\n":"NA\n",x,y)){for(x=b/c,x=x<Q?x:Q;x;x--)if(x+(y=(b-x*c)/C)>=q)break;}exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"NA\n"
.LC2:
	.string	"%d%d%d%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	$32, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movl	%r8d, -20(%rbp)
	movl	%r9d, -24(%rbp)
	jmp	.L2
.L9:
	movl	-8(%rbp), %eax
	movl	-12(%rbp), %esi
	cltd
	idivl	%esi
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -24(%rbp)
	jmp	.L3
.L6:
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	imull	-24(%rbp), %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	-16(%rbp), %edi
	cltd
	idivl	%edi
	movl	%eax, 16(%rbp)
	movl	16(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L10
	subl	$1, -24(%rbp)
.L3:
	cmpl	$0, -24(%rbp)
	jne	.L6
	jmp	.L5
.L10:
	nop
.L5:
	cmpl	$0, -24(%rbp)
	je	.L7
	leaq	.LC0(%rip), %rax
	jmp	.L8
.L7:
	leaq	.LC1(%rip), %rax
.L8:
	movl	-24(%rbp), %ecx
	movl	16(%rbp), %edx
	movl	%ecx, %esi
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-20(%rbp), %rdi
	leaq	-16(%rbp), %rsi
	leaq	-12(%rbp), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$4, %eax
	jg	.L9
	movl	$0, %edi
	call	exit@PLT
	.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\n"
.LC1:
	.string	"NA\n"
.LC2:
	.string	"%d%d%d%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	$32, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movl	%r8d, -20(%rbp)
	movl	%r9d, -24(%rbp)
	jmp	.L2
.L9:
	movl	-8(%rbp), %eax
	movl	-12(%rbp), %esi
	cltd
	idivl	%esi
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	-24(%rbp), %edx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -24(%rbp)
	jmp	.L3
.L6:
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	imull	-24(%rbp), %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	-16(%rbp), %edi
	cltd
	idivl	%edi
	movl	%eax, 16(%rbp)
	movl	16(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L10
	subl	$1, -24(%rbp)
.L3:
	cmpl	$0, -24(%rbp)
	jne	.L6
	jmp	.L5
.L10:
	nop
.L5:
	cmpl	$0, -24(%rbp)
	je	.L7
	leaq	.LC0(%rip), %rax
	jmp	.L8
.L7:
	leaq	.LC1(%rip), %rax
.L8:
	movl	-24(%rbp), %ecx
	movl	16(%rbp), %edx
	movl	%ecx, %esi
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-20(%rbp), %rdi
	leaq	-16(%rbp), %rsi
	leaq	-12(%rbp), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$4, %eax
	jg	.L9
	movl	$0, %edi
	call	exit@PLT
	.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:
