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

```c
P(n){n/4&&P(n/4);putchar(48+n%4);}main(n){for(;~scanf("%d",&n);)n+1&&puts("",P(n));}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	P
	.type	P, @function
P:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	addl	$3, %eax
	cmpl	$6, %eax
	jbe	.L3
	movl	-4(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	P
	testl	%eax, %eax
.L3:
	movl	-4(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	addl	$48, %eax
	movl	%eax, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	P, .-P
	.section	.rodata
.LC0:
	.string	""
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	cmpl	$-1, %eax
	je	.L5
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	P
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	testl	%eax, %eax
.L5:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.globl	P
	.type	P, @function
P:
.LFB0:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edi, %ebx
	addl	$3, %edi
	cmpl	$6, %edi
	ja	.L7
.L2:
	movl	%ebx, %eax
	sarl	$31, %eax
	shrl	$30, %eax
	leal	(%rbx,%rax), %edi
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	andl	$3, %edi
	popq	%r12
	.cfi_def_cfa_offset 8
	subl	%eax, %edi
	addl	$48, %edi
	jmp	putchar@PLT
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	testl	%ebx, %ebx
	cmovns	%ebx, %edi
	sarl	$2, %edi
	leal	3(%rdi), %eax
	movl	%edi, %ebp
	cmpl	$6, %eax
	ja	.L8
.L3:
	movl	%ebp, %eax
	sarl	$31, %eax
	shrl	$30, %eax
	leal	0(%rbp,%rax), %edi
	andl	$3, %edi
	subl	%eax, %edi
	addl	$48, %edi
	call	putchar@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	testl	%edi, %edi
	cmovns	%edi, %eax
	movl	%eax, %r12d
	sarl	$2, %r12d
	leal	3(%r12), %eax
	cmpl	$6, %eax
	ja	.L9
.L4:
	movl	%r12d, %eax
	sarl	$31, %eax
	shrl	$30, %eax
	leal	(%r12,%rax), %edi
	andl	$3, %edi
	subl	%eax, %edi
	addl	$48, %edi
	call	putchar@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%r12d, %r12d
	cmovns	%r12d, %eax
	movl	%eax, %edi
	xorl	%eax, %eax
	sarl	$2, %edi
	call	P
	jmp	.L4
	.cfi_endproc
.LFE0:
	.size	P, .-P
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	""
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movl	%edi, 12(%rsp)
	leaq	12(%rsp), %rbp
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	movl	12(%rsp), %edi
	cmpl	$-1, %edi
	jne	.L17
.L12:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	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
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	call	P
	movq	%r12, %rdi
	movl	%eax, %esi
	call	puts@PLT
	jmp	.L12
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.globl	P
	.type	P, @function
P:
.LFB0:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edi, %ebx
	addl	$3, %edi
	cmpl	$6, %edi
	ja	.L7
.L2:
	movl	%ebx, %eax
	sarl	$31, %eax
	shrl	$30, %eax
	leal	(%rbx,%rax), %edi
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	andl	$3, %edi
	popq	%r12
	.cfi_def_cfa_offset 8
	subl	%eax, %edi
	addl	$48, %edi
	jmp	putchar@PLT
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	testl	%ebx, %ebx
	cmovns	%ebx, %edi
	sarl	$2, %edi
	leal	3(%rdi), %eax
	movl	%edi, %ebp
	cmpl	$6, %eax
	ja	.L8
.L3:
	movl	%ebp, %eax
	sarl	$31, %eax
	shrl	$30, %eax
	leal	0(%rbp,%rax), %edi
	andl	$3, %edi
	subl	%eax, %edi
	addl	$48, %edi
	call	putchar@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	testl	%edi, %edi
	cmovns	%edi, %eax
	movl	%eax, %r12d
	sarl	$2, %r12d
	leal	3(%r12), %eax
	cmpl	$6, %eax
	ja	.L9
.L4:
	movl	%r12d, %eax
	sarl	$31, %eax
	shrl	$30, %eax
	leal	(%r12,%rax), %edi
	andl	$3, %edi
	subl	%eax, %edi
	addl	$48, %edi
	call	putchar@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L9:
	testl	%r12d, %r12d
	cmovns	%r12d, %eax
	movl	%eax, %edi
	xorl	%eax, %eax
	sarl	$2, %edi
	call	P
	jmp	.L4
	.cfi_endproc
.LFE0:
	.size	P, .-P
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	""
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movl	%edi, 12(%rsp)
	leaq	12(%rsp), %rbp
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	movl	12(%rsp), %edi
	cmpl	$-1, %edi
	jne	.L17
.L12:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	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
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	call	P
	movq	%r12, %rdi
	movl	%eax, %esi
	call	puts@PLT
	jmp	.L12
	.cfi_endproc
.LFE1:
	.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:

P(n){n/4&&P(n/4);putchar(48+n%4);}main(n){for(;~scanf("%d",&n);)n+1&&puts("",P(n));}
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
P(n){n/4&&P(n/4);putchar(48+n%4);}main(n){for(;~scanf("%d",&n);)n+1&&puts("",P(n));}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	P
	.type	P, @function
P:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	addl	$3, %eax
	cmpl	$6, %eax
	jbe	.L3
	movl	-4(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	P
	testl	%eax, %eax
.L3:
	movl	-4(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	addl	$48, %eax
	movl	%eax, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	P, .-P
	.section	.rodata
.LC0:
	.string	""
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	cmpl	$-1, %eax
	je	.L5
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	P
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	testl	%eax, %eax
.L5:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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.
val
	.file	"temp.c"
	.text
	.globl	P
	.type	P, @function
P:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	addl	$3, %eax
	cmpl	$6, %eax
	jbe	.L3
	movl	-4(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	P
	testl	%eax, %eax
.L3:
	movl	-4(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	addl	$48, %eax
	movl	%eax, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	P, .-P
	.section	.rodata
.LC0:
	.string	""
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	cmpl	$-1, %eax
	je	.L5
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	P
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	testl	%eax, %eax
.L5:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
