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

```c
// Aizu Vol-2 0208: Room Numbers of a Hospital
// 2017.8.18
// 8?????°??????????????????01234567???01235789??????????????????

#include <stdio.h>

char buf[30], *p;
char b[8] = { '0', '1', '2', '3', '5', '7', '8', '9' };

int main(void)
{
	int n;

	while (scanf("%d", &n) && n) {
		sprintf(p = buf, "%o", n);
		while (*p) *p = b[*p - '0'], p++;
		puts(buf);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%o"
.LC1:
	.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
	leaq	b(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	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	buf(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L5
	movl	4(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L5
	movl	$30, %edx
	movq	%r13, %rcx
	movl	$1, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%rbx, p(%rip)
	call	__sprintf_chk@PLT
	movq	p(%rip), %rdx
	movsbl	(%rdx), %eax
	testb	%al, %al
	je	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	subl	$48, %eax
	cltq
	movzbl	(%r14,%rax), %eax
	movb	%al, (%rdx)
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movsbl	1(%rax), %eax
	testb	%al, %al
	jne	.L4
.L3:
	movq	%rbx, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$16, %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
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.data
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.ascii	"01235789"
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 16
	.type	buf, @object
	.size	buf, 30
buf:
	.zero	30
	.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	"%o"
.LC1:
	.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
	leaq	b(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	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	buf(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L5
	movl	4(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L5
	movl	$30, %edx
	movq	%r13, %rcx
	movl	$1, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%rbx, p(%rip)
	call	__sprintf_chk@PLT
	movq	p(%rip), %rdx
	movsbl	(%rdx), %eax
	testb	%al, %al
	je	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	subl	$48, %eax
	cltq
	movzbl	(%r14,%rax), %eax
	movb	%al, (%rdx)
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movsbl	1(%rax), %eax
	testb	%al, %al
	jne	.L4
.L3:
	movq	%rbx, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$16, %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
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.data
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.ascii	"01235789"
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 16
	.type	buf, @object
	.size	buf, 30
buf:
	.zero	30
	.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	"%o"
.LC1:
	.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
	leaq	b(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	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	buf(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L5
	movl	4(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L5
	movl	$30, %edx
	movq	%r13, %rcx
	movl	$1, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%rbx, p(%rip)
	call	__sprintf_chk@PLT
	movq	p(%rip), %rdx
	movsbl	(%rdx), %eax
	testb	%al, %al
	je	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	subl	$48, %eax
	cltq
	movzbl	(%r14,%rax), %eax
	movb	%al, (%rdx)
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movsbl	1(%rax), %eax
	testb	%al, %al
	jne	.L4
.L3:
	movq	%rbx, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$16, %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
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.data
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.ascii	"01235789"
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 16
	.type	buf, @object
	.size	buf, 30
buf:
	.zero	30
	.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
// Aizu Vol-2 0208: Room Numbers of a Hospital
// 2017.8.18
// 8?????°??????????????????01234567???01235789??????????????????

#include <stdio.h>

char buf[30], *p;
char b[8] = { '0', '1', '2', '3', '5', '7', '8', '9' };

int main(void)
{
	int n;

	while (scanf("%d", &n) && n) {
		sprintf(p = buf, "%o", n);
		while (*p) *p = b[*p - '0'], p++;
		puts(buf);
	}
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// Aizu Vol-2 0208: Room Numbers of a Hospital
// 2017.8.18
// 8?????°??????????????????01234567???01235789??????????????????

#include <stdio.h>

char buf[30], *p;
char b[8] = { '0', '1', '2', '3', '5', '7', '8', '9' };

int main(void)
{
	int n;

	while (scanf("%d", &n) && n) {
		sprintf(p = buf, "%o", n);
		while (*p) *p = b[*p - '0'], p++;
		puts(buf);
	}
	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:

15
100
1000000000
1
0
 15
110
1000000000
1
0
 15
101
1000000000
3
0
 15
110
1000000000
0
0
 15
101
1001000000
3
0
 15
100
1000000000
0
0
 15
111
1001000000
3
0
 15
000
1000000000
0
0
 15
111
1001000000
2
0
 15
111
1001000001
2
0

19
155
9358757000
1
 19
178
9358757000
1
 19
157
9358757000
3
 19
178
9358757000
 19
157
9372508100
3
 19
155
9358757000
 19
179
9372508100
3
 19
 19
179
9372508100
2
 19
179
9372508101
2

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

```c
// Aizu Vol-2 0208: Room Numbers of a Hospital
// 2017.8.18
// 8?????°??????????????????01234567???01235789??????????????????

#include <stdio.h>

char buf[30], *p;
char b[8] = { '0', '1', '2', '3', '5', '7', '8', '9' };

int main(void)
{
	int n;

	while (scanf("%d", &n) && n) {
		sprintf(p = buf, "%o", n);
		while (*p) *p = b[*p - '0'], p++;
		puts(buf);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%o"
.LC1:
	.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
	leaq	b(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	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	buf(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L5
	movl	4(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L5
	movl	$30, %edx
	movq	%r13, %rcx
	movl	$1, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%rbx, p(%rip)
	call	__sprintf_chk@PLT
	movq	p(%rip), %rdx
	movsbl	(%rdx), %eax
	testb	%al, %al
	je	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	subl	$48, %eax
	cltq
	movzbl	(%r14,%rax), %eax
	movb	%al, (%rdx)
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movsbl	1(%rax), %eax
	testb	%al, %al
	jne	.L4
.L3:
	movq	%rbx, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$16, %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
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.data
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.ascii	"01235789"
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 16
	.type	buf, @object
	.size	buf, 30
buf:
	.zero	30
	.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	"%o"
.LC1:
	.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
	leaq	b(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	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	buf(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L5
	movl	4(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L5
	movl	$30, %edx
	movq	%r13, %rcx
	movl	$1, %esi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%rbx, p(%rip)
	call	__sprintf_chk@PLT
	movq	p(%rip), %rdx
	movsbl	(%rdx), %eax
	testb	%al, %al
	je	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	subl	$48, %eax
	cltq
	movzbl	(%r14,%rax), %eax
	movb	%al, (%rdx)
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movsbl	1(%rax), %eax
	testb	%al, %al
	jne	.L4
.L3:
	movq	%rbx, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$16, %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
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.data
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.ascii	"01235789"
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 16
	.type	buf, @object
	.size	buf, 30
buf:
	.zero	30
	.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:
```