// File: /workspace/github_cpp_makefile_star2_O1/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 0x17e7e
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x324525(%rip)    # 0x33c220
callq 0x9120
movq %rax, %r14
testl %r14d, %r14d
jle 0x17e70
leaq 0x32450d(%rip), %r15    # 0x33c220
xorl %ecx, %ecx
xorl %eax, %eax
movslq %ecx, %r13
movb (%rbx,%r13), %dl
cmpb $0x26, %dl
jne 0x17dd5
movzbl 0x1(%rbx,%r13), %edx
incq %r13
cmpl $0x74, %edx
je 0x17e0f
cmpl $0x64, %edx
je 0x17dee
cmpl $0x26, %edx
jne 0x17e4d
cmpl $0x11e, %eax            # imm = 0x11E
ja 0x17e70
movl %eax, %edi
addq %r15, %rdi
cmpb $0x0, 0x327976(%rip)    # 0x33f6d8
leaq 0x327937(%rip), %rax    # 0x33f6a0
leaq 0x2f5380(%rip), %rcx    # 0x30d0f0
cmoveq %rcx, %rax
movsd (%rax), %xmm0
leaq 0x327929(%rip), %rax    # 0x33f6a8
leaq 0x2f537a(%rip), %rcx    # 0x30d100
cmoveq %rcx, %rax
movsd (%rax), %xmm1
leaq 0x32791b(%rip), %rax    # 0x33f6b0
leaq 0x2f536c(%rip), %rcx    # 0x30d108
cmoveq %rcx, %rax
movsd (%rax), %xmm2
leaq 0x32790d(%rip), %rax    # 0x33f6b8
leaq 0x2f539e(%rip), %rcx    # 0x30d150
cmoveq %rcx, %rax
movsd (%rax), %xmm3
leaq 0xf2ca6(%rip), %rsi     # 0x10aa67
leaq 0xf2cbe(%rip), %rax     # 0x10aa86
cmoveq %rax, %rsi
movb $0x4, %al
callq 0x9060
jmp 0x17e43
movl %eax, %eax
movb %dl, (%rax,%r15)
movb $0x0, 0x1(%rax,%r15)
testb %dl, %dl
je 0x17e70
incq %rax
jmp 0x17e58
cmpl $0x137, %eax            # imm = 0x137
ja 0x17e70
movl %eax, %r12d
addq %r15, %r12
xorl %edi, %edi
callq 0xef1b0
movq %r12, %rdi
movq %rax, %rsi
callq 0x9340
jmp 0x17e43
cmpl $0x137, %eax            # imm = 0x137
ja 0x17e70
movl %eax, %edi
addq %r15, %rdi
movl 0x2f56e7(%rip), %edx    # 0x30d508
movl 0x2f56dd(%rip), %ecx    # 0x30d504
movl 0x2f56d2(%rip), %r8d    # 0x30d500
leaq 0xf2c85(%rip), %rsi     # 0x10aaba
leaq 0x2f5af4(%rip), %r9     # 0x30d930
xorl %eax, %eax
callq 0x9060
movq %r15, %rdi
callq 0x9120
jmp 0x17e5b
movl %eax, %edx
incl %eax
movw $0x26, (%rdx,%r15)
movl %ecx, %r13d
movl %r13d, %ecx
incl %ecx
cmpl %r14d, %ecx
jge 0x17e70
cmpl $0x14a, %eax            # imm = 0x14A
jb 0x17d17
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq