// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/io.c
// Function: cfun_io_printf_impl_x
static Janet cfun_io_printf_impl_x(int32_t argc, Janet *argv, int newline,
                                   FILE *dflt_file, int32_t offset, Janet x) {
    FILE *f;
    const char *fmt = janet_getcstring(argv, offset);
    switch (janet_type(x)) {
        default:
            janet_panicf("cannot print to %v", x);
        case JANET_BUFFER: {
            /* Special case buffer */
            JanetBuffer *buf = janet_unwrap_buffer(x);
            janet_buffer_format(buf, fmt, offset, argc, argv);
            if (newline) janet_buffer_push_u8(buf, '\n');
            return janet_wrap_nil();
        }
        case JANET_FUNCTION: {
            /* Special case function */
            JanetFunction *fun = janet_unwrap_function(x);
            JanetBuffer *buf = janet_buffer(0);
            janet_buffer_format(buf, fmt, offset, argc, argv);
            if (newline) janet_buffer_push_u8(buf, '\n');
            Janet args[1] = { janet_wrap_buffer(buf) };
            janet_call(fun, 1, args);
            return janet_wrap_nil();
        }
        case JANET_NIL:
            f = dflt_file;
            if (f == NULL) janet_panic("cannot print to nil");
            break;
        case JANET_ABSTRACT: {
            void *abstract = janet_unwrap_abstract(x);
            if (janet_abstract_type(abstract) != &janet_file_type)
                return janet_wrap_nil();
            JanetFile *iofile = abstract;
            if (iofile->flags & JANET_FILE_CLOSED) {
                janet_panic("cannot print to closed file");
            }
            io_assert_writeable(iofile);
            f = iofile->file;
            break;
        }
    }
    JanetBuffer *buf = janet_buffer(10);
    janet_buffer_format(buf, fmt, offset, argc, argv);
    if (newline) janet_buffer_push_u8(buf, '\n');
    if (buf->count) {
        if (1 != fwrite(buf->data, buf->count, 1, f)) {
            janet_panicf("could not print %d bytes to file", buf->count);
        }
    }
    /* Clear buffer to make things easier for GC */
    buf->count = 0;
    buf->capacity = 0;
    janet_free(buf->data);
    buf->data = NULL;
    return janet_wrap_nil();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %r9, -0x10(%rbp)
movl %edi, -0x14(%rbp)
movq %rsi, -0x20(%rbp)
movl %edx, -0x24(%rbp)
movq %rcx, -0x30(%rbp)
movl %r8d, -0x34(%rbp)
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x1c280
movq %rax, -0x48(%rbp)
movsd -0x10(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x3f5c3
jmp 0x3f5d7
movq -0x10(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x8c(%rbp)
jmp 0x3f5e1
xorl %eax, %eax
movl %eax, -0x8c(%rbp)
jmp 0x3f5e1
movl -0x8c(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x98(%rbp)
subl $0xd, %eax
ja 0x3f60e
movq -0x98(%rbp), %rax
leaq 0x4bd83(%rip), %rcx     # 0x8b388
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rsi
leaq 0x4d115(%rip), %rdi     # 0x8c72e
movb $0x0, %al
callq 0x1ac40
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x34(%rbp), %edx
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %r8
callq 0x5bf70
cmpl $0x0, -0x24(%rbp)
je 0x3f658
movq -0x50(%rbp), %rdi
movl $0xa, %esi
callq 0x18820
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x3f86a
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x58(%rbp)
xorl %edi, %edi
callq 0x18490
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x34(%rbp), %edx
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %r8
callq 0x5bf70
cmpl $0x0, -0x24(%rbp)
je 0x3f6b3
movq -0x60(%rbp), %rdi
movl $0xa, %esi
callq 0x18820
movq -0x60(%rbp), %rdi
movabsq $-0x2800000000000, %rsi # imm = 0xFFFD800000000000
callq 0x7b610
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rdi
leaq -0x68(%rbp), %rdx
movl $0x1, %esi
callq 0x70ae0
movq %rax, -0x70(%rbp)
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x3f86a
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x3f713
leaq 0x4d033(%rip), %rdi     # 0x8c741
callq 0x1ad60
jmp 0x3f782
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
leaq 0x6d6e3(%rip), %rcx     # 0xace10
cmpq %rcx, -0x10(%rax)
je 0x3f74b
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
jmp 0x3f86a
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x3f76e
leaq 0x4d01e(%rip), %rdi     # 0x8c787
callq 0x1ad60
movq -0x80(%rbp), %rdi
callq 0x3e9f0
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movl $0xa, %edi
callq 0x18490
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x34(%rbp), %edx
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %r8
callq 0x5bf70
cmpl $0x0, -0x24(%rbp)
je 0x3f7c4
movq -0x88(%rbp), %rdi
movl $0xa, %esi
callq 0x18820
movq -0x88(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x3f81c
movq -0x88(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x88(%rbp), %rax
movslq 0x10(%rax), %rsi
movq -0x40(%rbp), %rcx
movl $0x1, %edx
callq 0x12a90
movq %rax, %rcx
movl $0x1, %eax
cmpq %rcx, %rax
je 0x3f81a
movq -0x88(%rbp), %rax
movl 0x10(%rax), %esi
leaq 0x4cf90(%rip), %rdi     # 0x8c7a3
movb $0x0, %al
callq 0x1ac40
jmp 0x3f81c
movq -0x88(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x88(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x88(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x120b0
movq -0x88(%rbp), %rax
movq $0x0, 0x18(%rax)
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x7b460
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)