// File: /workspace/github_cpp_makefile_star2_O2/joao18araujo[P]pierluigi/src/counterpoint.cpp
// Function: Counterpoint::generate_first_species_counterpoint(Song&, bool)
vector<Note> Counterpoint::generate_first_species_counterpoint(Song & c_song, bool ascendant){
  song = &c_song;
  vector <Note> counterpoint;
  vector<Interval> consonant_intervals {Interval("P1", ascendant), Interval("P8", ascendant), Interval("P5", ascendant), Interval("m3", ascendant), Interval("M3", ascendant), Interval("m6", ascendant), Interval("M6", ascendant), Interval("m10", ascendant), Interval("M10", ascendant)};
  vector<Interval> perfect_consonant_intervals {Interval("P1", ascendant), Interval("P8", ascendant), Interval("P5", ascendant)};
  vector<Interval> imperfect_consonant_intervals { Interval("m3", ascendant), Interval("M3", ascendant), Interval("m6", ascendant), Interval("M6", ascendant), Interval("m10", ascendant), Interval("M10", ascendant)};

  vector<Interval> possible_intervals;

  srand(clock());

  int count_imperfects = 0;

  Interval current_interval, previous_interval, interval;
  Interval melodic_cantus_interval, melodic_counterpoint_interval;
  Note previous_note;
  Note counterpoint_note;
  Note previous_counterpoint_note;

  int times_not_reversed = 0;
  for(unsigned i = 0; i < song->size(); ++i){
    possible_intervals.clear();
    auto note = song->notes[i];

    melodic_cantus_interval = Interval(previous_note, note);
    bool reverse_movement = true;

    begin:
    bool melodic_ascendant = melodic_cantus_interval.ascendant();
    if(reverse_movement) melodic_ascendant = !melodic_ascendant;

    string previous = previous_interval.description();
    if(i == 0 || i == song->size() - 1){
      interval = Interval("P1", ascendant);
      counterpoint_note = Interval::interval_to_note(note, interval);
      analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("P1", ascendant), nullptr);
    }else if(count_imperfects < 4){
      analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("m3", ascendant), nullptr);
      analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("M3", ascendant), nullptr);
      analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("m6", ascendant), nullptr);
      analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("M6", ascendant), nullptr);
      analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("m10", ascendant), nullptr);
      analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("M10", ascendant), nullptr);
    }

    if(previous != "P5" && previous != "P8"){
      analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("P8", ascendant), nullptr);
      if(ascendant)
        analyse_and_add_interval(reverse_movement, melodic_ascendant, possible_intervals, previous_counterpoint_note, note, Interval("P5", ascendant), nullptr);
    }

    if(possible_intervals.empty() && reverse_movement && times_not_reversed++ < 3){
      reverse_movement = false;
      goto begin;
    }

    if(possible_intervals.empty()) return vector<Note>();
    int index = rand() % possible_intervals.size();

    current_interval = possible_intervals[index];
    counterpoint_note = Interval::interval_to_note(note, current_interval);
    if(note.valid) counterpoint.push_back(counterpoint_note);

    string interval_qualitative = current_interval.qualitative;
    if(interval_qualitative == "M" || interval_qualitative == "m")
      count_imperfects++;
    else
      count_imperfects = 0;

    previous_interval = current_interval;
    previous_note = note;
    previous_counterpoint_note = counterpoint_note;
  }

  return counterpoint;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x11f8, %rsp           # imm = 0x11F8
