// File: /workspace/github_c_makefile_star2_O2/JimKent[P]linearSat/lib/kxTok.c
// Function: kxTokenizeFancy
struct kxTok *kxTokenizeFancy(char *text, boolean wildAst,
			      boolean wildPercent, boolean includeHyphen)
/* Convert text to stream of tokens. If 'wildAst' is
 * TRUE then '*' character will be treated as wildcard
 * rather than multiplication sign.  
 * If wildPercent is TRUE then the '%' character will be treated as a 
 * wildcard (as in SQL) rather than a modulo (kxtMod) or percent sign.
 * If includeHyphen is TRUE then a '-' character in the middle of a String 
 * token will be treated as a hyphen (part of the String token) instead of 
 * a new kxtSub token. */
{
struct kxTok *tokList = NULL, *tok;
char c, *s, *start = NULL, *end = NULL;
enum kxTokType type = 0;
boolean spaceBefore = FALSE;

s = text;
for (;;)
    {
    if ((c = *s) == 0)
        break;
    start = s++;
    if (isspace(c))
        {
	spaceBefore = TRUE;
        continue;
        }
    else if (isalnum(c) || c == '?' || (wildAst && c == '*') ||
	     (wildPercent && c == '%'))
        {
        if (c == '?')
            type = kxtWildString;
	else if (wildAst && c == '*')
            type = kxtWildString;
	else if (wildPercent && c == '%')
            type = kxtWildString;
        else
            type = kxtString;
        for (;;)
            {
            c = *s;
            if (isalnum(c) || c == ':' || c == '_' || c == '.' ||
		(includeHyphen && c == '-'))
                ++s;
            else if (c == '?' || (wildAst && c == '*') ||
		     (wildPercent && c == '%'))
                {
                type = kxtWildString;
                ++s;
                }
            else
                break;
            }
        end = s;
        }
    else if (c == '"')
        {
        type = kxtString;
        if (! includeQuotes)
	    start = s;
        for (;;)
            {
            c = *s++;
            if (c == '"')
                break;
            if (c == '*' || c == '?' || (wildPercent && c == '%'))
                type = kxtWildString;
            }
	if (! includeQuotes)
	    end = s-1;
	else
	    end = s;
        }
    else if (c == '\'')
        {
        type = kxtString;
        if (! includeQuotes)
	    start = s;
        for (;;)
            {
            c = *s++;
            if (c == '\'')
                break;
            if (c == '*' || c == '?' || (wildPercent && c == '%'))
                type = kxtWildString;
            }
	if (! includeQuotes)
	    end = s-1;
	else
	    end = s;
        } 
    else if (c == '=')
        {
        type = kxtEquals;
        end = s;
        }
    else if (c == '&')
        {
        type = kxtAnd;
        end = s;
        }
    else if (c == '|')
        {
        type = kxtOr;
        end = s;
        }
    else if (c == '^')
        {
        type = kxtXor;
        end = s;
        }
    else if (c == '+')
        {
	type = kxtAdd;
	end = s;
	}
    else if (c == '-')
        {
	type = kxtSub;
	end = s;
	}
    else if (c == '*')
        {
	type = kxtMul;
	end = s;
	}
    else if (c == '/')
        {
	type = kxtDiv;
	end = s;
	}
    else if (c == '(')
        {
        type = kxtOpenParen;
        end = s;
        }
    else if (c == ')')
        {
        type = kxtCloseParen;
        end = s;
        }
    else if (c == '!')
        {
        type = kxtNot;
        end = s;
        }
    else if (c == '>')
        {
        if (*s == '=')
            {
            ++s;
            type = kxtGE;
            }
        else
            type = kxtGT;
        end = s;
        }
    else if (c == '<')
        {
        if (*s == '=')
            {
            ++s;
            type = kxtLE;
            }
        else
            type = kxtLT;
        end = s;
        }
    else if (c == '.')
        {
        type = kxtDot;
        end = s;
	}
    else if (c == '%')
        {
        type = kxtMod;
        end = s;
	}
    else if (ispunct(c))
        {
        type = kxtPunct;
        end = s;
	}
    else
        {
        errAbort("Unrecognized character %c", c);
        }
    tok = kxTokNew(type, start, end-start, spaceBefore);
    slAddHead(&tokList, tok);
    spaceBefore = FALSE;
    }
tok = kxTokNew(kxtEnd, "end", 3, spaceBefore);
slAddHead(&tokList, tok);
slReverse(&tokList);
return tokList;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebx
movl %edx, 0x10(%rsp)
movl %esi, 0x14(%rsp)
andq $0x0, 0x20(%rsp)
movq %rdi, %r15
movabsq $0x2000000001001, %rbp  # imm = 0x2000000001001
movq $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r12d, %r12d
xorl %edx, %edx
movl %edx, %r13d
movsbq (%r15), %r14
testq %r14, %r14
je 0x14961
incq %r15
callq 0x37a0
movq (%rax), %rax
movzwl (%rax,%r14,2), %ecx
btl $0xd, %ecx
pushq $0x1
popq %rdx
jb 0x1463a
movzbl %r14b, %edx
cmpl $0x0, 0x14(%rsp)
setne %dil
cmpb $0x2a, %r14b
sete %sil
andb %dil, %sil
leaq -0x1(%r15), %r8
cmpb $0x3f, %r14b
je 0x1470f
movl %ecx, %edi
andl $0x8, %edi
jne 0x1470f
pushq $0x2
popq %rdi
testb %sil, %sil
movl 0x10(%rsp), %r10d
jne 0x14736
testl %r10d, %r10d
je 0x146ac
cmpb $0x25, %r14b
je 0x14723
leal -0x22(%rdx), %eax
cmpl $0xb, %eax
ja 0x147e3
leaq 0x5d91(%rip), %rsi      # 0x1a450
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
movl 0x22e4a(%rip), %eax     # 0x37518
movq %r15, %rdi
pushq $0x1
popq %r12
pushq $0x2
popq %rsi
movq 0x8(%rsp), %r14
movq %rdi, %rdx
movq %rdx, %rdi
movzbl (%rdx), %ecx
cmpl $0x22, %ecx
je 0x1486c
cmpl $0x2a, %ecx
je 0x14707
cmpl $0x3f, %ecx
je 0x14707
leaq 0x1(%rdi), %rdx
testl %r10d, %r10d
je 0x146e0
cmpb $0x25, %cl
jne 0x146e0
incq %rdi
movl %esi, %r12d
jmp 0x146dd
cmpb $0x3f, %r14b
sete %cl
orb %sil, %cl
pushq $0x2
popq %rdi
movl 0x10(%rsp), %r10d
jne 0x14736
testl %r10d, %r10d
setne %cl
cmpl $0x25, %edx
sete %dl
andb %cl, %dl
movzbl %dl, %edi
incl %edi
movq %r8, 0x18(%rsp)
movl %edi, %r12d
movl 0x14(%rsp), %r11d
pushq $0x2
popq %r14
movsbq (%r15), %rdx
movzwl (%rax,%rdx,2), %ecx
testb $0x8, %cl
jne 0x14765
movzbl %dl, %ecx
leal -0x2e(%rcx), %esi
cmpl $0x31, %esi
ja 0x14770
btq %rsi, %rbp
jae 0x14770
movl %r12d, %esi
incq %r15
movl %esi, %r12d
jmp 0x14747
testl %ebx, %ebx
je 0x14779
cmpb $0x2d, %dl
je 0x14765
testl %r10d, %r10d
setne %dl
testl %r11d, %r11d
setne %r8b
cmpl $0x2a, %ecx
sete %r9b
cmpl $0x25, %ecx
sete %dil
movl %r14d, %esi
cmpl $0x3f, %ecx
je 0x14768
movl %r14d, %esi
andb %r9b, %r8b
jne 0x14768
movl %r14d, %esi
andb %dil, %dl
jne 0x14768
movq %r15, %rdi
movq 0x8(%rsp), %r14
movq 0x18(%rsp), %r8
movq %rdi, 0x18(%rsp)
movl %edi, %edx
subl %r8d, %edx
movl %r12d, %edi
movq %r8, %rsi
movl %r13d, %ecx
callq 0x149a5
movq %r14, (%rax)
movq %rax, 0x20(%rsp)
movq %rax, 0x8(%rsp)
jmp 0x14638
cmpl $0x7c, %edx
je 0x14886
cmpl $0x5e, %edx
je 0x1487f
cmpl $0x3d, %edx
jne 0x14804
movq %r15, %rdi
pushq $0x3
jmp 0x1488b
cmpl $0x2a, %edx
jne 0x14897
movq %r15, %rdi
pushq $0x11
jmp 0x1488b
movq %r15, %rdi
pushq $0xe
jmp 0x1488b
movq %r15, %rdi
pushq $0x8
jmp 0x1488b
movq %r15, %rdi
pushq $0xf
jmp 0x1488b
movl 0x22ce9(%rip), %eax     # 0x37518
movq %r15, %rdi
pushq $0x1
popq %r12
pushq $0x2
popq %rsi
movq 0x8(%rsp), %r14
movq %rdi, %rdx
movq %rdx, %rdi
movzbl (%rdx), %ecx
cmpl $0x27, %ecx
je 0x1486c
cmpl $0x2a, %ecx
je 0x14864
cmpl $0x3f, %ecx
je 0x14864
leaq 0x1(%rdi), %rdx
testl %r10d, %r10d
je 0x14841
cmpb $0x25, %cl
jne 0x14841
incq %rdi
movl %esi, %r12d
jmp 0x1483e
testl %eax, %eax
cmoveq %r15, %r8
leaq 0x1(%rdi), %r15
cmovneq %r15, %rdi
jmp 0x147b9
movq %r15, %rdi
pushq $0xa
jmp 0x1488b
movq %r15, %rdi
pushq $0x9
popq %r12
movq 0x8(%rsp), %r14
jmp 0x147b9
movzbl %r14b, %eax
leal -0x28(%rax), %esi
cmpl $0x7, %esi
ja 0x148ba
leaq 0x5bd6(%rip), %rdi      # 0x1a480
movslq (%rdi,%rsi,4), %rax
addq %rdi, %rax
jmpq *%rax
movq %r15, %rdi
pushq $0xc
jmp 0x1488b
cmpl $0x21, %eax
je 0x14922
cmpl $0x3c, %eax
je 0x14903
cmpl $0x3e, %eax
jne 0x148e2
leaq 0x1(%r15), %rax
xorl %r12d, %r12d
cmpb $0x3d, (%r15)
sete %r12b
cmoveq %rax, %r15
orl $0x4, %r12d
jmp 0x1491a
cmpl $0x25, %edx
jne 0x1492c
movq %r15, %rdi
pushq $0x13
jmp 0x1488b
movq %r15, %rdi
pushq $0xd
jmp 0x1488b
movq %r15, %rdi
pushq $0x10
jmp 0x1488b
movq %r15, %rdi
pushq $0x12
jmp 0x1488b
leaq 0x1(%r15), %rax
xorl %r12d, %r12d
cmpb $0x3d, (%r15)
sete %r12b
cmoveq %rax, %r15
orl $0x6, %r12d
movq %r15, %rdi
jmp 0x1488d
movq %r15, %rdi
pushq $0xb
jmp 0x1488b
testb $0x4, %cl
jne 0x14957
leaq 0x5b68(%rip), %rdi      # 0x1a4a0
movl %r14d, %esi
xorl %eax, %eax
movq %r8, %r14
callq 0xa61f
movq %r14, %r8
movq 0x8(%rsp), %r14
movq 0x18(%rsp), %rdi
jmp 0x147b9
movq %r15, %rdi
pushq $0x14
jmp 0x1488b
pushq $0x13
popq %rdi
callq 0xd87c
andl $0x0, 0x8(%rax)
movb %r13b, 0xc(%rax)
movw $0x6e65, 0xd(%rax)      # imm = 0x6E65
movb $0x64, 0xf(%rax)
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x20(%rsp), %rbx
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x613f
movq (%rbx), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq