// File: /workspace/github_c_makefile_star2_O3/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 0x3ea16
leaq 0x29a64(%rip), %rax     # 0x682cc
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %r15
movq %r14, %rdi
callq 0x4ebc4
movl -0x8(%rax), %edx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x3e8d1
testb $0x1, %r14b
leaq 0x2a2b2(%rip), %rax     # 0x68b4c
leaq 0x2a2a3(%rip), %rsi     # 0x68b44
cmoveq %rax, %rsi
jmp 0x3ea4d
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %r14
cmpq %rbx, %rax
jne 0x3e8c6
movl 0x10(%r14), %esi
movq %rbx, %rdi
callq 0x177e3
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 0x178c5
movq %r14, %rdi
callq 0x4ebc4
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x3ea46
movq 0x48(%rax), %r15
testq %r15, %r15
je 0x3ea16
leaq 0x29c93(%rip), %rsi     # 0x6859e
movq %rbx, %rdi
callq 0x17878
movl -0x8(%r15), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x178c5
jmp 0x3e9fd
movl 0x10(%rbx), %esi
addl $0x40, %esi
movq %rbx, %rdi
movl $0x2, %edx
movsd %xmm0, -0x28(%rbp)
callq 0x1771e
xorpd %xmm0, %xmm0
movsd -0x28(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movsd -0x28(%rbp), %xmm0
jne 0x3ea61
jp 0x3ea61
movq 0x18(%rbx), %rax
movslq 0x10(%rbx), %rcx
movb $0x30, (%rax,%rcx)
movl $0x1, %eax
jmp 0x3eab9
movq %r14, %rdi
callq 0x4ebc4
movq -0x10(%rax), %rdx
movq 0x38(%rdx), %rcx
testq %rcx, %rcx
je 0x3eac9
movq %rax, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
leaq 0x2d736(%rip), %rsi     # 0x6c0dd
jmp 0x3ea4d
movq %r14, %rdi
callq 0x4ebc4
movq %rax, %rdi
callq 0x48bbc
testq %rax, %rax
je 0x3ea16
movq %rax, %r15
leaq 0x29bb1(%rip), %rsi     # 0x6857c
movq %rbx, %rdi
callq 0x17878
movq 0x10(%r15), %rsi
testq %rsi, %rsi
je 0x3e9f1
movq %rbx, %rdi
callq 0x17878
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x17947
movq 0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x17878
movq %rbx, %rdi
movl $0x3e, %esi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x17947
movl %r12d, %eax
leaq 0x459f0(%rip), %rcx     # 0x84410
movq (%rcx,%rax,8), %r15
movq %r14, %rdi
callq 0x4ebc4
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3ead4
leaq 0x29b3b(%rip), %rsi     # 0x68588
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x17878
callq 0x129f0
movsd -0x28(%rbp), %xmm1
ucomisd %xmm1, %xmm0
leaq 0x29bda(%rip), %rax     # 0x68650
leaq 0x29bce(%rip), %rdx     # 0x6864b
cmovneq %rax, %rdx
cmovpq %rax, %rdx
movsd 0x1f323(%rip), %xmm0    # 0x5ddb0
ucomisd %xmm1, %xmm0
cmovbq %rax, %rdx
ucomisd 0x1f31b(%rip), %xmm1    # 0x5ddb8
movapd %xmm1, %xmm0
cmovbq %rax, %rdx
movslq 0x10(%rbx), %rdi
addq 0x18(%rbx), %rdi
movl $0x40, %esi
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 0x3ea32