// File: joao18araujo[P]pierluigi/src/interval.cpp
// Function: Interval::Interval(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
Interval::Interval(string s_interval, bool ascendant){
  string s_quantitative = "", s_qualitative = "";
  bool is_on_number = false;
  this->direction = (ascendant ? 1 : -1);

  for(auto & c : s_interval){
    if(is_on_number)
      s_quantitative += c;
    else
      s_qualitative += c;

    if(c == 'd' || c == 'A' || c == 'm' || c == 'M' || c == 'P'){
      is_on_number = true;
    }
  }

  this->quantitative = stoi(s_quantitative);

  int note_diff = this->quantitative;
  int octave_diff = 0;
  if(note_diff > N_NOTES + 1){
    octave_diff = (note_diff - 2) / N_NOTES;
    while(note_diff > N_NOTES + 1)
      note_diff -= N_NOTES;
  }

  for(int i = 0; i < 17; ++i){
    if(intervals[note_diff][i] == s_qualitative){
      this->half_tones = i + octave_diff * N_SCALE;
      this->qualitative = s_qualitative;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rsi, -0xc8(%rbp)
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
addq $0x8, %rdi
movq %rdi, -0xb8(%rbp)
callq 0x6650
leaq -0x39(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x6830
movq -0xb0(%rbp), %rdx
leaq 0x44b98(%rip), %rsi     # 0x607d2
leaq -0x38(%rbp), %rdi
callq 0xfb20
jmp 0x1bc45
leaq -0x39(%rbp), %rdi
callq 0x64f0
leaq -0x71(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x6830
movq -0xd0(%rbp), %rdx
leaq 0x44b66(%rip), %rsi     # 0x607d2
leaq -0x70(%rbp), %rdi
callq 0xfb20
jmp 0x1bc77
leaq -0x71(%rbp), %rdi
callq 0x64f0
movq -0xc0(%rbp), %rcx
movq -0xc8(%rbp), %rax
movb $0x0, -0x72(%rbp)
movb -0x11(%rbp), %dil
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %esi
testb $0x1, %dil
cmovnel %esi, %edx
movw %dx, 0x2c(%rcx)
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
callq 0x63f0
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
callq 0x6290
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x1c7c0
testb $0x1, %al
jne 0x1bceb
jmp 0x1bde2
leaq -0x88(%rbp), %rdi
callq 0x1c800
movq %rax, -0x98(%rbp)
testb $0x1, -0x72(%rbp)
je 0x1bd69
movq -0x98(%rbp), %rax
movsbl (%rax), %esi
leaq -0x38(%rbp), %rdi
callq 0x62f0
jmp 0x1bd19
jmp 0x1bd80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x64f0
jmp 0x1bf0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x71(%rbp), %rdi
callq 0x64f0
jmp 0x1bf05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x62d0
jmp 0x1bf05
movq -0x98(%rbp), %rax
movsbl (%rax), %esi
leaq -0x70(%rbp), %rdi
callq 0x62f0
jmp 0x1bd7e
jmp 0x1bd80
movq -0x98(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x64, %eax
je 0x1bdcb
movq -0x98(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
je 0x1bdcb
movq -0x98(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x6d, %eax
je 0x1bdcb
movq -0x98(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x4d, %eax
je 0x1bdcb
movq -0x98(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x50, %eax
jne 0x1bdcf
movb $0x1, -0x72(%rbp)
jmp 0x1bdd1
leaq -0x88(%rbp), %rdi
callq 0x1c820
jmp 0x1bccf
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
movl $0xa, %edx
callq 0x1c840
movl %eax, -0xd4(%rbp)
jmp 0x1bdfc
movq -0xc0(%rbp), %rax
movl -0xd4(%rbp), %ecx
movl %ecx, (%rax)
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
cmpl $0x8, -0x9c(%rbp)
jle 0x1be59
movl -0x9c(%rbp), %eax
subl $0x2, %eax
movl $0x7, %ecx
cltd
idivl %ecx
movl %eax, -0xa0(%rbp)
cmpl $0x8, -0x9c(%rbp)
jle 0x1be57
movl -0x9c(%rbp), %eax
subl $0x7, %eax
movl %eax, -0x9c(%rbp)
jmp 0x1be3d
jmp 0x1be59
movl $0x0, -0xa4(%rbp)
cmpl $0x11, -0xa4(%rbp)
jge 0x1beea
movslq -0x9c(%rbp), %rax
leaq 0x9c2fa56(%rip), %rdi   # 0x9c4b8d0
imulq $0x220, %rax, %rax      # imm = 0x220
addq %rax, %rdi
movslq -0xa4(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x70(%rbp), %rsi
callq 0x1c880
testb $0x1, %al
jne 0x1bea1
jmp 0x1bed4
movq -0xc0(%rbp), %rdi
movl -0xa4(%rbp), %ecx
movl -0xa0(%rbp), %edx
movl %edx, %eax
leal (%rax,%rax,2), %edx
movl %ecx, %eax
movl %edx, %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x28(%rdi)
addq $0x8, %rdi
leaq -0x70(%rbp), %rsi
callq 0x6070
jmp 0x1bed2
jmp 0x1bed4
jmp 0x1bed6
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x1be63
leaq -0x70(%rbp), %rdi
callq 0x62d0
leaq -0x38(%rbp), %rdi
callq 0x62d0
addq $0xe0, %rsp
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x62d0
movq -0xb8(%rbp), %rdi
callq 0x62d0
movq -0x48(%rbp), %rdi
callq 0x6820
nopw %cs:(%rax,%rax)