// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %ebp
movq %rsi, %r13
leaq 0x8(%rdi), %rax
movq %rax, 0x18(%rsp)
leaq 0x18(%rdi), %rax
movq %rax, 0x10(%rsp)
movq %rax, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
movq %rdi, 0x8(%rsp)
movb $0x0, 0x18(%rdi)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x26754(%rip), %rdx     # 0x3b6fa
leaq 0x40(%rsp), %rdi
movq %rdx, %rsi
callq 0xb62c
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x26737(%rip), %rdx     # 0x3b6fa
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rdx, %rsi
callq 0xb62c
movzbl %bpl, %eax
decl %eax
orl $0x1, %eax
movq 0x8(%rsp), %rcx
movw %ax, 0x2c(%rcx)
movq 0x8(%r13), %rbp
testq %rbp, %rbp
je 0x1503a
movq (%r13), %rbx
xorl %r14d, %r14d
movabsq $0x100800009001, %r13   # imm = 0x100800009001
xorl %r15d, %r15d
movsbl (%rbx,%r14), %esi
testb $0x1, %r15b
movq %r12, %rdi
leaq 0x40(%rsp), %rax
cmovneq %rax, %rdi
callq 0x52e0
movzbl (%rbx,%r14), %eax
addl $-0x41, %eax
cmpl $0x2c, %eax
ja 0x15032
btq %rax, %r13
jae 0x15032
movb $0x1, %r15b
incq %r14
cmpq %r14, %rbp
jne 0x15002
movq 0x40(%rsp), %r12
callq 0x5060
movq %rax, %r15
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0x60(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movl $0xa, %edx
callq 0x5490
cmpq %r12, (%r13)
je 0x15181
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x1518d
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x1518d
testl %ecx, %ecx
jne 0x1508d
movl %ebp, (%r15)
movq 0x8(%rsp), %rcx
movl %eax, (%rcx)
cmpl $0x8, %eax
jle 0x150c8
leal -0x2(%rax), %ecx
imulq $0x24924925, %rcx, %rdx # imm = 0x24924925
shrq $0x20, %rdx
subl %edx, %ecx
shrl %ecx
addl %edx, %ecx
movl %ecx, %edx
shrl $0x2, %edx
leal (,%rdx,8), %esi
subl %esi, %edx
addl %eax, %edx
andl $-0x4, %ecx
leal (%rcx,%rcx,2), %r12d
movl %edx, %eax
jmp 0x150cb
xorl %r12d, %r12d
cltq
imulq $0x220, %rax, %r13      # imm = 0x220
leaq 0x9bfd6b5(%rip), %rbp   # 0x9c12790
movq %rbp, %rbx
addq %r13, %rbx
movl $0x8, %r14d
leaq 0x20(%rsp), %r15
leaq (%r14,%r13), %rax
movq (%rbp,%rax), %rdx
cmpq 0x28(%rsp), %rdx
jne 0x1512a
testq %rdx, %rdx
je 0x15114
movq 0x20(%rsp), %rsi
movq -0x8(%rbx,%r14), %rdi
callq 0x5380
testl %eax, %eax
jne 0x1512a
movq 0x8(%rsp), %rax
movl %r12d, 0x28(%rax)
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x51e0
incl %r12d
addq $0x20, %r14
cmpq $0x228, %r14            # imm = 0x228
jne 0x150ec
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x15156
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5360
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x15172
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5360
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x25f59(%rip), %rdi     # 0x3b0e1
callq 0x5200
leaq 0x25f4d(%rip), %rdi     # 0x3b0e1
callq 0x54d0
movq %rax, %r14
jmp 0x151d2
movq %rax, %r14
jmp 0x151ee
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x151b6
movl %ebp, (%r15)
jmp 0x151b6
jmp 0x151b3
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x151d2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5360
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x151ee
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5360
movq 0x18(%rsp), %rax
movq (%rax), %rdi
cmpq 0x10(%rsp), %rdi
je 0x1520d
movq 0x10(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5360
movq %r14, %rdi
callq 0x55e0
nop