// File: /workspace/github_cpp_makefile_star2_O1/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 0x1a9ac
leaq 0x16c5c(%rip), %rsi     # 0x3b55b
leaq 0x28(%rsp), %rdi
movl $0x10, %edx
callq 0x26334
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 0x1748d(%rip), %r8      # 0x3bdc9
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rcx
movl $0x2, %r9d
callq 0x33675
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5420
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x24976
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x28(%rsp), %rdi
callq 0x2639c
leaq 0x16bc2(%rip), %rsi     # 0x3b549
leaq 0x28(%rsp), %rdi
movl $0x10, %edx
callq 0x26334
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 0x16cc0(%rip), %r8      # 0x3b682
leaq 0x28(%rsp), %rcx
movl $0x2, %r9d
callq 0x33675
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5420
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x249f7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x28(%rsp), %rdi
callq 0x2639c
movq %r14, %rdi
callq 0x1c186
testb %al, %al
je 0x24b29
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 0x15c13
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 0x1705a(%rip), %r12     # 0x3baef
decl %ebp
cmpl $0x2, %ebp
jl 0x24aa9
movq %r15, %rdi
movq %r12, %rsi
callq 0x5650
jmp 0x24a95
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x5110
cmpb $0x1, 0x55(%r14)
jne 0x24b00
leaq 0x16bbe(%rip), %rsi     # 0x3b687
leaq 0x28(%rsp), %rdi
movq %rbx, %rdx
callq 0x18822
leaq 0x28(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5420
movq (%r14), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x24b00
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5360
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x24b17
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 0x24b4d
addl $-0x2, %ebp
leaq 0x16b4d(%rip), %r15     # 0x3b685
decl %ebp
je 0x24a11
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5650
jmp 0x24b38
addl $-0x4, %ebp
leaq 0x166ab(%rip), %r15     # 0x3b202
incl %ebp
je 0x24a11
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5650
jmp 0x24b57
jmp 0x24ba7
jmp 0x24ba7
jmp 0x24ba2
jmp 0x24ba2
jmp 0x24b78
jmp 0x24ba2
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x24b92
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
leaq 0x28(%rsp), %rdi
callq 0x2639c
jmp 0x24bc1
jmp 0x24ba2
jmp 0x24ba2
movq %rax, %r14
jmp 0x24bc1
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x24bc1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5360
movq (%rbx), %rdi
addq $0x10, %rbx
cmpq %rbx, %rdi
je 0x24bd8
movq (%rbx), %rsi
incq %rsi
callq 0x5360
movq %r14, %rdi
callq 0x55e0