// File: /workspace/github_c_makefile_star2_O0/msteveb[P]autosetup/./jimsh0.c
// Function: JimCallProcedure
static int JimCallProcedure(Jim_Interp *interp, Jim_Cmd *cmd, int argc, Jim_Obj *const *argv)
{
    Jim_CallFrame *callFramePtr;
    int i, d, retcode, optargs;


    if (argc - 1 < cmd->u.proc.reqArity ||
        (cmd->u.proc.argsPos < 0 && argc - 1 > cmd->u.proc.reqArity + cmd->u.proc.optArity)) {
        JimSetProcWrongArgs(interp, argv[0], cmd);
        return JIM_ERR;
    }

    if (Jim_Length(cmd->u.proc.bodyObjPtr) == 0) {

        return JIM_OK;
    }


    if (interp->framePtr->level == interp->maxCallFrameDepth) {
        Jim_SetResultString(interp, "Too many nested calls. Infinite recursion?", -1);
        return JIM_ERR;
    }


    callFramePtr = JimCreateCallFrame(interp, interp->framePtr, cmd->u.proc.nsObj);
    callFramePtr->argv = argv;
    callFramePtr->argc = argc;
    callFramePtr->procArgsObjPtr = cmd->u.proc.argListObjPtr;
    callFramePtr->procBodyObjPtr = cmd->u.proc.bodyObjPtr;
    callFramePtr->staticVars = cmd->u.proc.staticVars;

    interp->procLevel++;

    Jim_IncrRefCount(cmd->u.proc.argListObjPtr);
    Jim_IncrRefCount(cmd->u.proc.bodyObjPtr);
    interp->framePtr = callFramePtr;


    optargs = (argc - 1 - cmd->u.proc.reqArity);


    i = 1;
    for (d = 0; d < cmd->u.proc.argListLen; d++) {
        Jim_Obj *nameObjPtr = cmd->u.proc.arglist[d].nameObjPtr;
        if (d == cmd->u.proc.argsPos) {

            Jim_Obj *listObjPtr;
            int argsLen = 0;
            if (cmd->u.proc.reqArity + cmd->u.proc.optArity < argc - 1) {
                argsLen = argc - 1 - (cmd->u.proc.reqArity + cmd->u.proc.optArity);
            }
            listObjPtr = Jim_NewListObj(interp, &argv[i], argsLen);


            if (cmd->u.proc.arglist[d].defaultObjPtr) {
                nameObjPtr =cmd->u.proc.arglist[d].defaultObjPtr;
            }
            retcode = Jim_SetVariable(interp, nameObjPtr, listObjPtr);
            if (retcode != JIM_OK) {
                goto badargset;
            }

            i += argsLen;
            continue;
        }


        if (cmd->u.proc.arglist[d].defaultObjPtr == NULL || optargs-- > 0) {
            retcode = JimSetProcArg(interp, nameObjPtr, argv[i++]);
        }
        else {

            retcode = Jim_SetVariable(interp, nameObjPtr, cmd->u.proc.arglist[d].defaultObjPtr);
        }
        if (retcode != JIM_OK) {
            goto badargset;
        }
    }

    if (interp->traceCmdObj == NULL ||
        (retcode = JimTraceCallback(interp, "proc", argc, argv)) == JIM_OK) {

        retcode = Jim_EvalObj(interp, cmd->u.proc.bodyObjPtr);
    }

badargset:


    retcode = JimInvokeDefer(interp, retcode);
    interp->framePtr = interp->framePtr->parent;
    JimFreeCallFrame(interp, callFramePtr, JIM_FCF_REUSE);


    if (retcode == JIM_RETURN) {
        if (--interp->returnLevel <= 0) {
            retcode = interp->returnCode;
            interp->returnCode = JIM_OK;
            interp->returnLevel = 0;
        }
    }
    interp->procLevel--;

    return retcode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movq -0x18(%rbp), %rcx
cmpl 0x34(%rcx), %eax
jl 0x24eb8
movq -0x18(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
jge 0x24ed8
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movq -0x18(%rbp), %rcx
movl 0x34(%rcx), %ecx
movq -0x18(%rbp), %rdx
addl 0x38(%rdx), %ecx
cmpl %ecx, %eax
jle 0x24ed8
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x25290
movl $0x1, -0x4(%rbp)
jmp 0x2527f
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xc700
cmpl $0x0, %eax
jne 0x24ef6
movl $0x0, -0x4(%rbp)
jmp 0x2527f
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jne 0x24f6e
jmp 0x24f0c
movq -0x10(%rbp), %rdi
leaq 0x17691(%rip), %rsi     # 0x3c5a8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7990
movq %rax, -0x48(%rbp)
movq -0x48(%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 0x24f57
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x7a10
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x2527f
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rdx
callq 0xeb30
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movl -0x1c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x58(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x10(%rbp), %rax
movl 0x110(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x110(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movq -0x18(%rbp), %rcx
subl 0x34(%rcx), %eax
movl %eax, -0x40(%rbp)
movl $0x1, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x251b4
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movl -0x38(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x3c(%rcx), %eax
jne 0x25123
movl $0x0, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movl 0x34(%rax), %eax
movq -0x18(%rbp), %rcx
addl 0x38(%rcx), %eax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x250a2
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movq -0x18(%rbp), %rcx
movl 0x34(%rcx), %ecx
movq -0x18(%rbp), %rdx
addl 0x38(%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x5c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movslq -0x34(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movl -0x5c(%rbp), %edx
callq 0x7b50
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x250f6
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdx
callq 0x8df0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x25115
jmp 0x251f7
movl -0x5c(%rbp), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
jmp 0x251a6
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x2514d
movl -0x40(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x40(%rbp)
cmpl $0x0, %eax
jle 0x25175
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x34(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
callq 0x25480
movl %eax, -0x3c(%rbp)
jmp 0x2519c
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
callq 0x8df0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x251a4
jmp 0x251f7
jmp 0x251a6
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x25030
movq -0x10(%rbp), %rax
cmpq $0x0, 0x1a8(%rax)
je 0x251e1
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
leaq 0x1830a(%rip), %rsi     # 0x3d4de
callq 0x24c50
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jne 0x251f5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x9b80
movl %eax, -0x3c(%rbp)
jmp 0x251f7
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0xeff0
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x48(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x1, %edx
callq 0xf1d0
cmpl $0x2, -0x3c(%rbp)
jne 0x25266
movq -0x10(%rbp), %rcx
movl 0x2c(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x2c(%rcx)
cmpl $0x0, %eax
jg 0x25264
movq -0x10(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2c(%rax)
jmp 0x25266
movq -0x10(%rbp), %rax
movl 0x110(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x110(%rax)
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)