// File: /workspace/github_cpp_makefile_star2_O3/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 0x266dc(%rip), %rdx     # 0x3b6fa
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0xb5f8
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x266bc(%rip), %rdx     # 0x3b6fa
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0xb5f8
movzbl %bpl, %eax
decl %eax
orl $0x1, %eax
movq 0x8(%rsp), %rcx
movw %ax, 0x2c(%rcx)
movq 0x8(%r13), %rbp
testq %rbp, %rbp
je 0x150b0
movq (%r13), %r13
xorl %ebx, %ebx
movabsq $0x100800009001, %r12   # imm = 0x100800009001
xorl %r14d, %r14d
movq %r15, %rdi
testb $0x1, %r14b
jne 0x15087
leaq 0x20(%rsp), %rdi
movsbl (%r13,%rbx), %esi
callq 0x52e0
movb (%r13,%rbx), %cl
addb $-0x41, %cl
cmpb $0x2c, %cl
ja 0x150a8
movq %r12, %rax
shrq %cl, %rax
orb %al, %r14b
incq %rbx
cmpq %rbx, %rbp
jne 0x15079
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 0x151f5
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x15201
movl (%r15), %ecx
cmpl $0x22, %ecx
je 0x15201
testl %ecx, %ecx
jne 0x15103
movl %ebp, (%r15)
movq 0x8(%rsp), %rcx
movl %eax, (%rcx)
cmpl $0x9, %eax
jl 0x1513e
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 0x15141
xorl %r12d, %r12d
cltq
imulq $0x220, %rax, %rbx      # imm = 0x220
leaq 0x9bfd63f(%rip), %r13   # 0x9c12790
leaq (%rbx,%r13), %rbp
movl $0x8, %r14d
leaq 0x20(%rsp), %r15
leaq (%rbx,%r14), %rax
movq (%r13,%rax), %rdx
cmpq 0x28(%rsp), %rdx
jne 0x1519e
testq %rdx, %rdx
je 0x15188
movq 0x20(%rsp), %rsi
movq -0x8(%rbp,%r14), %rdi
callq 0x5380
testl %eax, %eax
jne 0x1519e
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 0x15160
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x151ca
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5360
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x151e6
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 0x25ee5(%rip), %rdi     # 0x3b0e1
callq 0x5200
leaq 0x25ed9(%rip), %rdi     # 0x3b0e1
callq 0x54d0
movq %rax, %r14
jmp 0x15246
movq %rax, %r14
jmp 0x15262
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x1522a
movl %ebp, (%r15)
jmp 0x1522a
jmp 0x15227
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x15246
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5360
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x15262
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5360
movq 0x18(%rsp), %rax
movq (%rax), %rdi
cmpq 0x10(%rsp), %rdi
je 0x15281
movq 0x10(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x5360
movq %r14, %rdi
callq 0x55e0
nop