// File: /workspace/github_cpp_makefile_star2_O1/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 0x2ddd94(%rip), %rax    # 0x30ce48
cmpb $0x0, (%rax)
je 0x2f133
movl $0x3f800000, %eax       # imm = 0x3F800000
leaq -0x14(%rbp), %rdx
movl %eax, (%rdx)
xorl %esi, %esi
leaq -0x8(%rbp), %rcx
movl %esi, (%rcx)
leaq -0x10(%rbp), %r8
movl %eax, (%r8)
leaq -0xc(%rbp), %r9
movl %esi, (%r9)
leaq 0x3101ff(%rip), %rdi    # 0x33f2e0
leaq 0xe8a65(%rip), %rsi     # 0x117b4d
xorl %eax, %eax
callq 0x9360
testl %eax, %eax
jle 0x2f164
cmpl $0x2, %eax
jg 0x2f10c
movss -0x14(%rbp), %xmm0
movss %xmm0, -0x10(%rbp)
movss -0x8(%rbp), %xmm0
movss %xmm0, -0xc(%rbp)
movss -0x10(%rbp), %xmm2
movss -0x14(%rbp), %xmm0
ucomiss %xmm0, %xmm2
jne 0x2f16d
jp 0x2f16d
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2f194
jp 0x2f194
leaq 0xe5b32(%rip), %rdi     # 0x114c60
jmp 0x2f1bd
leaq -0x4(%rbp), %rdx
movl $0x3f800000, (%rdx)     # imm = 0x3F800000
leaq -0x18(%rbp), %rcx
movl $0x0, (%rcx)
leaq 0x310192(%rip), %rdi    # 0x33f2e0
leaq 0x105f6d(%rip), %rsi    # 0x1350c2
xorl %eax, %eax
callq 0x9360
testl %eax, %eax
jg 0x2f200
leaq 0xe5acb(%rip), %rdi     # 0x114c36
jmp 0x2f1bd
movss -0xc(%rbp), %xmm1
movaps %xmm1, %xmm3
subss -0x8(%rbp), %xmm3
movaps %xmm2, %xmm4
subss %xmm0, %xmm4
divss %xmm4, %xmm3
movss %xmm3, -0x4(%rbp)
mulss %xmm2, %xmm3
subss %xmm3, %xmm1
jmp 0x2f1a2
movss -0x8(%rbp), %xmm2
divss %xmm0, %xmm2
movss %xmm2, -0x4(%rbp)
movss %xmm1, -0x18(%rbp)
movss -0x4(%rbp), %xmm0
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jne 0x2f1c7
jp 0x2f1c7
leaq 0xe5ad5(%rip), %rdi     # 0x114c92
callq 0x2326e
jmp 0x2f33a
leaq 0x310b8a(%rip), %rax    # 0x33fd58
movslq (%rax), %rax
imulq $0xe8, %rax, %rax
leaq 0x12eb51(%rip), %rcx    # 0x15dd30
movq (%rcx,%rax), %rdx
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm1
leaq 0x30f65e(%rip), %rdi    # 0x33e850
leaq 0xe5ac4(%rip), %rsi     # 0x114cbd
movb $0x2, %al
callq 0x9060
leaq 0x310b51(%rip), %rax    # 0x33fd58
movl (%rax), %eax
cmpq $0x12, %rax
ja 0x2f33a
leaq 0xdcd8e(%rip), %rcx     # 0x10bfa8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebf8e(%rip), %rax    # 0x21b1c0
movsd %xmm0, (%rax)
leaq 0x1ebf8b(%rip), %rax    # 0x21b1c8
jmp 0x2f329
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebf3f(%rip), %rax    # 0x21b190
movsd %xmm0, (%rax)
leaq 0x1ebf3c(%rip), %rax    # 0x21b198
jmp 0x2f329
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebf40(%rip), %rax    # 0x21b1b0
movsd %xmm0, (%rax)
leaq 0x1ebf3d(%rip), %rax    # 0x21b1b8
jmp 0x2f329
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebf11(%rip), %rax    # 0x21b1a0
movsd %xmm0, (%rax)
leaq 0x1ebf0e(%rip), %rax    # 0x21b1a8
jmp 0x2f329
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebed2(%rip), %rax    # 0x21b180
movsd %xmm0, (%rax)
leaq 0x1ebecf(%rip), %rax    # 0x21b188
jmp 0x2f329
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebf16(%rip), %rax    # 0x21b1e0
movsd %xmm0, (%rax)
leaq 0x1ebf13(%rip), %rax    # 0x21b1e8
jmp 0x2f329
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebe8a(%rip), %rax    # 0x21b170
movsd %xmm0, (%rax)
leaq 0x1ebe87(%rip), %rax    # 0x21b178
jmp 0x2f329
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebece(%rip), %rax    # 0x21b1d0
movsd %xmm0, (%rax)
leaq 0x1ebecb(%rip), %rax    # 0x21b1d8
jmp 0x2f329
xorps %xmm0, %xmm0
cvtss2sd -0x4(%rbp), %xmm0
leaq 0x1ebed2(%rip), %rax    # 0x21b1f0
movsd %xmm0, (%rax)
leaq 0x1ebecf(%rip), %rax    # 0x21b1f8
xorps %xmm0, %xmm0
cvtss2sd -0x18(%rbp), %xmm0
movsd %xmm0, (%rax)
callq 0x7ea4e
addq $0x20, %rsp
popq %rbp
retq