// File: /workspace/github_cpp_makefile_star2_O3/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 0x17eb4
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x3244ef(%rip)    # 0x33c220
callq 0x9120
movq %rax, %r14
testl %r14d, %r14d
jle 0x17ea6
leaq 0x3244d7(%rip), %r15    # 0x33c220
xorl %ecx, %ecx
xorl %eax, %eax
movslq %ecx, %r13
movb (%rbx,%r13), %dl
cmpb $0x26, %dl
jne 0x17e0b
movzbl 0x1(%rbx,%r13), %edx
incq %r13
cmpl $0x74, %edx
je 0x17e45
cmpl $0x64, %edx
je 0x17e24
cmpl $0x26, %edx
jne 0x17e83
cmpl $0x11e, %eax            # imm = 0x11E
ja 0x17ea6
movl %eax, %edi
addq %r15, %rdi
cmpb $0x0, 0x327940(%rip)    # 0x33f6d8
leaq 0x327901(%rip), %rax    # 0x33f6a0
leaq 0x2f534a(%rip), %rcx    # 0x30d0f0
cmoveq %rcx, %rax
movsd (%rax), %xmm0
leaq 0x3278f3(%rip), %rax    # 0x33f6a8
leaq 0x2f5344(%rip), %rcx    # 0x30d100
cmoveq %rcx, %rax
movsd (%rax), %xmm1
leaq 0x3278e5(%rip), %rax    # 0x33f6b0
leaq 0x2f5336(%rip), %rcx    # 0x30d108
cmoveq %rcx, %rax
movsd (%rax), %xmm2
leaq 0x3278d7(%rip), %rax    # 0x33f6b8
leaq 0x2f5368(%rip), %rcx    # 0x30d150
cmoveq %rcx, %rax
movsd (%rax), %xmm3
leaq 0xf2c80(%rip), %rsi     # 0x10aa77
leaq 0xf2c98(%rip), %rax     # 0x10aa96
cmoveq %rax, %rsi
movb $0x4, %al
callq 0x9060
jmp 0x17e79
movl %eax, %eax
movb %dl, (%rax,%r15)
movb $0x0, 0x1(%rax,%r15)
testb %dl, %dl
je 0x17ea6
incq %rax
jmp 0x17e8e
cmpl $0x137, %eax            # imm = 0x137
ja 0x17ea6
movl %eax, %r12d
addq %r15, %r12
xorl %edi, %edi
callq 0xef8e6
movq %r12, %rdi
movq %rax, %rsi
callq 0x9340
jmp 0x17e79
cmpl $0x137, %eax            # imm = 0x137
ja 0x17ea6
movl %eax, %edi
addq %r15, %rdi
movl 0x2f56b1(%rip), %edx    # 0x30d508
movl 0x2f56a7(%rip), %ecx    # 0x30d504
movl 0x2f569c(%rip), %r8d    # 0x30d500
leaq 0xf2c5f(%rip), %rsi     # 0x10aaca
leaq 0x2f5abe(%rip), %r9     # 0x30d930
xorl %eax, %eax
callq 0x9060
movq %r15, %rdi
callq 0x9120
jmp 0x17e91
movl %eax, %edx
incl %eax
movw $0x26, (%rdx,%r15)
movl %ecx, %r13d
movl %r13d, %ecx
incl %ecx
cmpl %r14d, %ecx
jge 0x17ea6
cmpl $0x14a, %eax            # imm = 0x14A
jb 0x17d4d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq