// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heather.cpp
// Function: format_plot_title(char*)
void format_plot_title(char *title)
{
int len;
int i, j;
char c;

   if(title == 0) return;

   j = 0;
   i = 0;
   out[0] = 0;
   len = strlen(title);

   for(i=0; i<len; i++) {
      if((unsigned) j > (sizeof(plot_title)-2)) break;

      c = title[i];
      if(c == '&') {
         if(title[i+1] == '&') {  // && -> disciplining parameters
            if((unsigned)j > (sizeof(plot_title)-45)) break;
            if(osc_control_on) {
               sprintf(&out[j], "(OSC PID: P=%f D=%f F=%f I=%f)", OSC_P_GAIN, OSC_D_TC, OSC_FILTER_TC, OSC_I_TC);
            }
            else {
               sprintf(&out[j], "(TC=%.3f  DAMPING=%.3f  GAIN=%.3f Hz/V  INITV:%.3f)",
                   time_constant, damping_factor, osc_gain, initial_voltage);
            }
            j = strlen(out);
            ++i;
         }
         else if(title[i+1] == 'd') {  // &d -> date
            if((unsigned)j > (sizeof(plot_title)-20)) break;
            sprintf(&out[j], "%s", fmt_date(0));
            j = strlen(out);
            ++i;
         }
         else if(title[i+1] == 't') {  // &t -> time
            if((unsigned)j > (sizeof(plot_title)-20)) break;
            sprintf(&out[j], "%02d:%02d:%02d %s", pri_hours,pri_minutes,pri_seconds, tz_string);
            j = strlen(out);
            ++i;
         }
         else {
            out[j++] = '&';
            out[j] = 0;
         }
      }
      else {
         out[j++] = c;
         out[j] = 0;
         if(c == 0) break;
      }
   }
}

// Assembly:
testq %rdi, %rdi
je 0x1747e
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x30ef23(%rip)    # 0x326220
callq 0x9120
movq %rax, %r14
leaq 0x30ef14(%rip), %r15    # 0x326220
xorl %eax, %eax
xorl %ecx, %ecx
cmpl %r14d, %ecx
jge 0x17470
cmpl $0x149, %eax            # imm = 0x149
ja 0x17470
movslq %ecx, %r13
movb (%rbx,%r13), %dl
movl %eax, %r12d
cmpb $0x26, %dl
jne 0x173e6
movzbl 0x1(%rbx,%r13), %edx
incq %r13
cmpl $0x74, %edx
je 0x1741a
cmpl $0x64, %edx
je 0x173fc
cmpl $0x26, %edx
jne 0x17459
cmpl $0x11e, %eax            # imm = 0x11E
ja 0x17470
addq %r15, %r12
cmpb $0x0, 0x312368(%rip)    # 0x3296d8
leaq 0x312329(%rip), %rax    # 0x3296a0
leaq 0x2dfd72(%rip), %rcx    # 0x2f70f0
cmoveq %rcx, %rax
movsd (%rax), %xmm0
leaq 0x31231b(%rip), %rax    # 0x3296a8
leaq 0x2dfd6c(%rip), %rcx    # 0x2f7100
cmoveq %rcx, %rax
movsd (%rax), %xmm1
leaq 0x31230d(%rip), %rax    # 0x3296b0
leaq 0x2dfd5e(%rip), %rcx    # 0x2f7108
cmoveq %rcx, %rax
movsd (%rax), %xmm2
leaq 0x3122ff(%rip), %rax    # 0x3296b8
leaq 0x2dfd90(%rip), %rcx    # 0x2f7150
cmoveq %rcx, %rax
movsd (%rax), %xmm3
leaq 0xdd723(%rip), %rsi     # 0xf4af2
leaq 0xdd73b(%rip), %rax     # 0xf4b11
cmoveq %rax, %rsi
movq %r12, %rdi
movb $0x4, %al
callq 0x9060
jmp 0x1744f
movb %dl, (%r12,%r15)
movb $0x0, 0x1(%r12,%r15)
testb %dl, %dl
je 0x17470
incq %r12
movl %r12d, %eax
jmp 0x17462
cmpl $0x137, %eax            # imm = 0x137
ja 0x17470
addq %r15, %r12
xorl %edi, %edi
callq 0xdab87
movq %r12, %rdi
movq %rax, %rsi
callq 0x9330
jmp 0x1744f
cmpl $0x137, %eax            # imm = 0x137
ja 0x17470
addq %r15, %r12
movl 0x2e00de(%rip), %edx    # 0x2f7508
movl 0x2e00d4(%rip), %ecx    # 0x2f7504
movl 0x2e00c9(%rip), %r8d    # 0x2f7500
movq %r12, %rdi
leaq 0xdd704(%rip), %rsi     # 0xf4b45
leaq 0x2e04e8(%rip), %r9     # 0x2f7930
xorl %eax, %eax
callq 0x9060
movq %r15, %rdi
callq 0x9120
jmp 0x17465
incl %eax
movw $0x26, (%r12,%r15)
movl %ecx, %r13d
incl %r13d
movl %r13d, %ecx
jmp 0x17310
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq