// File: /workspace/github_c_makefile_star2_O1/msteveb[P]autosetup/./jimsh0.c
// Function: JimForeachMapHelper
static int JimForeachMapHelper(Jim_Interp *interp, int argc, Jim_Obj *const *argv, int doMap)
{
    int result = JIM_OK;
    int i, numargs;
    Jim_ListIter twoiters[2];
    Jim_ListIter *iters;
    Jim_Obj *script;
    Jim_Obj *resultObj;

    if (argc < 4 || argc % 2 != 0) {
        Jim_WrongNumArgs(interp, 1, argv, "varList list ?varList list ...? script");
        return JIM_ERR;
    }
    script = argv[argc - 1];
    numargs = (argc - 1 - 1);

    if (numargs == 2) {
        iters = twoiters;
    }
    else {
        iters = Jim_Alloc(numargs * sizeof(*iters));
    }
    for (i = 0; i < numargs; i++) {
        JimListIterInit(&iters[i], argv[i + 1]);
        if (i % 2 == 0 && JimListIterDone(interp, &iters[i])) {
            result = JIM_ERR;
        }
    }
    if (result != JIM_OK) {
        Jim_SetResultString(interp, "foreach varlist is empty", -1);
        goto empty_varlist;
    }

    if (doMap) {
        resultObj = Jim_NewListObj(interp, NULL, 0);
    }
    else {
        resultObj = interp->emptyObj;
    }
    Jim_IncrRefCount(resultObj);

    while (1) {

        for (i = 0; i < numargs; i += 2) {
            if (!JimListIterDone(interp, &iters[i + 1])) {
                break;
            }
        }
        if (i == numargs) {

            break;
        }


        for (i = 0; i < numargs; i += 2) {
            Jim_Obj *varName;


            JimListIterInit(&iters[i], argv[i + 1]);
            while ((varName = JimListIterNext(interp, &iters[i])) != NULL) {
                Jim_Obj *valObj = JimListIterNext(interp, &iters[i + 1]);
                if (!valObj) {

                    valObj = interp->emptyObj;
                }

                Jim_IncrRefCount(valObj);
                result = Jim_SetVariable(interp, varName, valObj);
                Jim_DecrRefCount(interp, valObj);
                if (result != JIM_OK) {
                    goto err;
                }
            }
        }
        result = Jim_EvalObj(interp, script);
        if (JimCheckLoopRetcode(interp, result)) {
            goto err;
        }
        switch (result) {
            case JIM_OK:
                if (doMap) {
                    Jim_ListAppendElement(interp, resultObj, interp->result);
                }
                break;
            case JIM_CONTINUE:
                break;
            case JIM_BREAK:
                goto out;
            default:
                goto err;
        }
    }
  out:
    result = JIM_OK;
    Jim_SetResult(interp, resultObj);
  err:
    Jim_DecrRefCount(interp, resultObj);
  empty_varlist:
    if (numargs > 2) {
        Jim_Free(iters);
    }
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, %ebx
movq %rdi, %r14
cmpl $0x4, %esi
setge %al
movq %rsi, -0x40(%rbp)
testb $0x1, %sil
sete %cl
testb %cl, %al
je 0x22a5c
movq -0x40(%rbp), %rcx
movl %ecx, %eax
movq -0x8(%rdx,%rax,8), %rax
movq %rax, -0x70(%rbp)
leal -0x2(%rcx), %eax
cmpl $0x2, %eax
movq %rdx, -0x58(%rbp)
movl %eax, -0x2c(%rbp)
jne 0x22a7b
leaq -0x90(%rbp), %rdi
jmp 0x22a90
leaq 0xaa60(%rip), %rcx      # 0x2d4c3
movl $0x1, %r15d
movq %r14, %rdi
movl $0x1, %esi
callq 0x7454
jmp 0x22da8
movl %eax, %esi
shlq $0x4, %rsi
xorl %edi, %edi
callq *0x157ff(%rip)          # 0x38288
movq %rax, %rdi
movq -0x58(%rbp), %rdx
cmpl $0x3, -0x40(%rbp)
movq %rdi, -0x50(%rbp)
movl %ebx, -0x44(%rbp)
jl 0x22b46
movl -0x2c(%rbp), %eax
leaq 0x8(%rdi), %r12
xorl %r13d, %r13d
xorl %r15d, %r15d
movq %rax, -0x38(%rbp)
movq 0x8(%rdx,%r13,8), %rbx
movq %rbx, -0x8(%r12)
movl $0x0, (%r12)
testb $0x1, %r13b
jne 0x22aea
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe338
movq -0x38(%rbp), %rax
movq -0x58(%rbp), %rdx
cmpl $0x0, 0x20(%rbx)
movl $0x1, %ecx
cmovlel %ecx, %r15d
incq %r13
addq $0x10, %r12
cmpq %r13, %rax
jne 0x22ab2
testl %r15d, %r15d
movq -0x50(%rbp), %rdi
movl -0x44(%rbp), %ebx
je 0x22b46
movq %rdi, %r12
leaq 0xa9de(%rip), %rsi      # 0x2d4ea
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7516
movq %rax, %rbx
incl 0x10(%rax)
movq (%r14), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x22b38
movq %r14, %rdi
callq 0x759a
movq %rbx, (%r14)
movl $0x1, %r15d
jmp 0x22d97
testl %ebx, %ebx
je 0x22b76
movq %rdi, %rbx
movq %r14, %rdi
callq 0xae58
movq %rbx, %rdi
movq %rax, %rbx
leaq 0x137f6(%rip), %rax     # 0x36358
movq %rax, 0x8(%rbx)
movq $0x0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
jmp 0x22b7d
movq 0x128(%r14), %rbx
incl 0x10(%rbx)
leaq 0x18(%rdi), %rax
movq %rax, -0x68(%rbp)
xorl %r15d, %r15d
movq %rbx, -0x60(%rbp)
movq %r15, -0x38(%rbp)
movl $0x0, %r15d
cmpl $0x3, -0x40(%rbp)
jl 0x22bd6
movq -0x68(%rbp), %r12
xorl %r15d, %r15d
movl (%r12), %r13d
movq -0x8(%r12), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe338
cmpl 0x20(%rbx), %r13d
jl 0x22bce
addq $0x2, %r15
addq $0x20, %r12
cmpl %r15d, -0x2c(%rbp)
jg 0x22ba6
movq -0x50(%rbp), %rdi
movq -0x60(%rbp), %rbx
cmpl -0x2c(%rbp), %r15d
movq -0x38(%rbp), %r15
je 0x22d53
cmpl $0x3, -0x40(%rbp)
jl 0x22ce0
xorl %r12d, %r12d
movq %r15, -0x38(%rbp)
movq %r12, %rax
shlq $0x4, %rax
leaq (%rdi,%rax), %rbx
movq -0x58(%rbp), %rcx
movq 0x8(%rcx,%r12,8), %rcx
movq %rcx, (%rdi,%rax)
movl $0x0, 0x8(%rdi,%rax)
movq %rdi, %r13
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22dbf
movq %rax, %r15
xorl %eax, %eax
testq %r15, %r15
je 0x22cb4
movq %r12, -0x38(%rbp)
orq $0x1, %r12
shlq $0x4, %r12
addq %r13, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x22dbf
movq %rax, %r13
testq %rax, %rax
jne 0x22c5a
movq 0x128(%r14), %r13
incl 0x10(%r13)
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x871b
movl %eax, %r15d
movl 0x10(%r13), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r13)
cmpl $0x1, %eax
jg 0x22c8a
movq %r14, %rdi
movq %r13, %rsi
callq 0x759a
testl %r15d, %r15d
jne 0x22cbd
movq %r15, %r13
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22dbf
movq %rax, %r15
testq %rax, %rax
jne 0x22c40
movq -0x50(%rbp), %rdi
movq %r13, %r15
movq -0x38(%rbp), %r12
xorl %eax, %eax
jmp 0x22cca
movq -0x38(%rbp), %r15
movq %r13, %rdi
jmp 0x22cca
movl $0x12, %eax
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %r12
testl %eax, %eax
movq -0x60(%rbp), %rbx
jne 0x22d46
addq $0x2, %r12
cmpl %r12d, -0x2c(%rbp)
jg 0x22bf1
movq %rdi, %r12
movq %r14, %rdi
movq -0x70(%rbp), %rsi
callq 0x9078
movl %eax, %r15d
leal -0x3(%r15), %eax
cmpl $0x1, %eax
ja 0x22d0f
movl 0x18(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x18(%r14)
cmpl $0x1, %eax
jg 0x22dba
testl %r15d, %r15d
je 0x22d23
cmpl $0x4, %r15d
movq %r12, %rdi
je 0x22b8f
jmp 0x22d4d
cmpl $0x0, -0x44(%rbp)
movq %r12, %rdi
je 0x22b8f
movq (%r14), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7695
movq %r12, %rdi
jmp 0x22b8f
cmpl $0x12, %eax
je 0x22d7b
jmp 0x22da8
cmpl $0x3, %r15d
jne 0x22d7b
incl 0x10(%rbx)
movq (%r14), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x22d75
movq %rdi, %r15
movq %r14, %rdi
callq 0x759a
movq %r15, %rdi
movq %rbx, (%r14)
xorl %r15d, %r15d
movl 0x10(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rbx)
cmpl $0x1, %eax
jg 0x22d9a
movq %rdi, %r12
movq %r14, %rdi
movq %rbx, %rsi
callq 0x759a
movq %r12, %rdi
cmpl $0x4, -0x40(%rbp)
je 0x22da8
xorl %esi, %esi
callq *0x154e0(%rip)          # 0x38288
movl %r15d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
jmp 0x22d7b