// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: secondary_timing(int)
void secondary_timing(int get_tsip)
{
u08 spare1, spare2;
u32 dac_value;
u08 spare3[8];
int i;
int color;
u08 spare_data;
u08 survey_err;
double jit;
DATA_SIZE val;
DATA_SIZE x_dac;
double x_pps;
double x_osc;
double x_lat;
double x_lon;
double x_alt;
long   x_val;
int seq_err;

   // process the secondary timing message from the receiver (if any) and
   // validate the various receiver data values.  For TSIP devices, this routine
   // gets the secondary timing message from the device.
   if(get_tsip) log_packet_id("Packet 0x8F.AC (Secondary timing)");

   ++timing_seen;

   if(tsip_type == STARLOC_TYPE) {   // this turd can send secondary timing packets
      seq_err = this_pri_tow-(last_pri_tow+1);
      if(seq_err < (-1000)) seq_err += (7*24*60*60);  // week wrap
      if(seq_err == (-2)) return;  // skipped time stamp
      if(skip_starloc_time) return;  // without a preceeding primary timing packet
      skip_starloc_time = 1;
   }

   color = 0;

   if(get_tsip) {
      rcvr_mode = tsip_byte();
      discipline_mode = tsip_byte();
      if(SV6_FAMILY || ACUTIME || ACU_GG || ACU_360 || PALISADE) discipline_mode = DIS_MODE_NORMAL;
      survey_progress = tsip_byte();
      have_progress = 1;
      holdover = tsip_dword();
      critical_alarms = tsip_word();
      last_ma = minor_alarms;
      minor_alarms = tsip_word();
//if(last_ma != minor_alarms) sprintf(debug_text, "ma:%04X  last_ma:%04X", minor_alarms, last_ma); // rrrrr
      gps_status = tsip_byte();
      discipline = tsip_byte();
      spare1 = tsip_byte();
      spare2 = tsip_byte();
      x_pps = (double) tsip_single();
      x_osc = (double) tsip_single();
      x_val = tsip_dword();
      x_dac = tsip_single();
      if(res_t || ACU_GG || ACU_360 || ACUTIME) {
         have_sawtooth = 1;
         if(x_dac < 200e-9) x_dac *= 1.0E9;  // !!!! old firmware outputs sawtooth in seconds, convert to nsec
      }
      else have_dac = 1;
//      last_temp_val = temperature;
      last_xt = x_temp;
      x_temp = tsip_single();
      if(x_temp) have_temperature = 100;

      if(last_xt == 0.0F) last_xt = x_temp;
//      if(last_temp_val == 0.0F) last_temp_val = temperature;
      x_lat = tsip_double();
      x_lon = tsip_double();
      x_alt = tsip_double();

      pps_quant = tsip_single();  // res_t
      if(res_t || ACU_GG || ACU_360 || ACUTIME) x_dac = pps_quant;

      spare_data = 0;  // flag set if any non-zero spare data fields 
      for(i=0; i<4; i++) {
         spare3[i] = tsip_byte();  // ACUTIME spare3[0] -> 0=NO PPS GEN  1=PPS generated
         if(spare3[i]) ++spare_data;
      }

      check_tsip_end(1);

      if(!have_critical_alarms) need_redraw = 7701;

      have_antenna = 1;
      have_osc_age = 1;
      have_osc_offset = 1;
      have_pps_offset = 1;
      have_rcvr_pps = 1;
      have_rcvr_osc = 1;
      have_saved_posn = 1;
      have_tracking = 1;
      have_leap_info = 1;
      have_op_mode = 1;
      have_almanac = 1;
      have_critical_alarms = 1;
      have_gps_status = 1;
      have_sec_timing = 1;

      poll_raw_data();
//adadad    do_pps_adev(x_pps / 100.0);
//adadad    do_osc_adev(x_osc / 100.0);

      if(just_read) return;
      if(tsip_error) return;
   }
   else {
poll_raw_data();
      x_pps = pps_offset;
      x_osc = osc_offset;
      x_dac = dac_voltage;
      x_temp = temperature;
      last_xt = x_temp;
      x_val = 0;
   }

   pps_offset = x_pps;
   osc_offset = x_osc;
   dac_value = x_val;
   dac_voltage = x_dac;

if((jitter_adev == 0) && (TICC_USED == 0) && (pause_data == 0)) {
   add_rcvr_adev_point(0);
}

   last_temp_val = temperature;
// temperature = x_temp;
if(undo_fw_temp_filter && (luxor == 0) && (rcvr_type != UCCM_RCVR)) {
   temperature = (SENSOR_TC*x_temp) - ((SENSOR_TC-1.0F)*last_xt);  // unaverage the firmware reported temperature
   if((temperature < -100.0) || (temperature > 100.0F)) temperature = x_temp;  // filter problem
}
else if(have_temperature) {
   temperature = x_temp;
}

   if(last_temp_val == 0.0F) last_temp_val = temperature;
   if(get_tsip) {
      lat = x_lat;
      lon = x_lon;
      alt = x_alt;
   }

   if(plot[TEMP].plot_center == NEED_CENTER) plot[TEMP].plot_center = scale_temp((double) temperature);
   if(enviro_mode()) {
      if(plot[PRESSURE].plot_center == NEED_CENTER) plot[PRESSURE].plot_center = scale_pressure((double) pressure);
   }
   if(plot[BATTV].plot_center  == NEED_CENTER) plot[BATTV].plot_center  = dac_voltage;
   if(luxor && (plot[TC2].plot_center == NEED_CENTER)) plot[TC2].plot_center = scale_temp((double) luxor_tc2);
   if(luxor && (plot[LUX1].plot_center == NEED_CENTER)) plot[LUX1].plot_center = (float) (pps_offset * lux_scale);
   if(luxor && (plot[LUX2].plot_center == NEED_CENTER)) plot[LUX2].plot_center = (float) (pps_offset * lum_scale);

   if(survey_progress == 100) surveying = 0;
   if(doing_survey != last_survey) {  // self survey changed
      if(trimble_save) ;
      else if(precision_survey) ;
      else need_redraw = 2010;
   }
   last_survey = doing_survey;

   #ifdef PRECISE_STUFF
      precise_check();
   #endif

   if(crude_temp) {   // simulate the crude temperature sensor for temp ctrl pid testing
      val = temperature - (DATA_SIZE) (int) temperature;
      val -= 0.75;
      if((val >= 0.02) || (val < (-0.02))) {  // allow some noise around the switch point
         temperature = ((DATA_SIZE) (int) temperature) + (DATA_SIZE) 0.75;
      }
   }

   if(tsip_error) {  // don't pollute log with potentially bad data
      pps_offset = last_pps_offset;
      osc_offset = last_osc_offset;
      dac_voltage = last_dac_voltage;
      temperature = last_temp_val;
   }
   else {  // filter out bogus values
      if(TIMING_RCVR) ;
      else if(rcvr_type == THERMO_RCVR) ;
      else if(rcvr_type == TICC_RCVR) ;
      else if((ticc_type == LARS_TICC) && TICC_USED) ;
      else if(rcvr_type == UCCM_RCVR) ;  // kkkkkk
      else if(res_t == 0) {
         #ifdef __386__
            if(ABS(dac_voltage) <= 1.0E-4F) dac_voltage = 0.0F;
            if(ABS(temperature) <= 1.0E-4F) temperature = 0.0F;
         #endif

         if(luxor == 0) {
            if(dac_voltage == 0.0F) dac_voltage = last_dac_voltage;
            if(temperature == 0.0F) temperature = last_temp_val;
////        if(pps_offset == 0.0F)  pps_offset = last_pps_offset;
////        if(osc_offset == 0.0F)  osc_offset = last_osc_offset;
            if(DAC_PCT) {
               if((dac_voltage < (-100.0F)) || (dac_voltage > 100.0F)) dac_voltage = last_dac_voltage;
            }
            else if(rcvr_type == RFTG_RCVR) {
               if((dac_voltage < (-20.0F)) || (dac_voltage > 20.0F)) dac_voltage = last_dac_voltage;
            }
            else if((dac_voltage < (-10.0F)) || (dac_voltage > 10.0F)) dac_voltage = last_dac_voltage;
            if((temperature < (-55.0F)) || (temperature > 100.0F)) temperature = last_temp_val;
         }
      }

      have_rcvr_mode = 1;

      #ifdef PRECISE_STUFF
         update_precise_survey();
         if(rcvr_mode != last_rcvr_mode) plot_lla_axes(20);
         last_rcvr_mode = rcvr_mode;
      #endif
   }

   if(saw_ntpx && (initial_voltage == 0.0) && ((user_set_osc_param & PARAM_INITV) == 0x00)) {
      initial_voltage = dac_voltage;  // set initial dac voltage to the current dac value
      have_initv = 1;
   }

   if(have_time && (have_osc == 0)) {  // initialize the value to the current PPS offset
      have_osc = 1;
      osc_integral = (((double) pps_offset) * 1.0E-9);
   }
   osc_integral += (osc_offset * 1.0E-9);


   filter_spikes();    // filter out false temperature sensor spikes
   #ifdef TEMP_CONTROL
      control_temp();
   #else
      temp_dir = ' ';
   #endif

   #ifdef OSC_CONTROL
      control_osc();
   #endif

   survey_err = 0;
   if((rcvr_type == UCCM_RCVR) && (scpi_type == SAMSUNG_TYPE)) ;
   else if(survey_progress > 100) {
      survey_progress = 100;
      survey_err = 1;
   }

#ifdef ADEV_STUFF
   if(jitter_adev) {  // measuring message timing adevs
      jit = (this_time_msec-last_time_msec);   // rrrrr
      do_pps_adev(msg_ofs * 1.0E6);
      do_osc_adev(jit*1.0E6);
   }
#endif // ADEV_STUFF

   if((tsip_type == STARLOC_TYPE) && (pt_hh == st_hh) && (pt_min == st_min) && (pt_sec == st_sec)) {
      // ignore duplicate time stamp
   }
   else {
      if(reading_log == 0) {
         time_check(0, (DATA_SIZE) 1.0, year,month,day, hours,minutes,seconds,raw_frac);  // check for skips in the time
      }
      if(++log_file_time >= log_interval) {
         if(doing_log_dump == 0) write_log_readings(log_file, -1L);
         log_file_time = 0;
      }

      if(rinex_file && have_info) {
         write_rinex_header(rinex_file);
         write_rinex_obs(rinex_file);
      }
   }
   st_hh = pt_hh;
   st_min = pt_min;
   st_sec = pt_sec;

   if(sim_eof) tsip_error = survey_err = 0;
   if(tsip_error) return;
   if(survey_err) return;

   last_pps_offset = pps_offset;
   last_osc_offset = osc_offset;
   last_dac_voltage = dac_voltage;

   last_temperature = temperature;
   last_tc0 = tc0;
   last_tc1 = tc1;
   last_tc2 = tc2;

   last_adc1 = adc1;
   last_adc2 = adc2;
   last_adc3 = adc3;
   last_adc4 = adc4;

   last_humidity = humidity;
   last_pressure = pressure;

   // round these to multiples of the graph scale factor
   last_temperature *= plot[TEMP].ref_scale;
   last_temperature = (long) ((last_temperature / plot[TEMP].scale_factor)) * plot[TEMP].scale_factor;
   last_temperature /= plot[TEMP].ref_scale;

   if(0) {
      last_tc1 *= plot[TEMP1].ref_scale;
      last_tc1 = (long) ((last_tc1 / plot[TEMP1].scale_factor)) * plot[TEMP1].scale_factor;
      last_tc1 /= plot[TEMP1].ref_scale;

      last_tc2 *= plot[TEMP2].ref_scale;
      last_tc2 = (long) ((last_tc2 / plot[TEMP2].scale_factor)) * plot[TEMP2].scale_factor;
      last_tc2 /= plot[TEMP2].ref_scale;
   }

   last_dac_voltage *= plot[DAC].ref_scale; 
   last_dac_voltage = (long) ((last_dac_voltage / plot[DAC].scale_factor)) * plot[DAC].scale_factor;
   last_dac_voltage /= plot[DAC].ref_scale; 

   if(have_alarms == 0) {
      have_alarms = 1;
      last_critical = critical_alarms;
      last_minor = minor_alarms;
   }

#ifdef ADEV_STUFF
   if(pause_data == 0) {  // redraw adev curves and tables every 10 seconds
      update_adev_display(ATYPE, 0);  
   }
#endif // ADEV_STUFF

   show_version_header();    // show the receiver id info
   show_log_state();         // show the logging mode
   show_param_values(0);     // update alarm and data value displays

   write_log_changes();      // write important state changes to log file

   if((last_utc_ofs == 0) && have_utc_ofs) {  // we just got the UTC offset
      last_utc_ofs = have_utc_ofs;            
      if(rcvr_type == TICC_RCVR);
      else if(log_loaded == 0) clear_all_data();   // assume previous data was bogus, clear it
   }

   update_plot_data();       // add latest info to the plot queue and update the screen
   show_scaled_lla();
   show_plot_stats();

//sprintf(debug_text2, "dtl:%d  ppstrend:%d  ttype:%d", dynamic_trend_line, plot[PPS].show_trend, title_type);
   if(dynamic_trend_line) {  // update trend line info plot title dynamically
      show_trend_info(selected_plot);
   }

   track_object();  // output sun, moon, sat position to TRACK_PORT (if enabled)

   if(ticc_sim_file) {  // get aux TICC data from a simulation file  //lfs //LARS_TICC
      if(fgets(out, sizeof out, ticc_sim_file) != NULL) {
         char *s;
         s = strchr(out, 0x0D);
         if(s) *s = 0;
         s = strchr(out, 0x0A);
         if(s) *s = 0;
         strcpy((char *) ticc_buf, out);
         ticc_wptr = strlen((char *) ticc_buf);
         decode_ticc_msg(TICC_PORT);
         packet_end = 1;
         ticc_sim_eof = 0;
      }
      else ticc_sim_eof = 1;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edi, %ebx
testl %edi, %edi
je 0x6cac8
leaq 0x9f752(%rip), %rdi     # 0x10c215
callq 0x520bf
leaq 0x1bc4a9(%rip), %rax    # 0x228f78
incl (%rax)
leaq 0x1984fc(%rip), %r13    # 0x204fd4
cmpl $0x53, (%r13)
jne 0x6cb20
movl 0x2e92f3(%rip), %eax    # 0x355dd8
movl 0x2e92f1(%rip), %ecx    # 0x355ddc
notl %ecx
leal (%rax,%rcx), %edx
cmpl $0xfffffc18, %edx       # imm = 0xFFFFFC18
leal 0x93a80(%rax,%rcx), %eax
cmovgel %edx, %eax
cmpl $-0x2, %eax
je 0x6d7e2
cmpl $0x0, 0x2e92c4(%rip)    # 0x355dd4
jne 0x6d7e2
movl $0x1, 0x2e92b4(%rip)    # 0x355dd4
pushq $0x1
popq %r14
testl %ebx, %ebx
je 0x6ce25
callq 0x51c47
leaq 0x28a598(%rip), %rcx    # 0x2f70d0
movb %al, (%rcx)
callq 0x51c47
leaq 0x28a951(%rip), %rcx    # 0x2f7497
movb %al, (%rcx)
leaq 0x195d81(%rip), %r15    # 0x2028d0
cmpq $0x1, (%r15)
jne 0x6cb6e
movl (%r13), %eax
addl $-0x33, %eax
cmpl $0x1d, %eax
ja 0x6cb6e
movl $0x20004009, %edx       # imm = 0x20004009
btl %eax, %edx
jae 0x6cb6e
movb $0x0, (%rcx)
callq 0x51c47
movzbl %al, %eax
leaq 0x28b30f(%rip), %rcx    # 0x2f7e8c
movl %eax, (%rcx)
leaq 0x28b30a(%rip), %rax    # 0x2f7e90
movl $0x1, (%rax)
callq 0x51cf3
leaq 0x28a8c0(%rip), %rcx    # 0x2f7458
movl %eax, (%rcx)
callq 0x51c63
movzwl %ax, %eax
leaq 0x28a627(%rip), %rcx    # 0x2f71d0
movl %eax, (%rcx)
leaq 0x28a626(%rip), %r12    # 0x2f71d8
movl (%r12), %eax
movl %eax, 0x2ee15c(%rip)    # 0x35ad18
callq 0x51c63
movzwl %ax, %eax
movl %eax, (%r12)
callq 0x51c47
movzbl %al, %eax
leaq 0x28a8c5(%rip), %rcx    # 0x2f749c
movl %eax, (%rcx)
callq 0x51c47
leaq 0x28a8b0(%rip), %rcx    # 0x2f7495
movb %al, (%rcx)
callq 0x51c47
callq 0x51c47
callq 0x51dc3
movss %xmm0, -0x48(%rbp)
callq 0x51dc3
movss %xmm0, -0x40(%rbp)
callq 0x51cf3
callq 0x51dc3
cvtss2sd %xmm0, %xmm1
leaq 0x195cea(%rip), %r12    # 0x202904
cmpb $0x0, (%r12)
jne 0x6cc36
cmpq $0x1, (%r15)
jne 0x6d7f1
cmpl $0x41, (%r13)
jne 0x6d7f1
leaq 0x28a787(%rip), %rax    # 0x2f73c4
movl $0x1, (%rax)
movsd 0x9b68d(%rip), %xmm0    # 0x1082d8
ucomisd %xmm1, %xmm0
jbe 0x6cc59
mulsd 0x863cf(%rip), %xmm1    # 0xf3028
movsd %xmm1, -0x38(%rbp)
movsd 0x2ee0aa(%rip), %xmm0   # 0x35ad10
movsd %xmm0, 0x2ee09a(%rip)   # 0x35ad08
callq 0x51dc3
cvtss2sd %xmm0, %xmm1
movsd %xmm1, 0x2ee091(%rip)   # 0x35ad10
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jne 0x6cc89
jnp 0x6cc96
leaq 0x28a5bc(%rip), %rax    # 0x2f724c
movl $0x64, (%rax)
movsd 0x2ee06a(%rip), %xmm0   # 0x35ad08
xorps %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jne 0x6ccb1
jp 0x6ccb1
movsd %xmm1, 0x2ee057(%rip)   # 0x35ad08
callq 0x51e6f
movsd %xmm0, -0x30(%rbp)
callq 0x51e6f
movsd %xmm0, -0x58(%rbp)
callq 0x51e6f
movsd %xmm0, -0x50(%rbp)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
leaq 0x289d31(%rip), %rax    # 0x2f6a10
movsd %xmm0, (%rax)
cmpb $0x0, (%r12)
jne 0x6cd1e
cmpq $0x1, (%r15)
sete %cl
cmpl $0x41, (%r13)
sete %al
andb %cl, %al
leaq 0x195bf6(%rip), %rcx    # 0x2028f8
cmpl $0x47, (%rcx)
sete %cl
andb %al, %cl
xorb $0x1, %al
orb %cl, %al
movaps %xmm0, %xmm1
testb %cl, %cl
jne 0x6cd1a
movsd -0x38(%rbp), %xmm1
testb %al, %al
jne 0x6cd21
movaps %xmm0, %xmm1
movsd %xmm1, -0x38(%rbp)
cvtss2sd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
cvtss2sd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
pushq $0x4
popq %r15
subl $0x1, %r15d
jb 0x6cd4b
callq 0x51c47
jmp 0x6cd3e
xorl %edi, %edi
callq 0x52194
leaq 0x28a54f(%rip), %rax    # 0x2f72a8
cmpl $0x0, (%rax)
jne 0x6cd6b
leaq 0x195adf(%rip), %rcx    # 0x202844
movl $0x1e15, (%rcx)         # imm = 0x1E15
leaq 0x28a4ba(%rip), %rcx    # 0x2f722c
movl %r14d, (%rcx)
leaq 0x28a4b4(%rip), %rcx    # 0x2f7230
movl %r14d, (%rcx)
leaq 0x28a4ae(%rip), %rcx    # 0x2f7234
movl %r14d, (%rcx)
leaq 0x28a4a8(%rip), %rcx    # 0x2f7238
movl %r14d, (%rcx)
leaq 0x28a4aa(%rip), %rcx    # 0x2f7244
movl %r14d, (%rcx)
leaq 0x28a4a4(%rip), %rcx    # 0x2f7248
movl %r14d, (%rcx)
leaq 0x28a4de(%rip), %rcx    # 0x2f728c
movl %r14d, (%rcx)
leaq 0x28a4d8(%rip), %rcx    # 0x2f7290
movl %r14d, (%rcx)
leaq 0x28a4d6(%rip), %rcx    # 0x2f7298
movl %r14d, (%rcx)
leaq 0x28a4d0(%rip), %rcx    # 0x2f729c
movl %r14d, (%rcx)
leaq 0x28a4ce(%rip), %rcx    # 0x2f72a4
movl %r14d, (%rcx)
movl %r14d, (%rax)
leaq 0x28a4cd(%rip), %rax    # 0x2f72b0
movl %r14d, (%rax)
leaq 0x28a4b3(%rip), %rax    # 0x2f72a0
movl %r14d, (%rax)
callq 0x6dc5f
leaq 0x2b421c(%rip), %rax    # 0x321018
cmpb $0x0, (%rax)
movsd -0x38(%rbp), %xmm1
movsd -0x48(%rbp), %xmm2
movsd -0x40(%rbp), %xmm3
jne 0x6d7e2
leaq 0x1bc155(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
je 0x6ce66
jmp 0x6d7e2
callq 0x6dc5f
leaq 0x289987(%rip), %rax    # 0x2f67b8
movsd (%rax), %xmm2
leaq 0x289984(%rip), %rax    # 0x2f67c0
movsd (%rax), %xmm3
leaq 0x289bb9(%rip), %rax    # 0x2f6a00
movsd (%rax), %xmm1
leaq 0x289bc6(%rip), %rax    # 0x2f6a18
movsd (%rax), %xmm0
movsd %xmm0, 0x2edeb2(%rip)   # 0x35ad10
movsd %xmm0, 0x2edea2(%rip)   # 0x35ad08
leaq 0x28994b(%rip), %rax    # 0x2f67b8
movsd %xmm2, (%rax)
leaq 0x289948(%rip), %rax    # 0x2f67c0
movsd %xmm3, (%rax)
leaq 0x289b7d(%rip), %rax    # 0x2f6a00
movsd %xmm1, (%rax)
leaq 0x1b9e36(%rip), %rax    # 0x226cc4
cmpl $0x0, (%rax)
setne %al
leaq 0x195a35(%rip), %r12    # 0x2028d0
movq (%r12), %r13
cmpq $0x10000, %r13          # imm = 0x10000
sete %cl
orb %al, %cl
jne 0x6cecb
callq 0x66b41
testl %eax, %eax
jne 0x6cecb
leaq 0x198377(%rip), %rax    # 0x205234
cmpb $0x0, (%rax)
jne 0x6cecb
callq 0x6da12
movq (%r12), %r13
leaq 0x289b46(%rip), %rcx    # 0x2f6a18
movsd (%rcx), %xmm1
leaq 0x28a0a3(%rip), %rdx    # 0x2f6f80
movsd %xmm1, (%rdx)
leaq 0x198424(%rip), %rax    # 0x20530c
cmpb $0x0, (%rax)
leaq 0x1bc04c(%rip), %r15    # 0x228f3e
je 0x6cf49
cmpb $0x0, (%r15)
jne 0x6cf49
cmpq $0x8, %r13
je 0x6cf49
movsd 0x2ede08(%rip), %xmm2   # 0x35ad10
movsd 0x2eddf8(%rip), %xmm3   # 0x35ad08
mulsd 0x9b3c8(%rip), %xmm3    # 0x1082e0
movsd 0x86188(%rip), %xmm0    # 0xf30a8
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
movsd %xmm0, (%rcx)
movapd 0x8625c(%rip), %xmm3    # 0xf3190
andpd %xmm0, %xmm3
ucomisd 0x86120(%rip), %xmm3    # 0xf3060
movsd -0x30(%rbp), %xmm3
ja 0x6cf66
jmp 0x6cf6e
leaq 0x28a2fc(%rip), %rax    # 0x2f724c
cmpl $0x0, (%rax)
movapd %xmm1, %xmm0
movsd -0x30(%rbp), %xmm3
je 0x6cf6e
movsd 0x2eddaa(%rip), %xmm2   # 0x35ad10
movsd %xmm2, (%rcx)
movapd %xmm2, %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
leaq 0x289a83(%rip), %r13    # 0x2f6a00
jne 0x6cf85
jp 0x6cf85
movsd %xmm0, (%rdx)
testl %ebx, %ebx
movsd -0x58(%rbp), %xmm1
movsd -0x50(%rbp), %xmm2
je 0x6cfb4
leaq 0x28a036(%rip), %rax    # 0x2f6fd0
movsd %xmm3, (%rax)
leaq 0x28a033(%rip), %rax    # 0x2f6fd8
movsd %xmm1, (%rax)
leaq 0x28a030(%rip), %rax    # 0x2f6fe0
movsd %xmm2, (%rax)
leaq 0xdad75(%rip), %rbx     # 0x147d30
movsd 0x2e0(%rbx), %xmm1
ucomisd 0x86145(%rip), %xmm1    # 0xf3110
jne 0x6cfdc
jp 0x6cfdc
callq 0x12952
movsd %xmm0, 0x2e0(%rbx)
callq 0x57eca
testl %eax, %eax
je 0x6d011
movsd 0xea8(%rbx), %xmm0
ucomisd 0x8611b(%rip), %xmm0    # 0xf3110
jne 0x6d011
jp 0x6d011
leaq 0x289ba0(%rip), %rax    # 0x2f6ba0
movsd (%rax), %xmm0
callq 0x12a82
movsd %xmm0, 0xea8(%rbx)
movsd 0x1f8(%rbx), %xmm0
ucomisd 0x860ef(%rip), %xmm0    # 0xf3110
jne 0x6d033
jp 0x6d033
movsd (%r13), %xmm0
movsd %xmm0, 0x1f8(%rbx)
cmpb $0x0, (%r15)
je 0x6d0dd
movsd 0x768(%rbx), %xmm0
ucomisd 0x860c3(%rip), %xmm0    # 0xf3110
jne 0x6d06f
jp 0x6d06f
leaq 0x1981b0(%rip), %rax    # 0x205208
movsd (%rax), %xmm0
callq 0x12952
movsd %xmm0, 0x768(%rbx)
cmpb $0x0, (%r15)
je 0x6d0dd
movsd 0x28(%rbx), %xmm0
ucomisd 0x86094(%rip), %xmm0    # 0xf3110
jne 0x6d0a3
jp 0x6d0a3
leaq 0x289731(%rip), %rax    # 0x2f67b8
movsd (%rax), %xmm0
leaq 0x19581e(%rip), %rax    # 0x2028b0
mulsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x28(%rbx)
movsd 0x3c8(%rbx), %xmm0
ucomisd 0x8605d(%rip), %xmm0    # 0xf3110
jne 0x6d0dd
jp 0x6d0dd
leaq 0x2896fa(%rip), %rax    # 0x2f67b8
movsd (%rax), %xmm0
leaq 0x1957ef(%rip), %rax    # 0x2028b8
mulsd (%rax), %xmm0
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x3c8(%rbx)
leaq 0x28ada8(%rip), %rax    # 0x2f7e8c
cmpl $0x64, (%rax)
jne 0x6d0f3
leaq 0x28adb1(%rip), %rax    # 0x2f7ea1
movb $0x0, (%rax)
leaq 0x28a0de(%rip), %rax    # 0x2f71d8
movl (%rax), %eax
andl $0x20, %eax
cmpl 0x2e8cb3(%rip), %eax    # 0x355db8
je 0x6d12c
leaq 0x28ad8e(%rip), %rcx    # 0x2f7e9c
cmpl $0x0, (%rcx)
jne 0x6d12c
leaq 0x28ad7e(%rip), %rcx    # 0x2f7e98
cmpb $0x0, (%rcx)
jne 0x6d12c
leaq 0x19571e(%rip), %rcx    # 0x202844
movl $0x7da, (%rcx)          # imm = 0x7DA
movl %eax, 0x2e8c86(%rip)    # 0x355db8
callq 0xe58f8
leaq 0x2bc506(%rip), %rax    # 0x329644
cmpl $0x0, (%rax)
leaq 0x2898d0(%rip), %rsi    # 0x2f6a18
je 0x6d186
movsd (%rsi), %xmm1
cvttpd2dq %xmm1, %xmm0
cvtdq2pd %xmm0, %xmm0
subsd %xmm0, %xmm1
addsd 0x9b186(%rip), %xmm1    # 0x1082e8
ucomisd 0x9b186(%rip), %xmm1    # 0x1082f0
jae 0x6d17a
movsd 0x9b184(%rip), %xmm2    # 0x1082f8
ucomisd %xmm1, %xmm2
jbe 0x6d186
addsd 0x9b17e(%rip), %xmm0    # 0x108300
movsd %xmm0, (%rsi)
leaq 0x1bbde3(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
je 0x6d1e0
leaq 0x2897af(%rip), %rax    # 0x2f6948
movsd (%rax), %xmm0
leaq 0x289614(%rip), %rax    # 0x2f67b8
movsd %xmm0, (%rax)
leaq 0x2897a1(%rip), %rax    # 0x2f6950
movsd (%rax), %xmm0
leaq 0x289606(%rip), %rax    # 0x2f67c0
movsd %xmm0, (%rax)
leaq 0x289dab(%rip), %rax    # 0x2f6f70
movsd (%rax), %xmm0
movsd %xmm0, (%r13)
leaq 0x289daa(%rip), %rax    # 0x2f6f80
movsd (%rax), %xmm0
movsd %xmm0, (%rsi)
jmp 0x6d25e
leaq 0x19571d(%rip), %rax    # 0x202904
cmpb $0x0, (%rax)
jne 0x6d21c
movq (%r12), %rdi
leaq 0x197ddd(%rip), %rax    # 0x204fd4
movl (%rax), %eax
cmpq $0x1, %rdi
jne 0x6d808
cmpl $0x41, %eax
jne 0x6d808
leaq 0x1956e5(%rip), %rcx    # 0x2028f8
cmpl $0x47, (%rcx)
jne 0x6d808
movq %r12, %r13
leaq 0x28a1e7(%rip), %rax    # 0x2f740d
movb $0x1, (%rax)
callq 0xe8051
leaq 0x289e9b(%rip), %r12    # 0x2f70d0
movb (%r12), %al
leaq 0x28a1cc(%rip), %r15    # 0x2f740c
cmpb (%r15), %al
je 0x6d251
pushq $0x14
popq %rdi
callq 0xc9736
movb (%r12), %al
movb %al, (%r15)
movq %r13, %r12
leaq 0x2897a2(%rip), %r13    # 0x2f6a00
leaq 0x1bbcd7(%rip), %rax    # 0x228f3c
cmpb $0x0, (%rax)
je 0x6d2a4
leaq 0x289edf(%rip), %rax    # 0x2f7150
movsd (%rax), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x6d2a4
jp 0x6d2a4
leaq 0x28ab70(%rip), %rcx    # 0x2f7df8
testb $0x8, (%rcx)
jne 0x6d2a4
movsd (%r13), %xmm0
movsd %xmm0, (%rax)
leaq 0x28a062(%rip), %rax    # 0x2f7300
movl $0x1, (%rax)
leaq 0x1bbc31(%rip), %rax    # 0x228edc
cmpb $0x0, (%rax)
je 0x6d2d7
leaq 0x1bbc2d(%rip), %rax    # 0x228ee4
cmpl $0x0, (%rax)
jne 0x6d2d7
movl $0x1, (%rax)
leaq 0x2894ef(%rip), %rax    # 0x2f67b8
movsd (%rax), %xmm0
mulsd 0x85e73(%rip), %xmm0    # 0xf3148
jmp 0x6d2e2
leaq 0x197f32(%rip), %rax    # 0x205210
movsd (%rax), %xmm0
leaq 0x2894d7(%rip), %rax    # 0x2f67c0
movsd (%rax), %xmm1
mulsd 0x85e53(%rip), %xmm1    # 0xf3148
addsd %xmm0, %xmm1
leaq 0x197f10(%rip), %rax    # 0x205210
movsd %xmm1, (%rax)
callq 0xefdee
callq 0xeff1f
callq 0xf0ceb
cmpq $0x8, (%r12)
sete %al
leaq 0x197cbe(%rip), %rcx    # 0x204fe0
cmpl $0x53, (%rcx)
sete %cl
andb %al, %cl
leaq 0x28ab5b(%rip), %rax    # 0x2f7e8c
cmpl $0x65, (%rax)
setl %r15b
orb %cl, %r15b
jne 0x6d343
movl $0x64, (%rax)
leaq 0x1b997a(%rip), %rax    # 0x226cc4
cmpl $0x0, (%rax)
je 0x6d394
leaq 0x28a3ba(%rip), %rax    # 0x2f7710
movsd (%rax), %xmm0
leaq 0x28a3b7(%rip), %rax    # 0x2f7718
subsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
leaq 0x28ab5f(%rip), %rax    # 0x2f7ed0
movsd (%rax), %xmm0
mulsd 0x85cd3(%rip), %xmm0    # 0xf3050
callq 0x6d95e
movsd -0x30(%rbp), %xmm0
mulsd 0x85cc1(%rip), %xmm0    # 0xf3050
callq 0x6d9b8
leaq 0x197c39(%rip), %rax    # 0x204fd4
cmpl $0x53, (%rax)
jne 0x6d3ce
movl 0x2e8a3a(%rip), %eax    # 0x355de0
cmpl 0x2e8a44(%rip), %eax    # 0x355df0
jne 0x6d3ce
movl 0x2e8a30(%rip), %eax    # 0x355de4
cmpl 0x2e8a3a(%rip), %eax    # 0x355df4
jne 0x6d3ce
movl 0x2e8a26(%rip), %eax    # 0x355de8
cmpl 0x2e8a30(%rip), %eax    # 0x355df8
je 0x6d49a
leaq 0x1bb041(%rip), %rax    # 0x228416
cmpb $0x0, (%rax)
jne 0x6d42f
leaq 0x28a0fb(%rip), %rax    # 0x2f74dc
movl (%rax), %esi
leaq 0x28a0ee(%rip), %rax    # 0x2f74d8
movl (%rax), %edx
leaq 0x28a0e1(%rip), %rax    # 0x2f74d4
movl (%rax), %ecx
leaq 0x28a0d4(%rip), %rax    # 0x2f74d0
movl (%rax), %r8d
leaq 0x28a0c6(%rip), %rax    # 0x2f74cc
movl (%rax), %r9d
leaq 0x28a0b8(%rip), %rax    # 0x2f74c8
movl (%rax), %eax
leaq 0x28a0c7(%rip), %rdi    # 0x2f74e0
movsd (%rdi), %xmm1
movl %eax, (%rsp)
movsd 0x85c48(%rip), %xmm0    # 0xf3070
xorl %edi, %edi
callq 0xc28e4
leaq 0x1bafca(%rip), %r13    # 0x228400
movq (%r13), %rax
incq %rax
movq %rax, (%r13)
leaq 0x197f60(%rip), %rcx    # 0x2053a8
cmpq (%rcx), %rax
jl 0x6d470
leaq 0x1bafb4(%rip), %rax    # 0x228408
cmpl $0x0, (%rax)
jne 0x6d46b
leaq 0x1baf00(%rip), %rax    # 0x228360
movq (%rax), %rdi
pushq $-0x1
popq %rsi
callq 0xbcce1
andq $0x0, (%r13)
leaq 0x1baef1(%rip), %r13    # 0x228368
movq (%r13), %rdi
testq %rdi, %rdi
je 0x6d49a
leaq 0x28a4ed(%rip), %rax    # 0x2f7974
cmpl $0x0, (%rax)
je 0x6d49a
callq 0xb5803
movq (%r13), %rdi
callq 0xbdd20
movl 0x2e8940(%rip), %eax    # 0x355de0
movl %eax, 0x2e894a(%rip)    # 0x355df0
movl 0x2e8938(%rip), %eax    # 0x355de4
movl %eax, 0x2e8942(%rip)    # 0x355df4
movl 0x2e8930(%rip), %eax    # 0x355de8
movl %eax, 0x2e893a(%rip)    # 0x355df8
leaq 0x1baf13(%rip), %rax    # 0x2283d8
cmpl $0x0, (%rax)
je 0x6d4e4
leaq 0x1bba9f(%rip), %rax    # 0x228f70
andl $0x0, (%rax)
leaq 0x289525(%rip), %rcx    # 0x2f6a00
leaq 0x289536(%rip), %rdx    # 0x2f6a18
jmp 0x6d50c
leaq 0x1bba85(%rip), %rax    # 0x228f70
cmpl $0x0, (%rax)
setne %al
xorb $0x1, %r15b
orb %al, %r15b
leaq 0x289501(%rip), %rcx    # 0x2f6a00
leaq 0x289512(%rip), %rdx    # 0x2f6a18
jne 0x6d7e2
leaq 0x2892a5(%rip), %rax    # 0x2f67b8
movsd (%rax), %xmm0
leaq 0x28942a(%rip), %rax    # 0x2f6948
movsd %xmm0, (%rax)
leaq 0x289297(%rip), %rax    # 0x2f67c0
movsd (%rax), %xmm0
leaq 0x28941c(%rip), %rax    # 0x2f6950
movsd %xmm0, (%rax)
movsd (%rdx), %xmm0
leaq 0x289665(%rip), %rax    # 0x2f6ba8
movsd (%rax), %xmm1
leaq 0x2896ca(%rip), %rax    # 0x2f6c18
movsd %xmm1, (%rax)
leaq 0x289657(%rip), %rax    # 0x2f6bb0
movsd (%rax), %xmm1
leaq 0x2896bc(%rip), %rax    # 0x2f6c20
movsd %xmm1, (%rax)
leaq 0x289649(%rip), %rax    # 0x2f6bb8
movsd (%rax), %xmm1
leaq 0x2896ae(%rip), %rax    # 0x2f6c28
movsd %xmm1, (%rax)
leaq 0x28964b(%rip), %rax    # 0x2f6bd0
movsd (%rax), %xmm1
leaq 0x2896a0(%rip), %rax    # 0x2f6c30
movsd %xmm1, (%rax)
leaq 0x28963d(%rip), %rax    # 0x2f6bd8
movsd (%rax), %xmm1
leaq 0x289692(%rip), %rax    # 0x2f6c38
movsd %xmm1, (%rax)
leaq 0x28962f(%rip), %rax    # 0x2f6be0
movsd (%rax), %xmm1
leaq 0x289684(%rip), %rax    # 0x2f6c40
movsd %xmm1, (%rax)
leaq 0x289621(%rip), %rax    # 0x2f6be8
movsd (%rax), %xmm1
leaq 0x289676(%rip), %rax    # 0x2f6c48
movsd %xmm1, (%rax)
leaq 0x2895bb(%rip), %rax    # 0x2f6b98
movsd (%rax), %xmm1
leaq 0x2895d8(%rip), %rax    # 0x2f6bc0
movsd %xmm1, (%rax)
leaq 0x2895ad(%rip), %rax    # 0x2f6ba0
movsd (%rax), %xmm1
leaq 0x2895ca(%rip), %rax    # 0x2f6bc8
movsd %xmm1, (%rax)
movsd 0x2c8(%rbx), %xmm1
mulsd %xmm1, %xmm0
movsd 0x2f0(%rbx), %xmm2
divsd %xmm2, %xmm0
cvttsd2si %xmm0, %rax
cvtsi2sd %rax, %xmm0
movsd (%rcx), %xmm3
mulsd %xmm2, %xmm0
divsd %xmm1, %xmm0
leaq 0x289941(%rip), %rax    # 0x2f6f78
movsd 0x1e0(%rbx), %xmm1
movsd 0x208(%rbx), %xmm2
mulsd %xmm1, %xmm3
divsd %xmm2, %xmm3
cvttsd2si %xmm3, %rcx
cvtsi2sd %rcx, %xmm3
movsd %xmm0, (%rax)
mulsd %xmm2, %xmm3
divsd %xmm1, %xmm3
leaq 0x289904(%rip), %rax    # 0x2f6f70
movsd %xmm3, (%rax)
leaq 0x289b71(%rip), %rax    # 0x2f71e8
cmpb $0x0, (%rax)
jne 0x6d6a3
movb $0x1, (%rax)
leaq 0x289b4a(%rip), %rax    # 0x2f71d0
movl (%rax), %eax
leaq 0x289b45(%rip), %rcx    # 0x2f71d4
movl %eax, (%rcx)
leaq 0x289b40(%rip), %rax    # 0x2f71d8
movl (%rax), %eax
leaq 0x289b3b(%rip), %rcx    # 0x2f71dc
movl %eax, (%rcx)
leaq 0x197b8a(%rip), %rax    # 0x205234
cmpb $0x0, (%rax)
jne 0x6d6bf
leaq 0x19ff5a(%rip), %rax    # 0x20d610
movl (%rax), %edi
xorl %esi, %esi
callq 0xed5f1
callq 0x68b5b
callq 0xb1018
xorl %edi, %edi
callq 0x6de0d
callq 0xc0bba
leaq 0x289c44(%rip), %rax    # 0x2f7320
cmpl $0x0, (%rax)
sete %dl
leaq 0x289c33(%rip), %rcx    # 0x2f731c
movl (%rcx), %ecx
testl %ecx, %ecx
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x6d717
movl %ecx, (%rax)
cmpq $0x10000, (%r12)        # imm = 0x10000
je 0x6d717
leaq 0x1baced(%rip), %rax    # 0x2283fa
cmpb $0x0, (%rax)
jne 0x6d717
callq 0x3812c
callq 0x6df4a
callq 0x6dce4
callq 0x35e5f
leaq 0x2bc63f(%rip), %rax    # 0x329d6c
cmpl $0x0, (%rax)
je 0x6d740
leaq 0x2bc61f(%rip), %rax    # 0x329d58
movl (%rax), %edi
callq 0x36c5f
callq 0x6dfe5
leaq 0x1bac4c(%rip), %rax    # 0x228398
movq (%rax), %rdx
testq %rdx, %rdx
je 0x6d7e2
leaq 0x2b8ac1(%rip), %rdi    # 0x326220
movl $0x201, %esi            # imm = 0x201
callq 0x9600
testq %rax, %rax
je 0x6d7d8
leaq 0x2b8aab(%rip), %rdi    # 0x326220
pushq $0xd
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x6d785
movb $0x0, (%rax)
leaq 0x2b8a94(%rip), %rdi    # 0x326220
pushq $0xa
popq %rsi
callq 0x9100
testq %rax, %rax
je 0x6d79c
movb $0x0, (%rax)
leaq 0x2b4abd(%rip), %rbx    # 0x322260
leaq 0x2b8a76(%rip), %rsi    # 0x326220
movq %rbx, %rdi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
leaq 0x2b5aa3(%rip), %rcx    # 0x323264
movl %eax, (%rcx)
pushq $0xd
popq %rdi
callq 0x6e33e
movl $0x1, 0x2e84bf(%rip)    # 0x355c94
xorl %r14d, %r14d
leaq 0x1babfd(%rip), %rax    # 0x2283dc
movl %r14d, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsd %xmm1, -0x38(%rbp)
leaq 0x289aff(%rip), %rax    # 0x2f72fc
movl $0x1, (%rax)
jmp 0x6cc5e
cmpl $0x41, %eax
sete %cl
cmpq $0x1, %rdi
sete %dl
cmpl $0x50, %eax
sete %al
testl $0x800009e4, %edi       # imm = 0x800009E4
jne 0x6d21c
orb %al, %cl
andb %cl, %dl
jne 0x6d21c
cmpq $0x10000, %rdi          # imm = 0x10000
je 0x6d21c
cmpq $0x80000, %rdi          # imm = 0x80000
je 0x6d21c
leaq 0x1950b6(%rip), %rax    # 0x202908
cmpl $0x4c, (%rax)
jne 0x6d87c
movq %rdi, -0x30(%rbp)
callq 0x66b41
movq -0x30(%rbp), %rdi
leaq 0x2891ad(%rip), %rsi    # 0x2f6a18
cmpq $0x8, %rdi
sete %cl
orb %al, %cl
jne 0x6d21c
jmp 0x6d886
cmpq $0x8, %rdi
je 0x6d21c
cmpb $0x0, (%r15)
jne 0x6d21c
movsd (%r13), %xmm1
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jne 0x6d8b3
jp 0x6d8b3
leaq 0x2896c7(%rip), %rax    # 0x2f6f70
movsd (%rax), %xmm1
movsd %xmm1, (%r13)
movsd (%rsi), %xmm0
ucomisd %xmm2, %xmm0
jne 0x6d8ce
jp 0x6d8ce
leaq 0x2896ba(%rip), %rax    # 0x2f6f80
movsd (%rax), %xmm0
movsd %xmm0, (%rsi)
testl $0x140018, %edi         # imm = 0x140018
jne 0x6d8ff
leaq 0x1976f3(%rip), %rax    # 0x204fd0
cmpl $0x0, (%rax)
jne 0x6d8ff
andpd 0x858a6(%rip), %xmm1    # 0xf3190
cmpq $0x400000, %rdi         # imm = 0x400000
jne 0x6d952
ucomisd 0x882bd(%rip), %xmm1    # 0xf5bb8
ja 0x6d911
jmp 0x6d922
andpd 0x85889(%rip), %xmm1    # 0xf3190
ucomisd 0x85751(%rip), %xmm1    # 0xf3060
jbe 0x6d922
leaq 0x289658(%rip), %rax    # 0x2f6f70
movsd (%rax), %xmm1
movsd %xmm1, (%r13)
movsd 0x9a9de(%rip), %xmm1    # 0x108308
ucomisd %xmm0, %xmm1
ja 0x6d93e
ucomisd 0x85728(%rip), %xmm0    # 0xf3060
jbe 0x6d21c
leaq 0x28963b(%rip), %rax    # 0x2f6f80
movsd (%rax), %xmm0
movsd %xmm0, (%rsi)
jmp 0x6d21c
ucomisd 0x8574e(%rip), %xmm1    # 0xf30a8
ja 0x6d911
jmp 0x6d922