// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
leaq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rax)
movl $0x20, %esi
movb $0x0, %al
callq 0x61f0
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7990
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x73b8
movq -0x58(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
xorl %eax, %eax
movl %eax, %edi
movl $0x58, %esi
callq *0x40ebc(%rip)          # 0x48290
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x58, %edx
callq 0x6250
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl -0xc(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x18(%rax)
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x30(%rbp), %rax
leaq 0x3f8fe(%rip), %rcx     # 0x46d10
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x20(%rax)
movl -0x28(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x743a
movq -0x30(%rbp), %rax
movl $0x0, 0x8(%rax)
jmp 0x745f
movq -0x30(%rbp), %rax
movl 0x18(%rax), %edi
callq 0x6120
movl %eax, %edx
movl $0x2, %ecx
movl $0x1, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x28(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x7482
movq -0x30(%rbp), %rax
movl 0x18(%rax), %edi
movl $0x2, %esi
movl $0x1, %edx
movb $0x0, %al
callq 0x6400
movq -0x30(%rbp), %rdi
movl -0x28(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %esi
callq 0x186d0
movl -0x28(%rbp), %ecx
movq -0x30(%rbp), %rax
orl 0xc(%rax), %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x7990
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq $0x10000, 0x50(%rax)    # imm = 0x10000
movq -0x30(%rbp), %rax
movq $0x100, 0x48(%rax)      # imm = 0x100
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq -0x30(%rbp), %rcx
leaq -0xa13(%rip), %rdx      # 0x6af0
leaq 0x11a76(%rip), %r8      # 0x18f80
callq 0x7070
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0xd5a0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x7552
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
callq 0x7a10
movq -0x60(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)