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

```c
/* Coached by rainboy */
#include <stdio.h>
#include <stdlib.h>

#define INF 0x3f3f3f3f

char cc[64];
int cnt;

void encode(int n) {
	if (n == 0)
		return;
	if (n % 2 == 0) {
		encode(-n / 2);
		cc[cnt++] = '0';
	} else {
		encode(-(n - 1) / 2);
		cc[cnt++] = '1';
	}
}

int main() {
	int n;

	scanf("%d", &n);
	if (n == 0) {
		printf("0\n");
		return 0;
	}
	encode(n);
	printf("%s\n", cc);
	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	encode
	.type	encode, @function
encode:
.LFB39:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L26
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	testb	$1, %dil
	jne	.L3
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	negl	%eax
	je	.L30
	testb	$1, %al
	jne	.L6
	testl	%edi, %edi
	leal	3(%rdi), %eax
	cmovns	%edi, %eax
	sarl	$2, %eax
	je	.L31
	testb	$1, %al
	je	.L32
	movl	$1, %edx
	subl	%eax, %edx
	movl	%edx, %edi
	shrl	$31, %edi
	addl	%edx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L8:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L33
	testb	$1, %al
	jne	.L15
	testl	%edx, %edx
	leal	3(%rdx), %eax
	cmovns	%edx, %eax
	sarl	$2, %eax
	negl	%eax
	je	.L34
	testb	$1, %al
	je	.L35
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L17:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_def_cfa_offset 16
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L36
	testb	$1, %al
	je	.L37
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L11:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L38
	testb	$1, %al
	je	.L39
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L20:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L30:
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L5:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$48, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L14:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$49, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	testl	%edx, %edx
	leal	7(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$3, %edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L32:
	testl	%edi, %edi
	leal	7(%rdi), %eax
	cmovs	%eax, %edi
	sarl	$3, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L31:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L36:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L34:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L38:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L20
	.cfi_endproc
.LFE39:
	.size	encode, .-encode
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	testl	%edi, %edi
	je	.L45
	call	encode
	leaq	cc(%rip), %rdi
	call	puts@PLT
.L42:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L45:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L42
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 4
	.type	cnt, @object
	.size	cnt, 4
cnt:
	.zero	4
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 64
cc:
	.zero	64
	.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
	.p2align 4
	.globl	encode
	.type	encode, @function
encode:
.LFB39:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L26
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	testb	$1, %dil
	jne	.L3
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	negl	%eax
	je	.L30
	testb	$1, %al
	jne	.L6
	testl	%edi, %edi
	leal	3(%rdi), %eax
	cmovns	%edi, %eax
	sarl	$2, %eax
	je	.L31
	testb	$1, %al
	je	.L32
	movl	$1, %edx
	subl	%eax, %edx
	movl	%edx, %edi
	shrl	$31, %edi
	addl	%edx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L8:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L33
	testb	$1, %al
	jne	.L15
	testl	%edx, %edx
	leal	3(%rdx), %eax
	cmovns	%edx, %eax
	sarl	$2, %eax
	negl	%eax
	je	.L34
	testb	$1, %al
	je	.L35
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L17:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_def_cfa_offset 16
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L36
	testb	$1, %al
	je	.L37
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L11:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L38
	testb	$1, %al
	je	.L39
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L20:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L30:
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L5:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$48, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L14:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$49, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	testl	%edx, %edx
	leal	7(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$3, %edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L32:
	testl	%edi, %edi
	leal	7(%rdi), %eax
	cmovs	%eax, %edi
	sarl	$3, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L31:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L36:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L34:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L38:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L20
	.cfi_endproc
.LFE39:
	.size	encode, .-encode
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	testl	%edi, %edi
	je	.L45
	call	encode
	leaq	cc(%rip), %rdi
	call	puts@PLT
.L42:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L45:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L42
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 4
	.type	cnt, @object
	.size	cnt, 4
cnt:
	.zero	4
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 64
cc:
	.zero	64
	.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
	.p2align 4
	.globl	encode
	.type	encode, @function
encode:
.LFB39:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L26
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	testb	$1, %dil
	jne	.L3
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	negl	%eax
	je	.L30
	testb	$1, %al
	jne	.L6
	testl	%edi, %edi
	leal	3(%rdi), %eax
	cmovns	%edi, %eax
	sarl	$2, %eax
	je	.L31
	testb	$1, %al
	je	.L32
	movl	$1, %edx
	subl	%eax, %edx
	movl	%edx, %edi
	shrl	$31, %edi
	addl	%edx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L8:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L33
	testb	$1, %al
	jne	.L15
	testl	%edx, %edx
	leal	3(%rdx), %eax
	cmovns	%edx, %eax
	sarl	$2, %eax
	negl	%eax
	je	.L34
	testb	$1, %al
	je	.L35
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L17:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_def_cfa_offset 16
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L36
	testb	$1, %al
	je	.L37
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L11:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L38
	testb	$1, %al
	je	.L39
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L20:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L30:
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L5:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$48, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L14:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$49, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	testl	%edx, %edx
	leal	7(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$3, %edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L32:
	testl	%edi, %edi
	leal	7(%rdi), %eax
	cmovs	%eax, %edi
	sarl	$3, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L31:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L36:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L34:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L38:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L20
	.cfi_endproc
.LFE39:
	.size	encode, .-encode
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	testl	%edi, %edi
	je	.L45
	call	encode
	leaq	cc(%rip), %rdi
	call	puts@PLT
.L42:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L45:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L42
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 4
	.type	cnt, @object
	.size	cnt, 4
cnt:
	.zero	4
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 64
cc:
	.zero	64
	.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
/* Coached by rainboy */
#include <stdio.h>
#include <stdlib.h>

#define INF 0x3f3f3f3f

char cc[64];
int cnt;

void encode(int n) {
	if (n == 0)
		return;
	if (n % 2 == 0) {
		encode(-n / 2);
		cc[cnt++] = '0';
	} else {
		encode(-(n - 1) / 2);
		cc[cnt++] = '1';
	}
}

int main() {
	int n;

	scanf("%d", &n);
	if (n == 0) {
		printf("0\n");
		return 0;
	}
	encode(n);
	printf("%s\n", cc);
	return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
/* Coached by rainboy */
#include <stdio.h>
#include <stdlib.h>

#define INF 0x3f3f3f3f

char cc[64];
int cnt;

void encode(int n) {
	if (n == 0)
		return;
	if (n % 2 == 0) {
		encode(-n / 2);
		cc[cnt++] = '0';
	} else {
		encode(-(n - 1) / 2);
		cc[cnt++] = '1';
	}
}

int main() {
	int n;

	scanf("%d", &n);
	if (n == 0) {
		printf("0\n");
		return 0;
	}
	encode(n);
	printf("%s\n", cc);
	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:

-1
 208967441
 -6
 -2
 180276081
 -3
 1
 175198680
 -4
 2

11
 11101101101011110101100010001
 1110
 10
 11111110000111101110010110001
 1101
 1
 11111101100010101011000101000
 1100
 110

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

```c
/* Coached by rainboy */
#include <stdio.h>
#include <stdlib.h>

