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

```c
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string.h>

int main() {
	int n;
	char N[10000],x[2];
	int i;
	while (~fscanf(stdin, "%d", &n),n!=-1) {
		memset(x, '\0', sizeof(x));
		memset(N, '\0', sizeof(N));
		if(n==0) N[0]='0';
		while (n) {
			sprintf(x, "%d", n % 4);
			strcat(N, x);
			n /= 4;
		}
		for (i = strlen(N)-1; i >= 0; --i)fprintf(stdout, "%c", N[i]);
		puts("");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	""
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1840, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L8:
	leaq	-10018(%rbp), %rax
	movl	$2, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-10016(%rbp), %rax
	movl	$10000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-10028(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movb	$48, -10016(%rbp)
	jmp	.L4
.L5:
	movl	-10028(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	leaq	-10018(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	leaq	-10018(%rbp), %rdx
	leaq	-10016(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcat@PLT
	movl	-10028(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, -10028(%rbp)
.L4:
	movl	-10028(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	leaq	-10016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$1, %eax
	movl	%eax, -10024(%rbp)
	jmp	.L6
.L7:
	movl	-10024(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	movsbl	%al, %eax
	movq	stdout(%rip), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	fputc@PLT
	subl	$1, -10024(%rbp)
.L6:
	cmpl	$0, -10024(%rbp)
	jns	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	movq	stdin(%rip), %rax
	leaq	-10028(%rbp), %rdx
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-10028(%rbp), %eax
	cmpl	$-1, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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"
.LC1:
	.string	""
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$1848, %rsp
	.cfi_def_cfa_offset 10096
	leaq	.LC0(%rip), %r13
	leaq	.LC1(%rip), %r15
	movq	%fs:40, %rax
	movq	%rax, 10024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L2:
	movq	stdin(%rip), %rdi
	movq	%r14, %rdx
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__isoc99_fscanf@PLT
	movl	8(%rsp), %ebx
	cmpl	$-1, %ebx
	je	.L17
	leaq	16(%rsp), %rbp
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	$10000, %edx
	movq	%rbp, %rdi
	movw	%ax, 14(%rsp)
	leaq	14(%rsp), %r12
	call	memset@PLT
	testl	%ebx, %ebx
	jne	.L3
	movb	$48, 16(%rsp)
.L4:
	movq	%rbp, %rdi
	call	strlen@PLT
	leal	-1(%rax), %ebx
	testl	%eax, %eax
	je	.L5
	movslq	%ebx, %rbx
	.p2align 4,,10
	.p2align 3
.L6:
	movsbl	0(%rbp,%rbx), %edi
	movq	stdout(%rip), %rsi
	subq	$1, %rbx
	call	fputc@PLT
	cmpl	$-1, %ebx
	jne	.L6
.L5:
	movq	%r15, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%ebx, %eax
	movq	%r13, %rcx
	movl	$2, %edx
	movl	$1, %esi
	sarl	$31, %eax
	movq	%r12, %rdi
	shrl	$30, %eax
	leal	(%rbx,%rax), %r8d
	andl	$3, %r8d
	subl	%eax, %r8d
	xorl	%eax, %eax
	call	__sprintf_chk@PLT
	movl	$10000, %edx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__strcat_chk@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	leal	3(%rax), %ebx
	cmovns	%eax, %ebx
	sarl	$2, %ebx
	movl	%ebx, 8(%rsp)
	jne	.L3
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L17:
	movq	10024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$10040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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"
.LC1:
	.string	""
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$1848, %rsp
	.cfi_def_cfa_offset 10096
	leaq	.LC0(%rip), %r13
	leaq	.LC1(%rip), %r15
	movq	%fs:40, %rax
	movq	%rax, 10024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L2:
	movq	stdin(%rip), %rdi
	movq	%r14, %rdx
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__isoc99_fscanf@PLT
	movl	8(%rsp), %ebx
	cmpl	$-1, %ebx
	je	.L17
	leaq	16(%rsp), %rbp
	xorl	%eax, %eax
	xorl	%esi, %esi
	movl	$10000, %edx
	movq	%rbp, %rdi
	movw	%ax, 14(%rsp)
	leaq	14(%rsp), %r12
	call	memset@PLT
	testl	%ebx, %ebx
	jne	.L3
	movb	$48, 16(%rsp)
.L4:
	movq	%rbp, %rdi
	call	strlen@PLT
	leal	-1(%rax), %ebx
	testl	%eax, %eax
	je	.L5
	movslq	%ebx, %rbx
	.p2align 4,,10
	.p2align 3
.L6:
	movsbl	0(%rbp,%rbx), %edi
	movq	stdout(%rip), %rsi
	subq	$1, %rbx
	call	fputc@PLT
	cmpl	$-1, %ebx
	jne	.L6
.L5:
	movq	%r15, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%ebx, %eax
	movq	%r13, %rcx
	movl	$2, %edx
	movl	$1, %esi
	sarl	$31, %eax
	movq	%r12, %rdi
	shrl	$30, %eax
	leal	(%rbx,%rax), %r8d
	andl	$3, %r8d
	subl	%eax, %r8d
	xorl	%eax, %eax
	call	__sprintf_chk@PLT
	movl	$10000, %edx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__strcat_chk@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	leal	3(%rax), %ebx
	cmovns	%eax, %ebx
	sarl	$2, %ebx
	movl	%ebx, 8(%rsp)
	jne	.L3
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L17:
	movq	10024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$10040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string.h>

int main() {
	int n;
	char N[10000],x[2];
	int i;
	while (~fscanf(stdin, "%d", &n),n!=-1) {
		memset(x, '\0', sizeof(x));
		memset(N, '\0', sizeof(N));
		if(n==0) N[0]='0';
		while (n) {
			sprintf(x, "%d", n % 4);
			strcat(N, x);
			n /= 4;
		}
		for (i = strlen(N)-1; i >= 0; --i)fprintf(stdout, "%c", N[i]);
		puts("");
	}
	return 0;
}
7
4
0
12
10
10010
-1
 7
4
0
12
4
10000
-1
 7
4
0
13
10
10010
-1
 7
4
0
12
6
10000
-1
 7
4
0
24
10
10010
-1
 7
4
1
12
6
10000
-1
 7
4
1
24
10
10010
-1
 7
6
1
12
6
10000
-1
 7
1
1
24
10
10010
-1
 7
6
1
12
11
10000
-1

13
10
0
30
22
2130122
 13
10
0
30
10
2130100
 13
10
0
31
22
2130122
 13
10
0
30
12
2130100
 13
10
0
120
22
2130122
 13
10
1
30
12
2130100
 13
10
1
120
22
2130122
 13
12
1
30
12
2130100
 13
1
1
120
22
2130122
 13
12
1
30
23
2130100

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

```c
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string.h>

