// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, %r14
cmpl $0x4, %esi
setge %al
testb $0x1, %sil
sete %dil
testb %dil, %al
je 0x1f332
movl %ecx, -0x34(%rbp)
movl %esi, %eax
movq -0x8(%rdx,%rax,8), %rax
movq %rax, -0x60(%rbp)
leal -0x2(%rsi), %eax
movl %eax, %ebx
movl %eax, -0x38(%rbp)
cmpl $0x2, %eax
movq %rdx, -0x30(%rbp)
movq %rsi, -0x50(%rbp)
jne 0x1f34d
leaq -0x90(%rbp), %rax
jmp 0x1f360
pushq $0x1
popq %r13
leaq 0x9178(%rip), %rcx      # 0x284b5
movq %r14, %rdi
movl %r13d, %esi
callq 0x72a5
jmp 0x1f5dc
movq %rbx, %rsi
shlq $0x4, %rsi
xorl %edi, %edi
callq *0x13f2c(%rip)          # 0x33288
movq -0x30(%rbp), %rdx
movq %rax, -0x48(%rbp)
leaq -0x10(%rax), %r15
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %r13, %rax
shlq $0x4, %rax
addq %r15, %rax
movq %r13, %rcx
cmpq %rcx, %rbx
je 0x1f3b7
leaq 0x1(%rcx), %r13
movq 0x8(%rdx,%rcx,8), %rsi
movq %rsi, 0x10(%rax)
andl $0x0, 0x18(%rax)
leaq 0x10(%rax), %rsi
movq %rsi, %rax
testb $0x1, %cl
movq %r13, %rcx
jne 0x1f37b
movq %r14, %rdi
callq 0x1f619
movq -0x30(%rbp), %rdx
testl %eax, %eax
pushq $0x1
popq %rax
cmovnel %eax, %r12d
jmp 0x1f36e
testl %r12d, %r12d
je 0x1f401
leaq 0x9119(%rip), %rsi      # 0x284dc
pushq $-0x1
popq %rdx
movq %r14, %rdi
callq 0x7363
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 0x1f3f1
movq %r14, %rdi
callq 0x73bf
movq %rbx, (%r14)
movq -0x50(%rbp), %rax
pushq $0x1
popq %r13
jmp 0x1f5cc
cmpl $0x0, -0x34(%rbp)
movq -0x48(%rbp), %r12
je 0x1f420
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x745b
movq -0x30(%rbp), %rdx
movq %rax, %r15
jmp 0x1f427
movq 0x128(%r14), %r15
incl 0x10(%r15)
movslq -0x38(%rbp), %rax
xorl %ebx, %ebx
movq %r15, -0x58(%rbp)
movq %rax, -0x40(%rbp)
cmpq %rax, %rbx
jge 0x1f469
movq %rax, %r13
movq %rbx, %rax
shlq $0x4, %rax
leaq (%r12,%rax), %rsi
addq $0x10, %rsi
movq %r14, %rdi
callq 0x1f619
movq -0x30(%rbp), %rdx
testl %eax, %eax
movq %r13, %rax
je 0x1f469
addq $0x2, %rbx
jmp 0x1f439
cmpl %ebx, -0x38(%rbp)
je 0x1f5f4
xorl %esi, %esi
cmpq %rax, %rsi
jge 0x1f52a
movq %rsi, %rax
shlq $0x4, %rax
leaq (%r12,%rax), %r13
movq 0x8(%rdx,%rsi,8), %rcx
movq %rcx, (%r12,%rax)
andl $0x0, 0x8(%r12,%rax)
movq %rsi, -0x68(%rbp)
movq %rsi, %r15
orq $0x1, %r15
shlq $0x4, %r15
addq %r12, %r15
movq %r14, %rdi
movq %r13, %rsi
callq 0x1f63a
testq %rax, %rax
je 0x1f50d
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x1f63a
movq %rax, %rbx
testq %rax, %rax
jne 0x1f4d6
movq 0x128(%r14), %rbx
incl 0x10(%rbx)
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x8306
movl %eax, %r12d
movl 0x10(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rbx)
cmpl $0x1, %eax
jg 0x1f503
movq %r14, %rdi
movq %rbx, %rsi
callq 0x73bf
testl %r12d, %r12d
je 0x1f4a9
jmp 0x1f59f
movq -0x68(%rbp), %rsi
addq $0x2, %rsi
movq -0x48(%rbp), %r12
movq -0x30(%rbp), %rdx
movq -0x58(%rbp), %r15
movq -0x40(%rbp), %rax
jmp 0x1f474
movq %r14, %rdi
movq -0x60(%rbp), %rsi
callq 0x8b54
movl %eax, %r13d
leal -0x3(%r13), %eax
cmpl $0x1, %eax
ja 0x1f552
movl 0x18(%r14), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x18(%r14)
cmpl $0x1, %eax
jg 0x1f5ad
movl $0x0, %ebx
testl %r13d, %r13d
je 0x1f570
cmpl $0x4, %r13d
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rax
je 0x1f439
jmp 0x1f5ee
cmpl $0x0, -0x34(%rbp)
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rax
je 0x1f439
movq (%r14), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x74ad
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rdx
xorl %ebx, %ebx
jmp 0x1f439
pushq $0x1
popq %rax
movl %eax, %r13d
movq -0x48(%rbp), %r12
movq -0x58(%rbp), %r15
movl 0x10(%r15), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r15)
cmpl $0x1, %eax
jg 0x1f5c8
movq %r14, %rdi
movq %r15, %rsi
callq 0x73bf
movq -0x50(%rbp), %rax
cmpl $0x4, %eax
je 0x1f5dc
movq %r12, %rdi
xorl %esi, %esi
callq *0x13cac(%rip)          # 0x33288
movl %r13d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, %r13d
jne 0x1f5ad
incl 0x10(%r15)
movq (%r14), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0x1f611
movq %r14, %rdi
callq 0x73bf
movq %r15, (%r14)
xorl %r13d, %r13d
jmp 0x1f5ad