// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x2b58
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x20c0
movl %eax, -0x20(%rbp)
jmp 0x2b69
movq -0x30(%rbp), %rax
movl 0x28(%rax), %ecx
movl %ecx, -0x20(%rbp)
movl $0x0, 0x28(%rax)
cmpl $-0x1, -0x20(%rbp)
jne 0x2b74
jmp 0x2ecd
cmpl $0x20, -0x20(%rbp)
je 0x2b8c
cmpl $0x9, -0x20(%rbp)
je 0x2b8c
cmpl $0xa, -0x20(%rbp)
je 0x2b8c
cmpl $0xd, -0x20(%rbp)
jne 0x2bdc
cmpl $0xd, -0x20(%rbp)
je 0x2b98
cmpl $0xa, -0x20(%rbp)
jne 0x2ba5
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
cmpl $0xd, -0x20(%rbp)
jne 0x2bcc
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x20c0
movl %eax, -0x20(%rbp)
cmpl $0xa, -0x20(%rbp)
je 0x2bca
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, 0x28(%rax)
jmp 0x2bcc
cmpl $0x0, -0x1c(%rbp)
je 0x2bd7
jmp 0x2ecd
jmp 0x2b3d
movl -0x20(%rbp), %edi
callq 0x2350
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x2dd7
cmpl $0x2f, -0x20(%rbp)
jne 0x2cf5
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x20c0
movl %eax, -0x20(%rbp)
cmpl $0x2f, -0x20(%rbp)
jne 0x2c70
jmp 0x2c12
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x20c0
movl %eax, -0x20(%rbp)
cmpl $0xa, -0x20(%rbp)
je 0x2c33
cmpl $0xd, -0x20(%rbp)
je 0x2c33
cmpl $-0x1, -0x20(%rbp)
jne 0x2c35
jmp 0x2c37
jmp 0x2c12
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x2c(%rax)
cmpl $0xd, -0x20(%rbp)
jne 0x2c6b
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x20c0
movl %eax, -0x20(%rbp)
cmpl $0xa, -0x20(%rbp)
je 0x2c69
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, 0x28(%rax)
jmp 0x2c6b
jmp 0x2b3d
cmpl $0x2a, -0x20(%rbp)
jne 0x2cc9
jmp 0x2c78
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x20c0
movl %eax, -0x20(%rbp)
cmpl $-0x1, -0x20(%rbp)
jne 0x2c99
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2f32
cmpl $0x2a, -0x20(%rbp)
jne 0x2cc2
jmp 0x2ca1
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x20c0
movl %eax, -0x20(%rbp)
cmpl $0x2f, -0x20(%rbp)
jne 0x2cb8
jmp 0x2cc4
cmpl $0x2a, -0x20(%rbp)
jne 0x2cc0
jmp 0x2ca1
jmp 0x2cc2
jmp 0x2c78
jmp 0x2b3d
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, 0x28(%rax)
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movb $0x2f, (%rax,%rcx)
movl $0x3, -0x1c(%rbp)
jmp 0x2ecd
cmpl $0x61, -0x20(%rbp)
jl 0x2d27
cmpl $0x7a, -0x20(%rbp)
jg 0x2d27
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x1, -0x1c(%rbp)
jmp 0x2dd0
cmpl $0x30, -0x20(%rbp)
jl 0x2d56
cmpl $0x39, -0x20(%rbp)
jg 0x2d56
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x2, -0x1c(%rbp)
jmp 0x2dce
cmpl $0x2e, -0x20(%rbp)
jne 0x2d95
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movb $0x30, (%rax,%rcx)
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x2, -0x1c(%rbp)
jmp 0x2dcc
cmpl $0x22, -0x20(%rbp)
jne 0x2da4
movl $0x4, -0x1c(%rbp)
jmp 0x2dca
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl $0x3, -0x1c(%rbp)
jmp 0x2ecd
jmp 0x2dcc
jmp 0x2dce
jmp 0x2dd0
jmp 0x2dd2
jmp 0x2ec8
cmpl $0x1, -0x1c(%rbp)
jne 0x2e2b
cmpl $0x61, -0x20(%rbp)
jl 0x2de9
cmpl $0x7a, -0x20(%rbp)
jle 0x2dfb
cmpl $0x30, -0x20(%rbp)
jl 0x2df5
cmpl $0x39, -0x20(%rbp)
jle 0x2dfb
cmpl $0x5f, -0x20(%rbp)
jne 0x2e17
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x2e26
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, 0x28(%rax)
jmp 0x2ecd
jmp 0x2ec6
cmpl $0x2, -0x1c(%rbp)
jne 0x2e9a
cmpl $0x30, -0x20(%rbp)
jl 0x2e59
cmpl $0x39, -0x20(%rbp)
jg 0x2e59
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x2e98
cmpl $0x2e, -0x20(%rbp)
jne 0x2e8a
cmpl $0x0, -0x28(%rbp)
jne 0x2e8a
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2e96
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, 0x28(%rax)
jmp 0x2ecd
jmp 0x2e98
jmp 0x2ec4
cmpl $0x4, -0x1c(%rbp)
jne 0x2ec2
cmpl $0x22, -0x20(%rbp)
jne 0x2ea8
jmp 0x2ecd
movl -0x20(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x24(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x2ec4
jmp 0x2ec6
jmp 0x2ec8
jmp 0x2b3d
cmpl $0x4, -0x1c(%rbp)
jne 0x2f11
cmpl $0x22, -0x20(%rbp)
je 0x2f11
movq -0x30(%rbp), %rdi
callq 0x2f40
movq %rax, %rsi
leaq 0xd2d7(%rip), %rdi      # 0x101c3
movb $0x0, %al
callq 0x2060
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %esi
leaq 0xd2d2(%rip), %rdi      # 0x101d3
movb $0x0, %al
callq 0x2060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2f32
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x0, (%rax,%rcx)
cmpl $0x0, -0x24(%rbp)
jne 0x2f2c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2f32
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)