#define INF 0x3f3f3f3f

char cc[64];
int cnt;

void encode(int n) {
	if (n == 0)
		return;
	if (n % 2 == 0) {
		encode(-n / 2);
		cc[cnt++] = '0';
	} else {
		encode(-(n - 1) / 2);
		cc[cnt++] = '1';
	}
}

int main() {
	int n;

	scanf("%d", &n);
	if (n == 0) {
		printf("0\n");
		return 0;
	}
	encode(n);
	printf("%s\n", cc);
	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	encode
	.type	encode, @function
encode:
.LFB39:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L26
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	testb	$1, %dil
	jne	.L3
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	negl	%eax
	je	.L30
	testb	$1, %al
	jne	.L6
	testl	%edi, %edi
	leal	3(%rdi), %eax
	cmovns	%edi, %eax
	sarl	$2, %eax
	je	.L31
	testb	$1, %al
	je	.L32
	movl	$1, %edx
	subl	%eax, %edx
	movl	%edx, %edi
	shrl	$31, %edi
	addl	%edx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L8:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L33
	testb	$1, %al
	jne	.L15
	testl	%edx, %edx
	leal	3(%rdx), %eax
	cmovns	%edx, %eax
	sarl	$2, %eax
	negl	%eax
	je	.L34
	testb	$1, %al
	je	.L35
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L17:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_def_cfa_offset 16
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L36
	testb	$1, %al
	je	.L37
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L11:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L38
	testb	$1, %al
	je	.L39
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L20:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L30:
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L5:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$48, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L14:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$49, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	testl	%edx, %edx
	leal	7(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$3, %edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L32:
	testl	%edi, %edi
	leal	7(%rdi), %eax
	cmovs	%eax, %edi
	sarl	$3, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L31:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L36:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L34:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L38:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L20
	.cfi_endproc
.LFE39:
	.size	encode, .-encode
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	testl	%edi, %edi
	je	.L45
	call	encode
	leaq	cc(%rip), %rdi
	call	puts@PLT
.L42:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L45:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L42
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 4
	.type	cnt, @object
	.size	cnt, 4
cnt:
	.zero	4
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 64
cc:
	.zero	64
	.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
	.p2align 4
	.globl	encode
	.type	encode, @function
encode:
.LFB39:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L26
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	testb	$1, %dil
	jne	.L3
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	negl	%eax
	je	.L30
	testb	$1, %al
	jne	.L6
	testl	%edi, %edi
	leal	3(%rdi), %eax
	cmovns	%edi, %eax
	sarl	$2, %eax
	je	.L31
	testb	$1, %al
	je	.L32
	movl	$1, %edx
	subl	%eax, %edx
	movl	%edx, %edi
	shrl	$31, %edi
	addl	%edx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L8:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L33
	testb	$1, %al
	jne	.L15
	testl	%edx, %edx
	leal	3(%rdx), %eax
	cmovns	%edx, %eax
	sarl	$2, %eax
	negl	%eax
	je	.L34
	testb	$1, %al
	je	.L35
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L17:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$48, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_def_cfa_offset 16
	movl	$1, %ecx
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L36
	testb	$1, %al
	je	.L37
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L11:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%ecx, %edx
	subl	%eax, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	je	.L38
	testb	$1, %al
	je	.L39
	subl	%eax, %ecx
	movl	%ecx, %edi
	shrl	$31, %edi
	addl	%ecx, %edi
	sarl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$49, (%rax,%rdx)
	leal	1(%rdx), %ecx
.L20:
	leal	1(%rcx), %edx
	movslq	%ecx, %rcx
	movb	$49, (%rax,%rcx)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L30:
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L5:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$48, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movl	cnt(%rip), %edx
	leaq	cc(%rip), %rax
.L14:
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movl	%ecx, cnt(%rip)
	movb	$49, (%rax,%rdx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	testl	%edx, %edx
	leal	7(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$3, %edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L32:
	testl	%edi, %edi
	leal	7(%rdi), %eax
	cmovs	%eax, %edi
	sarl	$3, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%edx, %edx
	leal	3(%rdx), %edi
	cmovns	%edx, %edi
	sarl	$2, %edi
	negl	%edi
	call	encode
	movslq	cnt(%rip), %rdx
	leaq	cc(%rip), %rax
	movb	$48, (%rax,%rdx)
	leal	1(%rdx), %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L31:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L36:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L34:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L38:
	movl	cnt(%rip), %ecx
	leaq	cc(%rip), %rax
	jmp	.L20
	.cfi_endproc
.LFE39:
	.size	encode, .-encode
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	testl	%edi, %edi
	je	.L45
	call	encode
	leaq	cc(%rip), %rdi
	call	puts@PLT
.L42:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L45:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L42
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 4
	.type	cnt, @object
	.size	cnt, 4
cnt:
	.zero	4
	.globl	cc
	.align 32
	.type	cc, @object
	.size	cc, 64
cc:
	.zero	64
	.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:
```