// File: 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 0x329df9(%rip), %rax    # 0x36c028
cmpb $0x0, (%rax)
je 0x423ae
movss 0x12f6fc(%rip), %xmm0   # 0x17193c
movss %xmm0, -0xc(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
movss 0x12f6e7(%rip), %xmm0   # 0x17193c
movss %xmm0, -0x14(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x18(%rbp)
leaq 0x35c257(%rip), %rdi    # 0x39e4c0
leaq 0x13a36f(%rip), %rsi    # 0x17c5df
leaq -0xc(%rbp), %rdx
leaq -0x10(%rbp), %rcx
leaq -0x14(%rbp), %r8
leaq -0x18(%rbp), %r9
movb $0x0, %al
callq 0x9370
movl %eax, -0x1c(%rbp)
cmpl $0x1, -0x1c(%rbp)
jge 0x422a1
leaq 0x1373cf(%rip), %rdi    # 0x179666
callq 0x30d60
jmp 0x4260b
cmpl $0x3, -0x1c(%rbp)
jge 0x422bb
movss -0xc(%rbp), %xmm0
movss %xmm0, -0x14(%rbp)
movss -0x10(%rbp), %xmm0
movss %xmm0, -0x18(%rbp)
movss -0x14(%rbp), %xmm0
ucomiss -0xc(%rbp), %xmm0
jne 0x42301
jp 0x42301
movss -0xc(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x422e8
jp 0x422e8
leaq 0x1373b2(%rip), %rdi    # 0x179690
callq 0x30d60
jmp 0x4260b
movss -0x10(%rbp), %xmm0
divss -0xc(%rbp), %xmm0
movss %xmm0, -0x4(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x8(%rbp)
jmp 0x42347
movss -0x18(%rbp), %xmm0
subss -0x10(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
subss -0xc(%rbp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x4(%rbp)
movss -0x18(%rbp), %xmm1
movss -0x4(%rbp), %xmm0
movss -0x14(%rbp), %xmm2
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x8(%rbp)
movss -0x4(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x42367
jp 0x42367
leaq 0x137365(%rip), %rdi    # 0x1796c2
callq 0x30d60
jmp 0x4260b
leaq 0x35cbca(%rip), %rax    # 0x39ef38
movslq (%rax), %rcx
leaq 0x17a9a8(%rip), %rax    # 0x1bcd20
imulq $0xe8, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x8(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x35b692(%rip), %rdi    # 0x39da30
leaq 0x137348(%rip), %rsi    # 0x1796ed
movb $0x2, %al
callq 0x9060
jmp 0x423fc
movss 0x12f586(%rip), %xmm0   # 0x17193c
movss %xmm0, -0x4(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x8(%rbp)
leaq 0x35c0f6(%rip), %rdi    # 0x39e4c0
leaq 0x155973(%rip), %rsi    # 0x197d44
leaq -0x4(%rbp), %rdx
leaq -0x8(%rbp), %rcx
movb $0x0, %al
callq 0x9370
movl %eax, -0x1c(%rbp)
cmpl $0x1, -0x1c(%rbp)
jge 0x423fa
leaq 0x137276(%rip), %rdi    # 0x179666
callq 0x30d60
jmp 0x4260b
jmp 0x423fc
leaq 0x35cb35(%rip), %rax    # 0x39ef38
cmpl $0x3, (%rax)
jne 0x42435
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237f38(%rip), %rax    # 0x27a350
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237f2c(%rip), %rax    # 0x27a358
movsd %xmm0, (%rax)
jmp 0x42606
leaq 0x35cafc(%rip), %rax    # 0x39ef38
cmpl $0x8, (%rax)
jne 0x4246e
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237f0f(%rip), %rax    # 0x27a360
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237f03(%rip), %rax    # 0x27a368
movsd %xmm0, (%rax)
jmp 0x42604
leaq 0x35cac3(%rip), %rax    # 0x39ef38
cmpl $0x1, (%rax)
jne 0x424a7
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237ef6(%rip), %rax    # 0x27a380
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237eea(%rip), %rax    # 0x27a388
movsd %xmm0, (%rax)
jmp 0x42602
leaq 0x35ca8a(%rip), %rax    # 0x39ef38
cmpl $0x2, (%rax)
jne 0x424e0
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237ead(%rip), %rax    # 0x27a370
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237ea1(%rip), %rax    # 0x27a378
movsd %xmm0, (%rax)
jmp 0x42600
leaq 0x35ca51(%rip), %rax    # 0x39ef38
cmpl $0x6, (%rax)
jne 0x42519
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237e94(%rip), %rax    # 0x27a390
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237e88(%rip), %rax    # 0x27a398
movsd %xmm0, (%rax)
jmp 0x425fe
leaq 0x35ca18(%rip), %rax    # 0x39ef38
cmpl $0x0, (%rax)
jne 0x42552
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237e6b(%rip), %rax    # 0x27a3a0
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237e5f(%rip), %rax    # 0x27a3a8
movsd %xmm0, (%rax)
jmp 0x425fc
leaq 0x35c9df(%rip), %rax    # 0x39ef38
cmpl $0x4, (%rax)
jne 0x42588
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237e42(%rip), %rax    # 0x27a3b0
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237e36(%rip), %rax    # 0x27a3b8
movsd %xmm0, (%rax)
jmp 0x425fa
leaq 0x35c9a9(%rip), %rax    # 0x39ef38
cmpl $0xd, (%rax)
jne 0x425be
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237e1c(%rip), %rax    # 0x27a3c0
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237e10(%rip), %rax    # 0x27a3c8
movsd %xmm0, (%rax)
jmp 0x425f8
leaq 0x35c973(%rip), %rax    # 0x39ef38
cmpl $0x12, (%rax)
jne 0x425f4
movss -0x4(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237df6(%rip), %rax    # 0x27a3d0
movsd %xmm0, (%rax)
movss -0x8(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x237dea(%rip), %rax    # 0x27a3d8
movsd %xmm0, (%rax)
jmp 0x425f6
jmp 0x4260b
jmp 0x425f8
jmp 0x425fa
jmp 0x425fc
jmp 0x425fe
jmp 0x42600
jmp 0x42602
jmp 0x42604
jmp 0x42606
callq 0xad600
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)