// File: /workspace/github_cpp_makefile_star2_O1/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 0x30c311(%rip), %rax    # 0x33f2e0
cmpb $0x0, (%rax)
je 0x33040
leaq 0x30c305(%rip), %rbx    # 0x33f2e0
movq %rbx, %rdi
movl $0x2e, %esi
callq 0x9100
testq %rax, %rax
jne 0x33001
movq %rbx, %rdi
callq 0x9120
movl $0x7263732e, (%rbx,%rax) # imm = 0x7263732E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x30c2d8(%rip), %rdi    # 0x33f2e0
leaq 0xee2cc(%rip), %rsi     # 0x1212db
callq 0x9a4d
testq %rax, %rax
jne 0x3305c
leaq 0x309200(%rip), %rbx    # 0x33c220
leaq 0xe2213(%rip), %rsi     # 0x11523a
leaq 0x30c2b2(%rip), %rdx    # 0x33f2e0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
jmp 0x33247
leaq 0xe21e8(%rip), %rdi     # 0x11522f
leaq 0xee28d(%rip), %rsi     # 0x1212db
callq 0x9a4d
testq %rax, %rax
je 0x3321d
movq %rax, %rbx
leaq 0xe21f4(%rip), %rdi     # 0x11525a
movl $0x2f, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x9750
leaq 0x1e80e9(%rip), %rax    # 0x21b168
movsd (%rax), %xmm0
leaq 0xe2200(%rip), %rsi     # 0x11528a
movq %rbx, %rdi
movb $0x1, %al
callq 0x9560
leaq 0x1e80c5(%rip), %rax    # 0x21b160
movsd (%rax), %xmm0
leaq 0xe220a(%rip), %rsi     # 0x1152b0
movq %rbx, %rdi
movb $0x1, %al
callq 0x9560
leaq 0x1e80d9(%rip), %rax    # 0x21b190
movsd (%rax), %xmm0
leaq 0x1e80d6(%rip), %rax    # 0x21b198
movsd (%rax), %xmm1
leaq 0xe220f(%rip), %rsi     # 0x1152dc
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e80c2(%rip), %rax    # 0x21b1a0
movsd (%rax), %xmm0
leaq 0x1e80bf(%rip), %rax    # 0x21b1a8
movsd (%rax), %xmm1
leaq 0xe221a(%rip), %rsi     # 0x11530e
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e80ab(%rip), %rax    # 0x21b1b0
movsd (%rax), %xmm0
leaq 0x1e80a8(%rip), %rax    # 0x21b1b8
movsd (%rax), %xmm1
leaq 0xe2221(%rip), %rsi     # 0x11533c
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e8044(%rip), %rax    # 0x21b170
movsd (%rax), %xmm0
leaq 0x1e8041(%rip), %rax    # 0x21b178
movsd (%rax), %xmm1
leaq 0xe2224(%rip), %rsi     # 0x115366
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e802d(%rip), %rax    # 0x21b180
movsd (%rax), %xmm0
leaq 0x1e802a(%rip), %rax    # 0x21b188
movsd (%rax), %xmm1
leaq 0xe2229(%rip), %rsi     # 0x115392
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e8046(%rip), %rax    # 0x21b1c0
movsd (%rax), %xmm0
leaq 0x1e8043(%rip), %rax    # 0x21b1c8
movsd (%rax), %xmm1
leaq 0xe222e(%rip), %rsi     # 0x1153be
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e802f(%rip), %rax    # 0x21b1d0
movsd (%rax), %xmm0
leaq 0x1e802c(%rip), %rax    # 0x21b1d8
movsd (%rax), %xmm1
leaq 0xe2230(%rip), %rsi     # 0x1153e7
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e8028(%rip), %rax    # 0x21b1f0
movsd (%rax), %xmm0
leaq 0x1e8025(%rip), %rax    # 0x21b1f8
movsd (%rax), %xmm1
leaq 0xe2234(%rip), %rsi     # 0x115412
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
leaq 0x1e7ff1(%rip), %rax    # 0x21b1e0
movsd (%rax), %xmm0
leaq 0x1e7fee(%rip), %rax    # 0x21b1e8
movsd (%rax), %xmm1
leaq 0xe2241(%rip), %rsi     # 0x115446
movq %rbx, %rdi
movb $0x2, %al
callq 0x9560
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x9370
movups 0xe1ffe(%rip), %xmm0    # 0x115222
leaq 0x308ff5(%rip), %rdi    # 0x33c220
movaps %xmm0, 0x10(%rdi)
movups 0xe1fdc(%rip), %xmm0    # 0x115212
movaps %xmm0, (%rdi)
movabsq $0x7263732e6c6163, %rax # imm = 0x7263732E6C6163
movq %rax, 0x20(%rdi)
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2326e