// File: /workspace/github_c_makefile_star2_O2/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, %r15
movl %esi, %r12d
movq %rdi, %rbx
cmpl $0x2, %esi
movq %rdi, -0x48(%rbp)
jl 0x9842
movq 0x1b8(%rbx), %r14
movl %r12d, %eax
movq -0x8(%r15,%rax,8), %rsi
leaq 0x1e72a(%rip), %rdx     # 0x27ee8
movq %rbx, %rdi
callq 0x7223
testl %eax, %eax
je 0x9842
addl $-0x2, %r12d
addq $0x8, %r15
leaq -0x50(%rbp), %rcx
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x140b2
testl %eax, %eax
js 0x99fa
movq %r14, -0x40(%rbp)
movq %rbx, %rdi
xorl %ebx, %ebx
xorl %esi, %esi
xorl %edx, %edx
movl %eax, %r14d
callq 0x745b
movq %rax, %r12
movq -0x50(%rbp), %r13
movl %r14d, -0x38(%rbp)
movl %r14d, %r14d
movq -0x48(%rbp), %r15
cmpq %rbx, %r14
je 0x9a00
movslq (%r13,%rbx,4), %rsi
movq %r15, %rdi
callq 0x8212
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x74ad
incq %rbx
jmp 0x9819
decl %r12d
addq $0x8, %r15
leaq -0x50(%rbp), %rcx
leaq -0x54(%rbp), %r8
leaq -0x30(%rbp), %r9
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x140b2
testl %eax, %eax
js 0x99fa
movl %eax, %r14d
leaq 0x1fdcc(%rip), %rsi     # 0x29641
movq $0x0, -0x38(%rbp)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7363
movq %rax, %r15
movl -0x54(%rbp), %esi
cmpl $-0x1, %esi
je 0x989d
movq %rbx, %rdi
movq %r15, %rdx
callq 0x14d6c
movq %r15, -0x60(%rbp)
leaq 0x1fd99(%rip), %rsi     # 0x29641
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7363
movq %rax, -0x40(%rbp)
incl 0x10(%rax)
movq -0x50(%rbp), %r12
movq 0x1b8(%rbx), %r13
movl %r14d, %r14d
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x9934
andl $0x0, -0x2c(%rbp)
movl (%r12,%rbx,4), %r15d
movq %r13, %rdi
movl %r15d, %esi
callq 0x14e42
testl %eax, %eax
je 0x98ea
incq %rbx
jmp 0x98c9
movl %r15d, %edi
leaq -0x2c(%rbp), %rsi
xorl %edx, %edx
callq 0x6420
testl %eax, %eax
jle 0x98e5
movl -0x2c(%rbp), %edx
testw $0xff7f, %dx            # imm = 0xFF7F
je 0x98e5
movslq %eax, %rsi
movq -0x48(%rbp), %r15
movq %r15, %rdi
movq -0x40(%rbp), %rcx
callq 0x14ea4
movq %r15, %rdi
leaq 0x1e0bc(%rip), %rsi     # 0x279df
movq %rax, %rdx
callq 0xb985
pushq $0x1
popq %rax
movq %rax, -0x38(%rbp)
jmp 0x98e5
movq %r12, %rdi
xorl %esi, %esi
callq *0x29949(%rip)          # 0x33288
xorl %r12d, %r12d
cmpl $0x0, -0x38(%rbp)
setne %r15b
movl -0x30(%rbp), %edi
cmpl $-0x1, %edi
movq -0x48(%rbp), %rbx
movq -0x60(%rbp), %r13
movq -0x40(%rbp), %r14
je 0x9979
xorl %esi, %esi
xorl %edx, %edx
callq 0x64a0
movl -0x30(%rbp), %esi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x14d6c
testl %eax, %eax
jne 0x9987
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0xa6f6
movl 0x10(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r14)
cmpl $0x1, %eax
jg 0x99a2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x73bf
leaq -0x2c(%rbp), %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0x7fc7
movslq (%r14), %rcx
testq %rcx, %rcx
jle 0x99d5
cmpb $0xa, -0x1(%rax,%rcx)
jne 0x99d5
movslq 0x14(%r13), %rax
leaq -0x1(%rax), %rcx
movl %ecx, 0x14(%r13)
movq (%r13), %rcx
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 0x99f2
movq %rbx, %rdi
callq 0x73bf
movb %r15b, %r12b
movq %r13, (%rbx)
jmp 0x9a42
pushq $0x1
popq %r12
jmp 0x9a42
incl 0x10(%r12)
movq -0x48(%rbp), %rbx
movq (%rbx), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x9a22
movq %rbx, %rdi
callq 0x73bf
movq %r12, (%rbx)
movq -0x40(%rbp), %rdi
movl -0x38(%rbp), %esi
movq %r13, %rdx
callq 0x14d1d
xorl %r12d, %r12d
movq %r13, %rdi
xorl %esi, %esi
callq *0x29846(%rip)          # 0x33288
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq