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

```c
q,b,c,d,r;main(y){for(;scanf("%d%d%d%d%d",&q,&b,&c,&d,&r),q;puts("NA"))for(;r;r--)y=b-c*r,y<0|r+y/d<q||main(printf("%d %d\n",r,y/d));exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	r
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"NA"
.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	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L7:
	movl	b(%rip), %eax
	movl	c(%rip), %ecx
	movl	r(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	shrl	$31, %eax
	movl	%eax, %esi
	movl	d(%rip), %ecx
	movl	-4(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movl	r(%rip), %eax
	addl	%eax, %edx
	movl	q(%rip), %eax
	cmpl	%eax, %edx
	setl	%al
	orl	%esi, %eax
	testb	%al, %al
	jne	.L6
	movl	d(%rip), %esi
	movl	-4(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, %edx
	movl	r(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	%eax, %edi
	movl	$0, %eax
	call	main
	testl	%eax, %eax
.L6:
	movl	r(%rip), %eax
	subl	$1, %eax
	movl	%eax, r(%rip)
.L3:
	movl	r(%rip), %eax
	testl	%eax, %eax
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	r(%rip), %r9
	leaq	d(%rip), %r8
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	q(%rip), %eax
	testl	%eax, %eax
	jne	.L3
	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"
.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
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	c(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	b(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	q(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
.L2:
	leaq	r(%rip), %r9
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	leaq	d(%rip), %r8
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	q(%rip), %r9d
	testl	%r9d, %r9d
	je	.L6
	movl	r(%rip), %esi
	testl	%esi, %esi
	je	.L8
	movl	c(%rip), %r10d
	movl	b(%rip), %ecx
	xorl	%edi, %edi
	movl	d(%rip), %r8d
	movl	%r10d, %eax
	imull	%esi, %eax
	subl	%eax, %ecx
.L5:
	movl	%ecx, %eax
	movl	%edi, %r11d
	cltd
	idivl	%r8d
	leal	(%rax,%rsi), %edx
	cmpl	%r9d, %edx
	movl	%ecx, %edx
	setl	%dil
	shrl	$31, %edx
	orb	%dl, %dil
	je	.L15
	addl	%r10d, %ecx
	subl	$1, %esi
	je	.L16
	movl	%esi, %ebx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L16:
	movl	$0, r(%rip)
.L8:
	movq	%r15, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	xorl	%edi, %edi
	call	exit@PLT
	.p2align 4,,10
	.p2align 3
.L15:
	testb	%r11b, %r11b
	je	.L4
	movl	%ebx, r(%rip)
.L4:
	movl	%eax, %edx
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	%eax, %edi
	xorl	%eax, %eax
	call	main
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.bss
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	q
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	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\n"
.LC1:
	.string	"NA"
.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
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	c(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	b(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	q(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
.L2:
	leaq	r(%rip), %r9
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	leaq	d(%rip), %r8
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	q(%rip), %r9d
	testl	%r9d, %r9d
	je	.L6
	movl	r(%rip), %esi
	testl	%esi, %esi
	je	.L8
	movl	c(%rip), %r10d
	movl	b(%rip), %ecx
	xorl	%edi, %edi
	movl	d(%rip), %r8d
	movl	%r10d, %eax
	imull	%esi, %eax
	subl	%eax, %ecx
.L5:
	movl	%ecx, %eax
	movl	%edi, %r11d
	cltd
	idivl	%r8d
	leal	(%rax,%rsi), %edx
	cmpl	%r9d, %edx
	movl	%ecx, %edx
	setl	%dil
	shrl	$31, %edx
	orb	%dl, %dil
	je	.L15
	addl	%r10d, %ecx
	subl	$1, %esi
	je	.L16
	movl	%esi, %ebx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L16:
	movl	$0, r(%rip)
.L8:
	movq	%r15, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	xorl	%edi, %edi
	call	exit@PLT
	.p2align 4,,10
	.p2align 3
.L15:
	testb	%r11b, %r11b
	je	.L4
	movl	%ebx, r(%rip)
.L4:
	movl	%eax, %edx
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	%eax, %edi
	xorl	%eax, %eax
	call	main
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.bss
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	q
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	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:

q,b,c,d,r;main(y){for(;scanf("%d%d%d%d%d",&q,&b,&c,&d,&r),q;puts("NA"))for(;r;r--)y=b-c*r,y<0|r+y/d<q||main(printf("%d %d\n",r,y/d));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
q,b,c,d,r;main(y){for(;scanf("%d%d%d%d%d",&q,&b,&c,&d,&r),q;puts("NA"))for(;r;r--)y=b-c*r,y<0|r+y/d<q||main(printf("%d %d\n",r,y/d));exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	r
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"NA"
.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	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L7:
	movl	b(%rip), %eax
	movl	c(%rip), %ecx
	movl	r(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	shrl	$31, %eax
	movl	%eax, %esi
	movl	d(%rip), %ecx
	movl	-4(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movl	r(%rip), %eax
	addl	%eax, %edx
	movl	q(%rip), %eax
	cmpl	%eax, %edx
	setl	%al
	orl	%esi, %eax
	testb	%al, %al
	jne	.L6
	movl	d(%rip), %esi
	movl	-4(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, %edx
	movl	r(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	%eax, %edi
	movl	$0, %eax
	call	main
	testl	%eax, %eax
.L6:
	movl	r(%rip), %eax
	subl	$1, %eax
	movl	%eax, r(%rip)
.L3:
	movl	r(%rip), %eax
	testl	%eax, %eax
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	r(%rip), %r9
	leaq	d(%rip), %r8
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	q(%rip), %eax
	testl	%eax, %eax
	jne	.L3
	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
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	r
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"NA"
.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	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L7:
	movl	b(%rip), %eax
	movl	c(%rip), %ecx
	movl	r(%rip), %edx
	imull	%ecx, %edx
	subl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	shrl	$31, %eax
	movl	%eax, %esi
	movl	d(%rip), %ecx
	movl	-4(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %edx
	movl	r(%rip), %eax
	addl	%eax, %edx
	movl	q(%rip), %eax
	cmpl	%eax, %edx
	setl	%al
	orl	%esi, %eax
	testb	%al, %al
	jne	.L6
	movl	d(%rip), %esi
	movl	-4(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, %edx
	movl	r(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	%eax, %edi
	movl	$0, %eax
	call	main
	testl	%eax, %eax
.L6:
	movl	r(%rip), %eax
	subl	$1, %eax
	movl	%eax, r(%rip)
.L3:
	movl	r(%rip), %eax
	testl	%eax, %eax
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	r(%rip), %r9
	leaq	d(%rip), %r8
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	q(%rip), %eax
	testl	%eax, %eax
	jne	.L3
	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:
