// File: /workspace/github_c_makefile_star2_O0/heltilda[P]cicada/cmpile.c
// Function: findToken
ccInt findToken(compiler_type *compiler, linkedlist *tokenStringList, char **scriptStringPtr, ccInt *whichElement,
        ccBool endWithNull, ccBool maybeVariableName)
{
    ccInt loopElement, searchBottom = 1, searchTop = tokenStringList->elementNum;
    ccInt numLanguageOps = compiler->numLanguageOps[(ccInt) **scriptStringPtr], directionToAdjust;
    char *scriptChar, *storedChar, *scriptStringStart = *scriptStringPtr;
    ccBool isWord = ccFalse, comparingLanguageOp = ccTrue, maybeFinishedScriptToken, finishedScriptToken, finishedStoredToken;
    
    if (searchTop == 0)  {  *whichElement = 1;  return ccFalse;  }
    
    
        // loop over all tokens in the current list
    
    *whichElement = 0;
    do  {
        scriptChar = scriptStringStart;
        
        if (searchBottom > numLanguageOps)  {
            if ((comparingLanguageOp) && (*whichElement > 0))  break;       // interpret it as a language op if possible
            comparingLanguageOp = ccFalse;      }
        
        if (comparingLanguageOp)  loopElement = searchBottom;               // first do an enumerative search over all built-in operators,
        else  loopElement = (searchBottom+searchTop)/2;                     // then a binary search over the stored variable names
        
        
            // try to match all of the characters of this particular token
        
        storedChar = ((tokenStringType *) element(tokenStringList, loopElement))->name;
        while (*storedChar != 0)  {
            
            isWord = ccFalse;
            if (*storedChar != ' ')  {
                if ((lettertype(scriptChar) == a_letter) || (lettertype(scriptChar) == a_number))  isWord = ccTrue;
                if (*scriptChar != *storedChar)  break;
                
                nextChar(&scriptChar);
                storedChar++;       }
            
            else  {                         // spaces get special treatment
                if ((*(storedChar+1) == ' ') && (*scriptChar != *storedChar))  break;
                else  {
                    while (*storedChar == ' ')  storedChar++;
                    while ((*scriptChar == ' ') || (*scriptChar == '\t') || (lettertype(scriptChar) == unprintable))  {
                        scriptChar++;
        }   }   }   }
        
        
            // figure out if we have to move up (directionToAdjust = 1), down (directionToAdjust = -1), or if we have a match
        
        if ( ((isWord) && ((lettertype(scriptChar) == a_letter) || (lettertype(scriptChar) == a_number)))
                    || ((endWithNull) && (lettertype(scriptChar) != a_null)) )  {
            finishedScriptToken = maybeFinishedScriptToken = ccFalse;       }
        else  {
            finishedScriptToken = (!comparingLanguageOp);
            maybeFinishedScriptToken = ccTrue;            }
        finishedStoredToken = (*storedChar == 0);
        
        if ((maybeFinishedScriptToken) && (finishedStoredToken))  directionToAdjust = 0;
        else if (finishedScriptToken)  directionToAdjust = -1;
        else if (finishedStoredToken) directionToAdjust = 1;
        else  {
            while (lettertype(storedChar) == a_space)  nextChar(&storedChar);       // operator spaces confuse the alphabetization
            while (lettertype(scriptChar) == a_space)  scriptChar++;
            
            if (*scriptChar < *storedChar)  directionToAdjust = -1;
            else  directionToAdjust = 1;            }
        
        
            // adjust searchBottom/searchTop accordingly
        
        if (directionToAdjust == -1)  {
            if (!comparingLanguageOp)  searchTop = loopElement-1;
            else if ((!maybeVariableName) || (!(*whichElement == 0)))  break;
            else  searchBottom = numLanguageOps+1;      }
        
        else if (directionToAdjust == 0)  {
            *whichElement = loopElement;
            *scriptStringPtr = scriptChar;
            if (!comparingLanguageOp)  break;
            else  searchBottom++;           }
        
        else  searchBottom = loopElement+1;
        
    }  while (searchBottom <= searchTop);
    
    
        // if the string wasn't found, return the position where a new entry can be inserted
    
    if (*whichElement == 0)  {
        *whichElement = searchBottom;
        return  ccFalse;       }
    
    else  return ccTrue;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl %r8d, -0x7c(%rbp)
movq %rcx, %rax
movl -0x7c(%rbp), %ecx
movq %rax, -0x78(%rbp)
movq %rdx, %rax
movq -0x78(%rbp), %rdx
movq %rax, -0x70(%rbp)
movq %rsi, %rax
movq -0x70(%rbp), %rsi
movq %rax, -0x68(%rbp)
movq %rdi, %r8
movq -0x68(%rbp), %rdi
movb %r9b, %al
movq %r8, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movb %cl, -0x29(%rbp)
movb %al, -0x2a(%rbp)
movl $0x1, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movl 0x1000(%rax,%rcx,4), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movb $0x0, -0x59(%rbp)
movb $0x1, -0x5a(%rbp)
cmpl $0x0, -0x38(%rbp)
jne 0xd089
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd3c9
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jle 0xd0bb
cmpb $0x0, -0x5a(%rbp)
je 0xd0b7
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
jle 0xd0b7
jmp 0xd3a7
movb $0x0, -0x5a(%rbp)
cmpb $0x0, -0x5a(%rbp)
je 0xd0c9
movl -0x34(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0xd0da
movl -0x34(%rbp), %eax
addl -0x38(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x9700
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xd209
movb $0x0, -0x59(%rbp)
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
je 0xd16e
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1c053(%rip), %rax     # 0x29170
cmpl $0x3, (%rax,%rcx,4)
je 0xd139
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1c03d(%rip), %rax     # 0x29170
cmpl $0x4, (%rax,%rcx,4)
jne 0xd13d
movb $0x1, -0x59(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
movq -0x50(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0xd154
jmp 0xd209
leaq -0x48(%rbp), %rdi
callq 0xb6c0
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0xd204
movq -0x50(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x20, %eax
jne 0xd18f
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
movq -0x50(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0xd18f
jmp 0xd209
jmp 0xd191
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0xd1ab
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0xd191
jmp 0xd1ad
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x7d(%rbp)
je 0xd1e9
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x9, %ecx
movb %al, -0x7d(%rbp)
je 0xd1e9
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1bf91(%rip), %rax     # 0x29170
cmpl $0x0, (%rax,%rcx,4)
sete %al
movb %al, -0x7d(%rbp)
movb -0x7d(%rbp), %al
testb $0x1, %al
jne 0xd1f2
jmp 0xd200
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xd1ad
jmp 0xd202
jmp 0xd204
jmp 0xd0ed
cmpb $0x0, -0x59(%rbp)
je 0xd23b
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1bf51(%rip), %rax     # 0x29170
cmpl $0x3, (%rax,%rcx,4)
je 0xd257
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1bf3b(%rip), %rax     # 0x29170
cmpl $0x4, (%rax,%rcx,4)
je 0xd257
cmpb $0x0, -0x29(%rbp)
je 0xd261
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1bf1f(%rip), %rax     # 0x29170
cmpl $0x6, (%rax,%rcx,4)
je 0xd261
movb $0x0, -0x5b(%rbp)
movb $0x0, -0x5c(%rbp)
jmp 0xd273
cmpb $0x0, -0x5a(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x5c(%rbp)
movb $0x1, -0x5b(%rbp)
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, -0x5d(%rbp)
cmpb $0x0, -0x5b(%rbp)
je 0xd29d
cmpb $0x0, -0x5d(%rbp)
je 0xd29d
movl $0x0, -0x40(%rbp)
jmp 0xd32c
cmpb $0x0, -0x5c(%rbp)
je 0xd2ac
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0xd32a
cmpb $0x0, -0x5d(%rbp)
je 0xd2bb
movl $0x1, -0x40(%rbp)
jmp 0xd328
jmp 0xd2bd
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1bea3(%rip), %rax     # 0x29170
cmpl $0x1, (%rax,%rcx,4)
jne 0xd2de
leaq -0x50(%rbp), %rdi
callq 0xb6c0
jmp 0xd2bd
jmp 0xd2e0
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x1be80(%rip), %rax     # 0x29170
cmpl $0x1, (%rax,%rcx,4)
jne 0xd304
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xd2e0
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
movq -0x50(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0xd31f
movl $0xffffffff, -0x40(%rbp) # imm = 0xFFFFFFFF
jmp 0xd326
movl $0x1, -0x40(%rbp)
jmp 0xd328
jmp 0xd32a
jmp 0xd32c
cmpl $-0x1, -0x40(%rbp)
jne 0xd361
cmpb $0x0, -0x5a(%rbp)
jne 0xd343
movl -0x30(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xd35f
cmpb $0x0, -0x2a(%rbp)
je 0xd352
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xd354
jmp 0xd3a7
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd35f
jmp 0xd399
cmpl $0x0, -0x40(%rbp)
jne 0xd38e
movl -0x30(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpb $0x0, -0x5a(%rbp)
jne 0xd383
jmp 0xd3a7
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd397
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd399
jmp 0xd39b
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jle 0xd093
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xd3c2
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xd3c9
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)