// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x48(%rsi), %ebp
callq 0x1265c
leaq 0x11481(%rip), %rsi     # 0x295a4
movq %rsp, %rdi
pushq $0x10
popq %rdx
callq 0x18db8
leaq 0x11ce4(%rip), %rcx     # 0x29e19
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
movq %rbx, %rsi
xorl %r8d, %r8d
callq 0x18e38
leaq 0x20(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5400
movq %r15, %rdi
callq 0x51b0
movq %rsp, %rdi
callq 0x18e1e
leaq 0x1141b(%rip), %rsi     # 0x2958a
movq %rsp, %rdi
pushq $0x10
popq %rdx
callq 0x18db8
leaq 0x11551(%rip), %rcx     # 0x296d2
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
movq %rbx, %rsi
xorl %r8d, %r8d
callq 0x18e38
leaq 0x20(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5400
movq %r15, %rdi
callq 0x51b0
movq %rsp, %rdi
callq 0x18e1e
movq %r14, %rdi
callq 0x1302a
testb %al, %al
je 0x1828b
movl (%r14), %eax
bsrl %eax, %ecx
pushq $0x20
popq %rsi
shrl %cl, %esi
testl %eax, %eax
cmovel %eax, %esi
leaq 0x20(%rsp), %rdi
callq 0xf8f4
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 0x11923(%rip), %r15     # 0x29b3f
leaq 0x20(%rsp), %r12
decl %ebp
cmpl $0x2, %ebp
jl 0x18235
movq %r12, %rdi
movq %r15, %rsi
callq 0x5620
jmp 0x18221
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x5650
cmpb $0x1, 0x55(%r14)
jne 0x18271
leaq 0x11487(%rip), %rsi     # 0x296d7
movq %rsp, %rdi
movq %rbx, %rdx
callq 0x115e5
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5400
movq %r14, %rdi
callq 0x51b0
leaq 0x20(%rsp), %rdi
callq 0x51b0
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, %ebp
jle 0x182af
addl $-0x2, %ebp
leaq 0x1143b(%rip), %r15     # 0x296d5
decl %ebp
je 0x181c4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5620
jmp 0x1829a
addl $-0x4, %ebp
leaq 0x10f59(%rip), %r15     # 0x29212
incl %ebp
je 0x181c4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5620
jmp 0x182b9
jmp 0x182f0
jmp 0x182f0
jmp 0x182eb
jmp 0x182eb
jmp 0x182da
jmp 0x182eb
movq %rax, %r14
movq %rsp, %rdi
callq 0x18e1e
jmp 0x182fd
jmp 0x182eb
jmp 0x182eb
movq %rax, %r14
jmp 0x182fd
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x51b0
movq %rbx, %rdi
callq 0x51b0
movq %r14, %rdi
callq 0x55d0
nop