// File: /workspace/github_cpp_makefile_star2_O2/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 0x2ca649(%rip), %rax    # 0x2f6e48
cmpb $0x0, (%rax)
je 0x2c85c
movl $0x3f800000, %eax       # imm = 0x3F800000
leaq -0x4(%rbp), %rcx
andl $0x0, (%rcx)
leaq -0x18(%rbp), %rdx
movl %eax, (%rdx)
leaq -0x10(%rbp), %r8
movl %eax, (%r8)
leaq -0xc(%rbp), %r9
andl $0x0, (%r9)
leaq 0x2fcab4(%rip), %rdi    # 0x3292e0
leaq 0xd542e(%rip), %rsi     # 0x101c61
xorl %eax, %eax
callq 0x9350
testl %eax, %eax
jle 0x2c88a
movss -0x18(%rbp), %xmm2
cmpl $0x2, %eax
ja 0x2c893
movss %xmm2, -0x10(%rbp)
movss -0x4(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movaps %xmm2, %xmm3
jmp 0x2c898
leaq -0x8(%rbp), %rdx
movl $0x3f800000, (%rdx)     # imm = 0x3F800000
leaq -0x14(%rbp), %rcx
andl $0x0, (%rcx)
leaq 0x2fca6c(%rip), %rdi    # 0x3292e0
leaq 0xf2857(%rip), %rsi     # 0x11f0d2
xorl %eax, %eax
callq 0x9350
testl %eax, %eax
jg 0x2c940
leaq 0xd24b9(%rip), %rdi     # 0xfed4a
jmp 0x2c8fd
movss -0x10(%rbp), %xmm3
ucomiss %xmm2, %xmm3
jne 0x2c8b2
jp 0x2c8b2
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm2
jne 0x2c8d9
jp 0x2c8d9
leaq 0xd24c4(%rip), %rdi     # 0xfed74
jmp 0x2c8fd
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 0x2c8e7
movss -0x4(%rbp), %xmm0
divss %xmm2, %xmm0
movss %xmm0, -0x8(%rbp)
movss %xmm1, -0x14(%rbp)
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jne 0x2c907
jp 0x2c907
leaq 0xd24a9(%rip), %rdi     # 0xfeda6
callq 0x214df
jmp 0x2ca08
leaq 0x2fd44a(%rip), %rax    # 0x329d58
movslq (%rax), %rax
imulq $0xe8, %rax, %rax
leaq 0x11b411(%rip), %rcx    # 0x147d30
movq (%rcx,%rax), %rdx
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
leaq 0x2fbf1e(%rip), %rdi    # 0x328850
leaq 0xd2498(%rip), %rsi     # 0xfedd1
movb $0x2, %al
callq 0x9060
leaq 0x2fd411(%rip), %rax    # 0x329d58
movl (%rax), %eax
cmpq $0x12, %rax
ja 0x2ca08
leaq 0xc96ce(%rip), %rcx     # 0xf6028
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1d885e(%rip), %rax    # 0x2051c8
leaq 0x1d884f(%rip), %rcx    # 0x2051c0
jmp 0x2c9f1
leaq 0x1d881e(%rip), %rax    # 0x205198
leaq 0x1d880f(%rip), %rcx    # 0x205190
jmp 0x2c9f1
leaq 0x1d882e(%rip), %rax    # 0x2051b8
leaq 0x1d881f(%rip), %rcx    # 0x2051b0
jmp 0x2c9f1
leaq 0x1d880e(%rip), %rax    # 0x2051a8
leaq 0x1d87ff(%rip), %rcx    # 0x2051a0
jmp 0x2c9f1
leaq 0x1d87de(%rip), %rax    # 0x205188
leaq 0x1d87cf(%rip), %rcx    # 0x205180
jmp 0x2c9f1
leaq 0x1d882e(%rip), %rax    # 0x2051e8
leaq 0x1d881f(%rip), %rcx    # 0x2051e0
jmp 0x2c9f1
leaq 0x1d87ae(%rip), %rax    # 0x205178
leaq 0x1d879f(%rip), %rcx    # 0x205170
jmp 0x2c9f1
leaq 0x1d87fe(%rip), %rax    # 0x2051d8
leaq 0x1d87ef(%rip), %rcx    # 0x2051d0
jmp 0x2c9f1
leaq 0x1d880e(%rip), %rax    # 0x2051f8
leaq 0x1d87ff(%rip), %rcx    # 0x2051f0
cvtss2sd -0x8(%rbp), %xmm0
movsd %xmm0, (%rcx)
cvtss2sd -0x14(%rbp), %xmm0
movsd %xmm0, (%rax)
callq 0x73466
addq $0x20, %rsp
popq %rbp
retq