// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/io.c
// Function: janet_dynprintf
void janet_dynprintf(const char *name, FILE *dflt_file, const char *format, ...) {
    va_list args;
    va_start(args, format);
    Janet x = janet_dyn(name);
    JanetType xtype = janet_type(x);
    switch (xtype) {
        default:
            /* Other values simply do nothing */
            break;
        case JANET_NIL:
        case JANET_ABSTRACT: {
            FILE *f = dflt_file;
            JanetBuffer buffer;
            int32_t len = 0;
            while (format[len]) len++;
            janet_buffer_init(&buffer, len);
            janet_formatbv(&buffer, format, args);
            if (xtype == JANET_ABSTRACT) {
                void *abstract = janet_unwrap_abstract(x);
                if (janet_abstract_type(abstract) != &janet_file_type)
                    break;
                JanetFile *iofile = abstract;
                io_assert_writeable(iofile);
                f = iofile->file;
            }
            fwrite(buffer.data, buffer.count, 1, f);
            janet_buffer_deinit(&buffer);
            break;
        }
        case JANET_FUNCTION: {
            JanetFunction *fun = janet_unwrap_function(x);
            int32_t len = 0;
            while (format[len]) len++;
            JanetBuffer *buf = janet_buffer(len);
            janet_formatbv(buf, format, args);
            Janet args[1] = { janet_wrap_buffer(buf) };
            janet_call(fun, 1, args);
            break;
        }
        case JANET_BUFFER:
            janet_formatbv(janet_unwrap_buffer(x), format, args);
            break;
    }
    va_end(args);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
testb %al, %al
je 0x3fa67
movaps %xmm0, -0x130(%rbp)
movaps %xmm1, -0x120(%rbp)
movaps %xmm2, -0x110(%rbp)
movaps %xmm3, -0x100(%rbp)
movaps %xmm4, -0xf0(%rbp)
movaps %xmm5, -0xe0(%rbp)
movaps %xmm6, -0xd0(%rbp)
movaps %xmm7, -0xc0(%rbp)
movq %r9, -0x138(%rbp)
movq %r8, -0x140(%rbp)
movq %rcx, -0x148(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x30(%rbp), %rax
leaq -0x160(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x18, (%rax)
movq -0x8(%rbp), %rdi
callq 0x1ce50
movq %rax, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x3facb
jmp 0x3fadf
movq -0x38(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x164(%rbp)
jmp 0x3fae9
xorl %eax, %eax
movl %eax, -0x164(%rbp)
jmp 0x3fae9
movl -0x164(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x170(%rbp)
subl $0xd, %eax
ja 0x3fb1c
movq -0x170(%rbp), %rax
leaq 0x4b8ad(%rip), %rcx     # 0x8b3c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x3fc88
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x6c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x6c(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x3fb49
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x3fb30
movl -0x6c(%rbp), %esi
leaq -0x68(%rbp), %rdi
callq 0x182e0
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x5af10
cmpl $0xe, -0x3c(%rbp)
jne 0x3fbab
movq -0x38(%rbp), %rdi
callq 0x7b260
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
leaq 0x6d28c(%rip), %rcx     # 0xace10
cmpq %rcx, -0x10(%rax)
je 0x3fb8f
jmp 0x3fc88
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x3e9f0
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rdi
movslq -0x58(%rbp), %rsi
movq -0x48(%rbp), %rcx
movl $0x1, %edx
callq 0x12a90
leaq -0x68(%rbp), %rdi
callq 0x18460
jmp 0x3fc88
movq -0x38(%rbp), %rdi
callq 0x7b260
movq %rax, -0x88(%rbp)
movl $0x0, -0x8c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x8c(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x3fc0b
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x3fbe9
movl -0x8c(%rbp), %edi
callq 0x18490
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x5af10
movq -0x98(%rbp), %rdi
movabsq $-0x2800000000000, %rsi # imm = 0xFFFD800000000000
callq 0x7b610
movq %rax, -0xa0(%rbp)
movq -0x88(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
movl $0x1, %esi
callq 0x70ae0
movq %rax, -0xa8(%rbp)
jmp 0x3fc88
movq -0x38(%rbp), %rdi
callq 0x7b260
movq %rax, %rdi
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x5af10
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw %cs:(%rax,%rax)