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

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


int main(void)
{
    unsigned int room;
    int flag;
    char *table = "01235789";
    int i;
    
    while (1){
        scanf("%u", &room);
        if (room == 0){
            break;
        }
        
        flag = 0;
        for (i = 30; i >= 0; i -= 3){
            if (((room >> i) & 7) != 0){
                flag = 1;
            }
            if (flag == 1){
                printf("%c", table[(room >> i) & 7]);
            }
        }
        printf("\n");
    }
    return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"01235789"
.LC1:
	.string	"%u"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rax
	movq	%rax, -16(%rbp)
.L8:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	je	.L12
	movl	$0, -24(%rbp)
	movl	$30, -20(%rbp)
	jmp	.L4
.L7:
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %ecx
	shrl	%cl, %edx
	movl	%edx, %eax
	andl	$7, %eax
	testl	%eax, %eax
	je	.L5
	movl	$1, -24(%rbp)
.L5:
	cmpl	$1, -24(%rbp)
	jne	.L6
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %ecx
	shrl	%cl, %edx
	movl	%edx, %eax
	movl	%eax, %eax
	andl	$7, %eax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
.L6:
	subl	$3, -20(%rbp)
.L4:
	cmpl	$0, -20(%rbp)
	jns	.L7
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L8
.L12:
	nop
	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	"%u"
.LC1:
	.string	"01235789"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %edx
	shrl	$27, %edx
	jne	.L4
	movl	%eax, %edx
	shrl	$24, %edx
	andl	$7, %edx
	jne	.L6
	movl	%eax, %edx
	shrl	$21, %edx
	andl	$7, %edx
	jne	.L8
	movl	%eax, %edx
	shrl	$18, %edx
	andl	$7, %edx
	jne	.L10
	movl	%eax, %edx
	shrl	$15, %edx
	andl	$7, %edx
	jne	.L12
	movl	%eax, %edx
	shrl	$12, %edx
	andl	$7, %edx
	jne	.L14
	movl	%eax, %edx
	shrl	$9, %edx
	andl	$7, %edx
	jne	.L16
	movl	%eax, %edx
	shrl	$6, %edx
	andl	$7, %edx
	jne	.L18
	movl	%eax, %edx
	shrl	$3, %edx
	andl	$7, %edx
	jne	.L20
	andl	$7, %eax
	jne	.L22
.L23:
	movl	$10, %edi
	call	putchar@PLT
.L24:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	movl	%eax, %edx
	shrl	$30, %edx
	je	.L3
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$27, %edx
	andl	$7, %edx
.L4:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movzbl	7(%rsp), %edx
	andl	$7, %edx
.L6:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$21, %edx
	andl	$7, %edx
.L8:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$18, %edx
	andl	$7, %edx
.L10:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$15, %edx
	andl	$7, %edx
.L12:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$12, %edx
	andl	$7, %edx
.L14:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$9, %edx
	andl	$7, %edx
.L16:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$6, %edx
	andl	$7, %edx
.L18:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$3, %edx
	andl	$7, %edx
.L20:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %eax
	andl	$7, %eax
.L22:
	movl	%eax, %eax
	movsbl	(%rbx,%rax), %edi
	call	putchar@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L31:
	.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	"%u"
.LC1:
	.string	"01235789"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %edx
	shrl	$27, %edx
	jne	.L4
	movl	%eax, %edx
	shrl	$24, %edx
	andl	$7, %edx
	jne	.L6
	movl	%eax, %edx
	shrl	$21, %edx
	andl	$7, %edx
	jne	.L8
	movl	%eax, %edx
	shrl	$18, %edx
	andl	$7, %edx
	jne	.L10
	movl	%eax, %edx
	shrl	$15, %edx
	andl	$7, %edx
	jne	.L12
	movl	%eax, %edx
	shrl	$12, %edx
	andl	$7, %edx
	jne	.L14
	movl	%eax, %edx
	shrl	$9, %edx
	andl	$7, %edx
	jne	.L16
	movl	%eax, %edx
	shrl	$6, %edx
	andl	$7, %edx
	jne	.L18
	movl	%eax, %edx
	shrl	$3, %edx
	andl	$7, %edx
	jne	.L20
	andl	$7, %eax
	jne	.L22
.L23:
	movl	$10, %edi
	call	putchar@PLT
.L24:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	movl	%eax, %edx
	shrl	$30, %edx
	je	.L3
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$27, %edx
	andl	$7, %edx
.L4:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movzbl	7(%rsp), %edx
	andl	$7, %edx
.L6:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$21, %edx
	andl	$7, %edx
.L8:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$18, %edx
	andl	$7, %edx
.L10:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$15, %edx
	andl	$7, %edx
.L12:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$12, %edx
	andl	$7, %edx
.L14:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$9, %edx
	andl	$7, %edx
.L16:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$6, %edx
	andl	$7, %edx
.L18:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %edx
	shrl	$3, %edx
	andl	$7, %edx
.L20:
	movl	%edx, %edx
	movsbl	(%rbx,%rdx), %edi
	call	putchar@PLT
	movl	4(%rsp), %eax
	andl	$7, %eax
.L22:
	movl	%eax, %eax
	movsbl	(%rbx,%rax), %edi
	call	putchar@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L31:
	.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:

#include <stdio.h>
#include <string.h>


int main(void)
{
    unsigned int room;
    int flag;
    char *table = "01235789";
    int i;
    
    while (1){
        scanf("%u", &room);
        if (room == 0){
            break;
        }
        
        flag = 0;
        for (i = 30; i >= 0; i -= 3){
            if (((room >> i) & 7) != 0){
                flag = 1;
            }
            if (flag == 1){
                printf("%c", table[(room >> i) & 7]);
            }
        }
        printf("\n");
    }
    return (0);
}
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 unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

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


int main(void)
{
    unsigned int room;
    int flag;
    char *table = "01235789";
    int i;
    
    while (1){
        scanf("%u", &room);
        if (room == 0){
            break;
        }
        
        flag = 0;
        for (i = 30; i >= 0; i -= 3){
            if (((room >> i) & 7) != 0){
                flag = 1;
            }
            if (flag == 1){
                printf("%c", table[(room >> i) & 7]);
            }
        }
        printf("\n");
    }
    return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"01235789"
.LC1:
	.string	"%u"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rax
	movq	%rax, -16(%rbp)
.L8:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	je	.L12
	movl	$0, -24(%rbp)
	movl	$30, -20(%rbp)
	jmp	.L4
.L7:
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %ecx
	shrl	%cl, %edx
	movl	%edx, %eax
	andl	$7, %eax
	testl	%eax, %eax
	je	.L5
	movl	$1, -24(%rbp)
.L5:
	cmpl	$1, -24(%rbp)
	jne	.L6
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %ecx
	shrl	%cl, %edx
	movl	%edx, %eax
	movl	%eax, %eax
	andl	$7, %eax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
.L6:
	subl	$3, -20(%rbp)
.L4:
	cmpl	$0, -20(%rbp)
	jns	.L7
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L8
.L12:
	nop
	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	"01235789"
.LC1:
	.string	"%u"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rax
	movq	%rax, -16(%rbp)
.L8:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	je	.L12
	movl	$0, -24(%rbp)
	movl	$30, -20(%rbp)
	jmp	.L4
.L7:
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %ecx
	shrl	%cl, %edx
	movl	%edx, %eax
	andl	$7, %eax
	testl	%eax, %eax
	je	.L5
	movl	$1, -24(%rbp)
.L5:
	cmpl	$1, -24(%rbp)
	jne	.L6
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %ecx
	shrl	%cl, %edx
	movl	%edx, %eax
	movl	%eax, %eax
	andl	$7, %eax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
.L6:
	subl	$3, -20(%rbp)
.L4:
	cmpl	$0, -20(%rbp)
	jns	.L7
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L8
.L12:
	nop
	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:
