// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %ecx, %ecx
movl $0x4801, %r15d          # imm = 0x4801
xorl %ebp, %ebp
xorl %r12d, %r12d
movl %ecx, %r13d
movl 0x28(%rbx), %eax
testl %eax, %eax
je 0x28b1
movl $0x0, 0x28(%rbx)
jmp 0x28b9
movq (%rbx), %rdi
callq 0x20a0
cmpl $0xc, %eax
jg 0x28d2
cmpl $0x9, %eax
je 0x28fd
cmpl $0xa, %eax
je 0x28dc
cmpl $-0x1, %eax
jne 0x290c
jmp 0x2ab0
cmpl $0x20, %eax
je 0x28fd
cmpl $0xd, %eax
jne 0x290c
incl 0x2c(%rbx)
cmpl $0xd, %eax
jne 0x28fd
movq (%rbx), %rdi
callq 0x20a0
movl %eax, %ecx
movl $0xa, %eax
cmpl $0xa, %ecx
je 0x28fd
movl %ecx, 0x28(%rbx)
movl %ecx, %eax
movl $0x0, %ecx
testl %r13d, %r13d
je 0x289e
jmp 0x2ab0
movl %eax, %edi
callq 0x2270
testl %r13d, %r13d
jne 0x29ad
cmpl $0x2f, %eax
jne 0x2a39
movq (%rbx), %rdi
callq 0x20a0
cmpl $0x2f, %eax
je 0x2966
cmpl $0x2a, %eax
jne 0x2a9d
movq (%rbx), %rdi
callq 0x20a0
cmpl $0x2a, %eax
je 0x2952
cmpl $-0x1, %eax
jne 0x293b
jmp 0x2af7
movq (%rbx), %rdi
callq 0x20a0
cmpl $0x2a, %eax
je 0x2952
cmpl $0x2f, %eax
jne 0x293b
jmp 0x29a6
movq (%rbx), %rdi
callq 0x20a0
leal 0x1(%rax), %ecx
cmpl $0xe, %ecx
ja 0x2966
btl %ecx, %r15d
jae 0x2966
incl 0x2c(%rbx)
movl $0x0, %ecx
cmpl $0xd, %eax
jne 0x289e
movq (%rbx), %rdi
callq 0x20a0
movl $0x0, %ecx
cmpl $0xa, %eax
je 0x289e
movl %eax, 0x28(%rbx)
xorl %ecx, %ecx
jmp 0x289e
cmpl $0x1, %r13d
je 0x29db
cmpl $0x2, %r13d
je 0x29fb
cmpl $0x4, %r13d
jne 0x2a2f
cmpl $0x22, %eax
je 0x2b06
movslq %ebp, %rcx
incl %ebp
movb %al, (%r14,%rcx)
movl $0x4, %ecx
jmp 0x289e
leal -0x61(%rax), %ecx
cmpl $0x1a, %ecx
jb 0x2a41
leal -0x30(%rax), %ecx
cmpl $0xa, %ecx
setae %cl
cmpl $0x5f, %eax
setne %dl
testb %cl, %dl
je 0x2a41
jmp 0x2b1e
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
jbe 0x2a5c
cmpl $0x2e, %eax
jne 0x2b13
testl %r12d, %r12d
jne 0x2b13
movslq %ebp, %rax
incl %ebp
movb $0x2e, (%r14,%rax)
movl $0x1, %r12d
movl $0x2, %ecx
jmp 0x289e
movl $0x3, %ecx
jmp 0x289e
leal -0x61(%rax), %ecx
cmpl $0x19, %ecx
ja 0x2a54
movslq %ebp, %rcx
incl %ebp
movb %al, (%r14,%rcx)
movl $0x1, %ecx
jmp 0x289e
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0x2a6f
movslq %ebp, %rcx
incl %ebp
movb %al, (%r14,%rcx)
movl $0x2, %ecx
jmp 0x289e
movl $0x4, %ecx
cmpl $0x22, %eax
je 0x289e
cmpl $0x2e, %eax
jne 0x2b29
movslq %ebp, %rax
movw $0x2e30, (%r14,%rax)    # imm = 0x2E30
addl $0x2, %ebp
movl $0x2, %ecx
jmp 0x289e
movl %eax, 0x28(%rbx)
movslq %ebp, %rcx
incl %ebp
movb $0x2f, (%r14,%rcx)
movl $0x3, %r13d
cmpl $0x4, %r13d
jne 0x2ae5
cmpl $0x22, %eax
je 0x2ae5
movq 0x8(%rbx), %rsi
leaq 0x46f4(%rip), %rdi      # 0x71ba
xorl %eax, %eax
callq 0x2050
movl 0x2c(%rbx), %esi
leaq 0x46f3(%rip), %rdi      # 0x71ca
xorl %eax, %eax
callq 0x2050
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x2af7
movslq %ebp, %rcx
movb $0x0, (%r14,%rcx)
xorl %eax, %eax
cmpl $0x1, %ecx
sbbl %eax, %eax
orl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x22, %eax
movl $0x4, %r13d
jmp 0x2ab0
movl %eax, 0x28(%rbx)
movl $0x2, %r13d
jmp 0x2ab0
movl %eax, 0x28(%rbx)
movl $0x1, %r13d
jmp 0x2ab0
movslq %ebp, %rcx
incl %ebp
movb %al, (%r14,%rcx)
jmp 0x2aaa
nop