// File: /workspace/github_c_makefile_star2_O1/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 0x3f10f
leaq 0x2a39c(%rip), %rax     # 0x692ec
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r14, %rdi
callq 0x4f838
movq %rax, %r15
movq %r14, %rdi
callq 0x4f838
movl -0x8(%rax), %edx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x3efb9
testb $0x1, %r14b
leaq 0x2abea(%rip), %rax     # 0x69b6c
leaq 0x2abdb(%rip), %rsi     # 0x69b64
cmoveq %rax, %rsi
jmp 0x3f146
movq %r14, %rdi
callq 0x4f838
movq %rax, %r14
cmpq %rbx, %rax
jne 0x3efae
movl 0x10(%r14), %esi
movq %rbx, %rdi
callq 0x17843
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 0x17925
movq %r14, %rdi
callq 0x4f838
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x3f13f
movq 0x48(%rax), %r15
testq %r15, %r15
je 0x3f10f
leaq 0x2a5cb(%rip), %rsi     # 0x695be
movq %rbx, %rdi
callq 0x178d8
movl -0x8(%r15), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x17925
movq %rbx, %rdi
movl $0x3e, %esi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x179a7
movl 0x10(%rbx), %esi
addl $0x40, %esi
movq %rbx, %rdi
movl $0x2, %edx
movsd %xmm0, -0x28(%rbp)
callq 0x1777e
xorpd %xmm0, %xmm0
movsd -0x28(%rbp), %xmm1
ucomisd %xmm0, %xmm1
movsd -0x28(%rbp), %xmm0
jne 0x3f15a
jp 0x3f15a
movq 0x18(%rbx), %rax
movslq 0x10(%rbx), %rcx
movb $0x30, (%rax,%rcx)
movl $0x1, %eax
jmp 0x3f1b2
movq %r14, %rdi
callq 0x4f838
movq -0x10(%rax), %rdx
movq 0x38(%rdx), %rcx
testq %rcx, %rcx
je 0x3f1c2
movq %rax, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
leaq 0x2e05a(%rip), %rsi     # 0x6d0fd
jmp 0x3f146
movq %r14, %rdi
callq 0x4f838
movq %rax, %rdi
callq 0x496ca
testq %rax, %rax
je 0x3f10f
movq %rax, %r15
leaq 0x2a4d5(%rip), %rsi     # 0x6959c
movq %rbx, %rdi
callq 0x178d8
movq 0x10(%r15), %rsi
testq %rsi, %rsi
je 0x3f0ed
movq %rbx, %rdi
callq 0x178d8
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x179a7
movq 0x8(%r15), %rsi
movq %rbx, %rdi
callq 0x178d8
movq %rbx, %rdi
movl $0x3e, %esi
callq 0x179a7
testq %r15, %r15
jne 0x3f1b5
movl %r12d, %eax
leaq 0x462f7(%rip), %rcx     # 0x85410
movq (%rcx,%rax,8), %r15
movq %r14, %rdi
callq 0x4f838
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3f1cd
leaq 0x2a462(%rip), %rsi     # 0x695a8
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x178d8
callq 0x12a00
movsd -0x28(%rbp), %xmm1
ucomisd %xmm1, %xmm0
leaq 0x2a501(%rip), %rax     # 0x69670
leaq 0x2a4f5(%rip), %rdx     # 0x6966b
cmovneq %rax, %rdx
cmovpq %rax, %rdx
movsd 0x1fc2a(%rip), %xmm0    # 0x5edb0
ucomisd %xmm1, %xmm0
cmovbq %rax, %rdx
ucomisd 0x1fc22(%rip), %xmm1    # 0x5edb8
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 0x3f12b