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

  tokens_include = new Tokens();

  token_type = tokens->get(token);

  if (token_type != TOKEN_STRING)
  {
    print_error(tokens, "filename", token);
    return -1;
  }

  filename[0] = 0;

  if (token[0] != '/')
  {
    strcpy(lastfilename, tokens->get_filename());

    if (dirname_m(lastfilename) != 0)
    {
      strcpy(filename, lastfilename);
      strcat(filename, "/");
    }
  }

  strcat(filename, token);

  if (tokens_include->open(filename) != 0)
  {
    printf("Error: included file not found: %s at %s:%d.\n",
      filename, tokens->get_filename(), tokens->get_line());

    delete tokens_include;

    return -1;
  }
    else
  {
    if (parse(tokens_include) == -1) { return -1; }
  }

  tokens_include->close();
  delete tokens_include;

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc70, %rsp            # imm = 0xC70
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc48(%rbp)
movl $0x30, %edi
callq 0x2220
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xc40(%rbp)
callq 0x2a10
jmp 0x5d1c
movq -0xc40(%rbp), %rax
movq %rax, -0xc28(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x2b10
movl %eax, -0x1c(%rbp)
cmpl $0x4, -0x1c(%rbp)
je 0x5d95
movq -0xc48(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x420(%rbp), %rcx
leaq 0xa87e(%rip), %rdx      # 0x105da
callq 0x7e10
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5f20
movq -0xc40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc30(%rbp)
movl %eax, -0xc34(%rbp)
movl $0x30, %esi
callq 0x2230
jmp 0x5f2c
movb $0x0, -0x820(%rbp)
movsbl -0x420(%rbp), %eax
cmpl $0x2f, %eax
je 0x5e0f
leaq -0xc20(%rbp), %rax
movq %rax, -0xc50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2f40
movq -0xc50(%rbp), %rdi
movq %rax, %rsi
callq 0x21f0
movq -0xc48(%rbp), %rdi
leaq -0xc20(%rbp), %rsi
callq 0x7e80
cmpq $0x0, %rax
je 0x5e0d
leaq -0x820(%rbp), %rdi
leaq -0xc20(%rbp), %rsi
callq 0x21f0
leaq -0x820(%rbp), %rdi
leaq 0xa6d2(%rip), %rsi      # 0x104da
callq 0x23e0
jmp 0x5e0f
leaq -0x820(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x23e0
movq -0xc28(%rbp), %rdi
leaq -0x820(%rbp), %rsi
callq 0x2a70
cmpl $0x0, %eax
je 0x5eb9
leaq -0x820(%rbp), %rax
movq %rax, -0xc68(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2f40
movq %rax, -0xc60(%rbp)
movq -0x18(%rbp), %rdi
callq 0x89f0
movq -0xc68(%rbp), %rsi
movq -0xc60(%rbp), %rdx
movl %eax, %ecx
leaq 0xa76b(%rip), %rdi      # 0x105e3
movb $0x0, %al
callq 0x2060
movq -0xc28(%rbp), %rax
movq %rax, -0xc58(%rbp)
cmpq $0x0, %rax
je 0x5eb0
movq -0xc58(%rbp), %rdi
callq 0x2a50
movq -0xc58(%rbp), %rdi
movl $0x30, %esi
callq 0x2230
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5f20
movq -0xc48(%rbp), %rdi
movq -0xc28(%rbp), %rsi
callq 0x52f0
cmpl $-0x1, %eax
jne 0x5eda
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5f20
jmp 0x5edc
movq -0xc28(%rbp), %rdi
callq 0x2ae0
movq -0xc28(%rbp), %rax
movq %rax, -0xc70(%rbp)
cmpq $0x0, %rax
je 0x5f19
movq -0xc70(%rbp), %rdi
callq 0x2a50
movq -0xc70(%rbp), %rdi
movl $0x30, %esi
callq 0x2230
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc70, %rsp            # imm = 0xC70
popq %rbp
retq
movq -0xc30(%rbp), %rdi
callq 0x23c0
nopl (%rax,%rax)