// File: /workspace/github_c_makefile_star2_O2/msteveb[P]autosetup/./jimsh0.c
// Function: JimInterpolateTokens
static Jim_Obj *JimInterpolateTokens(Jim_Interp *interp, const ScriptToken * token, int tokens, int flags)
{
    int totlen = 0, i;
    Jim_Obj **intv;
    Jim_Obj *sintv[JIM_EVAL_SINTV_LEN];
    Jim_Obj *objPtr;
    char *s;

    if (tokens <= JIM_EVAL_SINTV_LEN)
        intv = sintv;
    else
        intv = Jim_Alloc(sizeof(Jim_Obj *) * tokens);

    for (i = 0; i < tokens; i++) {
        switch (JimSubstOneToken(interp, &token[i], &intv[i])) {
            case JIM_OK:
            case JIM_RETURN:
                break;
            case JIM_BREAK:
                if (flags & JIM_SUBST_FLAG) {

                    tokens = i;
                    continue;
                }


            case JIM_CONTINUE:
                if (flags & JIM_SUBST_FLAG) {
                    intv[i] = NULL;
                    continue;
                }


            default:
                while (i--) {
                    Jim_DecrRefCount(interp, intv[i]);
                }
                if (intv != sintv) {
                    Jim_Free(intv);
                }
                return NULL;
        }
        Jim_IncrRefCount(intv[i]);
        Jim_String(intv[i]);
        totlen += intv[i]->length;
    }


    if (tokens == 1 && intv[0] && intv == sintv) {

        intv[0]->refCount--;
        return intv[0];
    }

    objPtr = Jim_NewStringObjNoAlloc(interp, NULL, 0);

    if (tokens == 4 && token[0].type == JIM_TT_ESC && token[1].type == JIM_TT_ESC
        && token[2].type == JIM_TT_VAR) {

        objPtr->typePtr = &interpolatedObjType;
        objPtr->internalRep.dictSubstValue.varNameObjPtr = token[0].objPtr;
        objPtr->internalRep.dictSubstValue.indexObjPtr = intv[2];
        Jim_IncrRefCount(intv[2]);
    }
    else if (tokens && intv[0] && intv[0]->typePtr == &sourceObjType) {

        int line;
        Jim_Obj *fileNameObj = Jim_GetSourceInfo(interp, intv[0], &line);
        Jim_SetSourceInfo(interp, objPtr, fileNameObj, line);
    }


    s = objPtr->bytes = Jim_Alloc(totlen + 1);
    objPtr->length = totlen;
    for (i = 0; i < tokens; i++) {
        if (intv[i]) {
            memcpy(s, intv[i]->bytes, intv[i]->length);
            s += intv[i]->length;
            Jim_DecrRefCount(interp, intv[i]);
        }
    }
    objPtr->bytes[totlen] = '\0';

    if (intv != sintv) {
        Jim_Free(intv);
    }

    return objPtr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %ecx, -0x38(%rbp)
movq %rsi, %r15
movq %rdi, %r13
cmpl $0x9, %edx
jge 0xf9da
leaq -0xa0(%rbp), %rax
jmp 0xf9ec
movl %edx, %esi
shlq $0x3, %rsi
xorl %edi, %edi
movl %edx, %ebx
callq *0x2389e(%rip)          # 0x33288
movl %ebx, %edx
movq %rax, -0x30(%rbp)
xorl %r12d, %r12d
movq %r15, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movslq %edx, %rax
cmpq %rax, %r12
movl %edx, %ebx
jge 0xfb0c
movl 0x8(%r15), %eax
leal -0x1(%rax), %ecx
cmpl $0x4, %ecx
ja 0xfa2e
leaq 0x13754(%rip), %rdx     # 0x23174
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq (%r15), %rcx
jmp 0xfa8e
cmpl $0x11, %eax
jne 0xfb3c
movq (%r15), %rsi
movq %r13, %rdi
callq 0xcb7c
testl %eax, %eax
jne 0xfaa0
movq (%r13), %rcx
xorl %eax, %eax
jmp 0xfa91
movq (%r15), %rsi
movq %r13, %rdi
callq 0x8b54
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0xfaa0
movq (%r13), %rcx
jmp 0xfa91
movq (%r15), %rsi
movq %r13, %rdi
pushq $0x1
popq %r14
movl %r14d, %edx
callq 0x9378
movq %rax, %rcx
movl %r14d, %eax
jmp 0xfa91
movq (%r15), %rsi
movq %r13, %rdi
callq 0xf92d
movq %rax, %rcx
pushq $0x1
popq %rax
testq %rcx, %rcx
je 0xfaa0
movq -0x30(%rbp), %rax
movq %rcx, (%rax,%r12,8)
jmp 0xfabb
cmpl $0x4, %eax
ja 0xfb3c
movl %eax, %eax
leaq 0x136d6(%rip), %rcx     # 0x23188
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r13, %r14
movq -0x30(%rbp), %r13
movq (%r13,%r12,8), %rdi
incl 0x10(%rdi)
callq 0x7340
movq (%r13,%r12,8), %rax
movq %r14, %r13
movq -0x40(%rbp), %rcx
addl 0x14(%rax), %ecx
movq %rcx, -0x40(%rbp)
movl %ebx, %edx
incq %r12
addq $0x10, %r15
jmp 0xf9ff
cmpb $0x0, -0x38(%rbp)
jns 0xfb3c
movq -0x30(%rbp), %rax
andq $0x0, (%rax,%r12,8)
jmp 0xfae2
cmpb $0x0, -0x38(%rbp)
jns 0xfb3c
movl %r12d, %edx
jmp 0xfae4
cmpl $0x1, %edx
jne 0xfb77
movq -0x30(%rbp), %rdx
movq (%rdx), %r14
testq %r14, %r14
setne %al
leaq -0xa0(%rbp), %rcx
cmpq %rcx, %rdx
sete %cl
testb %cl, %al
je 0xfbd4
decl 0x10(%r14)
jmp 0xfcd5
decq %r12
movq -0x30(%rbp), %rbx
cmpq $-0x1, %r12
je 0xfb68
movq (%rbx,%r12,8), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0xfb63
movq %r13, %rdi
callq 0x73bf
decq %r12
jmp 0xfb43
leaq -0xa0(%rbp), %rax
xorl %r14d, %r14d
jmp 0xfcc5
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xa654
movq %rax, %r14
testl %ebx, %ebx
je 0xfc27
cmpl $0x4, %ebx
jne 0xfbe3
movq -0x50(%rbp), %rcx
cmpl $0x2, 0x8(%rcx)
jne 0xfbe3
cmpl $0x2, 0x18(%rcx)
jne 0xfbe3
cmpl $0x3, 0x28(%rcx)
jne 0xfbe3
movq %r13, -0x48(%rbp)
leaq 0x221f4(%rip), %rax     # 0x31da8
movq %rax, 0x8(%r14)
movq (%rcx), %rax
movq %rax, 0x18(%r14)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %r14, -0x38(%rbp)
movq %rax, 0x20(%r14)
incl 0x10(%rax)
jmp 0xfc2f
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xa654
movq %rax, %r14
movq -0x30(%rbp), %rax
movq (%rax), %rsi
testq %rsi, %rsi
movq %r13, -0x48(%rbp)
movq %r14, -0x38(%rbp)
je 0xfc2f
leaq 0x2168a(%rip), %rax     # 0x31288
cmpq %rax, 0x8(%rsi)
jne 0xfc2f
leaq -0x54(%rbp), %r12
movq %r13, %rdi
movq %r12, %rdx
callq 0xb377
movl (%r12), %ecx
movq %r13, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xb3cf
jmp 0xfc2f
movq %r14, -0x38(%rbp)
movq %r13, -0x48(%rbp)
movq -0x40(%rbp), %r15
leal 0x1(%r15), %eax
movslq %eax, %rsi
xorl %r14d, %r14d
xorl %edi, %edi
callq *0x23643(%rip)          # 0x33288
movq %rax, %r13
movq -0x38(%rbp), %rax
movq %r13, (%rax)
movl %r15d, 0x14(%rax)
testl %ebx, %ebx
movl $0x0, %r15d
cmovgl %ebx, %r15d
movq -0x30(%rbp), %rbx
cmpq %r14, %r15
je 0xfcaf
movq (%rbx,%r14,8), %rax
testq %rax, %rax
je 0xfca4
movq (%rax), %rsi
movslq 0x14(%rax), %rdx
movq %r13, %rdi
callq 0x6320
movq (%rbx,%r14,8), %rsi
movslq 0x14(%rsi), %r12
addq %r13, %r12
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0xfca7
movq -0x48(%rbp), %rdi
callq 0x73bf
jmp 0xfca7
movq %r13, %r12
incq %r14
movq %r12, %r13
jmp 0xfc63
movq -0x38(%rbp), %r14
movq (%r14), %rax
movslq -0x40(%rbp), %rcx
movb $0x0, (%rax,%rcx)
leaq -0xa0(%rbp), %rax
cmpq %rax, %rbx
je 0xfcd5
movq %rbx, %rdi
xorl %esi, %esi
callq *0x235b3(%rip)          # 0x33288
movq %r14, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq