// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathui.cpp
// Function: dump_cal_file()
void dump_cal_file()
{
FILE *file;

   if(edit_buffer[0] == 0) {
      file = topen("luxcal.scr", "w");
      if(file == 0) {
         sprintf(out, "ERROR: could not write file: luxcal.scr");
         edit_error(out);
         return;
      }
   }
   else {
//    strupr(edit_buffer);
      if(strstr(edit_buffer, ".") == 0) strcat(edit_buffer, ".scr");
      file = topen(edit_buffer, "w");
      if(file == 0) {
         sprintf(out, "ERROR: could not write file: %s", edit_buffer);
         edit_error(out);
         return;
      }
   }
   if(file == 0) return;

   fprintf(file, "&c0                     ;exit calibration mode\n");
   fprintf(file, "&s  %.4f   SERIAL     ;serial number\n", vref_b);
   fprintf(file, "&v  %.6f VREF       ;ADC reference voltage\n", vref_m);
   fprintf(file, "gd& %.6f %.6f   ;battery/led voltage calibration\n", vcal_m, vcal_b);
   fprintf(file, "go& %.6f %.6f   ;battery current calibration\n", batti_m, batti_b);
   fprintf(file, "g3& %.6f %.6f   ;led current calibration\n", ledi_m, ledi_b);
   fprintf(file, "gt& %.6f %.6f   ;temp sensor 1 calibration\n", temp1_m, temp1_b);
   fprintf(file, "g5& %.6f %.6f   ;temp sensor 2 calibration\n", temp2_m, temp2_b);
   fprintf(file, "gp& %.6f %.6f   ;lux sensor calibration\n", lux1_m, lux1_b);
   fprintf(file, "g1& %.6f %.6f   ;lumen sensor calibration\n", lux2_m, lux2_b);
   fprintf(file, "gl& %.6f %.6f   ;r/b color temperature calibration\n", rb_m, rb_b);
   fprintf(file, "g0& %.6f %.6f   ;aux ADC channel calibration\n", adc2_m, adc2_b);

   fclose(file);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x30c1f6(%rip), %rax    # 0x33f2e0
cmpb $0x0, (%rax)
je 0x3315b
leaq 0x30c1ea(%rip), %rbx    # 0x33f2e0
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x9100
testq %rax, %rax
jne 0x3311c
movq %rbx, %rdi
callq 0x9120
movl $0x7263732e, (%rbx,%rax) # imm = 0x7263732E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x30c1bd(%rip), %rdi    # 0x33f2e0
leaq 0xee291(%rip), %rsi     # 0x1213bb
callq 0x9a47
testq %rax, %rax
jne 0x33177
leaq 0x3090e5(%rip), %rbx    # 0x33c220
leaq 0xe218c(%rip), %rsi     # 0x1152ce
leaq 0x30c197(%rip), %rdx    # 0x33f2e0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
jmp 0x33362
leaq 0xe2161(%rip), %rdi     # 0x1152c3
leaq 0xee252(%rip), %rsi     # 0x1213bb
callq 0x9a47
testq %rax, %rax
je 0x33338
movq %rax, %rbx
leaq 0xe216d(%rip), %rdi     # 0x1152ee
movl $0x2f, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x9750
leaq 0x1e7fce(%rip), %rax    # 0x21b168
movsd (%rax), %xmm0
leaq 0xe2179(%rip), %rsi     # 0x11531e
movq %rbx, %rdi
movb $0x1, %al
callq 0x9560
leaq 0x1e7faa(%rip), %rax    # 0x21b160
movsd (%rax), %xmm0
leaq 0xe2183(%rip), %rsi     # 0x115344
movq %rbx, %rdi
movb $0x1, %al
callq 0x9560
leaq 0x1e7fbe(%rip), %rax    # 0x21b190
movsd (%rax), %xmm0
leaq 0x1e7fbb(%rip), %rax    # 0x21b198
movsd (%rax), %xmm1
leaq 0xe2188(%rip), %rsi     # 0x115370
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7fa7(%rip), %rax    # 0x21b1a0
movsd (%rax), %xmm0
leaq 0x1e7fa4(%rip), %rax    # 0x21b1a8
movsd (%rax), %xmm1
leaq 0xe2193(%rip), %rsi     # 0x1153a2
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7f90(%rip), %rax    # 0x21b1b0
movsd (%rax), %xmm0
leaq 0x1e7f8d(%rip), %rax    # 0x21b1b8
movsd (%rax), %xmm1
leaq 0xe219a(%rip), %rsi     # 0x1153d0
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7f29(%rip), %rax    # 0x21b170
movsd (%rax), %xmm0
leaq 0x1e7f26(%rip), %rax    # 0x21b178
movsd (%rax), %xmm1
leaq 0xe219d(%rip), %rsi     # 0x1153fa
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7f12(%rip), %rax    # 0x21b180
movsd (%rax), %xmm0
leaq 0x1e7f0f(%rip), %rax    # 0x21b188
movsd (%rax), %xmm1
leaq 0xe21a2(%rip), %rsi     # 0x115426
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7f2b(%rip), %rax    # 0x21b1c0
movsd (%rax), %xmm0
leaq 0x1e7f28(%rip), %rax    # 0x21b1c8
movsd (%rax), %xmm1
leaq 0xe21a7(%rip), %rsi     # 0x115452
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7f14(%rip), %rax    # 0x21b1d0
movsd (%rax), %xmm0
leaq 0x1e7f11(%rip), %rax    # 0x21b1d8
movsd (%rax), %xmm1
leaq 0xe21a9(%rip), %rsi     # 0x11547b
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7f0d(%rip), %rax    # 0x21b1f0
movsd (%rax), %xmm0
leaq 0x1e7f0a(%rip), %rax    # 0x21b1f8
movsd (%rax), %xmm1
leaq 0xe21ad(%rip), %rsi     # 0x1154a6
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7ed6(%rip), %rax    # 0x21b1e0
movsd (%rax), %xmm0
leaq 0x1e7ed3(%rip), %rax    # 0x21b1e8
movsd (%rax), %xmm1
leaq 0xe21ba(%rip), %rsi     # 0x1154da
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x9370
movups 0xe1f77(%rip), %xmm0    # 0x1152b6
leaq 0x308eda(%rip), %rdi    # 0x33c220
movaps %xmm0, 0x10(%rdi)
movups 0xe1f55(%rip), %xmm0    # 0x1152a6
movaps %xmm0, (%rdi)
movabsq $0x7263732e6c6163, %rax # imm = 0x7263732E6C6163
movq %rax, 0x20(%rdi)
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x23027