// File: /workspace/github_c_makefile_star2_O0/msteveb[P]autosetup/./jimsh0.c
// Function: aio_cmd_read
static int aio_cmd_read(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    AioFile *af = Jim_CmdPrivData(interp);
    int nonewline = 0;
    jim_wide neededLen = -1;
    static const char * const options[] = { "-pending", "-nonewline", NULL };
    enum { OPT_PENDING, OPT_NONEWLINE };
    int option;
    int nb;
    Jim_Obj *objPtr;

    if (argc) {
        if (*Jim_String(argv[0]) == '-') {
            if (Jim_GetEnum(interp, argv[0], options, &option, NULL, JIM_ERRMSG) != JIM_OK) {
                return JIM_ERR;
            }
            switch (option) {
                case OPT_PENDING:

                    break;
                case OPT_NONEWLINE:
                    nonewline++;
                    break;
            }
        }
        else {
            if (Jim_GetWide(interp, argv[0], &neededLen) != JIM_OK)
                return JIM_ERR;
            if (neededLen < 0) {
                Jim_SetResultString(interp, "invalid parameter: negative len", -1);
                return JIM_ERR;
            }
        }
        argc--;
        argv++;
    }
    if (argc) {
        return -1;
    }


    nb = aio_start_nonblocking(af);

    if (aio_read_len(interp, af, nb ? AIO_NONBLOCK : 0, neededLen) != JIM_OK) {
        aio_set_nonblocking(af, nb);
        return JIM_ERR;
    }
    objPtr = aio_read_consume(interp, af, neededLen);

    aio_set_nonblocking(af, nb);

    if (objPtr) {
        if (nonewline) {
            int len;
            const char *s = Jim_GetString(objPtr, &len);

            if (len > 0 && s[len - 1] == '\n') {
                objPtr->length--;
                objPtr->bytes[objPtr->length] = '\0';
            }
        }
        Jim_SetResult(interp, objPtr);
    }
    else {
        Jim_SetEmptyResult(interp);
    }
    return JIM_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x1b8(%rax), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq $-0x1, -0x38(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x172f6
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x7960
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1724f
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
leaq 0x2fa5c(%rip), %rdx     # 0x46c60
leaq -0x3c(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
movl $0x1, %r9d
callq 0x8590
cmpl $0x0, %eax
je 0x17229
movl $0x1, -0x4(%rbp)
jmp 0x17477
movl -0x3c(%rbp), %eax
movl %eax, -0x74(%rbp)
testl %eax, %eax
je 0x1723f
jmp 0x17235
movl -0x74(%rbp), %eax
subl $0x1, %eax
je 0x17241
jmp 0x1724a
jmp 0x1724a
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x172e1
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
leaq -0x38(%rbp), %rdx
callq 0xf640
cmpl $0x0, %eax
je 0x17274
movl $0x1, -0x4(%rbp)
jmp 0x17477
cmpq $0x0, -0x38(%rbp)
jge 0x172df
jmp 0x1727d
movq -0x10(%rbp), %rdi
leaq 0x2456c(%rip), %rsi     # 0x3b7f4
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7990
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x172c8
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x7a10
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x17477
jmp 0x172e1
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x17308
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x17477
movq -0x28(%rbp), %rdi
callq 0x184c0
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x40(%rbp), %ecx
xorl %edx, %edx
movl $0x10, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
movq -0x38(%rbp), %rax
movl %eax, %ecx
callq 0x18510
cmpl $0x0, %eax
je 0x17354
movq -0x28(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x186d0
movl $0x1, -0x4(%rbp)
jmp 0x17477
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x38(%rbp), %rax
movl %eax, %edx
callq 0x18770
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x186d0
cmpq $0x0, -0x48(%rbp)
je 0x17420
cmpl $0x0, -0x2c(%rbp)
je 0x173d7
movq -0x48(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0x89b0
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x54(%rbp)
jle 0x173d5
movq -0x60(%rbp), %rax
movl -0x54(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x173d5
movq -0x48(%rbp), %rax
movl 0x14(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x14(%rax)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movslq 0x14(%rcx), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x173d7
jmp 0x173d9
movq -0x48(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x17413
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x7a10
movq -0x68(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x17470
jmp 0x17422
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x17463
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x7a10
movq -0x70(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x17470
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)