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

```c
#include <stdio.h>

int main(void)
{
	int f;
	int i;
	int l, s, n;
	int b[10];
	int w, w2;
	int count;
	int num[4];
	
	while (scanf("%d", &n), n != 0){
		count = 0;
		f = 0;
		while (n != 6174){
			w = 1000;
			for (i = 0; i < 10; i++){
				b[i] = 0;
			}
			for (i = 0; i < 4; i++){
				num[i] = n / w;
				n %= w;
				w /= 10;
				b[num[i]]++;
			}
			
			w = 1000; w2 = 1;
			s = 0; l = 0;
			for (i = 0; i < 10; i++){
				while (b[i] > 0){
					s += i * w;
					w /= 10;
					l += i * w2;
					w2 *= 10;
					b[i]--;
				}
			}
			n = l - s;
			count++;
			if (n == 0){
				printf("NA\n");
				f = 1;
				break;
			}
		}
		if (f == 0){
			printf("%d\n", count);
		}
	}
	
	return (0);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"NA"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r13
.L2:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	pxor	%xmm0, %xmm0
	testl	%r8d, %r8d
	je	.L21
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$6174, %r8d
	je	.L8
	movslq	%r8d, %rax
	movl	%r8d, %edx
	movaps	%xmm0, 16(%rsp)
	leaq	16(%rsp), %r11
	imulq	$274877907, %rax, %rax
	sarl	$31, %edx
	xorl	%r10d, %r10d
	xorl	%edi, %edi
	movq	$0, 48(%rsp)
	movl	$1000, %ecx
	movaps	%xmm0, 32(%rsp)
	sarq	$38, %rax
	subl	%edx, %eax
	imull	$1000, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1374389535, %rax, %rax
	sarl	$31, %edx
	sarq	$37, %rax
	subl	%edx, %eax
	imull	$100, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1717986919, %rax, %rax
	sarl	$31, %edx
	sarq	$34, %rax
	subl	%edx, %eax
	leal	(%rax,%rax,4), %edx
	cltq
	addl	%edx, %edx
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	xorl	%r8d, %r8d
	addl	$1, 16(%rsp,%rax,4)
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r11), %esi
	testl	%esi, %esi
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edi, %edx
	imull	%ecx, %edx
	addl	%edx, %r10d
	movslq	%ecx, %rdx
	sarl	$31, %ecx
	imulq	$1717986919, %rdx, %rdx
	movl	%ecx, %r14d
	sarq	$34, %rdx
	movl	%edx, %ecx
	movl	%edi, %edx
	imull	%eax, %edx
	leal	(%rax,%rax,4), %eax
	subl	%r14d, %ecx
	addl	%eax, %eax
	addl	%edx, %r8d
	subl	$1, %esi
	jne	.L3
	movl	$0, (%r11)
.L5:
	addl	$1, %edi
	addq	$4, %r11
	cmpl	$10, %edi
	jne	.L9
	addl	$1, %r9d
	movl	$1, %eax
	subl	%r10d, %r8d
	jne	.L6
	movq	%rbx, %rdi
	movl	$0, 12(%rsp)
	call	puts@PLT
	jmp	.L2
.L8:
	testb	%al, %al
	je	.L10
	movl	$6174, 12(%rsp)
.L10:
	movl	%r9d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L21:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"NA"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r13
.L2:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	pxor	%xmm0, %xmm0
	testl	%r8d, %r8d
	je	.L21
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$6174, %r8d
	je	.L8
	movslq	%r8d, %rax
	movl	%r8d, %edx
	movaps	%xmm0, 16(%rsp)
	leaq	16(%rsp), %r11
	imulq	$274877907, %rax, %rax
	sarl	$31, %edx
	xorl	%r10d, %r10d
	xorl	%edi, %edi
	movq	$0, 48(%rsp)
	movl	$1000, %ecx
	movaps	%xmm0, 32(%rsp)
	sarq	$38, %rax
	subl	%edx, %eax
	imull	$1000, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1374389535, %rax, %rax
	sarl	$31, %edx
	sarq	$37, %rax
	subl	%edx, %eax
	imull	$100, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1717986919, %rax, %rax
	sarl	$31, %edx
	sarq	$34, %rax
	subl	%edx, %eax
	leal	(%rax,%rax,4), %edx
	cltq
	addl	%edx, %edx
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	xorl	%r8d, %r8d
	addl	$1, 16(%rsp,%rax,4)
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r11), %esi
	testl	%esi, %esi
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edi, %edx
	imull	%ecx, %edx
	addl	%edx, %r10d
	movslq	%ecx, %rdx
	sarl	$31, %ecx
	imulq	$1717986919, %rdx, %rdx
	movl	%ecx, %r14d
	sarq	$34, %rdx
	movl	%edx, %ecx
	movl	%edi, %edx
	imull	%eax, %edx
	leal	(%rax,%rax,4), %eax
	subl	%r14d, %ecx
	addl	%eax, %eax
	addl	%edx, %r8d
	subl	$1, %esi
	jne	.L3
	movl	$0, (%r11)
.L5:
	addl	$1, %edi
	addq	$4, %r11
	cmpl	$10, %edi
	jne	.L9
	addl	$1, %r9d
	movl	$1, %eax
	subl	%r10d, %r8d
	jne	.L6
	movq	%rbx, %rdi
	movl	$0, 12(%rsp)
	call	puts@PLT
	jmp	.L2
.L8:
	testb	%al, %al
	je	.L10
	movl	$6174, 12(%rsp)
.L10:
	movl	%r9d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L21:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"NA"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r13
.L2:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	pxor	%xmm0, %xmm0
	testl	%r8d, %r8d
	je	.L21
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$6174, %r8d
	je	.L8
	movslq	%r8d, %rax
	movl	%r8d, %edx
	movaps	%xmm0, 16(%rsp)
	leaq	16(%rsp), %r11
	imulq	$274877907, %rax, %rax
	sarl	$31, %edx
	xorl	%r10d, %r10d
	xorl	%edi, %edi
	movq	$0, 48(%rsp)
	movl	$1000, %ecx
	movaps	%xmm0, 32(%rsp)
	sarq	$38, %rax
	subl	%edx, %eax
	imull	$1000, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1374389535, %rax, %rax
	sarl	$31, %edx
	sarq	$37, %rax
	subl	%edx, %eax
	imull	$100, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1717986919, %rax, %rax
	sarl	$31, %edx
	sarq	$34, %rax
	subl	%edx, %eax
	leal	(%rax,%rax,4), %edx
	cltq
	addl	%edx, %edx
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	xorl	%r8d, %r8d
	addl	$1, 16(%rsp,%rax,4)
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r11), %esi
	testl	%esi, %esi
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edi, %edx
	imull	%ecx, %edx
	addl	%edx, %r10d
	movslq	%ecx, %rdx
	sarl	$31, %ecx
	imulq	$1717986919, %rdx, %rdx
	movl	%ecx, %r14d
	sarq	$34, %rdx
	movl	%edx, %ecx
	movl	%edi, %edx
	imull	%eax, %edx
	leal	(%rax,%rax,4), %eax
	subl	%r14d, %ecx
	addl	%eax, %eax
	addl	%edx, %r8d
	subl	$1, %esi
	jne	.L3
	movl	$0, (%r11)
.L5:
	addl	$1, %edi
	addq	$4, %r11
	cmpl	$10, %edi
	jne	.L9
	addl	$1, %r9d
	movl	$1, %eax
	subl	%r10d, %r8d
	jne	.L6
	movq	%rbx, %rdi
	movl	$0, 12(%rsp)
	call	puts@PLT
	jmp	.L2
.L8:
	testb	%al, %al
	je	.L10
	movl	$6174, 12(%rsp)
.L10:
	movl	%r9d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L21:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	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:
```
```c
#include <stdio.h>

int main(void)
{
	int f;
	int i;
	int l, s, n;
	int b[10];
	int w, w2;
	int count;
	int num[4];
	
	while (scanf("%d", &n), n != 0){
		count = 0;
		f = 0;
		while (n != 6174){
			w = 1000;
			for (i = 0; i < 10; i++){
				b[i] = 0;
			}
			for (i = 0; i < 4; i++){
				num[i] = n / w;
				n %= w;
				w /= 10;
				b[num[i]]++;
			}
			
			w = 1000; w2 = 1;
			s = 0; l = 0;
			for (i = 0; i < 10; i++){
				while (b[i] > 0){
					s += i * w;
					w /= 10;
					l += i * w2;
					w2 *= 10;
					b[i]--;
				}
			}
			n = l - s;
			count++;
			if (n == 0){
				printf("NA\n");
				f = 1;
				break;
			}
		}
		if (f == 0){
			printf("%d\n", count);
		}
	}
	
	return (0);
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int main(void)
{
	int f;
	int i;
	int l, s, n;
	int b[10];
	int w, w2;
	int count;
	int num[4];
	
	while (scanf("%d", &n), n != 0){
		count = 0;
		f = 0;
		while (n != 6174){
			w = 1000;
			for (i = 0; i < 10; i++){
				b[i] = 0;
			}
			for (i = 0; i < 4; i++){
				num[i] = n / w;
				n %= w;
				w /= 10;
				b[num[i]]++;
			}
			
			w = 1000; w2 = 1;
			s = 0; l = 0;
			for (i = 0; i < 10; i++){
				while (b[i] > 0){
					s += i * w;
					w /= 10;
					l += i * w2;
					w2 *= 10;
					b[i]--;
				}
			}
			n = l - s;
			count++;
			if (n == 0){
				printf("NA\n");
				f = 1;
				break;
			}
		}
		if (f == 0){
			printf("%d\n", count);
		}
	}
	
	return (0);
}```

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.
Optimized Assembly Code:

6174
3985
3333
0000
 6174
1779
3333
0000
 6174
1779
2211
0000
 6174
2012
3078
0000
 6174
3985
5889
0000
 6174
2012
3639
0000
 6174
1794
3333
0000
 6174
1779
1275
0000
 6174
1289
3078
0000
 6174
3985
4510
0000

0
3
NA
 0
6
NA
 0
6
4
 0
3
2
 0
3
4
 0
3
3
 0
5
NA
 0
6
3
 0
2
2
 0
3
5

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

```c
#include <stdio.h>

int main(void)
{
	int f;
	int i;
	int l, s, n;
	int b[10];
	int w, w2;
	int count;
	int num[4];
	
	while (scanf("%d", &n), n != 0){
		count = 0;
		f = 0;
		while (n != 6174){
			w = 1000;
			for (i = 0; i < 10; i++){
				b[i] = 0;
			}
			for (i = 0; i < 4; i++){
				num[i] = n / w;
				n %= w;
				w /= 10;
				b[num[i]]++;
			}
			
			w = 1000; w2 = 1;
			s = 0; l = 0;
			for (i = 0; i < 10; i++){
				while (b[i] > 0){
					s += i * w;
					w /= 10;
					l += i * w2;
					w2 *= 10;
					b[i]--;
				}
			}
			n = l - s;
			count++;
			if (n == 0){
				printf("NA\n");
				f = 1;
				break;
			}
		}
		if (f == 0){
			printf("%d\n", count);
		}
	}
	
	return (0);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"NA"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r13
.L2:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	pxor	%xmm0, %xmm0
	testl	%r8d, %r8d
	je	.L21
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$6174, %r8d
	je	.L8
	movslq	%r8d, %rax
	movl	%r8d, %edx
	movaps	%xmm0, 16(%rsp)
	leaq	16(%rsp), %r11
	imulq	$274877907, %rax, %rax
	sarl	$31, %edx
	xorl	%r10d, %r10d
	xorl	%edi, %edi
	movq	$0, 48(%rsp)
	movl	$1000, %ecx
	movaps	%xmm0, 32(%rsp)
	sarq	$38, %rax
	subl	%edx, %eax
	imull	$1000, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1374389535, %rax, %rax
	sarl	$31, %edx
	sarq	$37, %rax
	subl	%edx, %eax
	imull	$100, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1717986919, %rax, %rax
	sarl	$31, %edx
	sarq	$34, %rax
	subl	%edx, %eax
	leal	(%rax,%rax,4), %edx
	cltq
	addl	%edx, %edx
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	xorl	%r8d, %r8d
	addl	$1, 16(%rsp,%rax,4)
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r11), %esi
	testl	%esi, %esi
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edi, %edx
	imull	%ecx, %edx
	addl	%edx, %r10d
	movslq	%ecx, %rdx
	sarl	$31, %ecx
	imulq	$1717986919, %rdx, %rdx
	movl	%ecx, %r14d
	sarq	$34, %rdx
	movl	%edx, %ecx
	movl	%edi, %edx
	imull	%eax, %edx
	leal	(%rax,%rax,4), %eax
	subl	%r14d, %ecx
	addl	%eax, %eax
	addl	%edx, %r8d
	subl	$1, %esi
	jne	.L3
	movl	$0, (%r11)
.L5:
	addl	$1, %edi
	addq	$4, %r11
	cmpl	$10, %edi
	jne	.L9
	addl	$1, %r9d
	movl	$1, %eax
	subl	%r10d, %r8d
	jne	.L6
	movq	%rbx, %rdi
	movl	$0, 12(%rsp)
	call	puts@PLT
	jmp	.L2
.L8:
	testb	%al, %al
	je	.L10
	movl	$6174, 12(%rsp)
.L10:
	movl	%r9d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L21:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"NA"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r13
.L2:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	pxor	%xmm0, %xmm0
	testl	%r8d, %r8d
	je	.L21
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$6174, %r8d
	je	.L8
	movslq	%r8d, %rax
	movl	%r8d, %edx
	movaps	%xmm0, 16(%rsp)
	leaq	16(%rsp), %r11
	imulq	$274877907, %rax, %rax
	sarl	$31, %edx
	xorl	%r10d, %r10d
	xorl	%edi, %edi
	movq	$0, 48(%rsp)
	movl	$1000, %ecx
	movaps	%xmm0, 32(%rsp)
	sarq	$38, %rax
	subl	%edx, %eax
	imull	$1000, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1374389535, %rax, %rax
	sarl	$31, %edx
	sarq	$37, %rax
	subl	%edx, %eax
	imull	$100, %eax, %edx
	cltq
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	movl	%r8d, %edx
	imulq	$1717986919, %rax, %rax
	sarl	$31, %edx
	sarq	$34, %rax
	subl	%edx, %eax
	leal	(%rax,%rax,4), %edx
	cltq
	addl	%edx, %edx
	addl	$1, 16(%rsp,%rax,4)
	subl	%edx, %r8d
	movslq	%r8d, %rax
	xorl	%r8d, %r8d
	addl	$1, 16(%rsp,%rax,4)
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r11), %esi
	testl	%esi, %esi
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edi, %edx
	imull	%ecx, %edx
	addl	%edx, %r10d
	movslq	%ecx, %rdx
	sarl	$31, %ecx
	imulq	$1717986919, %rdx, %rdx
	movl	%ecx, %r14d
	sarq	$34, %rdx
	movl	%edx, %ecx
	movl	%edi, %edx
	imull	%eax, %edx
	leal	(%rax,%rax,4), %eax
	subl	%r14d, %ecx
	addl	%eax, %eax
	addl	%edx, %r8d
	subl	$1, %esi
	jne	.L3
	movl	$0, (%r11)
.L5:
	addl	$1, %edi
	addq	$4, %r11
	cmpl	$10, %edi
	jne	.L9
	addl	$1, %r9d
	movl	$1, %eax
	subl	%r10d, %r8d
	jne	.L6
	movq	%rbx, %rdi
	movl	$0, 12(%rsp)
	call	puts@PLT
	jmp	.L2
.L8:
	testb	%al, %al
	je	.L10
	movl	$6174, 12(%rsp)
.L10:
	movl	%r9d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L21:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	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:
```