int main() {
	int n;
	char N[10000],x[2];
	int i;
	while (~fscanf(stdin, "%d", &n),n!=-1) {
		memset(x, '\0', sizeof(x));
		memset(N, '\0', sizeof(N));
		if(n==0) N[0]='0';
		while (n) {
			sprintf(x, "%d", n % 4);
			strcat(N, x);
			n /= 4;
		}
		for (i = strlen(N)-1; i >= 0; --i)fprintf(stdout, "%c", N[i]);
		puts("");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	""
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1840, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L8:
	leaq	-10018(%rbp), %rax
	movl	$2, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-10016(%rbp), %rax
	movl	$10000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-10028(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movb	$48, -10016(%rbp)
	jmp	.L4
.L5:
	movl	-10028(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	leaq	-10018(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	leaq	-10018(%rbp), %rdx
	leaq	-10016(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcat@PLT
	movl	-10028(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, -10028(%rbp)
.L4:
	movl	-10028(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	leaq	-10016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$1, %eax
	movl	%eax, -10024(%rbp)
	jmp	.L6
.L7:
	movl	-10024(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	movsbl	%al, %eax
	movq	stdout(%rip), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	fputc@PLT
	subl	$1, -10024(%rbp)
.L6:
	cmpl	$0, -10024(%rbp)
	jns	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	movq	stdin(%rip), %rax
	leaq	-10028(%rbp), %rdx
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-10028(%rbp), %eax
	cmpl	$-1, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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"
.LC1:
	.string	""
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1840, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L8:
	leaq	-10018(%rbp), %rax
	movl	$2, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-10016(%rbp), %rax
	movl	$10000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-10028(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movb	$48, -10016(%rbp)
	jmp	.L4
.L5:
	movl	-10028(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	leaq	-10018(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	sprintf@PLT
	leaq	-10018(%rbp), %rdx
	leaq	-10016(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcat@PLT
	movl	-10028(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, -10028(%rbp)
.L4:
	movl	-10028(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	leaq	-10016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$1, %eax
	movl	%eax, -10024(%rbp)
	jmp	.L6
.L7:
	movl	-10024(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	movsbl	%al, %eax
	movq	stdout(%rip), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	fputc@PLT
	subl	$1, -10024(%rbp)
.L6:
	cmpl	$0, -10024(%rbp)
	jns	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	movq	stdin(%rip), %rax
	leaq	-10028(%rbp), %rdx
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-10028(%rbp), %eax
	cmpl	$-1, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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:
