// File: joao18araujo[P]pierluigi/src/counterpoint.cpp
// Function: Counterpoint::analyse_and_add_interval(bool, bool, std::vector<Interval, std::allocator<Interval>>&, Note, Note, Interval, Song*)
void Counterpoint::analyse_and_add_interval(bool reverse_movement, bool melodic_ascendant, vector<Interval> & possible_intervals, Note previous_counterpoint_note, Note note, Interval interval, Song *){
  Note next_note = Scale::interval_to_note_on_scale(note, interval, song->scale);
  if(!next_note.valid){
    return;
  }
  Interval melodic_interval(previous_counterpoint_note, next_note);
  bool can_jump = (reverse_movement or melodic_interval.quantitative <= 4 or melodic_interval.quantitative == 8);
  if((can_jump and (melodic_ascendant == melodic_interval.ascendant()) and note.valid) or previous_counterpoint_note.rest())
    possible_intervals.push_back(interval);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %r9, -0x2c0(%rbp)
movq %r8, -0x2c8(%rbp)
movq %rcx, -0x2d0(%rbp)
movl %esi, %eax
movq -0x2c8(%rbp), %rsi
movq 0x10(%rbp), %r8
andb $0x1, %dil
movb %dil, -0x1(%rbp)
andb $0x1, %al
movb %al, -0x2(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %r9, -0x28(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x22ce0
movq -0x2c0(%rbp), %rsi
leaq -0x108(%rbp), %rdi
callq 0xfdb0
jmp 0xf6eb
movq 0x9c3bef6(%rip), %rsi   # 0x9c4b5e8
addq $0x18, %rsi
leaq -0x1c8(%rbp), %rdi
callq 0x10110
jmp 0xf704
leaq -0x80(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
leaq -0x108(%rbp), %rdx
leaq -0x1c8(%rbp), %rcx
callq 0x27790
jmp 0xf724
leaq -0x1c8(%rbp), %rdi
callq 0x101b0
leaq -0x108(%rbp), %rdi
callq 0xfc90
leaq -0xd8(%rbp), %rdi
callq 0xfd80
testb $0x1, -0x2c(%rbp)
jne 0xf7c0
movl $0x1, -0x1cc(%rbp)
jmp 0xf969
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0xf7af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0xf7a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x101b0
leaq -0x108(%rbp), %rdi
callq 0xfc90
leaq -0xd8(%rbp), %rdi
callq 0xfd80
jmp 0xf984
movq -0x2d0(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x22ce0
jmp 0xf7d5
leaq -0x2b0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x22ce0
jmp 0xf7e7
leaq -0x200(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x2b0(%rbp), %rdx
callq 0x1bf30
jmp 0xf803
leaq -0x2b0(%rbp), %rdi
callq 0xfd80
leaq -0x258(%rbp), %rdi
callq 0xfd80
movb $0x1, %al
testb $0x1, -0x1(%rbp)
movb %al, -0x2d1(%rbp)
jne 0xf84a
movb $0x1, %al
cmpl $0x4, -0x200(%rbp)
movb %al, -0x2d1(%rbp)
jle 0xf84a
cmpl $0x8, -0x200(%rbp)
sete %al
movb %al, -0x2d1(%rbp)
movb -0x2d1(%rbp), %al
andb $0x1, %al
movb %al, -0x2b1(%rbp)
testb $0x1, -0x2b1(%rbp)
je 0xf8a5
movzbl -0x2(%rbp), %eax
andl $0x1, %eax
movl %eax, -0x2d8(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x1c680
movb %al, -0x2d2(%rbp)
jmp 0xf882
movl -0x2d8(%rbp), %eax
movb -0x2d2(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0xf8a5
movq -0x2c8(%rbp), %rax
testb $0x1, 0x54(%rax)
jne 0xf8c8
movq -0x2d0(%rbp), %rdi
callq 0x23be0
movb %al, -0x2d9(%rbp)
jmp 0xf8b9
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0xf8c8
jmp 0xf953
movq -0x2c0(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x101f0
jmp 0xf8da
jmp 0xf953
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0xf97b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0xf925
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0xfd80
leaq -0x258(%rbp), %rdi
callq 0xfd80
jmp 0xf97b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x200(%rbp), %rdi
callq 0xfc90
jmp 0xf97b
leaq -0x200(%rbp), %rdi
callq 0xfc90
movl $0x0, -0x1cc(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xfd80
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
leaq -0x80(%rbp), %rdi
callq 0xfd80
movq -0x110(%rbp), %rdi
callq 0x6820