// File: /workspace/github_cpp_makefile_star2_O3/joao18araujo[P]pierluigi/src/song_reader.cpp
// Function: SongReader::note_to_string[abi:cxx11](Note)
string SongReader::note_to_string(Note note){
  int octave_diff = note.octave - BELOW_MIDDLE_C_OCTAVE;
  string s = note.full_note();

  s = regex_replace(s, regex("#"), "is");
  s = regex_replace(s, regex("\u266D"), "es");

  if(not note.rest()){
    if(octave_diff > 0){
      while(octave_diff--)
        s += "\'";
    }else{
      while(octave_diff++)
        s += ",";
    }
  }

  string duration = to_string((note.duration ? QUANT / msb(note.duration) : 0));
  int total_dots = number_of_on_bits(note.duration) - 1;
  while(total_dots-- > 0){
    duration += ".";
  }

  s += duration;

  if(note.linked){
    s = "~ " + s;
  }

  return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x48(%rsi), %ebp
callq 0x1aa08
leaq 0x16c3c(%rip), %rsi     # 0x3b55b
leaq 0x28(%rsp), %rdi
movl $0x10, %edx
callq 0x26350
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movl $0x0, (%rsp)
leaq 0x1746d(%rip), %r8      # 0x3bdc9
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rcx
movl $0x2, %r9d
callq 0x336af
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5420
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x24996
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x28(%rsp), %rdi
callq 0x263b8
leaq 0x16ba2(%rip), %rsi     # 0x3b549
leaq 0x28(%rsp), %rdi
movl $0x10, %edx
callq 0x26350
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movl $0x0, (%rsp)
leaq 0x16ca0(%rip), %r8      # 0x3b682
leaq 0x28(%rsp), %rcx
movl $0x2, %r9d
callq 0x336af
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5420
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x24a17
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x28(%rsp), %rdi
callq 0x263b8
movq %r14, %rdi
callq 0x1c1fa
testb %al, %al
je 0x24b49
movl (%r14), %eax
bsrl %eax, %ecx
movl $0x20, %ebp
shrl %cl, %ebp
testl %eax, %eax
cmovel %eax, %ebp
cmpl $0xa, %ebp
movl $0x2, %r12d
sbbl $0x0, %r12d
leaq 0x8(%rsp), %rdi
movq %r13, (%rdi)
movq %r12, %rsi
movl $0x2d, %edx
callq 0x53f0
leaq 0x8(%rsp), %r15
movq (%r15), %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x15c7f
movl (%r14), %eax
movl %eax, %ecx
shrl %ecx
andl $0x55555555, %ecx       # imm = 0x55555555
subl %ecx, %eax
movl $0x33333333, %ecx       # imm = 0x33333333
movl %eax, %edx
andl %ecx, %edx
shrl $0x2, %eax
andl %ecx, %eax
addl %edx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
addl %eax, %ecx
andl $0xf0f0f0f, %ecx        # imm = 0xF0F0F0F
imull $0x1010101, %ecx, %ebp  # imm = 0x1010101
shrl $0x18, %ebp
incl %ebp
leaq 0x1703a(%rip), %r12     # 0x3baef
decl %ebp
cmpl $0x2, %ebp
jl 0x24ac9
movq %r15, %rdi
movq %r12, %rsi
callq 0x5650
jmp 0x24ab5
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x5110
cmpb $0x1, 0x55(%r14)
jne 0x24b20
leaq 0x16b9e(%rip), %rsi     # 0x3b687
leaq 0x28(%rsp), %rdi
movq %rbx, %rdx
callq 0x188b0
leaq 0x28(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5420
movq (%r14), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x24b20
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5360
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x24b37
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, %ebp
jle 0x24b6d
addl $-0x2, %ebp
leaq 0x16b2d(%rip), %r15     # 0x3b685
decl %ebp
je 0x24a31
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5650
jmp 0x24b58
addl $-0x4, %ebp
leaq 0x1668b(%rip), %r15     # 0x3b202
incl %ebp
je 0x24a31
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5650
jmp 0x24b77
jmp 0x24bc7
jmp 0x24bc7
jmp 0x24bc2
jmp 0x24bc2
jmp 0x24b98
jmp 0x24bc2
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x24bb2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x28(%rsp), %rdi
callq 0x263b8
jmp 0x24be1
jmp 0x24bc2
jmp 0x24bc2
movq %rax, %r14
jmp 0x24be1
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x24be1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
movq (%rbx), %rdi
addq $0x10, %rbx
cmpq %rbx, %rdi
je 0x24bf8
movq (%rbx), %rsi
incq %rsi
callq 0x5360
movq %r14, %rdi
callq 0x55e0