// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/pp.c
// Function: janet_to_string_b
void janet_to_string_b(JanetBuffer *buffer, Janet x) {
    switch (janet_type(x)) {
        case JANET_NIL:
            janet_buffer_push_cstring(buffer, "");
            break;
        case JANET_BOOLEAN:
            janet_buffer_push_cstring(buffer,
                                      janet_unwrap_boolean(x) ? "true" : "false");
            break;
        case JANET_NUMBER:
            number_to_string_b(buffer, janet_unwrap_number(x));
            break;
        case JANET_STRING:
        case JANET_SYMBOL:
        case JANET_KEYWORD:
            janet_buffer_push_bytes(buffer,
                                    janet_unwrap_string(x),
                                    janet_string_length(janet_unwrap_string(x)));
            break;
        case JANET_BUFFER: {
            JanetBuffer *to = janet_unwrap_buffer(x);
            /* Prevent resizing buffer while appending */
            if (buffer == to) janet_buffer_extra(buffer, to->count);
            janet_buffer_push_bytes(buffer, to->data, to->count);
            break;
        }
        case JANET_ABSTRACT: {
            JanetAbstract p = janet_unwrap_abstract(x);
            const JanetAbstractType *t = janet_abstract_type(p);
            if (t->tostring != NULL) {
                t->tostring(p, buffer);
            } else {
                string_description_b(buffer, t->name, p);
            }
        }
        return;
        case JANET_CFUNCTION: {
            JanetCFunRegistry *reg = janet_registry_get(janet_unwrap_cfunction(x));
            if (NULL != reg) {
                janet_buffer_push_cstring(buffer, "<cfunction ");
                if (NULL != reg->name_prefix) {
                    janet_buffer_push_cstring(buffer, reg->name_prefix);
                    janet_buffer_push_u8(buffer, '/');
                }
                janet_buffer_push_cstring(buffer, reg->name);
                janet_buffer_push_u8(buffer, '>');
                break;
            }
            goto fallthrough;
        }
        case JANET_FUNCTION: {
            JanetFunction *fun = janet_unwrap_function(x);
            JanetFuncDef *def = fun->def;
            if (def == NULL) {
                janet_buffer_push_cstring(buffer, "<incomplete function>");
                break;
            }
            if (def->name) {
                const uint8_t *n = def->name;
                janet_buffer_push_cstring(buffer, "<function ");
                janet_buffer_push_bytes(buffer, n, janet_string_length(n));
                janet_buffer_push_u8(buffer, '>');
                break;
            }
            goto fallthrough;
        }
    fallthrough:
        default:
            string_description_b(buffer, janet_type_names[janet_type(x)], janet_unwrap_pointer(x));
            break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rsi, %xmm0
movq %rsi, %rax
shrq $0x2f, %rax
andl $0xf, %eax
xorl %r12d, %r12d
ucomisd %xmm0, %xmm0
movq %rdi, %rbx
cmovpl %eax, %r12d
cmpl $0xe, %r12d
ja 0x3b4e6
leaq 0x28fac(%rip), %rax     # 0x642ec
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %r15
movq %r14, %rdi
callq 0x4b1f1
movl -0x8(%rax), %edx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x3b3a9
testb $0x1, %r14b
leaq 0x297fa(%rip), %rax     # 0x64b6c
leaq 0x297eb(%rip), %rsi     # 0x64b64
cmoveq %rax, %rsi
jmp 0x3b51d
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %r14
cmpq %rbx, %rax
jne 0x3b39e
movl 0x10(%r14), %esi
movq %rbx, %rdi
callq 0x16095
movq 0x18(%r14), %rsi
movl 0x10(%r14), %edx
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x16172
movq %r14, %rdi
callq 0x4b1f1
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x3b516
movq 0x48(%rax), %r15
testq %r15, %r15
je 0x3b4e6
leaq 0x291db(%rip), %rsi     # 0x645be
movq %rbx, %rdi
callq 0x1614c
movl -0x8(%r15), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x16172
jmp 0x3b4cf
movl 0x10(%rbx), %esi
addl $0x40, %esi
pushq $0x2
popq %rdx
movq %rbx, %rdi
movsd %xmm0, -0x28(%rbp)
callq 0x15f9b
xorpd %xmm0, %xmm0
movsd -0x28(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movsd -0x28(%rbp), %xmm0
jne 0x3b531
jp 0x3b531
movq 0x18(%rbx), %rax
movslq 0x10(%rbx), %rcx
movb $0x30, (%rax,%rcx)
pushq $0x1
popq %rax
jmp 0x3b587
movq %r14, %rdi
callq 0x4b1f1
movq -0x10(%rax), %rdx
movq 0x38(%rdx), %rcx
testq %rcx, %rcx
je 0x3b597
movq %rax, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
leaq 0x2cc82(%rip), %rsi     # 0x680fd
jmp 0x3b51d
movq %r14, %rdi
callq 0x4b1f1
movq %rax, %rdi
callq 0x4513c
testq %rax, %rax
je 0x3b4e6
movq %rax, %r15
leaq 0x290fd(%rip), %rsi     # 0x6459c
movq %rbx, %rdi
callq 0x1614c
movq 0x10(%r15), %rsi
testq %rsi, %rsi
je 0x3b4c3
movq %rbx, %rdi
callq 0x1614c
pushq $0x2f
popq %rsi
movq %rbx, %rdi
callq 0x161be
movq 0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x1614c
pushq $0x3e
popq %rsi
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x161be
movl %r12d, %eax
leaq 0x43f20(%rip), %rcx     # 0x7f410
movq (%rcx,%rax,8), %r15
movq %r14, %rdi
callq 0x4b1f1
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3b5a2
leaq 0x2908b(%rip), %rsi     # 0x645a8
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1614c
callq 0x129f0
movsd -0x28(%rbp), %xmm1
ucomisd %xmm1, %xmm0
leaq 0x2912a(%rip), %rax     # 0x64670
leaq 0x2911e(%rip), %rdx     # 0x6466b
cmovneq %rax, %rdx
cmovpq %rax, %rdx
movsd 0x1e853(%rip), %xmm0    # 0x59db0
ucomisd %xmm1, %xmm0
cmovbq %rax, %rdx
ucomisd 0x1e84b(%rip), %xmm1    # 0x59db8
movapd %xmm1, %xmm0
cmovbq %rax, %rdx
movslq 0x10(%rbx), %rdi
addq 0x18(%rbx), %rdi
pushq $0x40
popq %rsi
movb $0x1, %al
callq 0x12390
addl %eax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%rdx), %rsi
movq %rbx, %rdi
jmp 0x3b502