// File: /workspace/github_c_makefile_star2_O1/janet-lang[P]janet/src/core/io.c
// Function: cfun_io_print_impl_x
static Janet cfun_io_print_impl_x(int32_t argc, Janet *argv, int newline,
                                  FILE *dflt_file, int32_t offset, Janet x) {
    FILE *f;
    switch (janet_type(x)) {
        default:
            janet_panicf("cannot print to %v", x);
        case JANET_BUFFER: {
            /* Special case buffer */
            JanetBuffer *buf = janet_unwrap_buffer(x);
            for (int32_t i = offset; i < argc; ++i) {
                janet_to_string_b(buf, argv[i]);
            }
            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);
            for (int32_t i = offset; i < argc; ++i) {
                janet_to_string_b(buf, argv[i]);
            }
            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;
            io_assert_writeable(iofile);
            f = iofile->file;
            break;
        }
    }
    for (int32_t i = offset; i < argc; ++i) {
        int32_t len;
        const uint8_t *vstr;
        if (janet_checktype(argv[i], JANET_BUFFER)) {
            JanetBuffer *b = janet_unwrap_buffer(argv[i]);
            vstr = b->data;
            len = b->count;
        } else {
            vstr = janet_to_string(argv[i]);
            len = janet_string_length(vstr);
        }
        if (len) {
            if (1 != fwrite(vstr, len, 1, f)) {
                if (f == dflt_file) {
                    janet_panicf("cannot print %d bytes", len);
                } else {
                    janet_panicf("cannot print %d bytes to %v", len, x);
                }
            }
        }
    }
    if (newline)
        putc('\n', f);
    return janet_wrap_nil();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, %ebx
movl %edx, %r13d
movq %rsi, %r12
movq %r9, %xmm0
movq %r9, %rdx
shrq $0x2f, %rdx
andl $0xf, %edx
xorl %eax, %eax
ucomisd %xmm0, %xmm0
movl %edi, %r14d
cmovpl %edx, %eax
cmpl $0xb, %eax
jg 0x2ecbf
cmpl $0x1, %eax
je 0x2ed0a
cmpl $0xb, %eax
jne 0x2eeb8
movq %r9, %rdi
callq 0x4f838
movq %rax, %r15
subl %ebx, %r14d
jle 0x2eca4
movslq %ebx, %rax
leaq (%r12,%rax,8), %rbx
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
movq %r15, %rdi
callq 0x3ef10
incq %r12
cmpl %r12d, %r14d
jne 0x2ec90
testl %r13d, %r13d
je 0x2ee6d
movq %r15, %rdi
movl $0xa, %esi
callq 0x179a7
jmp 0x2ee6d
cmpl $0xc, %eax
movl %r13d, -0x2c(%rbp)
je 0x2ed2f
movq %rcx, -0x48(%rbp)
cmpl $0xe, %eax
jne 0x2eeb8
movq %r12, -0x50(%rbp)
movq %r9, -0x40(%rbp)
movq %r9, %rdi
callq 0x4f838
movq -0x10(%rax), %r15
cmpq 0x572a0(%rip), %r15     # 0x85f90
je 0x2edb6
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x4f95a
jmp 0x2edc9
movq %r9, -0x40(%rbp)
movl %r13d, -0x2c(%rbp)
movq %rcx, -0x38(%rbp)
movq %rcx, -0x48(%rbp)
testq %rcx, %rcx
jne 0x2ede5
leaq 0x3098c(%rip), %rdi     # 0x5f6b6
callq 0x19263
movq %r12, %r15
movq %r9, %rdi
callq 0x4f838
movq %rax, -0x38(%rbp)
xorl %edi, %edi
callq 0x17757
movq %rax, %r12
subl %ebx, %r14d
jle 0x2ed6b
movslq %ebx, %rax
leaq (%r15,%rax,8), %rbx
xorl %r13d, %r13d
movq (%rbx,%r13,8), %rsi
movq %r12, %rdi
callq 0x3ef10
incq %r13
cmpl %r13d, %r14d
jne 0x2ed57
cmpl $0x0, -0x2c(%rbp)
je 0x2ed7e
movq %r12, %rdi
movl $0xa, %esi
callq 0x179a7
movabsq $-0x2800000000000, %rsi # imm = 0xFFFD800000000000
movq %r12, %rdi
callq 0x4f9f2
leaq -0x58(%rbp), %rdx
movq %rax, (%rdx)
movq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x4c2d6
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x4f95a
jmp 0x2edd6
movq %rax, %r12
movq %rax, %rdi
callq 0x2e868
movq (%r12), %rax
movq %rax, -0x38(%rbp)
cmpq 0x571c0(%rip), %r15     # 0x85f90
movq -0x50(%rbp), %r12
je 0x2ede5
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subl %ebx, %r14d
jle 0x2ee59
movslq %ebx, %rax
leaq (%r12,%rax,8), %r15
xorl %r13d, %r13d
movabsq $-0x800000000000, %r12  # imm = 0xFFFF800000000000
movq (%r15,%r13,8), %rdi
movq %rdi, %rax
andq %r12, %rax
movabsq $-0x2800000000000, %rcx # imm = 0xFFFD800000000000
cmpq %rcx, %rax
jne 0x2ee26
callq 0x4f838
movq 0x18(%rax), %rdi
addq $0x10, %rax
jmp 0x2ee32
callq 0x3f44a
movq %rax, %rdi
addq $-0x8, %rax
movslq (%rax), %rbx
testq %rbx, %rbx
je 0x2ee51
movl $0x1, %edx
movq %rbx, %rsi
movq -0x38(%rbp), %rcx
callq 0x12a90
cmpq $0x1, %rax
jne 0x2ee8a
incq %r13
cmpl %r13d, %r14d
jne 0x2edfe
cmpl $0x0, -0x2c(%rbp)
je 0x2ee6d
movl $0xa, %edi
movq -0x38(%rbp), %rsi
callq 0x125b0
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f95a
movq -0x38(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0x2eea4
leaq 0x3082f(%rip), %rdi     # 0x5f6ca
movl %ebx, %esi
xorl %eax, %eax
callq 0x1917b
leaq 0x30835(%rip), %rdi     # 0x5f6e0
movl %ebx, %esi
movq -0x40(%rbp), %rdx
xorl %eax, %eax
callq 0x1917b
leaq 0x307e4(%rip), %rdi     # 0x5f6a3
movq %r9, %rsi
xorl %eax, %eax
callq 0x1917b