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

int main()
{
	int K;
	scanf("%d", &K);
	
	int i, j, d = 0, X[100] = {1};
	for (i = 1; i < K; i++) {
		for (j = 0; j < d; j++) if (X[j] != 9 && X[j] <= X[j+1]) break;
		if (j < d || X[j] != 9) {
			for (X[j--]++; j >= 0; j--) X[j] = (X[j+1] > 0)? X[j+1] - 1: 0;
		} else {
			X[++d] = 1;
			for (j = 0; j < d; j++) X[j] = 0;
		}
	}
	
	for (i = d; i >= 0; i--) printf("%d", X[i]);
	fflush(stdout);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	movl	$1, %ebx
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %r8
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	12(%rsp), %r13d
	movl	$50, %ecx
	movq	%r8, %rdi
	rep stosq
	movl	$1, 16(%rsp)
	movl	$1, %eax
	cmpl	$1, %r13d
	jle	.L38
	testl	%esi, %esi
	je	.L39
	.p2align 4,,10
	.p2align 3
.L11:
	movl	16(%rsp), %ecx
	leaq	20(%rsp), %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%ecx, %edi
	movl	%eax, %r9d
	movl	(%rdx), %ecx
	addl	$1, %eax
	cmpl	$9, %edi
	je	.L4
	cmpl	%ecx, %edi
	jle	.L5
.L4:
	addq	$4, %rdx
	cmpl	%eax, %esi
	jne	.L6
	cmpl	$9, %ecx
	je	.L17
	movslq	%esi, %rax
	addl	$1, %ecx
	movl	%r9d, %edx
	movl	%ecx, 16(%rsp,%rax,4)
.L15:
	movslq	%edx, %rdx
	movq	%r12, %rdi
	salq	$2, %rdx
	movl	20(%rsp,%rdx), %eax
	addq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%eax, %eax
	movl	$1, %ecx
	cmovle	%ecx, %eax
	subq	$4, %rdx
	subl	$1, %eax
	movl	%eax, 4(%rdx)
	cmpq	%rdi, %rdx
	jne	.L9
.L8:
	addl	$1, %ebx
	cmpl	%r13d, %ebx
	je	.L10
.L40:
	movl	16(%rsp), %eax
	testl	%esi, %esi
	jne	.L11
.L39:
	cmpl	$9, %eax
	je	.L17
	addl	$1, %eax
	movl	%eax, 16(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movslq	%r9d, %rax
	addl	$1, %edi
	leal	-1(%r9), %edx
	movl	%edi, 16(%rsp,%rax,4)
	testl	%r9d, %r9d
	jne	.L15
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%rsi), %r14d
	movq	%r8, %rdi
	xorl	%esi, %esi
	addl	$1, %ebx
	movslq	%r14d, %rdx
	movl	$1, 16(%rsp,%rdx,4)
	salq	$2, %rdx
	call	memset@PLT
	movslq	%r14d, %rsi
	movq	%rax, %r8
	cmpl	%r13d, %ebx
	jne	.L40
.L10:
	leaq	(%r8,%rsi,4), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r12
	jne	.L13
.L14:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$432, %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
.L38:
	.cfi_restore_state
	movl	$1, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	movl	$1, %ebx
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %r8
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	12(%rsp), %r13d
	movl	$50, %ecx
	movq	%r8, %rdi
	rep stosq
	movl	$1, 16(%rsp)
	movl	$1, %eax
	cmpl	$1, %r13d
	jle	.L38
	testl	%esi, %esi
	je	.L39
	.p2align 4,,10
	.p2align 3
.L11:
	movl	16(%rsp), %ecx
	leaq	20(%rsp), %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%ecx, %edi
	movl	%eax, %r9d
	movl	(%rdx), %ecx
	addl	$1, %eax
	cmpl	$9, %edi
	je	.L4
	cmpl	%ecx, %edi
	jle	.L5
.L4:
	addq	$4, %rdx
	cmpl	%eax, %esi
	jne	.L6
	cmpl	$9, %ecx
	je	.L17
	movslq	%esi, %rax
	addl	$1, %ecx
	movl	%r9d, %edx
	movl	%ecx, 16(%rsp,%rax,4)
.L15:
	movslq	%edx, %rdx
	movq	%r12, %rdi
	salq	$2, %rdx
	movl	20(%rsp,%rdx), %eax
	addq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%eax, %eax
	movl	$1, %ecx
	cmovle	%ecx, %eax
	subq	$4, %rdx
	subl	$1, %eax
	movl	%eax, 4(%rdx)
	cmpq	%rdi, %rdx
	jne	.L9
.L8:
	addl	$1, %ebx
	cmpl	%r13d, %ebx
	je	.L10
.L40:
	movl	16(%rsp), %eax
	testl	%esi, %esi
	jne	.L11
.L39:
	cmpl	$9, %eax
	je	.L17
	addl	$1, %eax
	movl	%eax, 16(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movslq	%r9d, %rax
	addl	$1, %edi
	leal	-1(%r9), %edx
	movl	%edi, 16(%rsp,%rax,4)
	testl	%r9d, %r9d
	jne	.L15
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%rsi), %r14d
	movq	%r8, %rdi
	xorl	%esi, %esi
	addl	$1, %ebx
	movslq	%r14d, %rdx
	movl	$1, 16(%rsp,%rdx,4)
	salq	$2, %rdx
	call	memset@PLT
	movslq	%r14d, %rsi
	movq	%rax, %r8
	cmpl	%r13d, %ebx
	jne	.L40
.L10:
	leaq	(%r8,%rsi,4), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r12
	jne	.L13
.L14:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$432, %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
.L38:
	.cfi_restore_state
	movl	$1, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	movl	$1, %ebx
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %r8
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	12(%rsp), %r13d
	movl	$50, %ecx
	movq	%r8, %rdi
	rep stosq
	movl	$1, 16(%rsp)
	movl	$1, %eax
	cmpl	$1, %r13d
	jle	.L38
	testl	%esi, %esi
	je	.L39
	.p2align 4,,10
	.p2align 3
.L11:
	movl	16(%rsp), %ecx
	leaq	20(%rsp), %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%ecx, %edi
	movl	%eax, %r9d
	movl	(%rdx), %ecx
	addl	$1, %eax
	cmpl	$9, %edi
	je	.L4
	cmpl	%ecx, %edi
	jle	.L5
.L4:
	addq	$4, %rdx
	cmpl	%eax, %esi
	jne	.L6
	cmpl	$9, %ecx
	je	.L17
	movslq	%esi, %rax
	addl	$1, %ecx
	movl	%r9d, %edx
	movl	%ecx, 16(%rsp,%rax,4)
.L15:
	movslq	%edx, %rdx
	movq	%r12, %rdi
	salq	$2, %rdx
	movl	20(%rsp,%rdx), %eax
	addq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%eax, %eax
	movl	$1, %ecx
	cmovle	%ecx, %eax
	subq	$4, %rdx
	subl	$1, %eax
	movl	%eax, 4(%rdx)
	cmpq	%rdi, %rdx
	jne	.L9
.L8:
	addl	$1, %ebx
	cmpl	%r13d, %ebx
	je	.L10
.L40:
	movl	16(%rsp), %eax
	testl	%esi, %esi
	jne	.L11
.L39:
	cmpl	$9, %eax
	je	.L17
	addl	$1, %eax
	movl	%eax, 16(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movslq	%r9d, %rax
	addl	$1, %edi
	leal	-1(%r9), %edx
	movl	%edi, 16(%rsp,%rax,4)
	testl	%r9d, %r9d
	jne	.L15
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%rsi), %r14d
	movq	%r8, %rdi
	xorl	%esi, %esi
	addl	$1, %ebx
	movslq	%r14d, %rdx
	movl	$1, 16(%rsp,%rdx,4)
	salq	$2, %rdx
	call	memset@PLT
	movslq	%r14d, %rsi
	movq	%rax, %r8
	cmpl	%r13d, %ebx
	jne	.L40
.L10:
	leaq	(%r8,%rsi,4), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r12
	jne	.L13
.L14:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$432, %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
.L38:
	.cfi_restore_state
	movl	$1, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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>
#include <stdlib.h>

int main()
{
	int K;
	scanf("%d", &K);
	
	int i, j, d = 0, X[100] = {1};
	for (i = 1; i < K; i++) {
		for (j = 0; j < d; j++) if (X[j] != 9 && X[j] <= X[j+1]) break;
		if (j < d || X[j] != 9) {
			for (X[j--]++; j >= 0; j--) X[j] = (X[j+1] > 0)? X[j+1] - 1: 0;
		} else {
			X[++d] = 1;
			for (j = 0; j < d; j++) X[j] = 0;
		}
	}
	
	for (i = d; i >= 0; i--) printf("%d", X[i]);
	fflush(stdout);
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int K;
	scanf("%d", &K);
	
	int i, j, d = 0, X[100] = {1};
	for (i = 1; i < K; i++) {
		for (j = 0; j < d; j++) if (X[j] != 9 && X[j] <= X[j+1]) break;
		if (j < d || X[j] != 9) {
			for (X[j--]++; j >= 0; j--) X[j] = (X[j+1] > 0)? X[j+1] - 1: 0;
		} else {
			X[++d] = 1;
			for (j = 0; j < d; j++) X[j] = 0;
		}
	}
	
	for (i = d; i >= 0; i--) printf("%d", X[i]);
	fflush(stdout);
	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:

8
 2
 12
 9
 20
 37
 10
 3
 5
 6

8 2 12 9 44 101 10 3 5 6
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>
#include <stdlib.h>

int main()
{
	int K;
	scanf("%d", &K);
	
	int i, j, d = 0, X[100] = {1};
	for (i = 1; i < K; i++) {
		for (j = 0; j < d; j++) if (X[j] != 9 && X[j] <= X[j+1]) break;
		if (j < d || X[j] != 9) {
			for (X[j--]++; j >= 0; j--) X[j] = (X[j+1] > 0)? X[j+1] - 1: 0;
		} else {
			X[++d] = 1;
			for (j = 0; j < d; j++) X[j] = 0;
		}
	}
	
	for (i = d; i >= 0; i--) printf("%d", X[i]);
	fflush(stdout);
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	movl	$1, %ebx
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %r8
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	12(%rsp), %r13d
	movl	$50, %ecx
	movq	%r8, %rdi
	rep stosq
	movl	$1, 16(%rsp)
	movl	$1, %eax
	cmpl	$1, %r13d
	jle	.L38
	testl	%esi, %esi
	je	.L39
	.p2align 4,,10
	.p2align 3
.L11:
	movl	16(%rsp), %ecx
	leaq	20(%rsp), %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%ecx, %edi
	movl	%eax, %r9d
	movl	(%rdx), %ecx
	addl	$1, %eax
	cmpl	$9, %edi
	je	.L4
	cmpl	%ecx, %edi
	jle	.L5
.L4:
	addq	$4, %rdx
	cmpl	%eax, %esi
	jne	.L6
	cmpl	$9, %ecx
	je	.L17
	movslq	%esi, %rax
	addl	$1, %ecx
	movl	%r9d, %edx
	movl	%ecx, 16(%rsp,%rax,4)
.L15:
	movslq	%edx, %rdx
	movq	%r12, %rdi
	salq	$2, %rdx
	movl	20(%rsp,%rdx), %eax
	addq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%eax, %eax
	movl	$1, %ecx
	cmovle	%ecx, %eax
	subq	$4, %rdx
	subl	$1, %eax
	movl	%eax, 4(%rdx)
	cmpq	%rdi, %rdx
	jne	.L9
.L8:
	addl	$1, %ebx
	cmpl	%r13d, %ebx
	je	.L10
.L40:
	movl	16(%rsp), %eax
	testl	%esi, %esi
	jne	.L11
.L39:
	cmpl	$9, %eax
	je	.L17
	addl	$1, %eax
	movl	%eax, 16(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movslq	%r9d, %rax
	addl	$1, %edi
	leal	-1(%r9), %edx
	movl	%edi, 16(%rsp,%rax,4)
	testl	%r9d, %r9d
	jne	.L15
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%rsi), %r14d
	movq	%r8, %rdi
	xorl	%esi, %esi
	addl	$1, %ebx
	movslq	%r14d, %rdx
	movl	$1, 16(%rsp,%rdx,4)
	salq	$2, %rdx
	call	memset@PLT
	movslq	%r14d, %rsi
	movq	%rax, %r8
	cmpl	%r13d, %ebx
	jne	.L40
.L10:
	leaq	(%r8,%rsi,4), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r12
	jne	.L13
.L14:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$432, %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
.L38:
	.cfi_restore_state
	movl	$1, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	movl	$1, %ebx
	subq	$432, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %r8
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	12(%rsp), %r13d
	movl	$50, %ecx
	movq	%r8, %rdi
	rep stosq
	movl	$1, 16(%rsp)
	movl	$1, %eax
	cmpl	$1, %r13d
	jle	.L38
	testl	%esi, %esi
	je	.L39
	.p2align 4,,10
	.p2align 3
.L11:
	movl	16(%rsp), %ecx
	leaq	20(%rsp), %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%ecx, %edi
	movl	%eax, %r9d
	movl	(%rdx), %ecx
	addl	$1, %eax
	cmpl	$9, %edi
	je	.L4
	cmpl	%ecx, %edi
	jle	.L5
.L4:
	addq	$4, %rdx
	cmpl	%eax, %esi
	jne	.L6
	cmpl	$9, %ecx
	je	.L17
	movslq	%esi, %rax
	addl	$1, %ecx
	movl	%r9d, %edx
	movl	%ecx, 16(%rsp,%rax,4)
.L15:
	movslq	%edx, %rdx
	movq	%r12, %rdi
	salq	$2, %rdx
	movl	20(%rsp,%rdx), %eax
	addq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%eax, %eax
	movl	$1, %ecx
	cmovle	%ecx, %eax
	subq	$4, %rdx
	subl	$1, %eax
	movl	%eax, 4(%rdx)
	cmpq	%rdi, %rdx
	jne	.L9
.L8:
	addl	$1, %ebx
	cmpl	%r13d, %ebx
	je	.L10
.L40:
	movl	16(%rsp), %eax
	testl	%esi, %esi
	jne	.L11
.L39:
	cmpl	$9, %eax
	je	.L17
	addl	$1, %eax
	movl	%eax, 16(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movslq	%r9d, %rax
	addl	$1, %edi
	leal	-1(%r9), %edx
	movl	%edi, 16(%rsp,%rax,4)
	testl	%r9d, %r9d
	jne	.L15
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%rsi), %r14d
	movq	%r8, %rdi
	xorl	%esi, %esi
	addl	$1, %ebx
	movslq	%r14d, %rdx
	movl	$1, 16(%rsp,%rdx,4)
	salq	$2, %rdx
	call	memset@PLT
	movslq	%r14d, %rsi
	movq	%rax, %r8
	cmpl	%r13d, %ebx
	jne	.L40
.L10:
	leaq	(%r8,%rsi,4), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r12
	jne	.L13
.L14:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$432, %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
.L38:
	.cfi_restore_state
	movl	$1, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:
```