// File: /workspace/github_c_makefile_star2_O2/msteveb[P]autosetup/./jimsh0.c
// Function: JimAioOpenCommand
static int JimAioOpenCommand(Jim_Interp *interp, int argc,
        Jim_Obj *const *argv)
{
    int openflags;
    const char *filename;
    int fd = -1;
    int n = 0;
    int flags = 0;

    if (argc > 2 && Jim_CompareStringImmediate(interp, argv[2], "-noclose")) {
        flags = AIO_KEEPOPEN;
        n++;
    }
    if (argc < 2 || argc > 3 + n) {
        Jim_WrongNumArgs(interp, 1, argv, "filename ?-noclose? ?mode?");
        return JIM_ERR;
    }

    filename = Jim_String(argv[1]);

#ifdef jim_ext_tclcompat
    {


        if (*filename == '|') {
            Jim_Obj *evalObj[3];
            int i = 0;

            evalObj[i++] = Jim_NewStringObj(interp, "::popen", -1);
            evalObj[i++] = Jim_NewStringObj(interp, filename + 1, -1);
            if (argc == 3 + n) {
                evalObj[i++] = argv[2 + n];
            }

            return Jim_EvalObjVector(interp, i, evalObj);
        }
    }
#endif
    if (argc == 3 + n) {
        openflags = parse_open_mode(interp, argv[1], argv[2 + n]);
        if (openflags == -1) {
            return JIM_ERR;
        }
    }
    else {
        openflags = O_RDONLY;
    }
    fd = open(filename, openflags, 0666);
    if (fd < 0) {
        JimAioSetError(interp, argv[1]);
        return JIM_ERR;
    }

    return JimMakeChannel(interp, fd, argv[1], "aio.handle%ld", 0, flags) ? JIM_OK : JIM_ERR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r15
movl %esi, %r12d
movq %rdi, %rbx
cmpl $0x3, %esi
jl 0x6c1e
movq 0x10(%r15), %rsi
leaq 0x20965(%rip), %rdx     # 0x27579
movq %rbx, %rdi
callq 0x7223
jmp 0x6c26
xorl %eax, %eax
cmpl $0x2, %r12d
jne 0x6c2f
leal 0x3(%rax), %r13d
cmpl %r12d, %r13d
jae 0x6c4d
leaq 0x2094c(%rip), %rcx     # 0x27582
pushq $0x1
popq %r13
movq %rbx, %rdi
movl %r13d, %esi
movq %r15, %rdx
callq 0x72a5
jmp 0x6e66
movq %rax, -0x30(%rbp)
movq 0x8(%r15), %rdi
callq 0x7340
cmpb $0x7c, (%rax)
jne 0x6ca9
leaq 0x20937(%rip), %rsi     # 0x2759d
pushq $-0x1
popq %rdx
movq %rbx, %rdi
movq %rax, %r14
callq 0x7363
movq %rax, -0x60(%rbp)
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
pushq $-0x1
popq %rdx
callq 0x7363
movq %rax, -0x58(%rbp)
cmpl %r12d, %r13d
jne 0x6d68
movl -0x30(%rbp), %eax
movq 0x10(%r15,%rax,8), %rax
movq %rax, -0x50(%rbp)
pushq $0x3
jmp 0x6d6a
movq %r15, -0x40(%rbp)
xorl %r15d, %r15d
cmpl %r12d, %r13d
jne 0x6df7
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rcx
movq 0x8(%rcx), %r14
movl -0x30(%rbp), %eax
movq 0x10(%rcx,%rax,8), %r12
movq %r12, %rdi
callq 0x7340
movq %rax, %r15
movzbl (%rax), %eax
cmpl $0x52, %eax
je 0x6d04
cmpl $0x77, %eax
je 0x6d8e
cmpl $0x61, %eax
je 0x6d99
cmpl $0x72, %eax
je 0x6d95
cmpl $0x57, %eax
jne 0x6e43
xorl %r14d, %r14d
pushq $0x1
popq %r13
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8b3c
cmpl %eax, %r14d
jge 0x6d7f
movq %rbx, %rdi
movq %r12, %rsi
movl %r14d, %edx
callq 0xd95e
movq %rbx, %rdi
movq %rax, %rsi
leaq 0x2af07(%rip), %rdx     # 0x31c40
leaq -0x60(%rbp), %rcx
leaq 0x208c3(%rip), %r8      # 0x27607
movl %r13d, %r9d
callq 0x7b44
testl %eax, %eax
jne 0x6e66
movslq -0x60(%rbp), %rax
leaq 0x1c9c1(%rip), %rcx     # 0x23720
orl (%rcx,%rax,4), %r15d
incl %r14d
jmp 0x6d0e
pushq $0x2
popq %rsi
leaq -0x60(%rbp), %rdx
movq %rbx, %rdi
callq 0xf32e
movl %eax, %r13d
jmp 0x6e66
cmpl $-0x1, %r15d
movq -0x38(%rbp), %rax
jne 0x6df7
jmp 0x6e66
movl $0x241, %eax            # imm = 0x241
jmp 0x6d9e
xorl %eax, %eax
jmp 0x6d9e
movl $0x441, %eax            # imm = 0x441
movq %r15, %rcx
addq $0x2, %rcx
xorl %edx, %edx
cmpb $0x62, 0x1(%r15)
leaq 0x1(%r15), %rsi
sete %dl
cmovneq %rsi, %rcx
xorl %esi, %esi
cmpb $0x74, 0x1(%rdx,%r15)
sete %sil
leaq (%rcx,%rsi), %rdx
movl %eax, %edi
andl $0x640, %edi            # imm = 0x640
orl $0x2, %edi
xorl %r8d, %r8d
cmpb $0x2b, (%rcx,%rsi)
sete %r8b
cmovnel %eax, %edi
movl %edi, %r15d
orl $0x80, %r15d
cmpb $0x78, (%r8,%rdx)
cmovnel %edi, %r15d
movq -0x38(%rbp), %rax
movq %rax, %rdi
movl %r15d, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x63d0
movq -0x40(%rbp), %rcx
movq 0x8(%rcx), %rdx
testl %eax, %eax
js 0x6e36
leaq 0x20789(%rip), %rcx     # 0x275a5
movq %rbx, %rdi
movl %eax, %esi
movq -0x30(%rbp), %r8
callq 0x6f74
xorl %r13d, %r13d
testq %rax, %rax
sete %r13b
jmp 0x6e66
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x12fac
jmp 0x6e62
movq %r14, %rdi
callq 0x7340
leaq 0x20761(%rip), %rsi     # 0x275b3
movq %rbx, %rdi
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x68a7
pushq $0x1
popq %r13
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq