// File: joao18araujo[P]pierluigi/src/main.cpp
// Function: main
int main(int argc, char *argv[]){

  if(argc < 4){
    cerr << "Missing parameters: prog input species ascendant" << endl;
    return -1;
  }

  string input_path(argv[1]);
  string simple_input_path = "public/simple_input.ly";
  int species = atoi(argv[2]);
  bool ascendant = (string(argv[3]) == "true");
  printf("[%s] [%d] [%d]\n", input_path.c_str(), species, ascendant);

  LyParser::convert_file_to_simple_format(input_path, simple_input_path);
  Song song = LyParser::read_file(simple_input_path);

  Song counterpoint, second_counterpoint, third_counterpoint, fourth_counterpoint;
  switch (species) {
    case 1:
      cout << "\nGenerating first species counterpoint...\n";
      counterpoint = FirstSpeciesCounterpoint::dfs_generate_counterpoint(song, ascendant, 4, song.size());
    break;

    case 2:
      cout << "\nGenerating second species counterpoint...\n";
      counterpoint = SecondSpeciesCounterpoint::dfs_generate_counterpoint(song, ascendant, 4, song.size() * 2);
    break;

    case 3:
      cout << "\nGenerating third species counterpoint...\n";
      counterpoint = ThirdSpeciesCounterpoint::dfs_generate_counterpoint(song, ascendant, 4, song.size() * 4);
    break;

    case 4:
      cout << "\nGenerating fourth species counterpoint...\n";
      counterpoint = FourthSpeciesCounterpoint::dfs_generate_counterpoint(song, ascendant, 4, song.size() * 2);
    break;

    default:
      cout << "\nGenerating counterpoints...\n";
      counterpoint = FirstSpeciesCounterpoint::dfs_generate_counterpoint(song, ascendant, 4, song.size());
      second_counterpoint = SecondSpeciesCounterpoint::dfs_generate_counterpoint(song, ascendant, 4, song.size() * 2);
      third_counterpoint = ThirdSpeciesCounterpoint::dfs_generate_counterpoint(song, ascendant, 4, song.size() * 4);
      fourth_counterpoint = FourthSpeciesCounterpoint::dfs_generate_counterpoint(song, ascendant, 4, song.size() * 2);
    break;
  }

  if(counterpoint.size())
    LyParser::add_counterpoint_to_lilypond(counterpoint, input_path, "public/counterpoint.ly");

  if(second_counterpoint.size())
    LyParser::add_counterpoint_to_lilypond(second_counterpoint, input_path, "public/counterpoint_2.ly");

  if(third_counterpoint.size())
    LyParser::add_counterpoint_to_lilypond(third_counterpoint, input_path, "public/counterpoint_3.ly");

  if(fourth_counterpoint.size())
    LyParser::add_counterpoint_to_lilypond(fourth_counterpoint, input_path, "public/counterpoint_4.ly");


  if(counterpoint.size() == 0){
    cout << "Couldn't generate counterpoint\n";
    return -2;
  }

  int size = min(song.size(), counterpoint.size());
  for(int i = 0; i < size; ++i){
    Interval in(song.notes[i], counterpoint.notes[i]);
    cout << song.notes[i].full_note_with_octave() << " " << counterpoint.notes[i].full_note_with_octave() << " " << in.description() << endl;
  }

  cout << endl;

  cout << "First Species Counterpoint\n";
  for(auto & c : counterpoint.notes){
    cout << SongReader::note_to_string(c) << " ";
  }
  cout << endl;
  printf("Size: %d\n", (int) counterpoint.size());

  cout << endl;
  cout << "Second Species Counterpoint\n";
  for(auto & c : second_counterpoint.notes){
    cout << SongReader::note_to_string(c) << " ";
  }
  cout << endl;
  printf("Size: %d\n", (int) second_counterpoint.size());

  cout << endl;
  cout << "Third Species Counterpoint\n";
  for(auto & c : third_counterpoint.notes){
    cout << SongReader::note_to_string(c) << " ";
  }
  cout << endl;
  printf("Size: %d\n", (int) third_counterpoint.size());

  cout << endl;
  cout << "Fourth Species Counterpoint\n";
  for(auto & c : fourth_counterpoint.notes){
    cout << SongReader::note_to_string(c) << " ";
  }
  cout << endl;
  printf("Size: %d\n", (int) fourth_counterpoint.size());

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x11a0, %rsp           # imm = 0x11A0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x4, -0x8(%rbp)
jge 0x2104d
movq 0x60fc2(%rip), %rdi     # 0x81fe8
leaq 0x3f2a7(%rip), %rsi     # 0x602d4
callq 0x6480
movq %rax, %rdi
movq 0x60f44(%rip), %rsi     # 0x81f80
callq 0x64d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x225fb
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1070(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x1068(%rbp)
callq 0x6830
movq -0x1070(%rbp), %rsi
movq -0x1068(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0xfb20
jmp 0x21085
leaq -0x31(%rbp), %rdi
callq 0x64f0
leaq -0x69(%rbp), %rdi
movq %rdi, -0x1078(%rbp)
callq 0x6830
movq -0x1078(%rbp), %rdx
leaq 0x3f259(%rip), %rsi     # 0x60305
leaq -0x68(%rbp), %rdi
callq 0xfb20
jmp 0x210b7
leaq -0x69(%rbp), %rdi
callq 0x64f0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x66f0
movl %eax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x1088(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x1080(%rbp)
callq 0x6830
movq -0x1088(%rbp), %rsi
movq -0x1080(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0xfb20
jmp 0x2110e
leaq 0x3f207(%rip), %rsi     # 0x6031c
leaq -0x98(%rbp), %rdi
callq 0xfff0
movb %al, -0x1089(%rbp)
jmp 0x21129
leaq -0x98(%rbp), %rdi
callq 0x62d0
leaq -0x99(%rbp), %rdi
callq 0x64f0
movb -0x1089(%rbp), %al
andb $0x1, %al
movb %al, -0x71(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x61d0
movq %rax, %rsi
movl -0x70(%rbp), %edx
movzbl -0x71(%rbp), %ecx
andl $0x1, %ecx
leaq 0x3f1b8(%rip), %rdi     # 0x60321
xorl %eax, %eax
callq 0x6090
jmp 0x21172
leaq -0xc0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x61f0
jmp 0x21184
leaq -0xe0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x61f0
jmp 0x21196
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x1f440
jmp 0x211ab
leaq -0xe0(%rbp), %rdi
callq 0x62d0
leaq -0xc0(%rbp), %rdi
callq 0x62d0
leaq -0x1d0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x61f0
jmp 0x211d5
leaq -0x1b0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
movl $0x1, %edx
callq 0x1ea10
jmp 0x211ef
leaq -0x1d0(%rbp), %rdi
callq 0x62d0
leaq -0x2a0(%rbp), %rdi
callq 0x16620
jmp 0x21209
leaq -0x370(%rbp), %rdi
callq 0x16620
jmp 0x21217
leaq -0x440(%rbp), %rdi
callq 0x16620
jmp 0x21225
leaq -0x510(%rbp), %rdi
callq 0x16620
jmp 0x21233
movl -0x70(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x1098(%rbp)
subl $0x3, %eax
ja 0x21618
movq -0x1098(%rbp), %rax
leaq 0x3f06c(%rip), %rcx     # 0x602c4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x64f0
jmp 0x22607
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x69(%rbp), %rdi
callq 0x64f0
jmp 0x225f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x212bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x62d0
leaq -0x99(%rbp), %rdi
callq 0x64f0
jmp 0x225e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x225e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21303
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x62d0
leaq -0xc0(%rbp), %rdi
callq 0x62d0
jmp 0x225e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x62d0
jmp 0x225e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x225db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x225cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x225c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x225b7
movq 0x60c2c(%rip), %rdi     # 0x81fa8
leaq 0x3efae(%rip), %rsi     # 0x60331
callq 0x6480
jmp 0x2138a
movb -0x71(%rbp), %al
movb %al, -0x109d(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x109c(%rbp)
jmp 0x213a7
movl -0x109c(%rbp), %r8d
movb -0x109d(%rbp), %al
movzbl %al, %edx
andl $0x1, %edx
leaq -0x5e0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0x4, %ecx
callq 0x132a0
jmp 0x213d4
leaq -0x2a0(%rbp), %rdi
leaq -0x5e0(%rbp), %rsi
callq 0x22610
jmp 0x213e9
leaq -0x5e0(%rbp), %rdi
callq 0x16720
jmp 0x21859
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x225ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x5e0(%rbp), %rdi
callq 0x16720
jmp 0x225ab
movq 0x60b79(%rip), %rdi     # 0x81fa8
leaq 0x3ef26(%rip), %rsi     # 0x6035c
callq 0x6480
jmp 0x2143d
movb -0x71(%rbp), %al
movb %al, -0x10a5(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10a4(%rbp)
jmp 0x2145a
movb -0x10a5(%rbp), %al
movl -0x10a4(%rbp), %r8d
addl %r8d, %r8d
movzbl %al, %edx
andl $0x1, %edx
leaq -0x6b0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0x4, %ecx
callq 0x28b60
jmp 0x2148a
leaq -0x2a0(%rbp), %rdi
leaq -0x6b0(%rbp), %rsi
callq 0x22610
jmp 0x2149f
leaq -0x6b0(%rbp), %rdi
callq 0x16720
jmp 0x21859
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x6b0(%rbp), %rdi
callq 0x16720
jmp 0x225ab
movq 0x60ad4(%rip), %rdi     # 0x81fa8
leaq 0x3eead(%rip), %rsi     # 0x60388
callq 0x6480
jmp 0x214e2
movb -0x71(%rbp), %al
movb %al, -0x10ad(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10ac(%rbp)
jmp 0x214ff
movb -0x10ad(%rbp), %al
movl -0x10ac(%rbp), %r8d
shll $0x2, %r8d
movzbl %al, %edx
andl $0x1, %edx
leaq -0x780(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0x4, %ecx
callq 0x5a050
jmp 0x21530
leaq -0x2a0(%rbp), %rdi
leaq -0x780(%rbp), %rsi
callq 0x22610
jmp 0x21545
leaq -0x780(%rbp), %rdi
callq 0x16720
jmp 0x21859
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x780(%rbp), %rdi
callq 0x16720
jmp 0x225ab
movq 0x60a2e(%rip), %rdi     # 0x81fa8
leaq 0x3ee32(%rip), %rsi     # 0x603b3
callq 0x6480
jmp 0x21588
movb -0x71(%rbp), %al
movb %al, -0x10b5(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10b4(%rbp)
jmp 0x215a5
movb -0x10b5(%rbp), %al
movl -0x10b4(%rbp), %r8d
addl %r8d, %r8d
movzbl %al, %edx
andl $0x1, %edx
leaq -0x850(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0x4, %ecx
callq 0x16f00
jmp 0x215d5
leaq -0x2a0(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0x22610
jmp 0x215ea
leaq -0x850(%rbp), %rdi
callq 0x16720
jmp 0x21859
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x850(%rbp), %rdi
callq 0x16720
jmp 0x225ab
movq 0x60989(%rip), %rdi     # 0x81fa8
leaq 0x3edb9(%rip), %rsi     # 0x603df
callq 0x6480
jmp 0x2162d
movb -0x71(%rbp), %al
movb %al, -0x10bd(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10bc(%rbp)
jmp 0x2164a
movl -0x10bc(%rbp), %r8d
movb -0x10bd(%rbp), %al
movzbl %al, %edx
andl $0x1, %edx
leaq -0x920(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0x4, %ecx
callq 0x132a0
jmp 0x21677
leaq -0x2a0(%rbp), %rdi
leaq -0x920(%rbp), %rsi
callq 0x22610
jmp 0x2168c
leaq -0x920(%rbp), %rdi
callq 0x16720
movb -0x71(%rbp), %al
movb %al, -0x10c5(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10c4(%rbp)
jmp 0x216b5
movb -0x10c5(%rbp), %al
movl -0x10c4(%rbp), %r8d
addl %r8d, %r8d
movzbl %al, %edx
andl $0x1, %edx
leaq -0x9f0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0x4, %ecx
callq 0x28b60
jmp 0x216e5
leaq -0x370(%rbp), %rdi
leaq -0x9f0(%rbp), %rsi
callq 0x22610
jmp 0x216fa
leaq -0x9f0(%rbp), %rdi
callq 0x16720
movb -0x71(%rbp), %al
movb %al, -0x10cd(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10cc(%rbp)
jmp 0x21723
movb -0x10cd(%rbp), %al
movl -0x10cc(%rbp), %r8d
shll $0x2, %r8d
movzbl %al, %edx
andl $0x1, %edx
leaq -0xac0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0x4, %ecx
callq 0x5a050
jmp 0x21754
leaq -0x440(%rbp), %rdi
leaq -0xac0(%rbp), %rsi
callq 0x22610
jmp 0x21769
leaq -0xac0(%rbp), %rdi
callq 0x16720
movb -0x71(%rbp), %al
movb %al, -0x10d5(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10d4(%rbp)
jmp 0x21792
movb -0x10d5(%rbp), %al
movl -0x10d4(%rbp), %r8d
addl %r8d, %r8d
movzbl %al, %edx
andl $0x1, %edx
leaq -0xb90(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
movl $0x4, %ecx
callq 0x16f00
jmp 0x217c2
leaq -0x510(%rbp), %rdi
leaq -0xb90(%rbp), %rsi
callq 0x22610
jmp 0x217d7
leaq -0xb90(%rbp), %rdi
callq 0x16720
jmp 0x21859
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x920(%rbp), %rdi
callq 0x16720
jmp 0x225ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x9f0(%rbp), %rdi
callq 0x16720
jmp 0x225ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xac0(%rbp), %rdi
callq 0x16720
jmp 0x225ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb90(%rbp), %rdi
callq 0x16720
jmp 0x225ab
leaq -0x2a0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10dc(%rbp)
jmp 0x2186d
movl -0x10dc(%rbp), %eax
cmpl $0x0, %eax
je 0x21942
leaq -0xbb0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x61f0
jmp 0x2188e
leaq -0xbd1(%rbp), %rdi
movq %rdi, -0x10e8(%rbp)
callq 0x6830
movq -0x10e8(%rbp), %rdx
leaq 0x3eb4e(%rip), %rsi     # 0x603fd
leaq -0xbd0(%rbp), %rdi
callq 0xfb20
jmp 0x218bd
leaq -0x2a0(%rbp), %rdi
leaq -0xbb0(%rbp), %rsi
leaq -0xbd0(%rbp), %rdx
callq 0x20020
jmp 0x218d9
leaq -0xbd0(%rbp), %rdi
callq 0x62d0
leaq -0xbd1(%rbp), %rdi
callq 0x64f0
leaq -0xbb0(%rbp), %rdi
callq 0x62d0
jmp 0x21942
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21925
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xbd0(%rbp), %rdi
callq 0x62d0
leaq -0xbd1(%rbp), %rdi
callq 0x64f0
leaq -0xbb0(%rbp), %rdi
callq 0x62d0
jmp 0x225ab
leaq -0x370(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10ec(%rbp)
jmp 0x21956
movl -0x10ec(%rbp), %eax
cmpl $0x0, %eax
je 0x21a2b
leaq -0xbf8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x61f0
jmp 0x21977
leaq -0xc19(%rbp), %rdi
movq %rdi, -0x10f8(%rbp)
callq 0x6830
movq -0x10f8(%rbp), %rdx
leaq 0x3ea7c(%rip), %rsi     # 0x60414
leaq -0xc18(%rbp), %rdi
callq 0xfb20
jmp 0x219a6
leaq -0x370(%rbp), %rdi
leaq -0xbf8(%rbp), %rsi
leaq -0xc18(%rbp), %rdx
callq 0x20020
jmp 0x219c2
leaq -0xc18(%rbp), %rdi
callq 0x62d0
leaq -0xc19(%rbp), %rdi
callq 0x64f0
leaq -0xbf8(%rbp), %rdi
callq 0x62d0
jmp 0x21a2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21a0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc18(%rbp), %rdi
callq 0x62d0
leaq -0xc19(%rbp), %rdi
callq 0x64f0
leaq -0xbf8(%rbp), %rdi
callq 0x62d0
jmp 0x225ab
leaq -0x440(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x10fc(%rbp)
jmp 0x21a3f
movl -0x10fc(%rbp), %eax
cmpl $0x0, %eax
je 0x21b14
leaq -0xc40(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x61f0
jmp 0x21a60
leaq -0xc61(%rbp), %rdi
movq %rdi, -0x1108(%rbp)
callq 0x6830
movq -0x1108(%rbp), %rdx
leaq 0x3e9ac(%rip), %rsi     # 0x6042d
leaq -0xc60(%rbp), %rdi
callq 0xfb20
jmp 0x21a8f
leaq -0x440(%rbp), %rdi
leaq -0xc40(%rbp), %rsi
leaq -0xc60(%rbp), %rdx
callq 0x20020
jmp 0x21aab
leaq -0xc60(%rbp), %rdi
callq 0x62d0
leaq -0xc61(%rbp), %rdi
callq 0x64f0
leaq -0xc40(%rbp), %rdi
callq 0x62d0
jmp 0x21b14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21af7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc60(%rbp), %rdi
callq 0x62d0
leaq -0xc61(%rbp), %rdi
callq 0x64f0
leaq -0xc40(%rbp), %rdi
callq 0x62d0
jmp 0x225ab
leaq -0x510(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x110c(%rbp)
jmp 0x21b28
movl -0x110c(%rbp), %eax
cmpl $0x0, %eax
je 0x21bfd
leaq -0xc88(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x61f0
jmp 0x21b49
leaq -0xca9(%rbp), %rdi
movq %rdi, -0x1118(%rbp)
callq 0x6830
movq -0x1118(%rbp), %rdx
leaq 0x3e8dc(%rip), %rsi     # 0x60446
leaq -0xca8(%rbp), %rdi
callq 0xfb20
jmp 0x21b78
leaq -0x510(%rbp), %rdi
leaq -0xc88(%rbp), %rsi
leaq -0xca8(%rbp), %rdx
callq 0x20020
jmp 0x21b94
leaq -0xca8(%rbp), %rdi
callq 0x62d0
leaq -0xca9(%rbp), %rdi
callq 0x64f0
leaq -0xc88(%rbp), %rdi
callq 0x62d0
jmp 0x21bfd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21be0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xca8(%rbp), %rdi
callq 0x62d0
leaq -0xca9(%rbp), %rdi
callq 0x64f0
leaq -0xc88(%rbp), %rdi
callq 0x62d0
jmp 0x225ab
leaq -0x2a0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x111c(%rbp)
jmp 0x21c11
movl -0x111c(%rbp), %eax
cmpl $0x0, %eax
jne 0x21c47
movq 0x60385(%rip), %rdi     # 0x81fa8
leaq 0x3e835(%rip), %rsi     # 0x6045f
callq 0x6480
jmp 0x21c31
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
movl $0x1, -0xcb0(%rbp)
jmp 0x2255b
leaq -0x1b0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x1120(%rbp)
jmp 0x21c5b
movl -0x1120(%rbp), %eax
movl %eax, -0xcb8(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x1124(%rbp)
jmp 0x21c7b
movl -0x1124(%rbp), %eax
movl %eax, -0xcbc(%rbp)
leaq -0xcb8(%rbp), %rdi
leaq -0xcbc(%rbp), %rsi
callq 0x22670
movq %rax, -0x1130(%rbp)
jmp 0x21ca3
movq -0x1130(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xcb4(%rbp)
movl $0x0, -0xcc0(%rbp)
movl -0xcc0(%rbp), %eax
cmpl -0xcb4(%rbp), %eax
jge 0x21f2e
movslq -0xcc0(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0xfd10
movq %rax, %rsi
leaq -0xd48(%rbp), %rdi
callq 0x22ce0
jmp 0x21cf2
movslq -0xcc0(%rbp), %rsi
leaq -0x2a0(%rbp), %rdi
callq 0xfd10
movq %rax, %rsi
leaq -0xda0(%rbp), %rdi
callq 0x22ce0
jmp 0x21d16
leaq -0xcf0(%rbp), %rdi
leaq -0xd48(%rbp), %rsi
leaq -0xda0(%rbp), %rdx
callq 0x1bf30
jmp 0x21d32
leaq -0xda0(%rbp), %rdi
callq 0xfd80
leaq -0xd48(%rbp), %rdi
callq 0xfd80
movslq -0xcc0(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0xfd10
movq %rax, %rsi
leaq -0xdc0(%rbp), %rdi
callq 0x232b0
jmp 0x21d6e
movq 0x60233(%rip), %rdi     # 0x81fa8
leaq -0xdc0(%rbp), %rsi
callq 0x6410
movq %rax, -0x1138(%rbp)
jmp 0x21d8a
movq -0x1138(%rbp), %rdi
leaq 0x3e454(%rip), %rsi     # 0x601ec
callq 0x6480
movq %rax, -0x1140(%rbp)
jmp 0x21da6
movslq -0xcc0(%rbp), %rsi
leaq -0x2a0(%rbp), %rdi
callq 0xfd10
movq %rax, %rsi
leaq -0xde0(%rbp), %rdi
callq 0x232b0
jmp 0x21dca
movq -0x1140(%rbp), %rdi
leaq -0xde0(%rbp), %rsi
callq 0x6410
movq %rax, -0x1148(%rbp)
jmp 0x21de6
movq -0x1148(%rbp), %rdi
leaq 0x3e3f8(%rip), %rsi     # 0x601ec
callq 0x6480
movq %rax, -0x1150(%rbp)
jmp 0x21e02
leaq -0xe00(%rbp), %rdi
leaq -0xcf0(%rbp), %rsi
callq 0x1c100
jmp 0x21e17
movq -0x1150(%rbp), %rdi
leaq -0xe00(%rbp), %rsi
callq 0x6410
movq %rax, -0x1158(%rbp)
jmp 0x21e33
movq -0x1158(%rbp), %rdi
movq 0x6013f(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x21e48
leaq -0xe00(%rbp), %rdi
callq 0x62d0
leaq -0xde0(%rbp), %rdi
callq 0x62d0
leaq -0xdc0(%rbp), %rdi
callq 0x62d0
leaq -0xcf0(%rbp), %rdi
callq 0xfc90
movl -0xcc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc0(%rbp)
jmp 0x21cbc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21eb2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xda0(%rbp), %rdi
callq 0xfd80
leaq -0xd48(%rbp), %rdi
callq 0xfd80
jmp 0x225ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21f1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21f11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x21f05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe00(%rbp), %rdi
callq 0x62d0
leaq -0xde0(%rbp), %rdi
callq 0x62d0
leaq -0xdc0(%rbp), %rdi
callq 0x62d0
leaq -0xcf0(%rbp), %rdi
callq 0xfc90
jmp 0x225ab
movq 0x60073(%rip), %rdi     # 0x81fa8
movq 0x60044(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x21f43
movq 0x6005e(%rip), %rdi     # 0x81fa8
leaq 0x3e52e(%rip), %rsi     # 0x6047f
callq 0x6480
jmp 0x21f58
leaq -0x2a0(%rbp), %rax
movq %rax, -0xe08(%rbp)
movq -0xe08(%rbp), %rdi
callq 0x126e0
movq %rax, -0xe10(%rbp)
movq -0xe08(%rbp), %rdi
callq 0x12550
movq %rax, -0xe18(%rbp)
leaq -0xe10(%rbp), %rdi
leaq -0xe18(%rbp), %rsi
callq 0x1cc60
testb $0x1, %al
jne 0x21fa8
jmp 0x22076
leaq -0xe10(%rbp), %rdi
callq 0x1b840
movq %rax, -0xe20(%rbp)
movq -0xe20(%rbp), %rsi
leaq -0xe98(%rbp), %rdi
callq 0x22ce0
jmp 0x21fd0
leaq -0xe40(%rbp), %rdi
leaq -0xe98(%rbp), %rsi
callq 0x2e5a0
jmp 0x21fe5
movq 0x5ffbc(%rip), %rdi     # 0x81fa8
leaq -0xe40(%rbp), %rsi
callq 0x6410
movq %rax, -0x1160(%rbp)
jmp 0x22001
movq -0x1160(%rbp), %rdi
leaq 0x3e1dd(%rip), %rsi     # 0x601ec
callq 0x6480
jmp 0x22016
leaq -0xe40(%rbp), %rdi
callq 0x62d0
leaq -0xe98(%rbp), %rdi
callq 0xfd80
leaq -0xe10(%rbp), %rdi
callq 0x1cca0
jmp 0x21f8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x22065
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe40(%rbp), %rdi
callq 0x62d0
leaq -0xe98(%rbp), %rdi
callq 0xfd80
jmp 0x225ab
movq 0x5ff2b(%rip), %rdi     # 0x81fa8
movq 0x5fefc(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x2208b
leaq -0x2a0(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x1164(%rbp)
jmp 0x2209f
movl -0x1164(%rbp), %esi
leaq 0x3e3ef(%rip), %rdi     # 0x6049b
xorl %eax, %eax
callq 0x6090
jmp 0x220b5
movq 0x5feec(%rip), %rdi     # 0x81fa8
movq 0x5febd(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x220ca
movq 0x5fed7(%rip), %rdi     # 0x81fa8
leaq 0x3e3cd(%rip), %rsi     # 0x604a5
callq 0x6480
jmp 0x220df
leaq -0x370(%rbp), %rax
movq %rax, -0xea0(%rbp)
movq -0xea0(%rbp), %rdi
callq 0x126e0
movq %rax, -0xea8(%rbp)
movq -0xea0(%rbp), %rdi
callq 0x12550
movq %rax, -0xeb0(%rbp)
leaq -0xea8(%rbp), %rdi
leaq -0xeb0(%rbp), %rsi
callq 0x1cc60
testb $0x1, %al
jne 0x2212f
jmp 0x221fd
leaq -0xea8(%rbp), %rdi
callq 0x1b840
movq %rax, -0xeb8(%rbp)
movq -0xeb8(%rbp), %rsi
leaq -0xf30(%rbp), %rdi
callq 0x22ce0
jmp 0x22157
leaq -0xed8(%rbp), %rdi
leaq -0xf30(%rbp), %rsi
callq 0x2e5a0
jmp 0x2216c
movq 0x5fe35(%rip), %rdi     # 0x81fa8
leaq -0xed8(%rbp), %rsi
callq 0x6410
movq %rax, -0x1170(%rbp)
jmp 0x22188
movq -0x1170(%rbp), %rdi
leaq 0x3e056(%rip), %rsi     # 0x601ec
callq 0x6480
jmp 0x2219d
leaq -0xed8(%rbp), %rdi
callq 0x62d0
leaq -0xf30(%rbp), %rdi
callq 0xfd80
leaq -0xea8(%rbp), %rdi
callq 0x1cca0
jmp 0x22113
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x221ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xed8(%rbp), %rdi
callq 0x62d0
leaq -0xf30(%rbp), %rdi
callq 0xfd80
jmp 0x225ab
movq 0x5fda4(%rip), %rdi     # 0x81fa8
movq 0x5fd75(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x22212
leaq -0x370(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x1174(%rbp)
jmp 0x22226
movl -0x1174(%rbp), %esi
leaq 0x3e268(%rip), %rdi     # 0x6049b
xorl %eax, %eax
callq 0x6090
jmp 0x2223c
movq 0x5fd65(%rip), %rdi     # 0x81fa8
movq 0x5fd36(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x22251
movq 0x5fd50(%rip), %rdi     # 0x81fa8
leaq 0x3e263(%rip), %rsi     # 0x604c2
callq 0x6480
jmp 0x22266
leaq -0x440(%rbp), %rax
movq %rax, -0xf38(%rbp)
movq -0xf38(%rbp), %rdi
callq 0x126e0
movq %rax, -0xf40(%rbp)
movq -0xf38(%rbp), %rdi
callq 0x12550
movq %rax, -0xf48(%rbp)
leaq -0xf40(%rbp), %rdi
leaq -0xf48(%rbp), %rsi
callq 0x1cc60
testb $0x1, %al
jne 0x222b6
jmp 0x22384
leaq -0xf40(%rbp), %rdi
callq 0x1b840
movq %rax, -0xf50(%rbp)
movq -0xf50(%rbp), %rsi
leaq -0xfc8(%rbp), %rdi
callq 0x22ce0
jmp 0x222de
leaq -0xf70(%rbp), %rdi
leaq -0xfc8(%rbp), %rsi
callq 0x2e5a0
jmp 0x222f3
movq 0x5fcae(%rip), %rdi     # 0x81fa8
leaq -0xf70(%rbp), %rsi
callq 0x6410
movq %rax, -0x1180(%rbp)
jmp 0x2230f
movq -0x1180(%rbp), %rdi
leaq 0x3decf(%rip), %rsi     # 0x601ec
callq 0x6480
jmp 0x22324
leaq -0xf70(%rbp), %rdi
callq 0x62d0
leaq -0xfc8(%rbp), %rdi
callq 0xfd80
leaq -0xf40(%rbp), %rdi
callq 0x1cca0
jmp 0x2229a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x22373
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xf70(%rbp), %rdi
callq 0x62d0
leaq -0xfc8(%rbp), %rdi
callq 0xfd80
jmp 0x225ab
movq 0x5fc1d(%rip), %rdi     # 0x81fa8
movq 0x5fbee(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x22399
leaq -0x440(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x1184(%rbp)
jmp 0x223ad
movl -0x1184(%rbp), %esi
leaq 0x3e0e1(%rip), %rdi     # 0x6049b
xorl %eax, %eax
callq 0x6090
jmp 0x223c3
movq 0x5fbde(%rip), %rdi     # 0x81fa8
movq 0x5fbaf(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x223d8
movq 0x5fbc9(%rip), %rdi     # 0x81fa8
leaq 0x3e0f8(%rip), %rsi     # 0x604de
callq 0x6480
jmp 0x223ed
leaq -0x510(%rbp), %rax
movq %rax, -0xfd0(%rbp)
movq -0xfd0(%rbp), %rdi
callq 0x126e0
movq %rax, -0xfd8(%rbp)
movq -0xfd0(%rbp), %rdi
callq 0x12550
movq %rax, -0xfe0(%rbp)
leaq -0xfd8(%rbp), %rdi
leaq -0xfe0(%rbp), %rsi
callq 0x1cc60
testb $0x1, %al
jne 0x2243d
jmp 0x2250b
leaq -0xfd8(%rbp), %rdi
callq 0x1b840
movq %rax, -0xfe8(%rbp)
movq -0xfe8(%rbp), %rsi
leaq -0x1060(%rbp), %rdi
callq 0x22ce0
jmp 0x22465
leaq -0x1008(%rbp), %rdi
leaq -0x1060(%rbp), %rsi
callq 0x2e5a0
jmp 0x2247a
movq 0x5fb27(%rip), %rdi     # 0x81fa8
leaq -0x1008(%rbp), %rsi
callq 0x6410
movq %rax, -0x1190(%rbp)
jmp 0x22496
movq -0x1190(%rbp), %rdi
leaq 0x3dd48(%rip), %rsi     # 0x601ec
callq 0x6480
jmp 0x224ab
leaq -0x1008(%rbp), %rdi
callq 0x62d0
leaq -0x1060(%rbp), %rdi
callq 0xfd80
leaq -0xfd8(%rbp), %rdi
callq 0x1cca0
jmp 0x22421
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x224fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1008(%rbp), %rdi
callq 0x62d0
leaq -0x1060(%rbp), %rdi
callq 0xfd80
jmp 0x225ab
movq 0x5fa96(%rip), %rdi     # 0x81fa8
movq 0x5fa67(%rip), %rsi     # 0x81f80
callq 0x64d0
jmp 0x22520
leaq -0x510(%rbp), %rdi
callq 0x2dd20
movl %eax, -0x1194(%rbp)
jmp 0x22534
movl -0x1194(%rbp), %esi
leaq 0x3df5a(%rip), %rdi     # 0x6049b
xorl %eax, %eax
callq 0x6090
jmp 0x2254a
movl $0x0, -0x4(%rbp)
movl $0x1, -0xcb0(%rbp)
leaq -0x510(%rbp), %rdi
callq 0x16720
leaq -0x440(%rbp), %rdi
callq 0x16720
leaq -0x370(%rbp), %rdi
callq 0x16720
leaq -0x2a0(%rbp), %rdi
callq 0x16720
leaq -0x1b0(%rbp), %rdi
callq 0x16720
leaq -0x68(%rbp), %rdi
callq 0x62d0
leaq -0x30(%rbp), %rdi
callq 0x62d0
jmp 0x225fb
leaq -0x510(%rbp), %rdi
callq 0x16720
leaq -0x440(%rbp), %rdi
callq 0x16720
leaq -0x370(%rbp), %rdi
callq 0x16720
leaq -0x2a0(%rbp), %rdi
callq 0x16720
leaq -0x1b0(%rbp), %rdi
callq 0x16720
leaq -0x68(%rbp), %rdi
callq 0x62d0
leaq -0x30(%rbp), %rdi
callq 0x62d0
jmp 0x22607
movl -0x4(%rbp), %eax
addq $0x11a0, %rsp           # imm = 0x11A0
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x6820