LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: free_mtie_data(int)
void free_mtie_data(int id)
{
int i;

   if(id < 0) return;
   if(id > MAX_MTIE_CHANS) return;
   if(mtie_taus[id] == 0) return;

   for(i=0; i<mtie_kmax; i++) {
      if(mtie_taus[id][i].vals) {
         if(mtie_taus[id][i].vals->min_vals) free(mtie_taus[id][i].vals->min_vals);
         if(mtie_taus[id][i].vals->max_vals) free(mtie_taus[id][i].vals->max_vals);
      }
   }

   for(i=0; i<mtie_kmax; i++) {
      if(mtie_taus[id][i].vals) {
         free(mtie_taus[id][i].vals);
      }
   }

   free(mtie_taus[id]);
   mtie_taus[id] = 0;

   if(mtie_buf[id]) {
      free(mtie_buf[id]);
      mtie_buf[id] = 0;
   }

   mtie_q_count[id] = 0;
   mtie_q_in = mtie_q_out = 0;
}

// Assembly:
cmpl $0x4, %edi
ja 0xfe05f
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq 0x357441(%rip), %r14    # 0x4553d0
cmpq $0x0, (%r14,%rbx,8)
je 0xfe055
cmpl $0x0, 0x357453(%rip)    # 0x4553f4
jle 0xfe00f
xorl %r15d, %r15d
movq (%r14,%rbx,8), %rax
movq (%rax,%r15,8), %rax
testq %rax, %rax
je 0xfdfd6
movq (%rax), %rdi
testq %rdi, %rdi
je 0xfdfc8
callq 0x9440
movq (%r14,%rbx,8), %rax
movq (%rax,%r15,8), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0xfdfd6
callq 0x9440
incq %r15
movslq 0x357414(%rip), %rax    # 0x4553f4
cmpq %rax, %r15
jl 0xfdfa6
testl %eax, %eax
jle 0xfe00f
xorl %r15d, %r15d
movq (%r14,%rbx,8), %rcx
movq (%rcx,%r15,8), %rdi
testq %rdi, %rdi
je 0xfe004
callq 0x9440
movl 0x3573f0(%rip), %eax    # 0x4553f4
incq %r15
movslq %eax, %rcx
cmpq %rcx, %r15
jl 0xfdfec
movq (%r14,%rbx,8), %rdi
callq 0x9440
movq $0x0, (%r14,%rbx,8)
leaq 0x356cc9(%rip), %r14    # 0x454cf0
movq (%r14,%rbx,8), %rdi
testq %rdi, %rdi
je 0xfe03d
callq 0x9440
movq $0x0, (%r14,%rbx,8)
leaq 0x356ccc(%rip), %rax    # 0x454d10
xorl %ecx, %ecx
movl %ecx, (%rax,%rbx,4)
movl %ecx, 0x3573ad(%rip)    # 0x4553fc
movl %ecx, 0x3573a3(%rip)    # 0x4553f8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: free_mtie()
void free_mtie()
{
   free_mtie_data(CHA_MTIE);
   free_mtie_data(CHB_MTIE);
   free_mtie_data(CHC_MTIE);
   free_mtie_data(CHD_MTIE);
   mtie_allocated = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %edi, %edi
callq 0xfdf73
movl $0x1, %edi
callq 0xfdf73
movl $0x2, %edi
callq 0xfdf73
movl $0x3, %edi
callq 0xfdf73
leaq 0x13e94c(%rip), %rax    # 0x23cce4
movl $0x0, (%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: save_mtie_phase(int, double)
void save_mtie_phase(int id, double val)
{
   // put a value into the MTIE data buffer

   if(id < 0) return;
   if(id > MAX_MTIE_CHANS) return;
   if(mtie_q_count[id] >= max_mtie_samples) return;

   mtie_buf[id][mtie_q_count[id]] = val;
   ++mtie_q_count[id];
}

// Assembly:
cmpl $0x4, %edi
ja 0xfe402
movl %edi, %eax
leaq 0x356934(%rip), %rcx    # 0x454d10
movslq (%rcx,%rax,4), %rdx
cmpl 0x35700a(%rip), %edx    # 0x4553f0
jge 0xfe402
pushq %rbp
movq %rsp, %rbp
leaq 0x3568fd(%rip), %rsi    # 0x454cf0
movq (%rsi,%rax,8), %rsi
movsd %xmm0, (%rsi,%rdx,8)
incl %edx
movl %edx, (%rcx,%rax,4)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: scan_mtie_bins(int)
void scan_mtie_bins(int id)
{
int i;
double val;

   // find min/max values in the MTIE data

   if(id < 0) return;
   if(id > MAX_MTIE_CHANS) return;

   for(i=first_show_bin; i<32; i++) {  // !!!!! should start at
      if(mtie[id][i] == (-BIG_NUM)) continue;
      val = (mtie[id][i] / 1.0E9);

      if(val > global_adev_max) global_adev_max = val;
      if(val < global_adev_min) global_adev_min = val;
   }
}

// Assembly:
cmpl $0x4, %edi
ja 0xfe835
pushq %rbp
movq %rsp, %rbp
leaq 0x13e4dd(%rip), %rax    # 0x23cc80
movslq (%rax), %rax
cmpq $0x1f, %rax
jg 0xfe834
leaq 0x13e339(%rip), %rcx    # 0x23caf0
movsd (%rcx), %xmm3
leaq 0x13e326(%rip), %rdx    # 0x23cae8
movsd (%rdx), %xmm0
movl %edi, %esi
imulq $0x328, %rsi, %rsi      # imm = 0x328
leaq (%rsi,%rax,8), %rdi
leaq 0x355876(%rip), %rsi    # 0x454050
addq %rdi, %rsi
incq %rax
movsd 0x2df88(%rip), %xmm1    # 0x12c770
movsd 0xa838(%rip), %xmm2     # 0x109028
movsd (%rsi), %xmm4
ucomisd %xmm1, %xmm4
jne 0xfe7fc
jnp 0xfe81a
divsd %xmm2, %xmm4
ucomisd %xmm0, %xmm4
jbe 0xfe80e
movsd %xmm4, (%rdx)
movapd %xmm4, %xmm0
ucomisd %xmm4, %xmm3
jbe 0xfe81a
movsd %xmm4, (%rcx)
jmp 0xfe81e
movapd %xmm3, %xmm4
addq $0x8, %rsi
movq %rax, %rdi
incq %rdi
movapd %xmm4, %xmm3
cmpl $0x20, %eax
movq %rdi, %rax
jne 0xfe7f0
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: reset_incr_bins(BIN*, double)
void reset_incr_bins(struct BIN *bins, double period)
{
int b;
S32 m;
struct BIN *B;

   if(bins == 0) return;

   m = 1L;
   for(b=0; b<MAX_ADEV_BINS; b++) {  // flush adev bin data
      B = &bins[b];
      if(B == 0) continue;

      B->m     = m;
      B->n     = 0;
      B->sum   = 0.0;
      B->value = 0.0;
      B->tau   = ((double) m) * period;
      B->accum = 0.0;
      B->i     = 0;
      B->j     = 0;
      B->init  = 0;

      m = next_tau(m, bin_scale);
   }
}

// Assembly:
testq %rdi, %rdi
je 0xfeaaa
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x1, %eax
movl $0x20, %r14d
xorl %r15d, %r15d
leaq 0x13e233(%rip), %r12    # 0x23cc7c
movsd %xmm0, -0x28(%rbp)
movl %eax, -0x20(%rbx,%r14)
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
movupd %xmm0, -0x1c(%rbx,%r14)
movl %r15d, -0xc(%rbx,%r14)
movsd %xmm1, -0x8(%rbx,%r14)
movslq %eax, %rdi
movupd %xmm0, (%rbx,%r14)
movl %r15d, 0x10(%rbx,%r14)
movl (%r12), %esi
callq 0xfe862
movsd -0x28(%rbp), %xmm0
addq $0x38, %r14
cmpq $0x1600, %r14           # imm = 0x1600
jne 0xfea4e
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: reset_pps_bins()
void reset_pps_bins()
{
   pps_adev_q_overflow = 0.0;
   reset_incr_bins(&pps_adev_bins[0], pps_adev_period);
   reset_incr_bins(&pps_hdev_bins[0], pps_adev_period);
   reset_incr_bins(&pps_mdev_bins[0], pps_adev_period);
   reset_incr_bins(&pps_tdev_bins[0], pps_adev_period);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x13e088(%rip), %rax    # 0x23cb40
movq $0x0, (%rax)
leaq 0x13e23a(%rip), %rbx    # 0x23cd00
movsd (%rbx), %xmm0
leaq 0x127e1f(%rip), %rdi    # 0x2268f0
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x12942f(%rip), %rdi    # 0x227f10
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x12aa3f(%rip), %rdi    # 0x229530
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x12c04f(%rip), %rdi    # 0x22ab50
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xfea19
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: reset_osc_bins()
void reset_osc_bins()
{
   osc_adev_q_overflow = 0.0;
   reset_incr_bins(&osc_adev_bins[0], osc_adev_period);
   reset_incr_bins(&osc_hdev_bins[0], osc_adev_period);
   reset_incr_bins(&osc_mdev_bins[0], osc_adev_period);
   reset_incr_bins(&osc_tdev_bins[0], osc_adev_period);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x13e077(%rip), %rax    # 0x23cb90
movq $0x0, (%rax)
leaq 0x13e1e1(%rip), %rbx    # 0x23cd08
movsd (%rbx), %xmm0
leaq 0x13189e(%rip), %rdi    # 0x2303d0
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x12d62e(%rip), %rdi    # 0x22c170
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x12ec3e(%rip), %rdi    # 0x22d790
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x13024e(%rip), %rdi    # 0x22edb0
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xfea19
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: reset_chc_bins()
void reset_chc_bins()
{
   chc_adev_q_overflow = 0.0;
   reset_incr_bins(&chc_adev_bins[0], chc_adev_period);
   reset_incr_bins(&chc_hdev_bins[0], chc_adev_period);
   reset_incr_bins(&chc_mdev_bins[0], chc_adev_period);
   reset_incr_bins(&chc_tdev_bins[0], chc_adev_period);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x13e066(%rip), %rax    # 0x23cbe0
movq $0x0, (%rax)
leaq 0x13e188(%rip), %rbx    # 0x23cd10
movsd (%rbx), %xmm0
leaq 0x132e5d(%rip), %rdi    # 0x2319f0
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x13446d(%rip), %rdi    # 0x233010
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x135a7d(%rip), %rdi    # 0x234630
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x13708d(%rip), %rdi    # 0x235c50
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xfea19
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: reset_chd_bins()
void reset_chd_bins()
{
   chd_adev_q_overflow = 0.0;
   reset_incr_bins(&chd_adev_bins[0], chd_adev_period);
   reset_incr_bins(&chd_hdev_bins[0], chd_adev_period);
   reset_incr_bins(&chd_mdev_bins[0], chd_adev_period);
   reset_incr_bins(&chd_tdev_bins[0], chd_adev_period);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x13e055(%rip), %rax    # 0x23cc30
movq $0x0, (%rax)
leaq 0x13e12f(%rip), %rbx    # 0x23cd18
movsd (%rbx), %xmm0
leaq 0x13867c(%rip), %rdi    # 0x237270
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x139c8c(%rip), %rdi    # 0x238890
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x13b29c(%rip), %rdi    # 0x239eb0
callq 0xfea19
movsd (%rbx), %xmm0
leaq 0x13c8ac(%rip), %rdi    # 0x23b4d0
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xfea19
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: adev_decade(float)
float adev_decade(float val)
{
float decade;

    // convert an ADEV value to the decade it is in
    for(decade=1.0F; decade>=1.0E-19F; decade/=10.0F) {
       if(val > decade) break;
    }
    return decade*10.0F;
}

// Assembly:
ucomiss 0xe2ad(%rip), %xmm0     # 0x10d06c
jbe 0xfedca
movss 0xe287(%rip), %xmm0     # 0x10d050
retq
movaps %xmm0, %xmm1
movss 0xe297(%rip), %xmm0     # 0x10d06c
movss 0xe273(%rip), %xmm2     # 0x10d050
movss 0x2da27(%rip), %xmm3    # 0x12c80c
divss %xmm2, %xmm0
ucomiss %xmm3, %xmm0
jb 0xfedf3
ucomiss %xmm0, %xmm1
jbe 0xfede5
pushq %rbp
movq %rsp, %rbp
mulss 0xe251(%rip), %xmm0     # 0x10d050
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: adev_mouse()
void adev_mouse()
{
u08 old_disable_kbd;

// return;    // this routine breaks "keep_adevs_fresh"  unless timer_serve is set when calling get_mouse_info()

   // keep mouse lively during long periods of thinking
   if((++adev_mouse_time & 0xFFFF) != 0x0000) return;

   update_pwm();
   if(mouse_shown == 0) return;

   old_disable_kbd = disable_kbd;
   if(kbd_flag) disable_kbd = 2; // (so that do_kbd() won't do anything when it's called by WM_CHAR during get_pending_gps())

   ++timer_serve;
   get_mouse_info();
   --timer_serve;

   disable_kbd = old_disable_kbd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x13d70f(%rip), %rax    # 0x23ccb8
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
testw %cx, %cx
jne 0xff5f3
callq 0xd1efe
leaq 0x11bc7d(%rip), %rax    # 0x21b23d
cmpb $0x0, (%rax)
je 0xff5f3
leaq 0x11bc50(%rip), %rbx    # 0x21b21c
movb (%rbx), %r14b
leaq 0x11bc47(%rip), %rax    # 0x21b21d
cmpb $0x0, (%rax)
je 0xff5de
movb $0x2, (%rbx)
leaq 0x11bc33(%rip), %r15    # 0x21b218
incl (%r15)
callq 0x1c461
decl (%r15)
movb %r14b, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: do_incr_pps_adevs()
void do_incr_pps_adevs()
{
   // update each of the PPS adev bins with the latest queue data
   incr_adev(PPS_ADEV, &pps_adev_bins[0]);
   incr_hdev(PPS_HDEV, &pps_hdev_bins[0]);
   incr_mdev(PPS_MDEV, &pps_mdev_bins[0]);
   incr_tdev(PPS_TDEV, &pps_tdev_bins[0]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1272e7(%rip), %rsi    # 0x2268f0
movl $0x5, %edi
callq 0xff647
leaq 0x1288f6(%rip), %rsi    # 0x227f10
movl $0x6, %edi
callq 0xff825
leaq 0x129f05(%rip), %rsi    # 0x229530
movl $0x7, %edi
callq 0xffa51
leaq 0x12b514(%rip), %rsi    # 0x22ab50
movl $0x8, %edi
popq %rbp
jmp 0xffd53
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: do_incr_osc_adevs()
void do_incr_osc_adevs()
{
   // update each of the OSC adev bins with the latest queue data
   incr_adev(OSC_ADEV, &osc_adev_bins[0]);
   incr_hdev(OSC_HDEV, &osc_hdev_bins[0]);
   incr_mdev(OSC_MDEV, &osc_mdev_bins[0]);
   incr_tdev(OSC_TDEV, &osc_tdev_bins[0]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x130362(%rip), %rsi    # 0x2303d0
xorl %edi, %edi
callq 0xff647
leaq 0x12c0f4(%rip), %rsi    # 0x22c170
movl $0x1, %edi
callq 0xff825
leaq 0x12d703(%rip), %rsi    # 0x22d790
movl $0x2, %edi
callq 0xffa51
leaq 0x12ed12(%rip), %rsi    # 0x22edb0
movl $0x3, %edi
popq %rbp
jmp 0xffd53
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: do_incr_chc_adevs()
void do_incr_chc_adevs()
{
   // update each of the CHC adev bins with the latest queue data
   incr_adev(CHC_ADEV, &chc_adev_bins[0]);
   incr_hdev(CHC_HDEV, &chc_hdev_bins[0]);
   incr_mdev(CHC_MDEV, &chc_mdev_bins[0]);
   incr_tdev(CHC_TDEV, &chc_tdev_bins[0]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x13193c(%rip), %rsi    # 0x2319f0
movl $0xa, %edi
callq 0xff647
leaq 0x132f4b(%rip), %rsi    # 0x233010
movl $0xb, %edi
callq 0xff825
leaq 0x13455a(%rip), %rsi    # 0x234630
movl $0xc, %edi
callq 0xffa51
leaq 0x135b69(%rip), %rsi    # 0x235c50
movl $0xd, %edi
popq %rbp
jmp 0xffd53
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: do_incr_chd_adevs()
void do_incr_chd_adevs()
{
   // update each of the CHD adev bins with the latest queue data
   incr_adev(CHD_ADEV, &chd_adev_bins[0]);
   incr_hdev(CHD_HDEV, &chd_hdev_bins[0]);
   incr_mdev(CHD_MDEV, &chd_mdev_bins[0]);
   incr_tdev(CHD_TDEV, &chd_tdev_bins[0]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x137173(%rip), %rsi    # 0x237270
movl $0xf, %edi
callq 0xff647
leaq 0x138782(%rip), %rsi    # 0x238890
movl $0x10, %edi
callq 0xff825
leaq 0x139d91(%rip), %rsi    # 0x239eb0
movl $0x11, %edi
callq 0xffa51
leaq 0x13b3a0(%rip), %rsi    # 0x23b4d0
movl $0x12, %edi
popq %rbp
jmp 0xffd53
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: incr_pps_overflow()
void incr_pps_overflow()
{
int b;

   // tweek bin data counts when the PPS/chA adev queue is full
   pps_adev_q_overflow += 1.0;

   for(b=0; b<n_bins; b++) {  
      pps_adev_bins[b].n--; 
      pps_adev_bins[b].j--;
      pps_hdev_bins[b].n--;
      pps_hdev_bins[b].j--;
      pps_mdev_bins[b].n--;
      pps_mdev_bins[b].j--;
      pps_tdev_bins[b].n--;
      pps_tdev_bins[b].j--;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x13c9c5(%rip), %rax    # 0x23cb40
movsd (%rax), %xmm0
addsd 0x8ee9(%rip), %xmm0     # 0x109070
movsd %xmm0, (%rax)
leaq 0x13cb2e(%rip), %rax    # 0x23ccc0
movslq (%rax), %rax
testq %rax, %rax
jle 0x1001e7
imulq $0x38, %rax, %rax
xorl %ecx, %ecx
leaq 0x126749(%rip), %rdx    # 0x2268f0
leaq 0x127d62(%rip), %rsi    # 0x227f10
leaq 0x12937b(%rip), %rdi    # 0x229530
leaq 0x12a994(%rip), %r8     # 0x22ab50
decl 0x4(%rdx,%rcx)
decl 0x2c(%rdx,%rcx)
decl 0x4(%rsi,%rcx)
decl 0x2c(%rsi,%rcx)
decl 0x4(%rdi,%rcx)
decl 0x2c(%rdi,%rcx)
decl 0x4(%r8,%rcx)
decl 0x2c(%r8,%rcx)
addq $0x38, %rcx
cmpq %rcx, %rax
jne 0x1001bc
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: incr_osc_overflow()
void incr_osc_overflow()
{
int b;

   // tweek bin data counts when the OSC/chB adev queue is full
   osc_adev_q_overflow += 1.0;

   for(b=0; b<n_bins; b++) {  
      osc_adev_bins[b].n--;
      osc_adev_bins[b].j--;
      osc_hdev_bins[b].n--;
      osc_hdev_bins[b].j--;
      osc_mdev_bins[b].n--;
      osc_mdev_bins[b].j--;
      osc_tdev_bins[b].n--;
      osc_tdev_bins[b].j--;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x13c99c(%rip), %rax    # 0x23cb90
movsd (%rax), %xmm0
addsd 0x8e70(%rip), %xmm0     # 0x109070
movsd %xmm0, (%rax)
leaq 0x13cab5(%rip), %rax    # 0x23ccc0
movslq (%rax), %rax
testq %rax, %rax
jle 0x100260
imulq $0x38, %rax, %rax
xorl %ecx, %ecx
leaq 0x1301b0(%rip), %rdx    # 0x2303d0
leaq 0x12bf49(%rip), %rsi    # 0x22c170
leaq 0x12d562(%rip), %rdi    # 0x22d790
leaq 0x12eb7b(%rip), %r8     # 0x22edb0
decl 0x4(%rdx,%rcx)
decl 0x2c(%rdx,%rcx)
decl 0x4(%rsi,%rcx)
decl 0x2c(%rsi,%rcx)
decl 0x4(%rdi,%rcx)
decl 0x2c(%rdi,%rcx)
decl 0x4(%r8,%rcx)
decl 0x2c(%r8,%rcx)
addq $0x38, %rcx
cmpq %rcx, %rax
jne 0x100235
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: incr_chc_overflow()
void incr_chc_overflow()
{
int b;

   // tweek bin data counts when the chC adev queue is full
   chc_adev_q_overflow += 1.0;

   for(b=0; b<n_bins; b++) {  
      chc_adev_bins[b].n--;
      chc_adev_bins[b].j--;
      chc_hdev_bins[b].n--;
      chc_hdev_bins[b].j--;
      chc_mdev_bins[b].n--;
      chc_mdev_bins[b].j--;
      chc_tdev_bins[b].n--;
      chc_tdev_bins[b].j--;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x13c973(%rip), %rax    # 0x23cbe0
movsd (%rax), %xmm0
addsd 0x8df7(%rip), %xmm0     # 0x109070
movsd %xmm0, (%rax)
leaq 0x13ca3c(%rip), %rax    # 0x23ccc0
movslq (%rax), %rax
testq %rax, %rax
jle 0x1002d9
imulq $0x38, %rax, %rax
xorl %ecx, %ecx
leaq 0x131757(%rip), %rdx    # 0x2319f0
leaq 0x132d70(%rip), %rsi    # 0x233010
leaq 0x134389(%rip), %rdi    # 0x234630
leaq 0x1359a2(%rip), %r8     # 0x235c50
decl 0x4(%rdx,%rcx)
decl 0x2c(%rdx,%rcx)
decl 0x4(%rsi,%rcx)
decl 0x2c(%rsi,%rcx)
decl 0x4(%rdi,%rcx)
decl 0x2c(%rdi,%rcx)
decl 0x4(%r8,%rcx)
decl 0x2c(%r8,%rcx)
addq $0x38, %rcx
cmpq %rcx, %rax
jne 0x1002ae
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: incr_chd_overflow()
void incr_chd_overflow()
{
int b;

   // tweek bin data counts when the chD adev queue is full
   chd_adev_q_overflow += 1.0;

   for(b=0; b<n_bins; b++) {  
      chd_adev_bins[b].n--;
      chd_adev_bins[b].j--;
      chd_hdev_bins[b].n--;
      chd_hdev_bins[b].j--;
      chd_mdev_bins[b].n--;
      chd_mdev_bins[b].j--;
      chd_tdev_bins[b].n--;
      chd_tdev_bins[b].j--;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x13c94a(%rip), %rax    # 0x23cc30
movsd (%rax), %xmm0
addsd 0x8d7e(%rip), %xmm0     # 0x109070
movsd %xmm0, (%rax)
leaq 0x13c9c3(%rip), %rax    # 0x23ccc0
movslq (%rax), %rax
testq %rax, %rax
jle 0x100352
imulq $0x38, %rax, %rax
xorl %ecx, %ecx
leaq 0x136f5e(%rip), %rdx    # 0x237270
leaq 0x138577(%rip), %rsi    # 0x238890
leaq 0x139b90(%rip), %rdi    # 0x239eb0
leaq 0x13b1a9(%rip), %r8     # 0x23b4d0
decl 0x4(%rdx,%rcx)
decl 0x2c(%rdx,%rcx)
decl 0x4(%rsi,%rcx)
decl 0x2c(%rsi,%rcx)
decl 0x4(%rdi,%rcx)
decl 0x2c(%rdi,%rcx)
decl 0x4(%r8,%rcx)
decl 0x2c(%r8,%rcx)
addq $0x38, %rcx
cmpq %rcx, %rax
jne 0x100327
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: calc_resids(int, double, double)
void calc_resids(int plot, double resid_val, double period)
{
double x,y;

   if(plot < 0) return;
   if(plot >= (NUM_PLOTS+DERIVED_PLOTS)) return;

   resid[plot].resid_count += 1.0;
   y = resid_val;
   x = resid[plot].resid_count * period;

   resid[plot].sum_x  += x;
   resid[plot].sum_y  += y;
   resid[plot].sum_xx += (x*x);
   resid[plot].sum_yy += (y*y);
   resid[plot].sum_xy += (x*y);
//   resid[plot].a0 = 
}

// Assembly:
cmpl $0x13, %edi
ja 0x1003d5
pushq %rbp
movq %rsp, %rbp
movl %edi, %eax
shlq $0x6, %rax
leaq 0x23f4e6(%rip), %rcx    # 0x33f850
movsd 0x38(%rcx,%rax), %xmm2
addsd 0x8cf8(%rip), %xmm2     # 0x109070
movsd %xmm2, 0x38(%rcx,%rax)
mulsd %xmm1, %xmm2
movsd (%rcx,%rax), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, (%rcx,%rax)
movsd 0x8(%rcx,%rax), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rcx,%rax)
movapd %xmm2, %xmm1
mulsd %xmm2, %xmm1
addsd 0x10(%rcx,%rax), %xmm1
movsd %xmm1, 0x10(%rcx,%rax)
mulsd %xmm0, %xmm2
mulsd %xmm0, %xmm0
addsd 0x18(%rcx,%rax), %xmm0
movsd %xmm0, 0x18(%rcx,%rax)
addsd 0x20(%rcx,%rax), %xmm2
movsd %xmm2, 0x20(%rcx,%rax)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: add_adev_point(double, double, double, double)
void add_adev_point(double osc_phase, double pps_phase, double chc_phase, double chd_phase)
{
   if(adev_period <= 0) return;
   if(adev_q_allocated == 0) {
      alloc_adev();
   }

   add_pps_adev_point(pps_phase, 0);
   add_osc_adev_point(osc_phase, 0);
   add_chc_adev_point(chc_phase, 0);
   add_chd_adev_point(chd_phase, 0);
   return;
}

// Assembly:
leaq 0x13bcca(%rip), %rax    # 0x23ccf8
xorpd %xmm4, %xmm4
ucomisd (%rax), %xmm4
jae 0x10109d
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movsd %xmm0, -0x10(%rbp)
movsd %xmm2, -0x18(%rbp)
movsd %xmm3, -0x20(%rbp)
leaq 0x13bc8a(%rip), %rax    # 0x23cce0
cmpl $0x0, (%rax)
jne 0x10106a
movsd %xmm1, -0x8(%rbp)
callq 0x10802
movsd -0x8(%rbp), %xmm1
movaps %xmm1, %xmm0
xorl %edi, %edi
callq 0x1003d6
movsd -0x10(%rbp), %xmm0
xorl %edi, %edi
callq 0x100950
movsd -0x18(%rbp), %xmm0
xorl %edi, %edi
callq 0x100b7b
movsd -0x20(%rbp), %xmm0
xorl %edi, %edi
addq $0x20, %rsp
popq %rbp
jmp 0x100dd1
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: scan_bins(BIN*)
void scan_bins(struct BIN *bin)
{
int i;

   // find the min and max adev values in the specified adev bins
// for(i=0; i<MAX_ADEV_BINS; i++) {
   for(i=first_show_bin; i<MAX_ADEV_BINS; i++) {
// aaaahhhh    if(bin[i].n < min_points_per_bin) break;
      if(bin[i].n < min_points_per_bin) continue;
      if(bin[i].value == 0.0) continue;
      if(bin[i].value > global_adev_max) global_adev_max = bin[i].value;
      if(bin[i].value < global_adev_min) global_adev_min = bin[i].value;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x1398b5(%rip), %rax    # 0x23cc80
movslq (%rax), %rax
cmpq $0x63, %rax
jg 0x103468
leaq 0x139711(%rip), %rcx    # 0x23caf0
movsd (%rcx), %xmm1
leaq 0x1396fe(%rip), %rdx    # 0x23cae8
movsd (%rdx), %xmm3
leaq 0x1398c7(%rip), %rsi    # 0x23ccbc
movl (%rsi), %esi
imulq $0x38, %rax, %r8
addq %r8, %rdi
addq $0x10, %rdi
incq %rax
xorpd %xmm0, %xmm0
cmpl %esi, -0xc(%rdi)
jl 0x10341a
movsd (%rdi), %xmm2
ucomisd %xmm0, %xmm2
jne 0x10343e
jp 0x10343e
movapd %xmm1, %xmm4
movapd %xmm3, %xmm2
addq $0x38, %rdi
movq %rax, %r8
incq %r8
movapd %xmm2, %xmm3
movapd %xmm4, %xmm1
cmpl $0x64, %eax
movq %r8, %rax
jne 0x103409
jmp 0x103468
ucomisd %xmm3, %xmm2
jbe 0x10344e
movsd %xmm2, (%rdx)
movsd (%rdi), %xmm4
jmp 0x103456
movapd %xmm2, %xmm4
movapd %xmm3, %xmm2
ucomisd %xmm4, %xmm1
jbe 0x103462
movsd %xmm4, (%rcx)
jmp 0x103422
movapd %xmm1, %xmm4
jmp 0x103422
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: write_gif_code(_IO_FILE*, GifEncoder*, int)
void write_gif_code(FILE *file, GifEncoder *encoder, int code)
{
   if(code == FLUSH_OUTPUT) {
      /* write all remaining data */
      while(encoder->shift_state > 0) {
         write_gif_byte(file, encoder, encoder->shift_data & 0xff);
         encoder->shift_data >>= 8;
         encoder->shift_state -= 8;
      }
      encoder->shift_state = 0;
      write_gif_byte(file, encoder, FLUSH_OUTPUT);
   }
   else {
      encoder->shift_data |= ((long) code) << encoder->shift_state;
      encoder->shift_state += encoder->running_bits;

      while(encoder->shift_state >= 8) { /* write full bytes */
         write_gif_byte(file, encoder, encoder->shift_data & 0xff);
         encoder->shift_data >>= 8;
         encoder->shift_state -= 8;
      }
   }

   /* If code can't fit into running_bits bits, raise its size.
    * Note that codes above 4095 are for signalling. */
   if((encoder->running_code >= encoder->max_code_plus_one) && (code < 4096)) {
      encoder->max_code_plus_one = (1 << ++encoder->running_bits);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x1000, %edx           # imm = 0x1000
jne 0x104497
cmpl $0x0, 0x2c(%rbx)
jle 0x10447e
movq 0x30(%rbx), %rax
movzbl %al, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x104540
movq 0x30(%rbx), %rax
shrq $0x8, %rax
movq %rax, 0x30(%rbx)
movl 0x2c(%rbx), %ecx
leal -0x8(%rcx), %edx
movl %edx, 0x2c(%rbx)
cmpl $0x8, %ecx
jg 0x104456
movl $0x0, 0x2c(%rbx)
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x104540
jmp 0x1044db
movslq %r14d, %rax
movl 0x2c(%rbx), %ecx
shlq %cl, %rax
orq 0x30(%rbx), %rax
movq %rax, 0x30(%rbx)
addl 0x18(%rbx), %ecx
movl %ecx, 0x2c(%rbx)
cmpl $0x8, %ecx
jl 0x1044db
movzbl %al, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x104540
movq 0x30(%rbx), %rax
shrq $0x8, %rax
movq %rax, 0x30(%rbx)
movl 0x2c(%rbx), %ecx
leal -0x8(%rcx), %edx
movl %edx, 0x2c(%rbx)
cmpl $0xf, %ecx
jg 0x1044b3
cmpl $0xfff, %r14d           # imm = 0xFFF
jg 0x1044fe
movl 0x1c(%rbx), %eax
cmpl %eax, 0x14(%rbx)
jl 0x1044fe
movl 0x18(%rbx), %ecx
incl %ecx
movl %ecx, 0x18(%rbx)
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: write_gif_byte(_IO_FILE*, GifEncoder*, int)
void write_gif_byte(FILE *file, GifEncoder *encoder, int ch)
{
unsigned char *buf;

   buf = encoder->buf;

   if(encoder->file_state == IMAGE_COMPLETE) return;

   if(ch == FLUSH_OUTPUT) {
      if(encoder->bufsize) {
         write_byte(file, encoder->bufsize);
         write_stream(file, buf, encoder->bufsize);
         encoder->bufsize = 0;
      }
      /* write an empty block to mark end of data */
      write_byte(file, 0);
      encoder->file_state = IMAGE_COMPLETE;
   }
   else {
      if(encoder->bufsize == 255) {
         /* write this buffer to the file */
         write_byte(file, encoder->bufsize);
         write_stream(file, buf, encoder->bufsize);
         encoder->bufsize = 0;
      }
      buf[encoder->bufsize++] = ch;
   }
}

// Assembly:
cmpl $0x1, 0x40(%rsi)
je 0x104609
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4c(%rsi), %r13
movl 0x48(%rsi), %r12d
cmpl $0x1000, %edx           # imm = 0x1000
jne 0x1045b9
testl %r12d, %r12d
je 0x1045a1
testq %r14, %r14
je 0x10459a
movl %r12d, %edi
movq %r14, %rsi
callq 0x9740
movslq 0x48(%rbx), %rdx
movl $0x1, %esi
movq %r13, %rdi
movq %r14, %rcx
callq 0x9750
movl $0x0, 0x48(%rbx)
testq %r14, %r14
je 0x1045b0
xorl %edi, %edi
movq %r14, %rsi
callq 0x9740
movl $0x1, 0x40(%rbx)
jmp 0x1045fb
cmpl $0xff, %r12d
jne 0x1045eb
xorl %r12d, %r12d
testq %r14, %r14
je 0x1045eb
movl $0xff, %edi
movq %r14, %rsi
callq 0x9740
movslq 0x48(%rbx), %rdx
movl $0x1, %esi
movq %r13, %rdi
movq %r14, %rcx
callq 0x9750
leal 0x1(%r12), %eax
movl %eax, 0x48(%rbx)
movslq %r12d, %rax
movb %r15b, 0x4c(%rbx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: write_gif_header(_IO_FILE*, Gif*)
void write_gif_header(FILE *file, Gif *gif)
{
unsigned char info;
GifScreen *screen;
GifPalette *cmap;
int i;
Colour c;

   if(file == 0) return;
   fprintf(file, "%s", gif->header);  // header info

   // image description
   screen = gif->screen;
   cmap = screen->cmap;
   write_gif_int(file, screen->width);
   write_gif_int(file, screen->height);

   info = 0;
   info = info | (screen->has_cmap ? 0x80 : 0x00);
   info = info | ((screen->color_res - 1) << 4);
// info = info | (screen->sorted ? 0x08 : 0x00);
   if(screen->cmap_depth > 0) {
      info = info | ((screen->cmap_depth) - 1);
   }
   write_byte(file, info);

   write_byte(file, screen->bgcolour);
   write_byte(file, screen->aspect);

   if(screen->has_cmap) {   // palette data
      for(i=0; i<cmap->length; i++) {
         c = cmap->colours[i];
         write_byte(file, c.red);
         write_byte(file, c.green);
         write_byte(file, c.blue);
      }
   }
}

// Assembly:
testq %rdi, %rdi
je 0x104972
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movq %rbx, %rsi
callq 0x9400
movq 0x8(%r14), %r15
movq 0x20(%r15), %r12
movl (%r15), %r14d
movl $0xff, %r13d
movl %r14d, %edi
andl %r13d, %edi
movq %rbx, %rsi
callq 0x9740
shrl $0x8, %r14d
andl %r13d, %r14d
movl %r14d, %edi
movq %rbx, %rsi
callq 0x9740
movl 0x4(%r15), %r14d
movl %r14d, %edi
andl %r13d, %edi
movq %rbx, %rsi
callq 0x9740
shrl $0x8, %r14d
andl %r13d, %r14d
movl %r14d, %edi
movq %rbx, %rsi
callq 0x9740
xorl %eax, %eax
cmpl $0x0, 0x8(%r15)
setne %al
shll $0x7, %eax
movl 0xc(%r15), %ecx
movl 0x14(%r15), %edx
shll $0x4, %ecx
addl $0xf0, %ecx
leal -0x1(%rdx), %esi
xorl %edi, %edi
testl %edx, %edx
cmovgl %esi, %edi
orl %ecx, %edi
orl %eax, %edi
andl %r13d, %edi
movq %rbx, %rsi
callq 0x9740
movl 0x18(%r15), %edi
movq %rbx, %rsi
callq 0x9740
movl 0x1c(%r15), %edi
movq %rbx, %rsi
callq 0x9740
cmpl $0x0, 0x8(%r15)
je 0x104964
cmpl $0x0, (%r12)
jle 0x104964
xorl %r13d, %r13d
movq 0x4(%r12), %rax
movzbl 0x1(%rax,%r13,4), %edi
movzbl 0x2(%rax,%r13,4), %r14d
movzbl 0x3(%rax,%r13,4), %r15d
movq %rbx, %rsi
callq 0x9740
movl %r14d, %edi
movq %rbx, %rsi
callq 0x9740
movl %r15d, %edi
movq %rbx, %rsi
callq 0x9740
incq %r13
movslq (%r12), %rax
cmpq %rax, %r13
jl 0x104923
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: write_gif_picture(_IO_FILE*, int, GifPicture*)
void write_gif_picture(FILE *file, int top_line, GifPicture *pic)
{
unsigned char info;
GifEncoder *encoder;
int row;

   write_byte(file, 0x2C);   // intro code

   write_gif_int(file, pic->left);
   write_gif_int(file, pic->top);
   write_gif_int(file, pic->width);
   write_gif_int(file, pic->height);

   info = 0;
// info = info | (pic->has_cmap    ? 0x80 : 0x00);
// info = info | (pic->interlace   ? 0x40 : 0x00);
// info = info | (pic->sorted      ? 0x20 : 0x00);
   info = info | ((pic->reserved << 3) & 0x18);
   if(pic->has_cmap) info = info | (pic->cmap_depth - 1);

   write_byte(file, info);

   encoder = &encoder_data;
   init_gif_encoder(file, encoder, pic->cmap_depth);

   row = 0;
   while(row < pic->height) {  // !!!!! kludge: top_line should be passed to this routine
     update_pwm();
     write_gif_line(file, encoder, row+top_line, pic->width);
     row += 1;
   }

   flush_gif_encoder(file, encoder);

   write_byte(file, 0x3B);   // end code
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %rbx
testq %rdi, %rdi
je 0x10499c
movl $0x2c, %edi
movq %rbx, %rsi
callq 0x9740
movl (%r14), %esi
movq %rbx, %rdi
callq 0x10462e
movl 0x4(%r14), %esi
movq %rbx, %rdi
callq 0x10462e
movl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x10462e
movl 0xc(%r14), %esi
movq %rbx, %rdi
callq 0x10462e
movb 0x1c(%r14), %al
shlb $0x3, %al
andb $0x18, %al
cmpl $0x0, 0x10(%r14)
je 0x1049e3
movb 0x20(%r14), %cl
decb %cl
orb %cl, %al
testq %rbx, %rbx
je 0x1049f3
movzbl %al, %edi
movq %rbx, %rsi
callq 0x9740
movl 0x20(%r14), %edx
leaq 0x350a06(%rip), %rsi    # 0x455404
movq %rbx, %rdi
callq 0x10437a
cmpl $0x0, 0xc(%r14)
jle 0x104a38
xorl %r13d, %r13d
leaq 0x3509ed(%rip), %r12    # 0x455404
callq 0xd1efe
leal (%r15,%r13), %edx
movl 0x8(%r14), %ecx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x104673
incl %r13d
cmpl 0xc(%r14), %r13d
jl 0x104a17
leaq 0x3509c5(%rip), %rsi    # 0x455404
movq %rbx, %rdi
callq 0x104509
testq %rbx, %rbx
je 0x104a67
movl $0x3b, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9740
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: disable_osc_control()
void disable_osc_control()
{
   if(osc_control_on == 0) return;

   osc_discipline = 1;
   if(rcvr_type == X72_RCVR) {
   }
   else {
      set_discipline_mode(SET_DIS_MODE_ENABLE);
   }

   osc_control_on = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x239d32(%rip), %rbx    # 0x33f6d8
cmpb $0x0, (%rbx)
je 0x1059d2
leaq 0x207ae2(%rip), %rax    # 0x30d494
movb $0x1, (%rax)
leaq 0x112f14(%rip), %rax    # 0x2188d0
cmpq $0x2000000, (%rax)      # imm = 0x2000000
je 0x1059cf
movl $0x5, %edi
callq 0x6d604
movb $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: calc_k_factors()
void calc_k_factors()
{
   // This routine converts the user friendly input PID constants into the
   // "k" values used by the PID filter algorithm.  It is called whenever
   // a PID filter constant is changed by the user.
   //
   // P_GAIN        -> k1   (PID gain)
   // D_TC          -> k2   (derivative time constant)
   // FILTER_TC     -> k3   (filter time constant)
   // I_TC          -> k4   (integrator time constant)
   // FILTER_OFFSET         (temperature setpoint offset)

   if(I_TC) k4 = ((DATA_SIZE)1.0/I_TC) / (DATA_SIZE) PID_UPDATE_RATE * P_GAIN;
   else     k4 = (DATA_SIZE) 0.0;

   if(FILTER_TC > 0.0) {
      k3 = (DATA_SIZE) 1.0 - ((DATA_SIZE) 1.0/((FILTER_TC*(DATA_SIZE) PID_UPDATE_RATE)+(DATA_SIZE) 1.0));
      k2 = ((DATA_SIZE) -1.0 * D_TC * P_GAIN) / (FILTER_TC*(DATA_SIZE) PID_UPDATE_RATE+(DATA_SIZE) 1.0) * ((DATA_SIZE) PID_UPDATE_RATE/(DATA_SIZE) SCALE_FACTOR);
   }
   else {
      k3 = FILTER_TC;
      k2 = ((DATA_SIZE) -1.0 * D_TC * P_GAIN) * ((DATA_SIZE) PID_UPDATE_RATE/(DATA_SIZE) SCALE_FACTOR);
   }

   k1 = ((P_GAIN/(DATA_SIZE) SCALE_FACTOR) * ((DATA_SIZE) 1.0 - k3)) - k2;

   if(pid_debug || bang_bang) {  // set a marker each time a PID value changes
      if(++test_marker >= MAX_MARKER) test_marker = 1;
      if(test_marker < 0) test_marker = 1;
      mark_q_entry[test_marker] = plot_q_in;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x239c58(%rip), %rax    # 0x33f660
movsd (%rax), %xmm2
movsd 0x365c(%rip), %xmm0     # 0x109070
movapd %xmm0, %xmm3
divsd %xmm2, %xmm3
leaq 0x239c25(%rip), %rax    # 0x33f648
movsd (%rax), %xmm1
mulsd %xmm1, %xmm3
xorpd %xmm4, %xmm4
cmpneqsd %xmm4, %xmm2
andpd %xmm3, %xmm2
movlpd %xmm2, 0x34fd10(%rip)   # 0x455750
leaq 0x239c11(%rip), %rax    # 0x33f658
movsd (%rax), %xmm2
ucomisd %xmm4, %xmm2
jbe 0x105a82
addsd %xmm0, %xmm2
movapd %xmm0, %xmm4
divsd %xmm2, %xmm4
leaq 0x239bec(%rip), %rax    # 0x33f650
movsd (%rax), %xmm3
xorpd 0x3740(%rip), %xmm3     # 0x1091b0
mulsd %xmm1, %xmm3
divsd %xmm2, %xmm3
movapd %xmm0, %xmm2
subsd %xmm4, %xmm2
jmp 0x105a99
leaq 0x239bc7(%rip), %rax    # 0x33f650
movsd (%rax), %xmm3
xorpd 0x371b(%rip), %xmm3     # 0x1091b0
mulsd %xmm1, %xmm3
movsd %xmm2, 0x34fca7(%rip)   # 0x455748
movsd %xmm3, 0x34fc97(%rip)   # 0x455740
subsd %xmm2, %xmm0
mulsd %xmm0, %xmm1
subsd %xmm3, %xmm1
movsd %xmm1, 0x34fc7b(%rip)   # 0x455738
leaq 0x239b7c(%rip), %rax    # 0x33f640
cmpb $0x0, (%rax)
jne 0x105ad5
leaq 0x239b6c(%rip), %rax    # 0x33f63c
cmpl $0x0, (%rax)
je 0x105b0b
leaq 0x239b5c(%rip), %rax    # 0x33f638
movl (%rax), %ecx
leal 0x1(%rcx), %edx
cmpl $0x9, %ecx
movl $0x1, %ecx
cmovgel %ecx, %edx
testl %edx, %edx
cmovsl %ecx, %edx
movl %edx, (%rax)
leaq 0x11582e(%rip), %rax    # 0x21b328
movq (%rax), %rax
movslq %edx, %rcx
leaq 0x1157a9(%rip), %rdx    # 0x21b2b0
movq %rax, (%rdx,%rcx,8)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: show_pid_values()
void show_pid_values()
{
   if(dac_dac) return;

   sprintf(plot_title, "kP(%.2f %c %.4f) kD(%.2f %c %.4f) kF(%.2f %c %.4f) kI(%.1f %c %.3f)  kO=%.3f kL=%.3f kS=%.3f kR=%.3f k9=%.3f", 
      P_GAIN,RIGHT_ARROW,k1, 
      D_TC,RIGHT_ARROW,k2, 
      FILTER_TC,RIGHT_ARROW,k3, 
      I_TC,RIGHT_ARROW,k4, 
      FILTER_OFFSET, k6, k7, k8, KL_TUNE_STEP);
   title_type = OTHER;
}

// Assembly:
leaq 0x235c6c(%rip), %rax    # 0x33b81c
cmpl $0x0, (%rax)
je 0x105bb6
retq
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
leaq 0x239a83(%rip), %rax    # 0x33f648
movsd (%rax), %xmm0
movsd 0x34fb67(%rip), %xmm1   # 0x455738
leaq 0x239a78(%rip), %rax    # 0x33f650
movsd (%rax), %xmm2
movsd 0x34fb5c(%rip), %xmm3   # 0x455740
leaq 0x239a6d(%rip), %rax    # 0x33f658
movsd (%rax), %xmm4
movsd 0x34fb51(%rip), %xmm5   # 0x455748
leaq 0x239a62(%rip), %rax    # 0x33f660
movsd (%rax), %xmm6
movsd 0x34fb46(%rip), %xmm7   # 0x455750
leaq 0x239a57(%rip), %rax    # 0x33f668
movsd (%rax), %xmm8
movsd 0x34fb39(%rip), %xmm9   # 0x455758
movsd 0x34fb38(%rip), %xmm10  # 0x455760
movsd 0x34fb37(%rip), %xmm11  # 0x455768
leaq 0x239a38(%rip), %rax    # 0x33f670
movsd (%rax), %xmm12
movsd %xmm12, 0x20(%rsp)
movsd %xmm11, 0x18(%rsp)
movsd %xmm10, 0x10(%rsp)
movsd %xmm9, 0x8(%rsp)
movsd %xmm8, (%rsp)
leaq 0x238bea(%rip), %rdi    # 0x33e850
leaq 0x30227(%rip), %rsi     # 0x135e94
movl $0x1a, %edx
movl $0x1a, %ecx
movl $0x1a, %r8d
movl $0x1a, %r9d
movb $0x8, %al
callq 0x9060
leaq 0x23963b(%rip), %rax    # 0x33f2cc
movl $0x3, (%rax)
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: calc_autotune()
int calc_autotune()
{
double val;

   if(HEAT_OVERSHOOT == 0.0F) return 1;
   if(COOL_UNDERSHOOT == 0.0F) return 2;
   if(ct_samples == 0.0) return 3;
   if(amp_ptr < 2) return 4;
   if(cyc_ptr < 2) return 5;

   val  = tune_amp[amp_ptr/2];
   if(amp_ptr > 2) {
      val += tune_amp[amp_ptr/2-1];
      val += tune_amp[amp_ptr/2+1];
      val /= 3.0;
   }
   if(val == 0.0) return 6;
   P_GAIN = 0.625F * (KL_TUNE_STEP+KL_TUNE_STEP) / (float) val;

   val  = tune_cyc[cyc_ptr/2];
   if(cyc_ptr > 2) {
      val += tune_cyc[cyc_ptr/2-1];
      val += tune_cyc[cyc_ptr/2+1];
      val /= 3.0;
   }
   I_TC   = 0.75F * (float) val;
   D_TC   = 0.1875F * (float) val; 

   k6 = 0.0F;
// integrator = 0.0F;

   calc_k_factors();
   clear_pid_display();
   show_pid_values();

   bang_bang = 0;    // pid autotune analysis done
   return 0;
}

// Assembly:
movsd 0x34fa4b(%rip), %xmm1   # 0x4556f0
movl $0x1, %eax
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x105cb7
jp 0x105cb7
retq
movsd 0x34fa39(%rip), %xmm1   # 0x4556f8
movl $0x2, %eax
ucomisd %xmm0, %xmm1
jne 0x105ccc
jnp 0x105cb6
movsd 0x34f9a4(%rip), %xmm0   # 0x455678
movl $0x3, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x105ce5
jnp 0x105cb6
movl 0x34fad5(%rip), %edx    # 0x4557c0
movl $0x4, %eax
cmpl $0x2, %edx
jl 0x105cb6
movl 0x34fb15(%rip), %ecx    # 0x455810
movl $0x5, %eax
cmpl $0x2, %ecx
jl 0x105cb6
movl %edx, %esi
shrl %esi
leaq 0x34fa70(%rip), %rax    # 0x455780
movsd (%rax,%rsi,8), %xmm0
cmpq $0x2, %rdx
je 0x105d33
leal -0x1(%rsi), %edx
addsd (%rax,%rdx,8), %xmm0
movl %esi, %edx
addsd 0x8(%rax,%rdx,8), %xmm0
divsd 0x5cd5(%rip), %xmm0     # 0x10ba08
movl $0x6, %eax
ucomisd %xmm1, %xmm0
jne 0x105d44
jnp 0x105cb6
leaq 0x239925(%rip), %rax    # 0x33f670
movsd (%rax), %xmm1
addsd %xmm1, %xmm1
mulsd 0x26a3d(%rip), %xmm1    # 0x12c798
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
divsd %xmm0, %xmm1
leaq 0x2398da(%rip), %rax    # 0x33f648
movsd %xmm1, (%rax)
movl %ecx, %edx
shrl %edx
leaq 0x34fa53(%rip), %rax    # 0x4557d0
movsd (%rax,%rdx,8), %xmm0
cmpq $0x2, %rcx
je 0x105da0
leal -0x1(%rdx), %ecx
addsd (%rax,%rcx,8), %xmm0
movl %edx, %ecx
addsd 0x8(%rax,%rcx,8), %xmm0
divsd 0x5c68(%rip), %xmm0     # 0x10ba08
pushq %rbp
movq %rsp, %rbp
cvtsd2ss %xmm0, %xmm0
movss 0x72c4(%rip), %xmm1     # 0x10d074
mulss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x2398a1(%rip), %rax    # 0x33f660
movsd %xmm1, (%rax)
mulss 0x26b25(%rip), %xmm0    # 0x12c8f0
cvtss2sd %xmm0, %xmm0
leaq 0x23987a(%rip), %rax    # 0x33f650
movsd %xmm0, (%rax)
movq $0x0, 0x34f973(%rip) # 0x455758
callq 0x1059fd
callq 0x33c11
callq 0x105ba9
leaq 0x239841(%rip), %rax    # 0x33f63c
movl $0x0, (%rax)
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: control_temp()
void control_temp()
{
char cmd[SLEN];

   if(temp_control_on == 0) return;

   if((test_heat > 0.0F) || (test_cool > 0.0F)) {  // manual pwm control is in effect
      heat_time = test_heat;
      cool_time = test_cool;

      sprintf(cmd, "$CTRL %04d", (int) (heat_time-cool_time));
      send_fan_cmd(cmd);

      #ifdef DEBUG_TEMP_CONTROL
         if(pid_debug || bang_bang) {
            sprintf(debug_text,  "heat:%.1f ms  cool:%.1f ms", heat_time, cool_time);
         }
      #endif
   }
   else {   // we are doing the PID filter stuff
      temp_pid_filter();     // update the PID and fan speed
      analyze_bang_bang();   // do autotune analysis
   }

   last_temp = this_temperature;
}

// Assembly:
leaq 0x2394e7(%rip), %rax    # 0x33fdc1
cmpb $0x0, (%rax)
je 0x1069af
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0x238d32(%rip), %rax    # 0x33f628
movsd (%rax), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
leaq 0x238d27(%rip), %rax    # 0x33f630
movsd (%rax), %xmm1
ja 0x106921
ucomisd %xmm2, %xmm1
ja 0x106921
callq 0x105e05
callq 0x1060da
jmp 0x106996
movsd %xmm0, 0x34ed17(%rip)   # 0x455640
movsd %xmm1, 0x34ed17(%rip)   # 0x455648
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %edx
leaq 0x2f5c1(%rip), %rsi     # 0x135f01
leaq -0x110(%rbp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x5f585
leaq 0x238ce0(%rip), %rax    # 0x33f640
cmpb $0x0, (%rax)
jne 0x106971
leaq 0x238cd0(%rip), %rax    # 0x33f63c
cmpl $0x0, (%rax)
je 0x106996
movsd 0x34ecc7(%rip), %xmm0   # 0x455640
movsd 0x34ecc7(%rip), %xmm1   # 0x455648
leaq 0x238018(%rip), %rdi    # 0x33e9a0
leaq 0x2f648(%rip), %rsi     # 0x135fd7
movb $0x2, %al
callq 0x9060
movsd 0x34ec6a(%rip), %xmm0   # 0x455608
movsd %xmm0, 0x34ec6a(%rip)   # 0x455610
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: apply_heat()
void apply_heat(void)
{
   if(lpt_addr) {  // using parallel port to control temp
      lpt_val = (lpt_val & 0xF0) | 0x09;
      outp(lpt_addr, lpt_val);
   }
   else if(com[fan_port].com_port > 0) { // using serial port DTR line to control temp
      SetDtrLine(fan_port, HEAT);
      SetRtsLine(fan_port, ENABLE);
   }

   if(a_heating == 0) {
      heat_on_tick = GetMsecs(); 
   }
   a_heating = 1;
   a_cooling = 0;
   a_holding = 0;
   temp_dir = UP_ARROW;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x239413(%rip), %rax    # 0x33fdd0
movl (%rax), %edi
testl %edi, %edi
je 0x1069dd
leaq 0x23940a(%rip), %rax    # 0x33fdd4
movzbl (%rax), %esi
andl $-0x10, %esi
orl $0x9, %esi
movb %sil, (%rax)
callq 0xaea5
jmp 0x106a0a
leaq 0x2078e8(%rip), %rbx    # 0x30e2cc
movl (%rbx), %edi
imulq $0x2260, %rdi, %rax     # imm = 0x2260
leaq 0x2078ec(%rip), %rcx    # 0x30e2e0
cmpl $0x0, (%rcx,%rax)
jle 0x106a0a
xorl %esi, %esi
callq 0xaeab
movl (%rbx), %edi
xorl %esi, %esi
callq 0xaef7
cmpb $0x0, 0x34ebef(%rip)    # 0x455600
jne 0x106a20
callq 0xae92
movsd %xmm0, 0x34ec30(%rip)   # 0x455650
movb $0x1, 0x34ebd9(%rip)    # 0x455600
xorl %eax, %eax
movb %al, 0x34ebd2(%rip)     # 0x455601
movb %al, 0x34ebcd(%rip)     # 0x455602
leaq 0x20654c(%rip), %rax    # 0x30cf88
movb $0x18, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: apply_cool()
void apply_cool() 
{
   if(lpt_addr) {  // using parallel port to control temp
      lpt_val = (lpt_val & 0xF0) | 0x0A;
      outp(lpt_addr, lpt_val);
   }
   else if(com[fan_port].com_port > 0) { // using serial port DTR line to control temp
      SetDtrLine(fan_port, COOL);
      SetRtsLine(fan_port, ENABLE);
   }

   if(a_cooling == 0) {
      cool_on_tick = GetMsecs(); 
   }
   a_cooling = 1;
   a_heating = 0;
   a_holding = 0;
   temp_dir = DOWN_ARROW;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x23937d(%rip), %rax    # 0x33fdd0
movl (%rax), %edi
testl %edi, %edi
je 0x106a73
leaq 0x239374(%rip), %rax    # 0x33fdd4
movzbl (%rax), %esi
andl $-0x10, %esi
orl $0xa, %esi
movb %sil, (%rax)
callq 0xaea5
jmp 0x106aa3
leaq 0x207852(%rip), %rbx    # 0x30e2cc
movl (%rbx), %edi
imulq $0x2260, %rdi, %rax     # imm = 0x2260
leaq 0x207856(%rip), %rcx    # 0x30e2e0
cmpl $0x0, (%rcx,%rax)
jle 0x106aa3
movl $0x1, %esi
callq 0xaeab
movl (%rbx), %edi
xorl %esi, %esi
callq 0xaef7
cmpb $0x0, 0x34eb57(%rip)    # 0x455601
jne 0x106ab9
callq 0xae92
movsd %xmm0, 0x34eb9f(%rip)   # 0x455658
movb $0x1, 0x34eb41(%rip)    # 0x455601
xorl %eax, %eax
movb %al, 0x34eb38(%rip)     # 0x455600
movb %al, 0x34eb34(%rip)     # 0x455602
leaq 0x2064b3(%rip), %rax    # 0x30cf88
movb $0x19, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: hold_temp()
void hold_temp()
{
   if(lpt_addr) {  // we are using the parallel port to control temp
      lpt_val = (lpt_val & 0xF0) | 0x06;
      outp(lpt_addr, lpt_val);
   }
   else if(com[fan_port].com_port > 0) { // using serial port DTR line to control temp
      SetDtrLine(fan_port, COOL);
      SetRtsLine(fan_port, DISABLE);
   }
   send_fan_cmd("$HOLD");

   if(a_holding == 0) {
      hold_on_tick = GetMsecs(); 
   }
   a_holding = 1;
   a_heating = 0;
   a_cooling = 0;
   temp_dir = '=';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x2392e4(%rip), %rax    # 0x33fdd0
movl (%rax), %edi
testl %edi, %edi
je 0x106b0c
leaq 0x2392db(%rip), %rax    # 0x33fdd4
movzbl (%rax), %esi
andl $-0x10, %esi
orl $0x6, %esi
movb %sil, (%rax)
callq 0xaea5
jmp 0x106b3f
leaq 0x2077b9(%rip), %rbx    # 0x30e2cc
movl (%rbx), %edi
imulq $0x2260, %rdi, %rax     # imm = 0x2260
leaq 0x2077bd(%rip), %rcx    # 0x30e2e0
cmpl $0x0, (%rcx,%rax)
jle 0x106b3f
movl $0x1, %esi
callq 0xaeab
movl (%rbx), %edi
movl $0x1, %esi
callq 0xaef7
leaq 0x2f4ac(%rip), %rdi     # 0x135ff2
callq 0x5f585
cmpb $0x0, 0x34eab0(%rip)    # 0x455602
jne 0x106b61
callq 0xae92
movsd %xmm0, 0x34eaff(%rip)   # 0x455660
movb $0x1, 0x34ea9a(%rip)    # 0x455602
xorl %eax, %eax
movb %al, 0x34ea90(%rip)     # 0x455600
movb %al, 0x34ea8b(%rip)     # 0x455601
leaq 0x20640b(%rip), %rax    # 0x30cf88
movb $0x3d, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathmsc.cpp
// Function: enable_temp_control()
void enable_temp_control()
{
   if(lpt_port) {  // get lpt port address from bios area
      lpt_addr = init_lpt();
   }
   else lpt_addr = 0;

   if(lpt_addr) {  // turn on parallel port temp control unit
      lpt_val = (lpt_val & 0x0F) | 0x90;
      outp(lpt_addr, lpt_val);
   }
   else if(com[fan_port].com_port > 0) { // using serial port lines to control temp
      SetRtsLine(fan_port, ENABLE);
   }
   send_fan_cmd("$INIT");

   low_ok = high_ok = 0;
   HEAT_OVERSHOOT = COOL_UNDERSHOOT = 0.0F;

   temp_control_on = 1;
   hold_temp();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x23048a(%rip), %rax    # 0x33701c
movl (%rax), %eax
decl %eax
cmpl $0x2, %eax
ja 0x106bcd
movl %eax, %eax
leaq 0x24b9c(%rip), %rcx     # 0x12b740
movl (%rcx,%rax,4), %edi
leaq 0x239222(%rip), %rax    # 0x33fdd0
movl %edi, (%rax)
leaq 0x23921d(%rip), %rax    # 0x33fdd4
movzbl (%rax), %esi
andl $0xf, %esi
orl $0x90, %esi
movb %sil, (%rax)
callq 0xaea5
jmp 0x106bfe
leaq 0x2391fc(%rip), %rax    # 0x33fdd0
movl $0x0, (%rax)
leaq 0x2076eb(%rip), %rax    # 0x30e2cc
movl (%rax), %edi
imulq $0x2260, %rdi, %rax     # imm = 0x2260
leaq 0x2076ef(%rip), %rcx    # 0x30e2e0
cmpl $0x0, (%rcx,%rax)
jle 0x106bfe
xorl %esi, %esi
callq 0xaef7
leaq 0x2f3f3(%rip), %rdi     # 0x135ff8
callq 0x5f585
xorl %eax, %eax
movq %rax, 0x34ead5(%rip)    # 0x4556e8
movq %rax, 0x34eac6(%rip)    # 0x4556e0
movq %rax, 0x34ead7(%rip)    # 0x4556f8
movq %rax, 0x34eac8(%rip)    # 0x4556f0
leaq 0x239192(%rip), %rax    # 0x33fdc1
movb $0x1, (%rax)
popq %rbp
jmp 0x106adf