// File: /workspace/github_c_makefile_star2_O1/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_ExecCmd
static int Jim_ExecCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    int outputId;
    int errorId;
    phandle_t *pidPtr;
    int numPids, result;
    int child_siginfo = 1;
    Jim_Obj *childErrObj;
    Jim_Obj *errStrObj;
    struct WaitInfoTable *table = Jim_CmdPrivData(interp);

    if (argc > 1 && Jim_CompareStringImmediate(interp, argv[argc - 1], "&")) {
        Jim_Obj *listObj;
        int i;

        argc--;
        numPids = JimCreatePipeline(interp, argc - 1, argv + 1, &pidPtr, NULL, NULL, NULL);
        if (numPids < 0) {
            return JIM_ERR;
        }

        listObj = Jim_NewListObj(interp, NULL, 0);
        for (i = 0; i < numPids; i++) {
            Jim_ListAppendElement(interp, listObj, Jim_NewIntObj(interp, JimProcessPid(pidPtr[i])));
        }
        Jim_SetResult(interp, listObj);
        JimDetachPids(table, numPids, pidPtr);
        Jim_Free(pidPtr);
        return JIM_OK;
    }

    numPids =
        JimCreatePipeline(interp, argc - 1, argv + 1, &pidPtr, NULL, &outputId, &errorId);

    if (numPids < 0) {
        return JIM_ERR;
    }

    result = JIM_OK;

    errStrObj = Jim_NewStringObj(interp, "", 0);


    if (outputId != -1) {
        if (JimAppendStreamToString(interp, outputId, errStrObj) < 0) {
            result = JIM_ERR;
            Jim_SetResultErrno(interp, "error reading from output pipe");
        }
    }


    childErrObj = Jim_NewStringObj(interp, "", 0);
    Jim_IncrRefCount(childErrObj);

    if (JimCleanupChildren(interp, numPids, pidPtr, childErrObj) != JIM_OK) {
        result = JIM_ERR;
    }

    if (errorId != -1) {
        int ret;
        Jim_Lseek(errorId, 0, SEEK_SET);
        ret = JimAppendStreamToString(interp, errorId, errStrObj);
        if (ret < 0) {
            Jim_SetResultErrno(interp, "error reading from error pipe");
            result = JIM_ERR;
        }
        else if (ret > 0) {

            child_siginfo = 0;
        }
    }

    if (child_siginfo) {

        Jim_AppendObj(interp, errStrObj, childErrObj);
    }
    Jim_DecrRefCount(interp, childErrObj);


    Jim_RemoveTrailingNewline(errStrObj);


    Jim_SetResult(interp, errStrObj);

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %rbx
cmpl $0x2, %esi
jl 0x9f3f
movq 0x1b8(%rbx), %r12
movl %r15d, %eax
movq -0x8(%r14,%rax,8), %rsi
leaq 0x230f6(%rip), %rdx     # 0x2cef6
movq %rbx, %rdi
callq 0x73d6
testl %eax, %eax
je 0x9f3f
addl $-0x2, %r15d
addq $0x8, %r14
leaq -0x50(%rbp), %rcx
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x161ae
testl %eax, %eax
js 0xa084
movl %eax, %r14d
movq %r12, -0x38(%rbp)
movq %rbx, %rdi
callq 0xae58
movq %rax, %r15
leaq 0x2c507(%rip), %rax     # 0x36358
movq %rax, 0x8(%r15)
movq $0x0, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r15)
movl %r14d, %r13d
movl %r14d, -0x2c(%rbp)
testl %r14d, %r14d
je 0x9ec3
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
xorl %r12d, %r12d
movq %r13, %r14
movq %r15, %r13
movq -0x48(%rbp), %rax
movslq (%rax,%r12,4), %r15
movq %rbx, %rdi
callq 0xae58
leaq 0x2c448(%rip), %rcx     # 0x362e0
movq %rcx, 0x8(%rax)
movq $0x0, (%rax)
movq %r15, 0x18(%rax)
movq %r13, %r15
movq %r14, %r13
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x7695
incq %r12
cmpq %r12, %r14
jne 0x9e7b
incl 0x10(%r15)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x9ee0
movq %rbx, %rdi
callq 0x759a
movq %r15, (%rbx)
movq -0x50(%rbp), %rdi
cmpl $0x0, -0x2c(%rbp)
movq -0x38(%rbp), %r10
je 0x9f2f
movl 0xc(%r10), %eax
movq %rax, %rcx
shlq $0x2, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
testl %eax, %eax
jle 0x9f27
movl (%rdi,%rdx,4), %r8d
movq (%r10), %rsi
xorl %r9d, %r9d
cmpl (%rsi,%r9), %r8d
je 0x9f21
addq $0xc, %r9
cmpq %r9, %rcx
jne 0x9f10
jmp 0x9f27
orb $0x2, 0x8(%rsi,%r9)
incq %rdx
cmpq %r13, %rdx
jne 0x9f02
xorl %r12d, %r12d
xorl %esi, %esi
callq *0x2e34e(%rip)          # 0x38288
jmp 0xa140
decl %r15d
addq $0x8, %r14
leaq -0x50(%rbp), %rcx
leaq -0x54(%rbp), %r8
leaq -0x3c(%rbp), %r9
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x161ae
testl %eax, %eax
js 0xa084
movl %eax, %r14d
movq %rbx, %rdi
callq 0xae58
movq %rax, %r13
leaq 0x2e31b(%rip), %r15     # 0x38298
movq %r15, (%rax)
movl $0x0, 0x14(%rax)
movq $0x0, 0x8(%rax)
movl -0x54(%rbp), %esi
cmpl $-0x1, %esi
je 0x9fa2
movq %rbx, %rdi
movq %r13, %rdx
callq 0x17091
movq %rbx, %rdi
callq 0xae58
movq %r15, (%rax)
movl $0x0, 0x14(%rax)
movq $0x0, 0x8(%rax)
movq %rax, -0x38(%rbp)
incl 0x10(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
testl %r14d, %r14d
je 0xa08f
movq %r13, -0x60(%rbp)
movq 0x1b8(%rbx), %r12
movl %r14d, %r15d
xorl %r13d, %r13d
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x48(%rbp), %rax
movl (%rax,%r13,4), %r14d
movq %r12, %rdi
movl %r14d, %esi
callq 0x17193
movq $-0x1, %rsi
testl %eax, %eax
jne 0xa022
movl %r14d, %edi
leaq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x6420
movslq %eax, %rsi
testq %rsi, %rsi
jle 0xa067
movl -0x40(%rbp), %edx
testl $0xff7f, %edx           # imm = 0xFF7F
je 0xa067
movq %rbx, %rdi
movq -0x38(%rbp), %rcx
callq 0x171e3
movq 0x58(%rbx), %r14
movq 0x60(%rbx), %rcx
movq %rcx, 0x58(%rbx)
movq %rbx, %rdi
leaq 0x22999(%rip), %rsi     # 0x2c9ed
movq %rax, %rdx
callq 0xc40a
movq %r14, 0x58(%rbx)
movl $0x1, -0x2c(%rbp)
incq %r13
cmpq %r13, %r15
jne 0x9fec
xorl %r12d, %r12d
cmpl $0x0, -0x2c(%rbp)
setne %r12b
movq -0x60(%rbp), %r13
jmp 0xa092
movl $0x1, %r12d
jmp 0xa140
xorl %r12d, %r12d
movq -0x38(%rbp), %r14
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq *0x2e1e6(%rip)          # 0x38288
movl -0x3c(%rbp), %edi
cmpl $-0x1, %edi
je 0xa0c5
xorl %esi, %esi
xorl %edx, %edx
callq 0x64a0
movl -0x3c(%rbp), %esi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x17091
testl %eax, %eax
jne 0xa0d3
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0xafb0
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
cmpl $0x1, %eax
jg 0xa0ee
movq %rbx, %rdi
movq %r14, %rsi
callq 0x759a
cmpq $0x0, (%r13)
jne 0xa0ff
movq 0x8(%r13), %rax
movq %r13, %rdi
callq *0x18(%rax)
movslq 0x14(%r13), %rax
testq %rax, %rax
jle 0xa120
movq (%r13), %rcx
cmpb $0xa, -0x1(%rcx,%rax)
jne 0xa120
leaq -0x1(%rax), %rdx
movl %edx, 0x14(%r13)
movb $0x0, -0x1(%rcx,%rax)
incl 0x10(%r13)
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0xa13d
movq %rbx, %rdi
callq 0x759a
movq %r13, (%rbx)
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq