// File: /workspace/github_c_makefile_star2_O3/msteveb[P]autosetup/./jimsh0.c
// Function: JimParseVar
static int JimParseVar(struct JimParserCtx *pc)
{

    pc->p++;
    pc->len--;

#ifdef EXPRSUGAR_BRACKET
    if (*pc->p == '[') {

        JimParseCmd(pc);
        pc->tt = JIM_TT_EXPRSUGAR;
        return JIM_OK;
    }
#endif

    pc->tstart = pc->p;
    pc->tt = JIM_TT_VAR;
    pc->tline = pc->linenr;

    if (*pc->p == '{') {
        pc->tstart = ++pc->p;
        pc->len--;

        while (pc->len && *pc->p != '}') {
            if (*pc->p == '\n') {
                pc->linenr++;
            }
            pc->p++;
            pc->len--;
        }
        pc->tend = pc->p - 1;
        if (pc->len) {
            pc->p++;
            pc->len--;
        }
    }
    else {
        while (1) {

            if (pc->p[0] == ':' && pc->p[1] == ':') {
                while (*pc->p == ':') {
                    pc->p++;
                    pc->len--;
                }
                continue;
            }
            if (isalnum(UCHAR(*pc->p)) || *pc->p == '_' || UCHAR(*pc->p) >= 0x80) {
                pc->p++;
                pc->len--;
                continue;
            }
            break;
        }

        if (*pc->p == '(') {
            int count = 1;
            const char *paren = NULL;

            pc->tt = JIM_TT_DICTSUGAR;

            while (count && pc->len) {
                pc->p++;
                pc->len--;
                if (*pc->p == '\\' && pc->len >= 1) {
                    pc->p++;
                    pc->len--;
                }
                else if (*pc->p == '(') {
                    count++;
                }
                else if (*pc->p == ')') {
                    paren = pc->p;
                    count--;
                }
            }
            if (count == 0) {
                pc->p++;
                pc->len--;
            }
            else if (paren) {

                paren++;
                pc->len += (pc->p - paren);
                pc->p = paren;
            }
#ifndef EXPRSUGAR_BRACKET
            if (*pc->tstart == '(') {
                pc->tt = JIM_TT_EXPRSUGAR;
            }
#endif
        }
        pc->tend = pc->p - 1;
    }
    if (pc->tstart == pc->p) {
        pc->p--;
        pc->len++;
        return JIM_ERR;
    }
    return JIM_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
leaq 0x1(%rax), %r14
movq %r14, (%rdi)
movl 0x8(%rdi), %edi
leal -0x1(%rdi), %r15d
movl %r15d, 0x8(%rbx)
movq %r14, 0x10(%rbx)
movl $0x3, 0x24(%rbx)
movl 0xc(%rbx), %ecx
movl %ecx, 0x20(%rbx)
movb 0x1(%rax), %r13b
cmpb $0x7b, %r13b
jne 0x17e83
leaq 0x2(%rax), %r14
movq %r14, (%rbx)
movq %r14, 0x10(%rbx)
movl %edi, %edx
movq %r14, %r12
addl $-0x2, %edx
movl %edx, 0x8(%rbx)
je 0x17e72
addl $-0x3, %edi
movl %edx, %esi
xorl %edx, %edx
movl %edi, %r15d
movzbl 0x2(%rax,%rdx), %edi
cmpl $0xa, %edi
je 0x17e4c
cmpl $0x7d, %edi
jne 0x17e51
jmp 0x17f83
incl %ecx
movl %ecx, 0xc(%rbx)
leaq (%rax,%rdx), %rdi
addq $0x3, %rdi
movq %rdi, (%rbx)
movl %r15d, 0x8(%rbx)
incq %rdx
decl %r15d
cmpl %edx, %esi
jne 0x17e38
leaq (%rax,%rdx), %r12
addq $0x2, %r12
leaq -0x1(%r12), %rax
movq %rax, 0x18(%rbx)
xorl %r15d, %r15d
jmp 0x17fb8
movq %r14, %r12
cmpb $0x3a, %r13b
jne 0x17eb2
cmpb $0x3a, 0x1(%r12)
jne 0x17eb2
incq %r12
movq %r12, (%rbx)
decl %r15d
movl %r15d, 0x8(%rbx)
cmpb $0x3a, (%r12)
leaq 0x1(%r12), %r12
je 0x17e97
decq %r12
jmp 0x17edf
callq 0x64e0
testb %r13b, %r13b
js 0x17ed2
cmpb $0x5f, %r13b
je 0x17ed2
movq (%rax), %rax
movzbl %r13b, %ecx
movzwl (%rax,%rcx,2), %eax
andl $0x8, %eax
je 0x17ee5
incq %r12
movq %r12, (%rbx)
decl %r15d
movl %r15d, 0x8(%rbx)
movb (%r12), %r13b
jmp 0x17e86
cmpb $0x28, %r13b
jne 0x17faf
movl $0x4, 0x24(%rbx)
movl $0x1, %ecx
xorl %eax, %eax
testl %r15d, %r15d
je 0x17f69
leaq 0x1(%r12), %rdx
movq %rdx, (%rbx)
leal -0x1(%r15), %esi
movl %esi, 0x8(%rbx)
movb 0x1(%r12), %dil
cmpl $0x2, %r15d
jl 0x17f33
cmpb $0x5c, %dil
jne 0x17f33
addq $0x2, %r12
movq %r12, (%rbx)
addl $-0x2, %r15d
movl %r15d, 0x8(%rbx)
jmp 0x17f56
movzbl %dil, %edi
cmpl $0x29, %edi
je 0x17f4b
cmpl $0x28, %edi
jne 0x17f43
incl %ecx
movq %rdx, %r12
movl %esi, %r15d
jmp 0x17f56
decl %ecx
movq %rdx, %r12
movl %esi, %r15d
movq %rdx, %rax
testl %ecx, %ecx
jne 0x17efd
incq %r12
movq %r12, (%rbx)
decl %r15d
movl %r15d, 0x8(%rbx)
jmp 0x17fa2
testq %rax, %rax
je 0x17f9f
incq %rax
subl %eax, %r12d
movl %r12d, 0x8(%rbx)
movq %rax, (%rbx)
movl %r12d, %r15d
movq %rax, %r12
jmp 0x17fa2
leaq (%rax,%rdx), %rcx
incq %rcx
movq %rcx, 0x18(%rbx)
leaq (%rax,%rdx), %r12
addq $0x3, %r12
movq %r12, (%rbx)
movl %r15d, 0x8(%rbx)
jmp 0x17fb8
xorl %r15d, %r15d
cmpb $0x28, (%r14)
jne 0x17faf
movl $0x11, 0x24(%rbx)
leaq -0x1(%r12), %rax
movq %rax, 0x18(%rbx)
xorl %eax, %eax
cmpq %r12, %r14
jne 0x17fd1
decq %r12
movq %r12, (%rbx)
incl %r15d
movl %r15d, 0x8(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq