// File: /workspace/github_c_makefile_star2_O3/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
cmpl $0x4, %esi
setge %al
testb $0x1, %sil
sete %r8b
testb %r8b, %al
je 0x2228e
movl %esi, %eax
movq -0x8(%rdx,%rax,8), %rax
movq %rax, -0x68(%rbp)
leal -0x2(%rsi), %eax
movl %eax, %r15d
movl %eax, -0x2c(%rbp)
cmpl $0x2, %eax
movq %rdi, -0x38(%rbp)
movq %rdx, -0x60(%rbp)
movq %rsi, -0x58(%rbp)
movl %ecx, -0x3c(%rbp)
jne 0x222aa
leaq -0x90(%rbp), %rax
jmp 0x222bd
leaq 0xa1d0(%rip), %rcx      # 0x2c465
movl $0x1, %r13d
movl $0x1, %esi
callq 0x7446
jmp 0x2251c
movq %r15, %rsi
shlq $0x4, %rsi
xorl %edi, %edi
callq *0x14fcf(%rip)          # 0x37288
movq -0x60(%rbp), %rdx
movq %rax, -0x48(%rbp)
leaq 0x8(%rax), %r12
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x8(%rdx,%r13,8), %rbx
movq %rbx, -0x8(%r12)
movl $0x0, (%r12)
testb $0x1, %r13b
jne 0x22300
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0xe2fe
movq -0x60(%rbp), %rdx
cmpl $0x0, 0x20(%rbx)
movl $0x1, %eax
cmovlel %eax, %r14d
incq %r13
addq $0x10, %r12
cmpq %r13, %r15
jne 0x222cb
testl %r14d, %r14d
je 0x2235a
leaq 0xa174(%rip), %rsi      # 0x2c48c
movq -0x38(%rbp), %r14
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7508
movq %rax, %rbx
incl 0x10(%rax)
movq (%r14), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
movq -0x48(%rbp), %r12
jg 0x2234c
movq %r14, %rdi
callq 0x758c
movq %rbx, (%r14)
movl $0x1, %r13d
jmp 0x22508
cmpl $0x0, -0x3c(%rbp)
movq -0x38(%rbp), %r14
movq -0x48(%rbp), %r12
je 0x2238b
movq %r14, %rdi
callq 0xae38
leaq 0x12ff1(%rip), %rcx     # 0x35368
movq %rcx, 0x8(%rax)
movq $0x0, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
jmp 0x22392
movq 0x128(%r14), %rax
movq %rax, -0x50(%rbp)
incl 0x10(%rax)
xorl %r15d, %r15d
movq %r15, %rax
shlq $0x4, %rax
movq 0x10(%r12,%rax), %rbx
movq %r14, %rdi
movl 0x18(%r12,%rax), %r14d
movq %rbx, %rsi
callq 0xe2fe
cmpl %r14d, 0x20(%rbx)
jle 0x223c4
movq -0x38(%rbp), %r14
jmp 0x223d2
addq $0x2, %r15
cmpl %r15d, -0x2c(%rbp)
movq -0x38(%rbp), %r14
jg 0x2239c
cmpl -0x2c(%rbp), %r15d
je 0x22534
xorl %edx, %edx
movq %rdx, %rax
shlq $0x4, %rax
leaq (%r12,%rax), %r13
movq %rdx, %r15
orq $0x1, %r15
movq -0x60(%rbp), %rcx
movq %rdx, -0x70(%rbp)
movq 0x8(%rcx,%rdx,8), %rcx
movq %rcx, (%r12,%rax)
movl $0x0, 0x8(%r12,%rax)
shlq $0x4, %r15
addq %r12, %r15
movq %r14, %rdi
movq %r13, %rsi
callq 0x2255c
testq %rax, %rax
je 0x22472
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x2255c
movq %rax, %rbx
testq %rax, %rax
jne 0x2243e
movq 0x128(%r14), %rbx
incl 0x10(%rbx)
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x876e
movl %eax, %r12d
movl 0x10(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rbx)
cmpl $0x1, %eax
jg 0x2246b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x758c
testl %r12d, %r12d
je 0x22411
jmp 0x224e4
movq -0x70(%rbp), %rdx
addq $0x2, %rdx
cmpl %edx, -0x2c(%rbp)
movq -0x48(%rbp), %r12
jg 0x223de
movq %r14, %rdi
movq -0x68(%rbp), %rsi
callq 0x908a
movl %eax, %r13d
leal -0x3(%r13), %eax
cmpl $0x1, %eax
ja 0x224af
movl 0x18(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x18(%r14)
cmpl $0x1, %eax
jg 0x224ee
movl $0x0, %r15d
testl %r13d, %r13d
je 0x224c6
cmpl $0x4, %r13d
je 0x2239c
jmp 0x2252e
cmpl $0x0, -0x3c(%rbp)
je 0x2239c
movq (%r14), %rdx
movq %r14, %rdi
movq -0x50(%rbp), %rsi
callq 0x7683
jmp 0x22399
movl $0x1, %r13d
movq -0x48(%rbp), %r12
movq -0x50(%rbp), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x22508
movq %r14, %rdi
callq 0x758c
movq -0x58(%rbp), %rax
cmpl $0x4, %eax
je 0x2251c
movq %r12, %rdi
xorl %esi, %esi
callq *0x14d6c(%rip)          # 0x37288
movl %r13d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, %r13d
jne 0x224ee
movq -0x50(%rbp), %rbx
incl 0x10(%rbx)
movq (%r14), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x22554
movq %r14, %rdi
callq 0x758c
movq %rbx, (%r14)
xorl %r13d, %r13d
jmp 0x224ee