// File: /workspace/github_c_makefile_star2_O0/msteveb[P]autosetup/./jimsh0.c
// Function: Jim_ScanString
Jim_Obj *Jim_ScanString(Jim_Interp *interp, Jim_Obj *strObjPtr, Jim_Obj *fmtObjPtr, int flags)
{
    size_t i, pos;
    int scanned = 1;
    const char *str = Jim_String(strObjPtr);
    int str_bytelen = Jim_Length(strObjPtr);
    Jim_Obj *resultList = 0;
    Jim_Obj **resultVec = 0;
    int resultc;
    Jim_Obj *emptyStr = 0;
    ScanFmtStringObj *fmtObj;


    JimPanic((fmtObjPtr->typePtr != &scanFmtStringObjType, "Jim_ScanString() for non-scan format"));

    fmtObj = (ScanFmtStringObj *) fmtObjPtr->internalRep.ptr;

    if (fmtObj->error != 0) {
        if (flags & JIM_ERRMSG)
            Jim_SetResultString(interp, fmtObj->error, -1);
        return 0;
    }

    emptyStr = Jim_NewEmptyStringObj(interp);
    Jim_IncrRefCount(emptyStr);

    resultList = Jim_NewListObj(interp, NULL, 0);
    if (fmtObj->maxPos > 0) {
        for (i = 0; i < fmtObj->maxPos; ++i)
            Jim_ListAppendElement(interp, resultList, emptyStr);
        JimListGetElements(interp, resultList, &resultc, &resultVec);
    }

    for (i = 0, pos = 0; i < fmtObj->count; ++i) {
        ScanFmtPartDescr *descr = &(fmtObj->descr[i]);
        Jim_Obj *value = 0;


        if (descr->type == 0)
            continue;

        if (scanned > 0)
            scanned = ScanOneEntry(interp, str, pos, str_bytelen, fmtObj, i, &value);

        if (scanned == -1 && i == 0)
            goto eof;

        pos += scanned;


        if (value == 0)
            value = Jim_NewEmptyStringObj(interp);

        if (descr->pos == -1) {
            Jim_FreeNewObj(interp, value);
        }
        else if (descr->pos == 0)

            Jim_ListAppendElement(interp, resultList, value);
        else if (resultVec[descr->pos - 1] == emptyStr) {

            Jim_DecrRefCount(interp, resultVec[descr->pos - 1]);
            Jim_IncrRefCount(value);
            resultVec[descr->pos - 1] = value;
        }
        else {

            Jim_FreeNewObj(interp, value);
            goto err;
        }
    }
    Jim_DecrRefCount(interp, emptyStr);
    return resultList;
  eof:
    Jim_DecrRefCount(interp, emptyStr);
    Jim_FreeNewObj(interp, resultList);
    return (Jim_Obj *)EOF;
  err:
    Jim_DecrRefCount(interp, emptyStr);
    Jim_FreeNewObj(interp, resultList);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x1, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7960
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
callq 0xc700
movl %eax, -0x4c(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x121ec
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x121df
jmp 0x12186
movq -0x10(%rbp), %rdi
movq -0x78(%rbp), %rax
movq 0x28(%rax), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x7990
movq %rax, -0x80(%rbp)
movq -0x80(%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 0x121d2
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x7a10
movq -0x80(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x121df
movq $0x0, -0x8(%rbp)
jmp 0x124e3
movq -0x10(%rbp), %rdi
leaq 0x2b7bb(%rip), %rsi     # 0x3d9b2
xorl %edx, %edx
callq 0x7990
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x7b50
movq %rax, -0x58(%rbp)
movq -0x78(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jbe 0x12277
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x12262
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x70(%rbp), %rdx
callq 0x7bd0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12235
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x64(%rbp), %rdx
leaq -0x60(%rbp), %rcx
callq 0x115c0
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq -0x78(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x1244d
movq -0x78(%rbp), %rax
addq $0x38, %rax
movq -0x30(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x88(%rbp), %rax
movsbl 0x1c(%rax), %eax
cmpl $0x0, %eax
jne 0x122d3
jmp 0x1243c
cmpl $0x0, -0x3c(%rbp)
jle 0x12305
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rax
movl %eax, %edx
movl -0x4c(%rbp), %ecx
movq -0x78(%rbp), %r8
movq -0x30(%rbp), %r9
leaq -0x90(%rbp), %rax
movq %rax, (%rsp)
callq 0x124f0
movl %eax, -0x3c(%rbp)
cmpl $-0x1, -0x3c(%rbp)
jne 0x12317
cmpq $0x0, -0x30(%rbp)
jne 0x12317
jmp 0x12476
movslq -0x3c(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x12346
movq -0x10(%rbp), %rdi
leaq 0x2b67a(%rip), %rsi     # 0x3d9b2
xorl %edx, %edx
callq 0x7990
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
cmpl $-0x1, 0x18(%rax)
jne 0x12368
movq -0x10(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x7a10
jmp 0x1243a
movq -0x88(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x1238e
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x90(%rbp), %rdx
callq 0x7bd0
jmp 0x12438
movq -0x60(%rbp), %rax
movq -0x88(%rbp), %rcx
movl 0x18(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x70(%rbp), %rax
jne 0x12424
movq -0x60(%rbp), %rax
movq -0x88(%rbp), %rcx
movl 0x18(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x123f3
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rax
movq -0x88(%rbp), %rcx
movl 0x18(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
callq 0x7a10
movq -0x90(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x90(%rbp), %rdx
movq -0x60(%rbp), %rax
movq -0x88(%rbp), %rcx
movl 0x18(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x12436
movq -0x10(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x7a10
jmp 0x124af
jmp 0x12438
jmp 0x1243a
jmp 0x1243c
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12287
movq -0x70(%rbp), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x1246c
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x7a10
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x124e3
movq -0x70(%rbp), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x12495
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x7a10
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x7a10
movq $-0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x124e3
movq -0x70(%rbp), %rcx
movl 0x10(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rcx)
cmpl $0x0, %eax
jg 0x124ce
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x7a10
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x7a10
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq