// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rsi, %rdi
callq 0x7340
movq %rax, %r13
movq %r15, %rdi
callq 0xa61a
movq 0x18(%r14), %r14
movq 0x28(%r14), %rsi
testq %rsi, %rsi
je 0xecea
testb $0x1, %bl
je 0xeccc
pushq $-0x1
popq %rdx
movq %r12, %rdi
callq 0x7363
movq %rax, %rbx
incl 0x10(%rax)
movq (%r12), %rsi
movl 0x10(%rsi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rsi)
cmpl $0x1, %eax
jg 0xecc8
movq %r12, %rdi
callq 0x73bf
movq %rbx, (%r12)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, -0x34(%rbp)
movq %r13, -0x58(%rbp)
leaq 0x1a949(%rip), %rsi     # 0x29641
movq $0x0, -0x98(%rbp)
movq %r12, %rdi
xorl %edx, %edx
callq 0x7363
movq %rax, %r13
incl 0x10(%rax)
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x745b
movq %rax, -0x48(%rbp)
movq 0x20(%r14), %rax
testq %rax, %rax
je 0xed62
xorl %ebx, %ebx
movq %r12, %rdi
cmpq %rax, %rbx
jae 0xed4b
movq -0x48(%rbp), %rsi
movq %r13, %rdx
callq 0x74ad
incq %rbx
movq 0x20(%r14), %rax
jmp 0xed2e
movq -0x48(%rbp), %rbx
movq %rbx, %rsi
callq 0x8b3c
movq 0x18(%rbx), %rax
movq %rax, -0x98(%rbp)
leaq 0x38(%r14), %rdi
movslq -0x34(%rbp), %rax
movq %rax, -0xb8(%rbp)
pushq $0x1
popq %r9
movq $0x0, -0x88(%rbp)
xorl %eax, %eax
movq %r12, -0x68(%rbp)
movq %r14, -0xa0(%rbp)
movq %rdi, -0x30(%rbp)
movq %r13, -0x90(%rbp)
cmpq 0x10(%r14), %rax
jae 0xf2a0
movq %rax, %r8
shlq $0x5, %r8
movzbl 0x1c(%rdi,%r8), %ebx
testl %ebx, %ebx
je 0xf298
addq %rdi, %r8
testl %r9d, %r9d
movq %r8, -0x40(%rbp)
movq %rax, -0x50(%rbp)
jle 0xee5c
movq 0x8(%r8), %r13
testq %r13, %r13
je 0xee64
xorl %r12d, %r12d
movq -0x88(%rbp), %rax
movl %eax, %r14d
movl -0x34(%rbp), %r8d
cmpl %r8d, %r14d
jge 0xef42
movzbl (%r13,%r12), %r15d
testq %r15, %r15
je 0xee70
callq 0x64e0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r15,2)
movslq %r14d, %rdx
jne 0xee23
movq -0x58(%rbp), %rax
cmpb (%rax,%rdx), %r15b
jne 0xee70
incl %r14d
movl -0x34(%rbp), %r8d
jmp 0xee57
movq -0x58(%rbp), %rcx
addq %rdx, %rcx
movq -0xb8(%rbp), %rsi
subq %rdx, %rsi
xorl %edx, %edx
movl -0x34(%rbp), %r8d
cmpq %rdx, %rsi
je 0xee4f
movzbl (%rcx,%rdx), %edi
testb $0x20, 0x1(%rax,%rdi,2)
je 0xee54
incq %rdx
jmp 0xee3a
movl %r8d, %r14d
jmp 0xee57
addl %edx, %r14d
incq %r12
jmp 0xede9
xorl %r14d, %r14d
jmp 0xf1c4
movq -0x88(%rbp), %rax
movl %eax, %r14d
jmp 0xee96
movl %r12d, %eax
xorl %r9d, %r9d
cmpb $0x0, (%r13,%rax)
movq -0x68(%rbp), %r12
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %r8
je 0xee96
movq -0x90(%rbp), %r13
jmp 0xf1e2
leal -0x5b(%rbx), %eax
cmpl $0x13, %eax
movq -0x90(%rbp), %r13
ja 0xeeaf
movl $0x80101, %ecx          # imm = 0x80101
btl %eax, %ecx
jb 0xeeda
callq 0x64e0
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %rdi
movq (%rax), %rax
movslq %r14d, %rcx
leal -0x1(%rcx), %r14d
addq -0x58(%rbp), %rcx
movzbl (%rcx), %edx
incl %r14d
incq %rcx
testb $0x20, 0x1(%rax,%rdx,2)
jne 0xeeca
movslq %r14d, %r10
movq %r10, %r9
subq -0x88(%rbp), %r9
cmpb $0x6e, %bl
jne 0xef0d
movq %r12, %rdi
movq %r10, %rsi
movq %r9, %rbx
callq 0x8212
movq %rbx, %r9
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %rdi
movq %rax, %r14
jmp 0xf1c0
cmpl -0x34(%rbp), %r14d
jge 0xef67
cmpb $0x63, %bl
jne 0xef75
movq -0x58(%rbp), %rax
movzbl (%rax,%r10), %esi
movq %r12, %rdi
movq %r9, %rbx
callq 0x8212
movq %rbx, %r9
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %rdi
movq %rax, %r14
incl %r9d
jmp 0xf1c0
xorl %r14d, %r14d
pushq $-0x1
popq %rax
movl %eax, %r9d
movq -0x68(%rbp), %r12
movq -0x90(%rbp), %r13
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %r8
jmp 0xf1c4
xorl %r14d, %r14d
pushq $-0x1
popq %rax
movl %eax, %r9d
jmp 0xf1c0
movq 0x10(%r8), %r12
testq %r12, %r12
movq %r9, -0x78(%rbp)
je 0xefd2
movl -0x34(%rbp), %eax
subl %r14d, %eax
jns 0xef9d
movq -0x58(%rbp), %rax
leaq (%rax,%r10), %rdi
movq %r10, %rbx
callq 0x6180
movq %rbx, %r10
movslq %eax, %rdx
cmpq %rdx, %r12
cmovbel %r12d, %edx
addq -0x58(%rbp), %r10
movq -0x68(%rbp), %r12
movq %r12, %rdi
movq %r10, %rsi
callq 0x7363
movq %rax, %rsi
movq (%rax), %r10
movq -0x40(%rbp), %r8
movb 0x1c(%r8), %bl
movq -0x30(%rbp), %rdi
movq -0x78(%rbp), %r9
jmp 0xefdc
addq -0x58(%rbp), %r10
xorl %esi, %esi
movq -0x68(%rbp), %r12
movzbl %bl, %eax
leal -0x5b(%rax), %ecx
cmpl $0x1d, %ecx
ja 0xf1a2
movl $0x24104200, %edx       # imm = 0x24104200
btl %ecx, %edx
movq %rsi, -0x60(%rbp)
jb 0xf041
movl $0x1c00, %eax           # imm = 0x1C00
btl %ecx, %eax
movq %r10, -0x80(%rbp)
jae 0xf066
movq %r10, %rdi
leaq -0x70(%rbp), %rsi
callq 0x6120
movq -0x80(%rbp), %rax
movq -0x70(%rbp), %rbx
cmpq %rax, %rbx
je 0xf185
movq %r12, %rdi
movq %rax, %r15
callq 0xd366
movq %rax, %r14
movq -0x78(%rbp), %r9
subq %r15, %r9
addq %rbx, %r9
jmp 0xf194
cmpb $0x69, %bl
je 0xf120
pushq $0x8
popq %rdx
cmpl $0x6f, %eax
je 0xf134
cmpl $0x78, %eax
jne 0xf131
pushq $0x10
jmp 0xf133
movl $0x1000001, %eax        # imm = 0x1000001
btl %ecx, %eax
jae 0xf1a2
movq (%r8), %rax
movq %rax, -0xb0(%rbp)
movq %r10, %rdi
callq 0x9e18
movq -0x80(%rbp), %rcx
movq %rax, -0xa8(%rbp)
xorl %r14d, %r14d
movzbl (%rcx,%r14), %ebx
testq %rbx, %rbx
je 0xf0f3
movq -0xb0(%rbp), %r15
testq %r15, %r15
je 0xf0d0
movq %r15, %rdi
callq 0x6180
movq %r15, %rdi
movl %eax, %esi
movl %ebx, %edx
pushq $0x2
popq %rcx
callq 0x1578d
testq %rax, %rax
movq -0x80(%rbp), %rcx
je 0xf0f3
movb (%rcx,%r14), %bl
jmp 0xf0e3
callq 0x64e0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
movq -0x80(%rbp), %rcx
jne 0xf0f3
movq -0xa8(%rbp), %rax
movb %bl, (%rax,%r14)
incq %r14
jmp 0xf094
movq -0xa8(%rbp), %rsi
movb $0x0, (%rsi,%r14)
movq %r12, %rdi
movl %r14d, %edx
callq 0xa654
movq %rax, %r14
movq %rax, %rdi
callq 0xa61a
movl %eax, %eax
movq -0x78(%rbp), %r9
addq %rax, %r9
jmp 0xf177
movq %r10, %rdi
leaq -0x70(%rbp), %rsi
movq %r10, %r14
callq 0xc7ef
jmp 0xf143
pushq $0xa
popq %rdx
movq %r10, %rdi
leaq -0x70(%rbp), %rsi
movq %r10, %r14
callq 0x6460
cmpq %r14, -0x70(%rbp)
je 0xf167
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rbx
callq 0x8212
movq %rax, %r14
movq -0x78(%rbp), %r9
subq %rbx, %r9
addq -0x70(%rbp), %r9
jmp 0xf177
cmpb $0x1, (%r14)
movl $0x0, %r9d
sbbq %r9, %r9
xorl %r14d, %r14d
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %r8
movq -0x60(%rbp), %rsi
jmp 0xf1a5
cmpb $0x1, (%rax)
movl $0x0, %r9d
sbbq %r9, %r9
xorl %r14d, %r14d
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x40(%rbp), %r8
jmp 0xf1a5
xorl %r14d, %r14d
testq %rsi, %rsi
je 0xf1c0
movq %r12, %rdi
movq %r9, %rbx
callq 0x73bf
movq %rbx, %r9
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rax
testq %rax, %rax
jne 0xf1d3
cmpl $-0x1, %r9d
je 0xf2c4
movl %r9d, %eax
addq %rax, -0x88(%rbp)
testq %r14, %r14
jne 0xf204
movq %r12, %rdi
leaq 0x1a455(%rip), %rsi     # 0x29641
xorl %edx, %edx
movq %r9, %rbx
callq 0x7363
movq %rbx, %r9
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %rdi
movq %rax, %r14
movslq 0x18(%r8), %rax
testq %rax, %rax
je 0xf222
cmpl $-0x1, %eax
jne 0xf23d
movq %r12, %rdi
movq %r14, %rsi
movq %r9, %rbx
callq 0x73bf
jmp 0xf234
movq %r12, %rdi
movq -0x48(%rbp), %rsi
movq %r14, %rdx
movq %r9, %rbx
callq 0x74ad
movq %rbx, %r9
movq -0x30(%rbp), %rdi
jmp 0xf28d
movq -0x98(%rbp), %rcx
movq -0x8(%rcx,%rax,8), %rsi
cmpq %r13, %rsi
jne 0xf2f7
movl 0x10(%rsi), %ecx
leal -0x1(%rcx), %edx
movl %edx, 0x10(%rsi)
cmpl $0x1, %ecx
jg 0xf27d
movq %r12, %rdi
movq %r8, %rbx
movq %r9, %r15
callq 0x73bf
movq %r15, %r9
movq -0x68(%rbp), %r12
movq -0x30(%rbp), %rdi
movslq 0x18(%rbx), %rax
incl 0x10(%r14)
movq -0x98(%rbp), %rcx
movq %r14, -0x8(%rcx,%rax,8)
movq -0xa0(%rbp), %r14
movq -0x50(%rbp), %rax
incq %rax
jmp 0xed98
movl 0x10(%r13), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r13)
cmpl $0x1, %eax
jg 0xecd4
movq %r12, %rdi
movq %r13, %rsi
callq 0x73bf
jmp 0xecd4
movl 0x10(%r13), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r13)
cmpl $0x1, %eax
jg 0xf2df
movq %r12, %rdi
movq %r13, %rsi
callq 0x73bf
movq %r12, %rdi
movq -0x48(%rbp), %rsi
callq 0x73bf
pushq $-0x1
popq %rax
movq %rax, -0x48(%rbp)
jmp 0xecd4
movq %r12, %rdi
movq %r14, %rsi
callq 0x73bf
movl 0x10(%r13), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%r13)
cmpl $0x1, %eax
jg 0xf31d
movq %r12, %rdi
movq %r13, %rsi
callq 0x73bf
movq %r12, %rdi
movq -0x48(%rbp), %rsi
callq 0x73bf
jmp 0xeccc