// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
movq %rdx, %r14
movl %esi, %r13d
movq %rdi, %rbx
cmpl $0x3, %esi
jl 0x6cfb
movq 0x10(%r14), %rsi
leaq 0x24838(%rip), %rdx     # 0x2b529
movq %rbx, %rdi
callq 0x73c6
jmp 0x6d03
xorl %eax, %eax
cmpl $0x2, %r13d
jne 0x6d0c
leal 0x3(%rax), %r12d
cmpl %r13d, %r12d
jae 0x6d2e
leaq 0x2481f(%rip), %rcx     # 0x2b532
movl $0x1, %r15d
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x7446
jmp 0x6f83
movq %rax, -0x30(%rbp)
movq 0x8(%r14), %r15
movq (%r15), %r9
testq %r9, %r9
jne 0x6d4b
movq 0x8(%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
movq (%r15), %r9
cmpb $0x7c, (%r9)
jne 0x6db2
leaq 0x247f5(%rip), %rsi     # 0x2b54d
movq %rbx, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r9, %r15
callq 0x7508
movq %rax, -0x50(%rbp)
incq %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7508
movq %rax, -0x48(%rbp)
movl $0x2, %esi
cmpl %r13d, %r12d
jne 0x6d9e
movl -0x30(%rbp), %eax
movq 0x10(%r14,%rax,8), %rax
movq %rax, -0x40(%rbp)
movl $0x3, %esi
leaq -0x50(%rbp), %rdx
movq %rbx, %rdi
callq 0x10431
movl %eax, %r15d
jmp 0x6f83
cmpl %r13d, %r12d
jne 0x6e11
movq 0x8(%r14), %r15
movl -0x30(%rbp), %eax
movq 0x10(%r14,%rax,8), %r13
movq (%r13), %r12
testq %r12, %r12
jne 0x6de0
movq 0x8(%r13), %rax
movq %r13, %rdi
movq %r9, %r12
callq *0x18(%rax)
movq %r12, %r9
movq (%r13), %r12
movzbl (%r12), %ecx
cmpl $0x60, %ecx
jle 0x6e19
cmpl $0x61, %ecx
je 0x6eb2
xorl %eax, %eax
cmpl $0x72, %ecx
je 0x6eb7
cmpl $0x77, %ecx
jne 0x6f54
movl $0x241, %eax            # imm = 0x241
jmp 0x6eb7
xorl %r15d, %r15d
jmp 0x6f0c
cmpl $0x52, %ecx
je 0x6e27
cmpl $0x57, %ecx
jne 0x6f54
movq %r9, -0x38(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe2fe
cmpl $0x0, 0x20(%r13)
jle 0x6f95
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0xe803
movq %rbx, %rdi
movq %rax, %rsi
leaq 0x2edde(%rip), %rdx     # 0x35c40
leaq -0x50(%rbp), %rcx
leaq 0x2474a(%rip), %r8      # 0x2b5b7
movl $0x1, %r9d
callq 0x7eac
testl %eax, %eax
jne 0x6f7d
movslq -0x50(%rbp), %rax
leaq 0x208a5(%rip), %rcx     # 0x27730
orl (%rcx,%rax,4), %r15d
incl %r12d
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe2fe
cmpl 0x20(%r13), %r12d
jl 0x6e47
cmpl $-0x1, %r15d
movq -0x38(%rbp), %r9
jne 0x6f0c
jmp 0x6f7d
movl $0x441, %eax            # imm = 0x441
leaq 0x1(%r12), %rcx
xorl %edx, %edx
cmpb $0x62, 0x1(%r12)
leaq 0x2(%r12), %rsi
sete %dl
cmoveq %rsi, %rcx
xorl %esi, %esi
cmpb $0x74, 0x1(%rdx,%r12)
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 %r9, %rdi
movl %r15d, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x63d0
movq 0x8(%r14), %rdx
testl %eax, %eax
js 0x6f47
leaq 0x24628(%rip), %rcx     # 0x2b555
movq %rbx, %rdi
movl %eax, %esi
movq -0x30(%rbp), %r8
callq 0x70b9
xorl %r15d, %r15d
testq %rax, %rax
sete %r15b
jmp 0x6f83
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x148fa
jmp 0x6f7d
movq (%r15), %rdx
testq %rdx, %rdx
jne 0x6f69
movq 0x8(%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
movq (%r15), %rdx
leaq 0x245f3(%rip), %rsi     # 0x2b563
movq %rbx, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x6923
movl $0x1, %r15d
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
movq -0x38(%rbp), %r9
jmp 0x6f0c