// File: mikeakohn[P]drumsplusplus/build/../src/Song.cxx
// Function: Song::parse(Tokens*)
int Song::parse(Tokens *tokens)
{
  int token_type;
  char token[1024];

#ifndef WINDOWS
  signal_catch(0);
  play_timer.it_value.tv_sec = 0;
  play_timer.it_value.tv_usec = 0;
#endif

  while(1)
  {
    token_type = tokens->get(token);

    if (token_type == -1) { break; }

    if (strcmp(token, "set") == 0)
    {
      if (parse_set(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "define") == 0)
    {
      if (parse_define(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "include") == 0)
    {
      if (parse_include(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "pattern") == 0)
    {
      if (parse_pattern(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "section") == 0)
    {
      if (parse_section(tokens) == -1) { return -1; }
    }
      else
    if (strcmp(token, "song") == 0)
    {
      if (parse_song(tokens) == -1) { return -1; }
    }
      else
    {
      printf("Error: Unknown token '%s' at %s:%d.\n",
        token, tokens->get_filename(), tokens->get_line());
      return -1;
    }
  }

#ifdef WINDOWS
  Sleep(1000);
#endif

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x440, %rsp            # imm = 0x440
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x428(%rbp)
xorl %edi, %edi
callq 0x5530
movq -0x428(%rbp), %rax
movq $0x0, 0x118(%rax)
movq $0x0, 0x120(%rax)
movq -0x18(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x2b10
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
jne 0x5350
jmp 0x551b
leaq -0x420(%rbp), %rdi
leaq 0xb451(%rip), %rsi      # 0x107af
callq 0x2320
cmpl $0x0, %eax
jne 0x538e
movq -0x428(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5560
cmpl $-0x1, %eax
jne 0x5389
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5522
jmp 0x5516
leaq -0x420(%rbp), %rdi
leaq 0xafe8(%rip), %rsi      # 0x10384
callq 0x2320
cmpl $0x0, %eax
jne 0x53cc
movq -0x428(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5a40
cmpl $-0x1, %eax
jne 0x53c7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5522
jmp 0x5514
leaq -0x420(%rbp), %rdi
leaq 0xafb1(%rip), %rsi      # 0x1038b
callq 0x2320
cmpl $0x0, %eax
jne 0x540a
movq -0x428(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5ce0
cmpl $-0x1, %eax
jne 0x5405
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5522
jmp 0x5512
leaq -0x420(%rbp), %rdi
leaq 0xaf7b(%rip), %rsi      # 0x10393
callq 0x2320
cmpl $0x0, %eax
jne 0x5448
movq -0x428(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5f40
cmpl $-0x1, %eax
jne 0x5443
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5522
jmp 0x5510
leaq -0x420(%rbp), %rdi
leaq 0xaf45(%rip), %rsi      # 0x1039b
callq 0x2320
cmpl $0x0, %eax
jne 0x5486
movq -0x428(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x6f40
cmpl $-0x1, %eax
jne 0x5481
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5522
jmp 0x550e
leaq -0x420(%rbp), %rdi
leaq 0xaf0f(%rip), %rsi      # 0x103a3
callq 0x2320
cmpl $0x0, %eax
jne 0x54be
movq -0x428(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7530
cmpl $-0x1, %eax
jne 0x54bc
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5522
jmp 0x550c
leaq -0x420(%rbp), %rax
movq %rax, -0x438(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2f40
movq %rax, -0x430(%rbp)
movq -0x18(%rbp), %rdi
callq 0x89f0
movq -0x438(%rbp), %rsi
movq -0x430(%rbp), %rdx
movl %eax, %ecx
leaq 0xaeac(%rip), %rdi      # 0x103a8
movb $0x0, %al
callq 0x2060
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5522
jmp 0x550e
jmp 0x5510
jmp 0x5512
jmp 0x5514
jmp 0x5516
jmp 0x5332
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x440, %rsp            # imm = 0x440
popq %rbp
retq
nop