// File: /workspace/github_c_makefile_star2_O0/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
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x4, -0x14(%rbp)
jl 0x2ef16
movl -0x14(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x2ef3b
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x1, %esi
leaq 0xd8fd(%rip), %rcx      # 0x3c827
callq 0x7880
movl $0x1, -0x4(%rbp)
jmp 0x2f2e1
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
cmpl $0x2, -0x30(%rbp)
jne 0x2ef6c
leaq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x2ef85
movq 0x1931d(%rip), %rax     # 0x48290
movslq -0x30(%rbp), %rsi
shlq $0x4, %rsi
xorl %ecx, %ecx
movl %ecx, %edi
callq *%rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x2effa
movq -0x58(%rbp), %rdi
movslq -0x2c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
callq 0x2f2f0
movl -0x2c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x2efed
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movslq -0x2c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x2f320
cmpl $0x0, %eax
je 0x2efed
movl $0x1, -0x28(%rbp)
jmp 0x2efef
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2ef8c
cmpl $0x0, -0x28(%rbp)
je 0x2f05d
jmp 0x2f002
movq -0x10(%rbp), %rdi
leaq 0xd841(%rip), %rsi      # 0x3c84e
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7990
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x2f04d
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x7a10
movq -0x70(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x2f2c4
cmpl $0x0, -0x24(%rbp)
je 0x2f078
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x7b50
movq %rax, -0x68(%rbp)
jmp 0x2f087
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x2f0d3
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x2c(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x4, %rax
addq %rax, %rsi
callq 0x2f320
cmpl $0x0, %eax
jne 0x2f0c6
jmp 0x2f0d3
jmp 0x2f0c8
movl -0x2c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2f09b
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x2f0e0
jmp 0x2f24a
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x2f1d4
movq -0x58(%rbp), %rdi
movslq -0x2c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
callq 0x2f2f0
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movslq -0x2c(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x2f360
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
je 0x2f1c4
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl -0x2c(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x4, %rax
addq %rax, %rsi
callq 0x2f360
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x2f174
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdx
callq 0x8df0
movl %eax, -0x28(%rbp)
movq -0x80(%rbp), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x2f1b4
movq -0x10(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x7a10
cmpl $0x0, -0x28(%rbp)
je 0x2f1bf
jmp 0x2f2a3
jmp 0x2f118
jmp 0x2f1c6
movl -0x2c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2f0e7
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x9b80
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x2eea0
cmpl $0x0, %eax
je 0x2f1fa
jmp 0x2f2a3
movl -0x28(%rbp), %eax
movl %eax, -0x8c(%rbp)
testl %eax, %eax
je 0x2f223
jmp 0x2f209
movl -0x8c(%rbp), %eax
subl $0x3, %eax
je 0x2f241
jmp 0x2f216
movl -0x8c(%rbp), %eax
subl $0x4, %eax
je 0x2f23f
jmp 0x2f243
cmpl $0x0, -0x24(%rbp)
je 0x2f23d
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
callq 0x7bd0
jmp 0x2f245
jmp 0x2f245
jmp 0x2f24c
jmp 0x2f2a3
jmp 0x2f094
jmp 0x2f24c
movl $0x0, -0x28(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x2f293
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x7a10
movq -0x88(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x2f2a3
movq -0x68(%rbp), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x2f2c2
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x7a10
jmp 0x2f2c4
cmpl $0x2, -0x30(%rbp)
jle 0x2f2db
movq 0x18fbf(%rip), %rax     # 0x48290
movq -0x58(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %esi
callq *%rax
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)