movl %edx, %ebp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x9bfb8fd(%rip)   # 0x9c034a8
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
leaq 0x21460(%rip), %rsi     # 0x29020
leaq 0x4a8(%rsp), %rdi
leaq 0x4e0(%rsp), %rdx
callq 0x96e6
movzbl %bpl, %edx
leaq 0x688(%rsp), %rbx
leaq 0x4a8(%rsp), %rsi
movq %rbx, %rdi
movl %edx, 0xc(%rsp)
callq 0xf280
leaq 0x6b8(%rsp), %r12
leaq 0x2141f(%rip), %rsi     # 0x29023
leaq 0x488(%rsp), %rdi
leaq 0x170(%rsp), %rdx
callq 0x96e6
leaq 0x488(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x6e8(%rsp), %r12
leaq 0x213ea(%rip), %rsi     # 0x29026
leaq 0x468(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0x96e6
leaq 0x468(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x718(%rsp), %r12
leaq 0x213b5(%rip), %rsi     # 0x29029
leaq 0x448(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x448(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x748(%rsp), %r12
leaq 0x21383(%rip), %rsi     # 0x2902c
leaq 0x428(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x96e6
leaq 0x428(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x778(%rsp), %r12
leaq 0x2134e(%rip), %rsi     # 0x2902f
leaq 0x408(%rsp), %rdi
leaq 0x1c8(%rsp), %rdx
callq 0x96e6
leaq 0x408(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x7a8(%rsp), %r12
leaq 0x21319(%rip), %rsi     # 0x29032
leaq 0x3e8(%rsp), %rdi
leaq 0x228(%rsp), %rdx
callq 0x96e6
leaq 0x3e8(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x7d8(%rsp), %r12
leaq 0x212e4(%rip), %rsi     # 0x29035
leaq 0x3c8(%rsp), %rdi
leaq 0x1f8(%rsp), %rdx
callq 0x96e6
leaq 0x3c8(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x808(%rsp), %r12
leaq 0x212b0(%rip), %rsi     # 0x29039
leaq 0x3a8(%rsp), %rdi
leaq 0x658(%rsp), %rdx
callq 0x96e6
leaq 0x3a8(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x4c8(%rsp), %rdi
leaq 0x688(%rsp), %rsi
pushq $0x9
popq %rdx
leaq 0x120(%rsp), %rcx
callq 0x9722
movl $0x188, %ebx            # imm = 0x188
leaq (%rsp,%rbx), %rdi
addq $0x688, %rdi            # imm = 0x688
callq 0x51b0
addq $-0x30, %rbx
cmpq $-0x28, %rbx
jne 0x7dd7
leaq 0x3a8(%rsp), %rdi
callq 0x51b0
leaq 0x3c8(%rsp), %rdi
callq 0x51b0
leaq 0x3e8(%rsp), %rdi
callq 0x51b0
leaq 0x408(%rsp), %rdi
callq 0x51b0
leaq 0x428(%rsp), %rdi
callq 0x51b0
leaq 0x448(%rsp), %rdi
callq 0x51b0
leaq 0x468(%rsp), %rdi
callq 0x51b0
leaq 0x488(%rsp), %rdi
callq 0x51b0
leaq 0x4a8(%rsp), %rdi
callq 0x51b0
leaq 0x211b3(%rip), %rsi     # 0x29020
leaq 0x370(%rsp), %rdi
leaq 0x4e0(%rsp), %rdx
callq 0x96e6
movl %ebp, 0x4c(%rsp)
leaq 0x688(%rsp), %rbx
leaq 0x370(%rsp), %rsi
movq %rbx, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x6b8(%rsp), %r15
leaq 0x21172(%rip), %rsi     # 0x29023
leaq 0x350(%rsp), %rdi
leaq 0x170(%rsp), %rdx
callq 0x96e6
leaq 0x350(%rsp), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x6e8(%rsp), %r15
leaq 0x2113d(%rip), %rsi     # 0x29026
leaq 0x330(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0x96e6
leaq 0x330(%rsp), %rsi
movq %r15, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x390(%rsp), %rdi
leaq 0x688(%rsp), %rsi
pushq $0x3
popq %rdx
leaq 0x70(%rsp), %rcx
callq 0x9722
pushq $0x68
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x688, %rdi            # imm = 0x688
callq 0x51b0
addq $-0x30, %rbx
cmpq $-0x28, %rbx
jne 0x7f32
leaq 0x330(%rsp), %rdi
callq 0x51b0
leaq 0x350(%rsp), %rdi
callq 0x51b0
leaq 0x370(%rsp), %rdi
callq 0x51b0
leaq 0x210af(%rip), %rsi     # 0x29029
leaq 0x2f8(%rsp), %rdi
leaq 0x4e0(%rsp), %rdx
callq 0x96e6
leaq 0x688(%rsp), %rbx
leaq 0x2f8(%rsp), %rsi
movq %rbx, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x6b8(%rsp), %r12
leaq 0x21072(%rip), %rsi     # 0x2902c
leaq 0x2d8(%rsp), %rdi
leaq 0x170(%rsp), %rdx
callq 0x96e6
leaq 0x2d8(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x6e8(%rsp), %r12
leaq 0x2103d(%rip), %rsi     # 0x2902f
leaq 0x2b8(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0x96e6
leaq 0x2b8(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x718(%rsp), %r12
leaq 0x21008(%rip), %rsi     # 0x29032
leaq 0x298(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x298(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x748(%rsp), %r12
leaq 0x20fd6(%rip), %rsi     # 0x29035
leaq 0x278(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x96e6
leaq 0x278(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x778(%rsp), %r12
leaq 0x20fa2(%rip), %rsi     # 0x29039
leaq 0x258(%rsp), %rdi
leaq 0x1c8(%rsp), %rdx
callq 0x96e6
leaq 0x258(%rsp), %rsi
movq %r12, %rdi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x318(%rsp), %rdi
leaq 0x688(%rsp), %rsi
pushq $0x6
popq %rdx
leaq 0x228(%rsp), %rcx
callq 0x9722
movl $0xf8, %ebx
leaq (%rsp,%rbx), %rdi
addq $0x688, %rdi            # imm = 0x688
callq 0x51b0
addq $-0x30, %rbx
cmpq $-0x28, %rbx
jne 0x80e5
leaq 0x258(%rsp), %rdi
callq 0x51b0
leaq 0x278(%rsp), %rdi
callq 0x51b0
leaq 0x298(%rsp), %rdi
callq 0x51b0
leaq 0x2b8(%rsp), %rdi
callq 0x51b0
leaq 0x2d8(%rsp), %rdi
callq 0x51b0
leaq 0x2f8(%rsp), %rdi
callq 0x51b0
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
callq 0x5270
movl %eax, %edi
callq 0x5330
leaq 0x158(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
leaq 0x1e0(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0x240(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x210(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x670(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x688(%rsp), %rdi
callq 0x12712
leaq 0x4e0(%rsp), %rdi
callq 0x12712
leaq 0x170(%rsp), %rdi
callq 0x12712
xorl %r15d, %r15d
leaq 0x11a0(%rsp), %r14
leaq 0x1148(%rsp), %r12
movl $0x0, 0x10(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x9bfb28e(%rip), %rdi   # 0x9c034a8
callq 0x17ce4
movl %eax, %eax
cmpq %rax, %r15
jae 0x8c84
leaq 0x20(%rsp), %rdi
callq 0x975c
movq 0x9bfb26d(%rip), %rax   # 0x9c034a8
imulq $0x58, %r15, %rsi
addq (%rax), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x12676
movq %r14, %rdi
leaq 0x688(%rsp), %rsi
callq 0x12676
movq %r12, %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xf41a
leaq 0x1f8(%rsp), %rdi
movq %rbx, %rsi
callq 0x9764
leaq 0x78(%rsp), %rdi
callq 0x51b0
movq %r12, %rdi
callq 0x979a
movq %r14, %rdi
callq 0x979a
movb $0x1, %al
movl %eax, 0x18(%rsp)
movq %r15, 0x68(%rsp)
leaq 0x1f8(%rsp), %rdi
callq 0xf856
movl %eax, %ebp
leaq 0x120(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0xf548
movl 0x18(%rsp), %ecx
xorb %cl, %bpl
movzbl %cl, %ecx
movl %ecx, 0x14(%rsp)
movzbl %bpl, %ebp
testq %r15, %r15
je 0x830b
movq 0x9bfb1af(%rip), %rdi   # 0x9c034a8
callq 0x17ce4
decl %eax
cmpq %rax, 0x68(%rsp)
jne 0x8678
leaq 0xa48(%rsp), %r14
movq %r14, %rdi
leaq 0x20d03(%rip), %rsi     # 0x29020
leaq 0x1f(%rsp), %rdx
callq 0x96e6
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
leaq 0x228(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x9764
leaq 0x78(%rsp), %rdi
callq 0x51b0
movq %r14, %rdi
callq 0x51b0
leaq 0xac0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0xa18(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x97b4
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
leaq 0xac0(%rsp), %rsi
movq %r14, %rdx
callq 0xf750
leaq 0x4e0(%rsp), %rdi
movq %rbx, %rsi
callq 0x97e8
movq %rbx, %rdi
callq 0x979a
leaq 0xa20(%rsp), %rdi
callq 0x51b0
leaq 0xac0(%rsp), %rdi
callq 0x979a
leaq 0x10f0(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0x1098(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x638(%rsp), %r14
movq %r14, %rdi
leaq 0x20c12(%rip), %rsi     # 0x29020
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x9e8(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
movl 0x14(%rsp), %edi
andl $0x1, %edi
movl %ebp, %esi
andl $0x1, %esi
leaq 0x20(%rsp), %rdx
leaq 0x10f0(%rsp), %r14
movq %r14, %rcx
leaq 0x1098(%rsp), %r13
movq %r13, %r8
movq %r12, %r9
callq 0x9456
leaq 0x9f0(%rsp), %rdi
callq 0x51b0
leaq 0x638(%rsp), %rdi
callq 0x51b0
movq %r13, %rdi
callq 0x979a
movq %r14, %rdi
callq 0x979a
leaq 0x120(%rsp), %rdi
leaq 0x20b8f(%rip), %rsi     # 0x29026
callq 0x982d
testb %al, %al
je 0x8630
leaq 0x120(%rsp), %rdi
leaq 0x20b70(%rip), %rsi     # 0x29023
callq 0x982d
testb %al, %al
je 0x8630
leaq 0xc20(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0xbc8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x558(%rsp), %r14
movq %r14, %rdi
leaq 0x20b27(%rip), %rsi     # 0x29023
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x898(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
movl 0x14(%rsp), %edi
andl $0x1, %edi
andl $0x1, %ebp
movl %edi, %ebx
movl %ebp, %esi
leaq 0x20(%rsp), %rdx
leaq 0xc20(%rsp), %r14
movq %r14, %rcx
leaq 0xbc8(%rsp), %r12
movq %r12, %r8
movq %r13, %r9
callq 0x9456
leaq 0x8a0(%rsp), %rdi
callq 0x51b0
leaq 0x558(%rsp), %rdi
callq 0x51b0
movq %r12, %rdi
callq 0x979a
movq %r14, %rdi
callq 0x979a
cmpb $0x0, 0x4c(%rsp)
je 0x8630
leaq 0xb70(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0xb18(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x538(%rsp), %r14
movq %r14, %rdi
leaq 0x20a67(%rip), %rsi     # 0x29026
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x868(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
pushq $0x1
popq %rdx
callq 0xf280
movl %ebx, %edi
movl %ebp, %esi
leaq 0x20(%rsp), %rdx
leaq 0xb70(%rsp), %r14
movq %r14, %rcx
leaq 0xb18(%rsp), %r15
movq %r15, %r8
movq %r12, %r9
callq 0x9456
leaq 0x870(%rsp), %rdi
callq 0x51b0
leaq 0x538(%rsp), %rdi
callq 0x51b0
movq %r15, %rdi
callq 0x979a
movq %r14, %rdi
callq 0x979a
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
cmpq %rcx, %rax
sete %dl
andb 0x18(%rsp), %dl
cmpb $0x1, %dl
jne 0x8ab3
movq 0x40(%rsp), %rsi
leal 0x1(%rsi), %edx
cmpl $0x3, %esi
jge 0x8aae
movb $0x1, %r15b
xorl %r14d, %r14d
movl %edx, %eax
movq %rax, 0x40(%rsp)
movl $0x0, 0x18(%rsp)
jmp 0x8c3e
cmpl $0x3, 0x10(%rsp)
jg 0x8488
leaq 0x1040(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0xfe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x618(%rsp), %rbx
movq %rbx, %rdi
leaq 0x2096a(%rip), %rsi     # 0x29029
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x9b8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
movl 0x14(%rsp), %r14d
andl $0x1, %r14d
movl %ebp, %r13d
andl $0x1, %r13d
movl %r14d, %edi
movl %r13d, %esi
leaq 0x20(%rsp), %rdx
leaq 0x1040(%rsp), %r12
movq %r12, %rcx
leaq 0xfe8(%rsp), %rbx
movq %rbx, %r8
movq %r15, %r9
callq 0x9456
leaq 0x9c0(%rsp), %rdi
callq 0x51b0
leaq 0x618(%rsp), %rdi
callq 0x51b0
movq %rbx, %rdi
callq 0x979a
movq %r12, %rdi
callq 0x979a
leaq 0xf90(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0xf38(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x5f8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x208ad(%rip), %rsi     # 0x2902c
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x988(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
movl %r14d, %edi
movl %r13d, %esi
leaq 0x20(%rsp), %rdx
leaq 0xf90(%rsp), %rbx
movq %rbx, %rcx
leaq 0xf38(%rsp), %r15
movq %r15, %r8
movq %r12, %r9
callq 0x9456
leaq 0x990(%rsp), %rdi
callq 0x51b0
leaq 0x5f8(%rsp), %rdi
callq 0x51b0
movq %r15, %rdi
callq 0x979a
movq %rbx, %rdi
callq 0x979a
leaq 0xee0(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0xe88(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x5d8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x20800(%rip), %rsi     # 0x2902f
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x958(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
movl %r14d, %edi
movl %r13d, %esi
leaq 0x20(%rsp), %rdx
leaq 0xee0(%rsp), %rbx
movq %rbx, %rcx
leaq 0xe88(%rsp), %r15
movq %r15, %r8
movq %r12, %r9
callq 0x9456
leaq 0x960(%rsp), %rdi
callq 0x51b0
leaq 0x5d8(%rsp), %rdi
callq 0x51b0
movq %r15, %rdi
callq 0x979a
movq %rbx, %rdi
callq 0x979a
leaq 0xe30(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0xdd8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x5b8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x20753(%rip), %rsi     # 0x29032
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x928(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
movl %r14d, %edi
movl %r13d, %esi
leaq 0x20(%rsp), %rdx
leaq 0xe30(%rsp), %rbx
movq %rbx, %rcx
leaq 0xdd8(%rsp), %r15
movq %r15, %r8
movq %r12, %r9
callq 0x9456
leaq 0x930(%rsp), %rdi
callq 0x51b0
leaq 0x5b8(%rsp), %rdi
callq 0x51b0
movq %r15, %rdi
callq 0x979a
movq %rbx, %rdi
callq 0x979a
leaq 0xd80(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0xd28(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x598(%rsp), %rbx
movq %rbx, %rdi
leaq 0x206a6(%rip), %rsi     # 0x29035
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x8f8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
movl %r14d, %edi
movl %r13d, %esi
leaq 0x20(%rsp), %rdx
leaq 0xd80(%rsp), %rbx
movq %rbx, %rcx
leaq 0xd28(%rsp), %r15
movq %r15, %r8
movq %r12, %r9
callq 0x9456
leaq 0x900(%rsp), %rdi
callq 0x51b0
leaq 0x598(%rsp), %rdi
callq 0x51b0
movq %r15, %rdi
callq 0x979a
movq %rbx, %rdi
callq 0x979a
leaq 0xcd0(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x12676
leaq 0xc78(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x578(%rsp), %rbx
movq %rbx, %rdi
leaq 0x205fa(%rip), %rsi     # 0x29039
leaq 0x70(%rsp), %rdx
callq 0x96e6
leaq 0x8c8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl 0xc(%rsp), %edx
callq 0xf280
movl %r14d, %edi
movl %r13d, %esi
leaq 0x20(%rsp), %rdx
leaq 0xcd0(%rsp), %rbx
movq %rbx, %rcx
leaq 0xc78(%rsp), %r14
movq %r14, %r8
movq %r15, %r9
callq 0x9456
leaq 0x8d0(%rsp), %rdi
callq 0x51b0
leaq 0x578(%rsp), %rdi
callq 0x51b0
movq %r14, %rdi
movq %rbx, %r14
jmp 0x847b
movq %rdx, 0x40(%rsp)
cmpq %rcx, %rax
je 0x8c28
callq 0x5100
movslq %eax, %rcx
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
subq %rdi, %rax
cqto
pushq $0x30
popq %rsi
idivq %rsi
movq %rax, %rsi
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movslq %edx, %rax
imulq $0x30, %rax, %rsi
addq %rdi, %rsi
leaq 0x140(%rsp), %rdi
callq 0x9838
leaq 0xa68(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x12676
leaq 0x838(%rsp), %r14
movq %r14, %rdi
leaq 0x140(%rsp), %rsi
callq 0x97b4
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
leaq 0xa68(%rsp), %rsi
movq %r14, %rdx
callq 0xf750
leaq 0x4e0(%rsp), %rdi
movq %rbx, %rsi
callq 0x97e8
movq %rbx, %rdi
callq 0x979a
leaq 0x840(%rsp), %rdi
callq 0x51b0
leaq 0xa68(%rsp), %rdi
callq 0x979a
cmpb $0x1, 0x11c(%rsp)
jne 0x8b8e
leaq 0x50(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
callq 0x986e
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
leaq 0x148(%rsp), %rsi
callq 0x5480
movq %rbx, %rdi
leaq 0x211ea(%rip), %rsi     # 0x29d97
callq 0x989a
testb %al, %al
jne 0x8bcd
leaq 0x70(%rsp), %rdi
leaq 0x20a13(%rip), %rsi     # 0x295d5
callq 0x989a
xorl %ebp, %ebp
testb %al, %al
je 0x8bd3
movl 0x10(%rsp), %ebp
incl %ebp
leaq 0x1c8(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x9838
leaq 0x688(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x97e8
leaq 0x170(%rsp), %rdi
leaq 0x4e0(%rsp), %rsi
callq 0x97e8
leaq 0x70(%rsp), %rdi
callq 0x51b0
movb $0x1, %r14b
xorl %r15d, %r15d
movl %ebp, 0x10(%rsp)
jmp 0x8c3e
movq 0x38(%rsp), %rax
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
xorl %r15d, %r15d
xorl %r14d, %r14d
leaq 0x120(%rsp), %rdi
callq 0x51b0
testb %r15b, %r15b
movq 0x68(%rsp), %r15
jne 0x82b7
leaq 0xc8(%rsp), %rdi
callq 0x979a
incq %r15
testb %r14b, %r14b
leaq 0x11a0(%rsp), %r14
leaq 0x1148(%rsp), %r12
jne 0x8213
jmp 0x8ca8
movaps 0x50(%rsp), %xmm0
movq 0x38(%rsp), %rcx
movups %xmm0, (%rcx)
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x979a
leaq 0x4e0(%rsp), %rdi
callq 0x979a
leaq 0x688(%rsp), %rdi
callq 0x979a
leaq 0x660(%rsp), %rdi
callq 0x51b0
leaq 0x200(%rsp), %rdi
callq 0x51b0
leaq 0x230(%rsp), %rdi
callq 0x51b0
leaq 0x1d0(%rsp), %rdi
callq 0x51b0
leaq 0x148(%rsp), %rdi
callq 0x51b0
leaq 0x20(%rsp), %rdi
callq 0x98a8
leaq 0x318(%rsp), %rdi
callq 0x98a8
leaq 0x390(%rsp), %rdi
callq 0x98a8
leaq 0x4c8(%rsp), %rdi
callq 0x98a8
leaq 0x50(%rsp), %rdi
callq 0x98ca
movq 0x38(%rsp), %rax
addq $0x11f8, %rsp           # imm = 0x11F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x93b8
movq %rax, %r14
jmp 0x93c5
movq %rax, %r14
jmp 0x93d2
movq %rax, %r14
movl $0xf8, %r15d
leaq (%rsp,%r15), %rdi
addq $0x688, %rdi            # imm = 0x688
callq 0x51b0
addq $-0x30, %r15
cmpq $-0x28, %r15
jne 0x8d83
movb $0x1, %bpl
jmp 0x8da7
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x258(%rsp), %rdi
callq 0x51b0
jmp 0x8dbd
jmp 0x8db8
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x278(%rsp), %rdi
callq 0x51b0
jmp 0x8dd3
jmp 0x8dce
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x298(%rsp), %rdi
callq 0x51b0
jmp 0x8de9
jmp 0x8de4
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x2b8(%rsp), %rdi
callq 0x51b0
jmp 0x8dff
jmp 0x8dfa
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x2d8(%rsp), %rdi
callq 0x51b0
leaq 0x2f8(%rsp), %rdi
callq 0x51b0
cmpq %r12, %rbx
sete %al
testb %bpl, %bpl
jne 0x942a
testb %al, %al
jne 0x942a
leaq 0x688(%rsp), %rbx
leaq -0x30(%r12), %r15
addq $-0x28, %r12
movq %r12, %rdi
callq 0x51b0
movq %r15, %r12
cmpq %rbx, %r15
jne 0x8e38
jmp 0x942a
movq %rax, %r14
xorl %ebp, %ebp
jmp 0x8e0c
movq %rax, %r14
xorl %ebp, %ebp
movq %rbx, %r12
jmp 0x8e0c
movq %rax, %r14
jmp 0x942a
movq %rax, %r14
pushq $0x68
popq %r12
leaq (%rsp,%r12), %rdi
addq $0x688, %rdi            # imm = 0x688
callq 0x51b0
addq $-0x30, %r12
cmpq $-0x28, %r12
jne 0x8e76
movb $0x1, %bpl
jmp 0x8e9a
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x330(%rsp), %rdi
callq 0x51b0
jmp 0x8eb0
jmp 0x8eab
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x350(%rsp), %rdi
callq 0x51b0
jmp 0x8ece
movq %rax, %r14
xorl %ebp, %ebp
jmp 0x8ece
movq %rax, %r14
xorl %ebp, %ebp
movq %rbx, %r15
leaq 0x370(%rsp), %rdi
callq 0x51b0
cmpq %r15, %rbx
sete %al
orb %bpl, %al
jne 0x9437
leaq 0x688(%rsp), %rbx
leaq -0x30(%r15), %r12
addq $-0x28, %r15
movq %r15, %rdi
callq 0x51b0
movq %r12, %r15
cmpq %rbx, %r12
jne 0x8ef2
jmp 0x9437
movq %rax, %r14
jmp 0x9437
movq %rax, %r14
movl $0x188, %r15d           # imm = 0x188
leaq (%rsp,%r15), %rdi
addq $0x688, %rdi            # imm = 0x688
callq 0x51b0
addq $-0x30, %r15
cmpq $-0x28, %r15
jne 0x8f20
movb $0x1, %bpl
jmp 0x8f44
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x3a8(%rsp), %rdi
callq 0x51b0
jmp 0x8f5a
jmp 0x8f55
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x3c8(%rsp), %rdi
callq 0x51b0
jmp 0x8f70
jmp 0x8f6b
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x3e8(%rsp), %rdi
callq 0x51b0
jmp 0x8f86
jmp 0x8f81
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x408(%rsp), %rdi
callq 0x51b0
jmp 0x8f9c
jmp 0x8f97
movq %rax, %r14
xorl %ebp, %ebp
leaq 0x428(%rsp), %rdi
callq 0x51b0
leaq 0x448(%rsp), %rdi
callq 0x51b0
leaq 0x468(%rsp), %rdi
callq 0x51b0
leaq 0x488(%rsp), %rdi
callq 0x51b0
leaq 0x4a8(%rsp), %rdi
callq 0x51b0
cmpq %r12, %rbx
sete %al
testb %bpl, %bpl
jne 0x9444
testb %al, %al
jne 0x9444
leaq 0x688(%rsp), %rbx
leaq -0x30(%r12), %r15
addq $-0x28, %r12
movq %r12, %rdi
callq 0x51b0
movq %r15, %r12
cmpq %rbx, %r15
jne 0x8ffc
jmp 0x9444
jmp 0x901c
movq %rax, %r14
xorl %ebp, %ebp
jmp 0x8fa9
jmp 0x9025
movq %rax, %r14
xorl %ebp, %ebp
jmp 0x8fb6
jmp 0x902e
movq %rax, %r14
xorl %ebp, %ebp
jmp 0x8fc3
movq %rax, %r14
xorl %ebp, %ebp
jmp 0x8fd0
movq %rax, %r14
xorl %ebp, %ebp
movq %rbx, %r12
jmp 0x8fd0
movq %rax, %r14
jmp 0x9444
jmp 0x937a
movq %rax, %r14
jmp 0x9068
movq %rax, %r14
leaq 0x1148(%rsp), %rdi
callq 0x979a
leaq 0x11a0(%rsp), %rdi
callq 0x979a
jmp 0x939e
jmp 0x907c
movq %rax, %r14
jmp 0x93ab
movq %rax, %r14
leaq 0x870(%rsp), %rdi
callq 0x51b0
jmp 0x9099
movq %rax, %r14
leaq 0x538(%rsp), %rdi
callq 0x51b0
jmp 0x90b0
movq %rax, %r14
jmp 0x90bd
movq %rax, %r14
leaq 0xb18(%rsp), %rdi
callq 0x979a
leaq 0xb70(%rsp), %rdi
jmp 0x936f
movq %rax, %r14
leaq 0x930(%rsp), %rdi
callq 0x51b0
jmp 0x90df
movq %rax, %r14
leaq 0x5b8(%rsp), %rdi
callq 0x51b0
jmp 0x90f1
movq %rax, %r14
leaq 0xdd8(%rsp), %rdi
callq 0x979a
jmp 0x9103
movq %rax, %r14
leaq 0xe30(%rsp), %rdi
jmp 0x936f
movq %rax, %r14
leaq 0x960(%rsp), %rdi
callq 0x51b0
jmp 0x9125
movq %rax, %r14
leaq 0x5d8(%rsp), %rdi
callq 0x51b0
jmp 0x9137
movq %rax, %r14
leaq 0xe88(%rsp), %rdi
callq 0x979a
jmp 0x9149
movq %rax, %r14
leaq 0xee0(%rsp), %rdi
jmp 0x936f
movq %rax, %r14
leaq 0x990(%rsp), %rdi
callq 0x51b0
jmp 0x916b
movq %rax, %r14
leaq 0x5f8(%rsp), %rdi
callq 0x51b0
jmp 0x917d
movq %rax, %r14
leaq 0xf38(%rsp), %rdi
callq 0x979a
jmp 0x918f
movq %rax, %r14
leaq 0xf90(%rsp), %rdi
jmp 0x936f
movq %rax, %r14
leaq 0x9c0(%rsp), %rdi
callq 0x51b0
jmp 0x91d5
movq %rax, %r14
leaq 0x8d0(%rsp), %rdi
callq 0x51b0
jmp 0x91c3
movq %rax, %r14
leaq 0x578(%rsp), %rdi
callq 0x51b0
jmp 0x91f9
movq %rax, %r14
leaq 0x618(%rsp), %rdi
callq 0x51b0
jmp 0x91e7
movq %rax, %r14
leaq 0xfe8(%rsp), %rdi
callq 0x979a
jmp 0x921b
movq %rax, %r14
leaq 0xc78(%rsp), %rdi
callq 0x979a
jmp 0x920b
movq %rax, %r14
leaq 0xcd0(%rsp), %rdi
jmp 0x936f
movq %rax, %r14
leaq 0x1040(%rsp), %rdi
jmp 0x936f
movq %rax, %r14
leaq 0x900(%rsp), %rdi
callq 0x51b0
jmp 0x923d
movq %rax, %r14
leaq 0x598(%rsp), %rdi
callq 0x51b0
jmp 0x924f
movq %rax, %r14
leaq 0xd28(%rsp), %rdi
callq 0x979a
jmp 0x9261
movq %rax, %r14
leaq 0xd80(%rsp), %rdi
jmp 0x936f
movq %rax, %r14
jmp 0x929a
movq %rax, %r14
jmp 0x92a7
movq %rax, %r14
leaq 0x8a0(%rsp), %rdi
callq 0x51b0
jmp 0x928d
movq %rax, %r14
leaq 0x558(%rsp), %rdi
callq 0x51b0
leaq 0xbc8(%rsp), %rdi
callq 0x979a
leaq 0xc20(%rsp), %rdi
jmp 0x936f
jmp 0x938e
movq %rax, %r14
jmp 0x92d5
movq %rax, %r14
jmp 0x92e2
jmp 0x938e
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x979a
leaq 0x840(%rsp), %rdi
callq 0x51b0
leaq 0xa68(%rsp), %rdi
jmp 0x936f
movq %rax, %r14
jmp 0x9301
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x979a
leaq 0xa20(%rsp), %rdi
callq 0x51b0
jmp 0x9367
movq %rax, %r14
jmp 0x9349
movq %rax, %r14
jmp 0x933c
movq %rax, %r14
jmp 0x932f
movq %rax, %r14
leaq 0x9f0(%rsp), %rdi
callq 0x51b0
leaq 0x638(%rsp), %rdi
callq 0x51b0
leaq 0x1098(%rsp), %rdi
callq 0x979a
leaq 0x10f0(%rsp), %rdi
jmp 0x936f
jmp 0x938e
movq %rax, %r14
leaq 0xa48(%rsp), %rdi
jmp 0x9387
jmp 0x938e
movq %rax, %r14
leaq 0xac0(%rsp), %rdi
callq 0x979a
jmp 0x9391
jmp 0x938e
jmp 0x937a
movq %rax, %r14
jmp 0x939e
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x51b0
jmp 0x9391
movq %rax, %r14
leaq 0x120(%rsp), %rdi
callq 0x51b0
leaq 0xc8(%rsp), %rdi
callq 0x979a
leaq 0x170(%rsp), %rdi
callq 0x979a
leaq 0x4e0(%rsp), %rdi
callq 0x979a
leaq 0x688(%rsp), %rdi
callq 0x979a
leaq 0x660(%rsp), %rdi
callq 0x51b0
leaq 0x200(%rsp), %rdi
callq 0x51b0
leaq 0x230(%rsp), %rdi
callq 0x51b0
leaq 0x1d0(%rsp), %rdi
callq 0x51b0
leaq 0x148(%rsp), %rdi
callq 0x51b0
leaq 0x20(%rsp), %rdi
callq 0x98a8
leaq 0x318(%rsp), %rdi
callq 0x98a8
leaq 0x390(%rsp), %rdi
callq 0x98a8
leaq 0x4c8(%rsp), %rdi
callq 0x98a8
leaq 0x50(%rsp), %rdi
callq 0x98ca
movq %r14, %rdi
callq 0x55d0