// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathui.cpp
// Function: edit_cal_param()
void edit_cal_param()
{
float m, b;            // !!!! float
float r1,a1, r2,a2;
int i;

   if(cal_mode) {
      r1 = 1.0F;
      a1 = 0.0F;
      r2 = 1.0F;
      a2 = 0.0F;
      i = sscanf(edit_buffer, "%f %f %f %f", &r1,&a1, &r2,&a2);
      if(i < 1) {
         edit_error("ERROR: No calibration numbers were given!");
         return;
      }
      if(i < 3) {
         r2 = r1;
         a2 = a1;
      }

      if(r2 == r1) {
         if(r1 == 0.0F) {
            edit_error("ERROR: reading1 and reading2 cannot both be zero!");
            return;
         }
         else {
            m = a1 / r1;
            b = 0.0F;
         }
      }
      else {
         m = (a2-a1) / (r2-r1);
         b = a2 - m*r2;
      }

      if(m == 0.0F) {
         edit_error("ERROR: calculated 'm' value cannot be 0.0!");
         return;
      }
      else {
         sprintf(plot_title, "%s cal: m=%.6f  b=%.6f", plot[selected_plot].plot_id, m,b);
      }
   }
   else {
      m = 1.0F;
      b = 0.0F;
      i = sscanf(edit_buffer, "%f %f", &m,&b);
      if(i < 1) {
         edit_error("ERROR: No calibration numbers were given!");
         return;
      }
   }

   if     (selected_plot == TEMP)  { temp1_m=m; temp1_b=b; }
   else if(selected_plot == TC2)   { temp2_m=m; temp2_b=b; }
   else if(selected_plot == BATTI) { batti_m=m; batti_b=b; }
   else if(selected_plot == BATTV) { vcal_m=m;  vcal_b=b; }
   else if(selected_plot == LEDI)  { ledi_m=m;  ledi_b=b; }
   else if(selected_plot == LUX1)  { lux1_m=m;  lux1_b=b; }
   else if(selected_plot == LUX2)  { lux2_m=m;  lux2_b=b; }
   else if(selected_plot == AUXV)  { adc2_m=m;  adc2_b=b; }
   else if(selected_plot == CCT)   { rb_m=m;    rb_b=b; }
   else return;
   set_luxor_cal();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x2ddb73(%rip), %rax    # 0x30ce48
cmpb $0x0, (%rax)
je 0x2f332
movl $0x3f800000, %eax       # imm = 0x3F800000
leaq -0x18(%rbp), %rdx
movl %eax, (%rdx)
xorl %esi, %esi
leaq -0x4(%rbp), %rcx
movl %esi, (%rcx)
leaq -0x10(%rbp), %r8
movl %eax, (%r8)
leaq -0xc(%rbp), %r9
movl %esi, (%r9)
leaq 0x30ffde(%rip), %rdi    # 0x33f2e0
leaq 0xe88d8(%rip), %rsi     # 0x117be1
xorl %eax, %eax
callq 0x9360
testl %eax, %eax
jle 0x2f363
movss -0x18(%rbp), %xmm2
cmpl $0x2, %eax
ja 0x2f36c
movss %xmm2, -0x10(%rbp)
movss -0x4(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movaps %xmm2, %xmm3
jmp 0x2f371
leaq -0x8(%rbp), %rdx
movl $0x3f800000, (%rdx)     # imm = 0x3F800000
leaq -0x14(%rbp), %rcx
movl $0x0, (%rcx)
leaq 0x30ff93(%rip), %rdi    # 0x33f2e0
leaq 0x105e5e(%rip), %rsi    # 0x1351b2
xorl %eax, %eax
callq 0x9360
testl %eax, %eax
jg 0x2f419
leaq 0xe5960(%rip), %rdi     # 0x114cca
jmp 0x2f3d6
movss -0x10(%rbp), %xmm3
ucomiss %xmm2, %xmm3
jne 0x2f38b
jp 0x2f38b
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm2
jne 0x2f3b2
jp 0x2f3b2
leaq 0xe596b(%rip), %rdi     # 0x114cf4
jmp 0x2f3d6
movss -0xc(%rbp), %xmm1
movaps %xmm1, %xmm0
subss -0x4(%rbp), %xmm0
movaps %xmm3, %xmm4
subss %xmm2, %xmm4
divss %xmm4, %xmm0
movss %xmm0, -0x8(%rbp)
mulss %xmm0, %xmm3
subss %xmm3, %xmm1
jmp 0x2f3c0
movss -0x4(%rbp), %xmm0
divss %xmm2, %xmm0
movss %xmm0, -0x8(%rbp)
movss %xmm1, -0x14(%rbp)
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jne 0x2f3e0
jp 0x2f3e0
leaq 0xe5950(%rip), %rdi     # 0x114d26
callq 0x23027
jmp 0x2f4e7
leaq 0x310971(%rip), %rax    # 0x33fd58
movslq (%rax), %rax
imulq $0xe8, %rax, %rax
leaq 0x12e938(%rip), %rcx    # 0x15dd30
movq (%rcx,%rax), %rdx
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
leaq 0x30f445(%rip), %rdi    # 0x33e850
leaq 0xe593f(%rip), %rsi     # 0x114d51
movb $0x2, %al
callq 0x9060
leaq 0x310938(%rip), %rax    # 0x33fd58
movl (%rax), %eax
cmpq $0x12, %rax
ja 0x2f4e7
leaq 0xdcb7d(%rip), %rcx     # 0x10bfb0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1ebd85(%rip), %rax    # 0x21b1c8
leaq 0x1ebd76(%rip), %rcx    # 0x21b1c0
jmp 0x2f4ca
leaq 0x1ebd45(%rip), %rax    # 0x21b198
leaq 0x1ebd36(%rip), %rcx    # 0x21b190
jmp 0x2f4ca
leaq 0x1ebd55(%rip), %rax    # 0x21b1b8
leaq 0x1ebd46(%rip), %rcx    # 0x21b1b0
jmp 0x2f4ca
leaq 0x1ebd35(%rip), %rax    # 0x21b1a8
leaq 0x1ebd26(%rip), %rcx    # 0x21b1a0
jmp 0x2f4ca
leaq 0x1ebd05(%rip), %rax    # 0x21b188
leaq 0x1ebcf6(%rip), %rcx    # 0x21b180
jmp 0x2f4ca
leaq 0x1ebd55(%rip), %rax    # 0x21b1e8
leaq 0x1ebd46(%rip), %rcx    # 0x21b1e0
jmp 0x2f4ca
leaq 0x1ebcd5(%rip), %rax    # 0x21b178
leaq 0x1ebcc6(%rip), %rcx    # 0x21b170
jmp 0x2f4ca
leaq 0x1ebd25(%rip), %rax    # 0x21b1d8
leaq 0x1ebd16(%rip), %rcx    # 0x21b1d0
jmp 0x2f4ca
leaq 0x1ebd35(%rip), %rax    # 0x21b1f8
leaq 0x1ebd26(%rip), %rcx    # 0x21b1f0
xorps %xmm0, %xmm0
cvtss2sd -0x8(%rbp), %xmm0
movsd %xmm0, (%rcx)
xorps %xmm0, %xmm0
cvtss2sd -0x14(%rbp), %xmm0
movsd %xmm0, (%rax)
callq 0x7e865
addq $0x20, %rsp
popq %rbp
retq