// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]drumsplusplus/build/../src/Tokens.cxx
// Function: Tokens::get(char*)
int Tokens::get(char *token)
{
  int token_type = 0;
  int ch, ptr;
  int dotflag;

  ptr = 0;
  dotflag = 0;

  while (1)
  {
    if (pushback == 0)
    {
      ch=getc(in);
    }
      else
    {
      ch = pushback;
      pushback = 0;
    }
    
    if (ch == EOF) { break; }
    if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')
    {
      if (ch == '\r' || ch == '\n') { line++; }
      if (ch == '\r')
      {
        ch = getc(in);
        if (ch!='\n') { pushback = ch; }
      }

      if (token_type != 0) { break; }
      continue;
    } 

    ch = tolower(ch);

    if (token_type == 0)
    {
      if (ch == '/')
      {
        ch = getc(in);

        if (ch == '/')
        {
          while (1)
          {
            ch = getc(in);
            if (ch == '\n' || ch == '\r' || ch == EOF) { break; }
          }

          line++;

          if (ch == '\r')
          {
            ch = getc(in);
            if (ch != '\n') { pushback = ch; }
          }
          continue;
        }
          else
        if (ch == '*')
        {
          while (1)
          {
            ch = getc(in);

            if (ch == EOF) { return -1; }
            if (ch == '*')
            {
              // FIXME: Get rid of this goto :(
again:
              ch = getc(in);

              if (ch == '/') { break; }
              if (ch == '*') { goto again; }
            }
          }

          continue;
        }
          else
        {
          pushback = ch;
          token[ptr++] = '/';
          token_type = TOKEN_SYMBOL;
          break;
        }
      }
        else
      if (ch >= 'a' && ch <= 'z')
      {
        token[ptr++] = ch;
        token_type = TOKEN_ALPHA;
      }
        else
      if (ch >= '0' && ch <= '9')
      {
        token[ptr++] = ch;
        token_type = TOKEN_NUMBER;
      }
        else
      if (ch == '.')
      {
        token[ptr++] = '0';
        token[ptr++] = ch;
        token_type = TOKEN_NUMBER;
      }
        else
      if (ch == '"')
      {
        token_type = TOKEN_STRING;
      }
        else
      {
        token[ptr++] = ch;
        token_type = TOKEN_SYMBOL;
        break;
      }
    }
      else
    if (token_type == TOKEN_ALPHA)
    {
      if ((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9') || ch == '_')
      {
        token[ptr++] = ch;
      }
        else
      {
        pushback = ch;
        break;
      }
    }
      else
    if (token_type == TOKEN_NUMBER)
    {
      if (ch >= '0' && ch <= '9')
      {
        token[ptr++] = ch;
      }
        else
      if (ch == '.' && dotflag == 0)
      {
        token[ptr++] = ch;
        dotflag++;
      }
        else
      {
        pushback = ch;
        break;
      }
    }
      else
    if (token_type == TOKEN_STRING)
    {
      if (ch == '"') { break; }
      token[ptr++] = ch;
    }
  }

  if (token_type == TOKEN_STRING && ch != '"')
  {
    printf(">> In file: %s\n", get_filename());
    printf("Error: Unterminated string on line %d.\n", line);
    return -1;
  }

  token[ptr] = 0;
  if (ptr == 0) { return -1; }

  return token_type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
xorl %ecx, %ecx
pushq $0xa
popq %r15
leaq 0x4969(%rip), %r13      # 0x71b4
movl $0x4801, %r12d          # imm = 0x4801
xorl %ebp, %ebp
movl $0x0, 0x14(%rsp)
movl %ecx, %ebx
movl 0x28(%r14), %eax
testl %eax, %eax
je 0x286c
andl $0x0, 0x28(%r14)
jmp 0x2874
movq (%r14), %rdi
callq 0x20a0
cmpl $0x9, %eax
je 0x2974
cmpl $0xa, %eax
je 0x2953
cmpl $0xd, %eax
je 0x2953
cmpl $0x20, %eax
je 0x2974
cmpl $-0x1, %eax
je 0x2a68
movl %eax, %edi
callq 0x22b0
cmpl $0x4, %ebx
ja 0x29fd
movl %ebx, %ecx
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
movslq %ebp, %rbx
jmpq *%rcx
cmpl $0x2f, %eax
jne 0x2a05
movq (%r14), %rdi
callq 0x20a0
cmpl $0x2f, %eax
je 0x290a
cmpl $0x2a, %eax
jne 0x2a9b
movq (%r14), %rdi
callq 0x20a0
cmpl $0x2a, %eax
je 0x28f6
cmpl $-0x1, %eax
jne 0x28df
jmp 0x2ac3
movq (%r14), %rdi
callq 0x20a0
cmpl $0x2a, %eax
je 0x28f6
cmpl $0x2f, %eax
jne 0x28df
jmp 0x294c
movq (%r14), %rdi
callq 0x20a0
leal 0x1(%rax), %ecx
cmpl $0xe, %ecx
ja 0x290a
btl %ecx, %r12d
jae 0x290a
incl 0x2c(%r14)
movl $0x0, %ecx
cmpl $0xd, %eax
jne 0x285b
movq (%r14), %rdi
callq 0x20a0
movl $0x0, %ecx
cmpl $0xa, %eax
je 0x285b
movl %eax, 0x28(%r14)
xorl %ecx, %ecx
jmp 0x285b
incl 0x2c(%r14)
cmpl $0xd, %eax
jne 0x2974
movq (%r14), %rdi
callq 0x20a0
movl %eax, %ecx
movl %r15d, %eax
cmpl $0xa, %ecx
je 0x2974
movl %ecx, 0x28(%r14)
movl %ecx, %eax
movl $0x0, %ecx
testl %ebx, %ebx
je 0x285b
jmp 0x2a68
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
jbe 0x2a28
cmpl $0x2e, %eax
jne 0x2ad6
cmpl $0x0, 0x14(%rsp)
jne 0x2ad6
leal 0x1(%rbx), %ebp
movq 0x8(%rsp), %rax
movb $0x2e, (%rax,%rbx)
pushq $0x2
popq %rcx
pushq $0x1
popq %rax
movl %eax, 0x14(%rsp)
jmp 0x285b
cmpl $0x22, %eax
je 0x2ad2
leal 0x1(%rbx), %ebp
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%rbx)
pushq $0x4
popq %rcx
jmp 0x285b
leal -0x61(%rax), %ecx
cmpl $0x1a, %ecx
jb 0x2a0d
leal -0x30(%rax), %ecx
cmpl $0xa, %ecx
setae %cl
cmpl $0x5f, %eax
setne %dl
testb %cl, %dl
je 0x2a0d
jmp 0x2ade
pushq $0x3
popq %rcx
jmp 0x285b
leal -0x61(%rax), %ecx
cmpl $0x19, %ecx
ja 0x2a20
leal 0x1(%rbx), %ebp
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%rbx)
pushq $0x1
popq %rcx
jmp 0x285b
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0x2a3b
leal 0x1(%rbx), %ebp
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%rbx)
pushq $0x2
popq %rcx
jmp 0x285b
pushq $0x4
popq %rcx
cmpl $0x22, %eax
je 0x285b
cmpl $0x2e, %eax
jne 0x2ae6
movq 0x8(%rsp), %rax
movw $0x2e30, (%rax,%rbx)    # imm = 0x2E30
addl $0x2, %ebx
pushq $0x2
popq %rcx
movl %ebx, %ebp
jmp 0x285b
cmpl $0x4, %ebx
jne 0x2aae
cmpl $0x22, %eax
je 0x2aae
movq 0x8(%r14), %rsi
leaq 0x474e(%rip), %rdi      # 0x71cb
xorl %eax, %eax
callq 0x2050
movl 0x2c(%r14), %esi
leaq 0x474c(%rip), %rdi      # 0x71db
xorl %eax, %eax
callq 0x2050
pushq $-0x1
popq %rax
jmp 0x2ac3
movl %eax, 0x28(%r14)
leal 0x1(%rbx), %ebp
movq 0x8(%rsp), %rax
movb $0x2f, (%rax,%rbx)
pushq $0x3
popq %rbx
movslq %ebp, %rcx
movq 0x8(%rsp), %rax
movb $0x0, (%rax,%rcx)
xorl %eax, %eax
cmpl $0x1, %ecx
sbbl %eax, %eax
orl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x4
jmp 0x2aad
movl %eax, 0x28(%r14)
pushq $0x2
jmp 0x2aad
movl %eax, 0x28(%r14)
pushq $0x1
jmp 0x2aad
leal 0x1(%rbx), %ebp
movq 0x8(%rsp), %rcx
movb %al, (%rcx,%rbx)
jmp 0x2aab
nop