// File: /workspace/github_c_makefile_star2_O3/msteveb[P]autosetup/./jimsh0.c
// Function: JimMakeChannel
static AioFile *JimMakeChannel(Jim_Interp *interp, int fd, Jim_Obj *filename,
    const char *hdlfmt, int family, int flags)
{
    AioFile *af;
    char buf[AIO_CMD_LEN];
    Jim_Obj *cmdname;

    snprintf(buf, sizeof(buf), hdlfmt, Jim_GetId(interp));
    cmdname = Jim_NewStringObj(interp, buf, -1);
    if (!filename) {
        filename = cmdname;
    }
    Jim_IncrRefCount(filename);


    af = Jim_Alloc(sizeof(*af));
    memset(af, 0, sizeof(*af));
    af->filename = filename;
    af->fd = fd;
    af->addr_family = family;
    af->fops = &stdio_fops;
    af->ssl = NULL;
    if (flags & AIO_WBUF_NONE) {
        af->wbuft = WBUF_OPT_NONE;
    }
    else {
#ifdef HAVE_ISATTY
        af->wbuft = isatty(af->fd) ? WBUF_OPT_LINE : WBUF_OPT_FULL;
#else
        af->wbuft = WBUF_OPT_FULL;
#endif
    }

#ifdef FD_CLOEXEC
    if ((flags & AIO_KEEPOPEN) == 0) {
        (void)fcntl(af->fd, F_SETFD, FD_CLOEXEC);
    }
#endif
    aio_set_nonblocking(af, !!(flags & AIO_NONBLOCK));

    af->flags |= flags;

    af->writebuf = Jim_NewStringObj(interp, NULL, 0);
    Jim_IncrRefCount(af->writebuf);
    af->wbuf_limit = AIO_DEFAULT_WBUF_LIMIT;
    af->rbuf_len = AIO_DEFAULT_RBUF_LEN;


    Jim_CreateCommand(interp, buf, JimAioSubCmdProc, af, JimAioDelProc);

    Jim_SetResult(interp, Jim_MakeGlobalNamespaceName(interp, cmdname));

    return af;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, %r12d
movq %rdx, %r14
movl %esi, -0x2c(%rbp)
movq %rdi, %rbx
movq 0x38(%rdi), %rax
incq %rax
movq %rax, 0x38(%rdi)
xorl %r13d, %r13d
leaq -0x60(%rbp), %r15
movl $0x20, %esi
movq %r15, %rdi
movq %rcx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x61e0
movq %rbx, %rdi
movq %r15, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7508
testq %r14, %r14
movq %rax, -0x38(%rbp)
cmoveq %rax, %r14
incl 0x10(%r14)
movl $0x58, %esi
xorl %edi, %edi
callq *0x3015f(%rip)          # 0x37288
movl -0x2c(%rbp), %edi
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x28(%rax)
movups %xmm0, 0x8(%rax)
movups %xmm0, 0x38(%rax)
movups %xmm0, 0x48(%rax)
movq %r14, (%rax)
movl %edi, 0x18(%rax)
leaq 0x2eb3d(%rip), %rax     # 0x35c90
movq %rax, 0x28(%r15)
testb $0x8, %r12b
jne 0x716c
callq 0x6110
xorl %r13d, %r13d
cmpl $0x1, %eax
adcl $0x1, %r13d
movl %r13d, 0x8(%r15)
testb $0x1, %r12b
jne 0x718b
movl 0x18(%r15), %edi
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0x63f0
movq %r15, %rdi
xorl %esi, %esi
callq 0x147c8
orl %r12d, 0xc(%r15)
movq %rbx, %rdi
callq 0xae38
leaq 0x300f0(%rip), %rcx     # 0x37298
movq %rcx, (%rax)
movl $0x0, 0x14(%rax)
movq $0x0, 0x8(%rax)
movq %rax, 0x38(%r15)
incl 0x10(%rax)
movq $0x10000, 0x50(%r15)    # imm = 0x10000
movq $0x100, 0x48(%r15)      # imm = 0x100
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7508
leaq -0x906(%rip), %rdx      # 0x68e3
leaq 0xd8d8(%rip), %r8       # 0x14ac8
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rcx
callq 0xbec5
movq -0x38(%rbp), %r14
incl 0x10(%r14)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x721f
movq %rbx, %rdi
callq 0x758c
movq %r14, (%rbx)
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq