// File: jkingan[P]ladyheather/heathgps.cpp
// Function: set_pps(unsigned char, unsigned char, double, double, float, int)
void set_pps(u08 pps_enable,  u08 pps_polarity,  double delay, double pps_delay, float threshold, int save)
{
int val;
int i;
u08 flags;
double dly;
char s[SLEN+1];

   if(read_only) return;
   if(luxor) return;

   // pps_polarity 0=positive  1=negative

   if(rcvr_type == BRANDY_RCVR) {
      i = brandy_pps_width;  // pulse width
      if(i < 0) i = 0 - i;
if(i == 0) i = 1;
      if(pps_polarity) i = 0-i;

      if(pps_enable) {  // enable J10 PPS output
         if(i > 0) sprintf(out, "$PRCCG,C,P%d,+%d", brandy_pps_rate, i);
         else      sprintf(out, "$PRCCG,C,P%d,%d", brandy_pps_rate, i);
         queue_brandy_cmd(out, BRANDY_PULSE_MSG);
      }
      else {  // disable PPS output
         queue_brandy_cmd("$PRCCG,E,X,0,X,X", BRANDY_CODE_MSG);
      }
   }
   else if(rcvr_type == ESIP_RCVR) {
      sprintf(out, "PERDAPI");
      strcat(out, ",PPS");
      if(esip_pps_type) strcat(out, ",GCLK");
      else              strcat(out, ",LEGACY");

      if(pps_enable) strcat(out, ",1");
      else           strcat(out, ",0");

      if(pps_rate == RATE_PP2S) strcat(out, ",1");    // PPS2S rate
      else                      strcat(out, ",0");    // 1PPS rate

      sprintf(s, ",%d", esip_pps_width);  // pps pulse width
      strcat(out, s); 

      sprintf(s, ",%d", (int) (delay*1.0E9));
      strcat(out, s);  // cable delay

      if((esip_pps_type == 0) || (pps_polarity == 0)) strcat(out, ",0"); // only rising edge avail in LEGACY mode
      else strcat(out, ",1");  // falling edge (only available in GCLK mode)

threshold = 300.0F;
      sprintf(s, ",%d", (int) (threshold));  // accuracy threshold
      strcat(out, s); 
      send_esip_cmd(out);

      request_rcvr_config(8787);
   }
   else if(rcvr_type == FURUNO_RCVR) {
      if(delay < 0.0) sprintf(out, "GPset,t-%06d", (int) (delay*1.0E9*(-1.0)));
      else            sprintf(out, "GPset,t+%06d", (int) (delay*1.0E9));
      send_furuno_cmd(out); 

      if(pps_enable) {  // !!!! pps output enabled if sats tracked
         sprintf(out, "GPrrs,%d,%d,%d", traim_mode,furuno_traim,2);
      }
      else {
         sprintf(out, "GPrrs,%d,%d,%d", traim_mode,furuno_traim,0);
      }
      send_furuno_cmd(out);

      request_rcvr_config(7531);
   }
   else if(rcvr_type == MOTO_RCVR) {  // !!! moto_chans
      val = (int) (delay*1.0E9);
      send_moto_start("Az");
      send_dword(val);
      send_moto_end();

      send_moto_start("Ay");
      send_dword((S32) pps_delay);
      send_moto_end();

      send_moto_start("Gc");
      send_byte(pps_enable);
      send_moto_end();

      send_moto_start("Bn");  // 6 chan traim control
      send_byte(1);
      if(traim_threshold) {
         send_byte(1);
         send_word(traim_threshold);
      }
      else {
         send_byte(0);
         send_word(1000);
      }
      send_byte(pps_enable);
      for(i=0; i<10; i++) send_byte(0);
      send_moto_end();

      send_moto_start("En");  // 8 chan traim control
      send_byte(1);
      if(traim_threshold) {
         send_byte(1);
         send_word(traim_threshold);
      }
      else {
         send_byte(0);
         send_word(1000);
      }
      send_byte(pps_enable);
      for(i=0; i<10; i++) send_byte(0);
      send_moto_end();
   }
   else if(rcvr_type == NVS_RCVR) { 
      send_nvs_start(0xD7);
      send_byte(0x06);
      send_double(delay * 1.0E6);   
      send_nvs_end();

      flags = 0x02;    // software PPS every second
      if(pps_polarity == 0)       flags |= 0x08;  // rising edge (direct PPS)
      if(time_flags & TFLAGS_UTC) flags |= 0x30;  // sync PPS to UTC time
      else                        flags |= 0x10;  // sync PPS to GPS time
      send_nvs_start(0xD7); // qqqqqqqqq !!!!! can also sync to GLONASS or UTC-SU
      send_byte(0x05);
      send_byte(flags);     // PPS config byte
      send_byte(1);         // keep internal time scale aligned
      if(pps_enable) {
         if(nvs_pps_width) send_dword(nvs_pps_width); // set pps width in nanoseconds
         else if(last_nvs_pps_width) send_dword(last_nvs_pps_width); // set pps width in nanoseconds
         else send_dword(NVS_PPS_WIDTH); // set pps width in nanoseconds
      }
      else send_dword(0); // set pps width in nanoseconds
      send_nvs_end();

      Sleep(200);
      request_pps_info();
   }
   else if(rcvr_type == PRS_RCVR) {
      if(pps_enable) {
         // !!!!! LM command does not respond with "OK" in verbose mode... use -PRS_LM_MSG kludge
         if(pps_polarity) {
            queue_prs_cmd("LM0", -PRS_LM_MSG);  // pps enabled - no lock filter
         }
         else {
            queue_prs_cmd("LM1", -PRS_LM_MSG);  // pps enabled -  with lock filter
         }
      }
      else {
         if(pps_polarity) {
            queue_prs_cmd("LM2", -PRS_LM_MSG);  // pps diabled, active  low on lock
         }
         else {
            queue_prs_cmd("LM3", -PRS_LM_MSG);  // pps diabled, active high on lock
         }
      }
      request_pps_info();
   }
   else if(rcvr_type == RFTG_RCVR) {
      set_rftg_cable(delay);
      set_rftg_offset(pps_delay);
      request_pps_info();
   }
   else if(rcvr_type == SCPI_RCVR) {
      extend_com_timeout(0.0);
      if(cable_nsecs) delay *= 1.0E9;
      if(scpi_type == NORTEL_TYPE) {
         sprintf(out, "GPS:REF:ADELAY %.9f", delay);
         queue_scpi_cmd(out, SCPI_SET_CABLE_MSG);
         queue_scpi_cmd("GPS:REF:ADELAY?", SCPI_GET_CABLE_MSG);
      }
      else {
         sprintf(out, ":PTIM:GPS:ADEL %.9f", delay);
         queue_scpi_cmd(out, SCPI_SET_CABLE_MSG);
         queue_scpi_cmd("PTIM:GPS:ADEL?", SCPI_GET_CABLE_MSG);
      }

      if((scpi_type == HP_TYPE) || (scpi_type == HP_TYPE2)) {
         if(pps_polarity) {  // falling edge  Z3816 HP59xxx
            queue_scpi_cmd(":PTIM:PPS:EDGE FALL", SCPI_EDGE_MSG);
         }
         else {  // rising edge
            queue_scpi_cmd(":PTIM:PPS:EDGE RIS", SCPI_EDGE_MSG);
         }
         queue_scpi_cmd(":PTIM:PPS:EDGE?", SCPI_EDGE_MSG);  // HP_TYPE2 only
      }

      // !!!! Z3816 / HP5xxxx can set pps rate
      // :PULSE:CONT:PER seconds
      // :PULSE:CONT:STAT (0 | 1)
   }
   else if(rcvr_type == SS_RCVR) {
      send_ss_start(69, 31);
      send_dword((int) (delay*1.0E9));
      send_dword((int) (pps_delay*1.0E9));
      val = (int) (ss_pps_width+50.0);  // in nsec (rounded up)
      val /= 100;
      send_dword(val);
      send_byte(2);     // keep pps aligned continuously
      if(pps_enable) send_byte(0); // pps always on
      else           send_byte(4); // disable pps
      send_byte(0);  // reserved
      send_word(ss_intrinsic_delay);  // intrinsic delay in ns
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_byte(0);  // reserved
      send_ss_end();
   }
   else if(rcvr_type == STAR_RCVR) {
      if(star_type == OSA_TYPE) {
         if(delay < 0.0) delay = 0.0 - delay;  // uses positive values

         sprintf(out, "PPS_USER_OFFSET=%d;", (int) (pps_delay));
         queue_star_cmd(out, STAR_OFFSET_MSG);
      }
      else {
         if(delay > 0.0) delay = 0.0 - delay;  // uses negative values
      }
      sprintf(out, "PPS_CABLE_DELAY=%d;", (int) (delay*1.0E9));
      queue_star_cmd(out, STAR_CABLE_MSG);

      request_rcvr_config(4965);  // CONF command returns the setting
   }
   else if(rcvr_type == TM4_RCVR) {
      delay *= 1.0E9;
      if(delay >= 0) sprintf(out, "#06,+%05d", (int) delay);
      else           sprintf(out, "#06,%06d", (int) delay);
      send_tm4_cmd(out);

      if(pps_enable) {
         send_tm4_cmd("#09,7");
      }
      else {
         send_tm4_cmd("#09,8");
      }
      request_rcvr_config(4998); 
   }
   else if(rcvr_type == TRUE_RCVR) {
      sprintf(out, "$SETDELAY %d", (int) (delay*1.0E9));
      send_true_cmd(out);  // $SETDELAY %d
      sprintf(out, "$SETBDELAY %d", (int) pps_delay);
      send_true_cmd(out);  // $SETBDELAY %d
      request_rcvr_config(4966);
   }
   else if(rcvr_type == TSIP_RCVR) {
      if(ACU_GG) ;
      else if(ACU_360) ;
      else if(ACUTIME) ;
      else if(PALISADE) ;
      else if(SV6_FAMILY) return;

      send_tsip_start(0x8E);
      send_byte(0x4A);
      send_byte(pps_enable);
      if(ACUTIME || PALISADE) {
         send_byte(0x01);   // !!!!!!!!!!!  use timing mode
      }
      else {
         send_byte(0x00);           // ACUTIME/PALISADE  0=GPS PPS   1=UTC PPS
      }
      send_byte(pps_polarity);
      send_double(delay);
      send_single(threshold);
      send_tsip_end();

      if(save) save_segment(6, 22);  // save timing config in EEPROM
   }
   else if(rcvr_type == UBX_RCVR) {  // !!!! zorky TP5
      set_ubx_pps(0, pps_rate, pps_enable, pps_polarity, delay, pps_delay, save);
   }
   else if(rcvr_type == UCCM_RCVR) {   // can't change polarity
      sprintf(out, "GPS:REF:ADEL %.9f", delay);
      extend_com_timeout(0.0);
      queue_uccm_cmd(out, SCPI_SET_CABLE_MSG);
      queue_uccm_cmd("GPS:REF:ADEL?", SCPI_GET_CABLE_MSG);

      if(pps_enable) queue_uccm_cmd("OUTP:ACT:ENAB", UCCM_OUTP_MSG);
      else           queue_uccm_cmd("OUTP:ACT:DIS", UCCM_OUTP_MSG);
      queue_uccm_cmd("OUTP:STAT?", UCCM_STATE_MSG);

      // !!!! Z3816 / HP5xxxx can set pps rate
      // :PULSE:CONT:PER seconds
      // :PULSE:CONT:STAT (0 | 1)
   }
   else if(rcvr_type == VENUS_RCVR) {
      send_venus_start(SET_VENUS_CABLE);
      send_dword((S32) (delay*1.0E11));
      send_venus_save(1);
   }
   else if(rcvr_type == X72_RCVR) {
      val = x72_creg;
      if(pps_enable) val &= (~0x0008);
      else           val |= (0x0008);
      set_x72_creg(val);

      if(pps_enable) last_x72_pps_enable = pps_enable;
      user_set_x72_pps_enable = 1;
      save_x72_state();
   }
   else if(rcvr_type == ZODIAC_RCVR) {
      dly = cable_delay;
      cable_delay = delay;
      set_zod_config(0, 0.0,0.0,0.0, traim_threshold, 4);  // cable delay
      cable_delay = dly;
   }
   else if(rcvr_type == ZYFER_RCVR) {
      sprintf(out, "$ANTD,%d", (int) (delay*1.0E9));
      send_zyfer_cmd(out);

      sprintf(out, "$OFST,%d", (int) (pps_delay*1.0E9));
      send_zyfer_cmd(out);

      if(pps_polarity) send_zyfer_cmd("$PULP,-");      
      else             send_zyfer_cmd("$PULP,+");      
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movb %sil, %al
movb %dil, %cl
movb %cl, -0x1(%rbp)
movb %al, -0x2(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movss %xmm2, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
leaq 0x3046aa(%rip), %rax    # 0x3961fa
cmpb $0x0, (%rax)
je 0x91b5a
jmp 0x92a62
leaq 0x20c5bd(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0x91b6b
jmp 0x92a62
leaq 0x1e5f3e(%rip), %rax    # 0x277ab0
cmpq $0x40000, (%rax)        # imm = 0x40000
jne 0x91c2d
leaq 0x3094b2(%rip), %rax    # 0x39b038
movl (%rax), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x91b99
xorl %eax, %eax
subl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x91ba6
movl $0x1, -0x28(%rbp)
cmpb $0x0, -0x2(%rbp)
je 0x91bb4
xorl %eax, %eax
subl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpb $0x0, -0x1(%rbp)
je 0x91c17
cmpl $0x0, -0x28(%rbp)
jle 0x91be3
leaq 0x309469(%rip), %rax    # 0x39b030
movl (%rax), %edx
movl -0x28(%rbp), %ecx
leaq 0x30982d(%rip), %rdi    # 0x39b400
leaq 0xf26a6(%rip), %rsi     # 0x184280
movb $0x0, %al
callq 0x9060
jmp 0x91c04
leaq 0x309446(%rip), %rax    # 0x39b030
movl (%rax), %edx
movl -0x28(%rbp), %ecx
leaq 0x30980a(%rip), %rdi    # 0x39b400
leaq 0xf2694(%rip), %rsi     # 0x184291
movb $0x0, %al
callq 0x9060
leaq 0x3097f5(%rip), %rdi    # 0x39b400
movl $0x191, %esi            # imm = 0x191
callq 0x82fd0
jmp 0x91c28
leaq 0xf2683(%rip), %rdi     # 0x1842a1
movl $0x192, %esi            # imm = 0x192
callq 0x82fd0
jmp 0x92a62
movl $0x80000000, %ecx       # imm = 0x80000000
leaq 0x1e5e77(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x91e01
leaq 0x3097b7(%rip), %rdi    # 0x39b400
leaq 0xf2662(%rip), %rsi     # 0x1842b2
movb $0x0, %al
callq 0x9060
leaq 0x3097a2(%rip), %rdi    # 0x39b400
leaq 0xf2600(%rip), %rsi     # 0x184265
callq 0x96a0
leaq 0x2db2e3(%rip), %rax    # 0x36cf54
cmpl $0x0, (%rax)
je 0x91c8b
leaq 0x309783(%rip), %rdi    # 0x39b400
leaq 0xf2636(%rip), %rsi     # 0x1842ba
callq 0x96a0
jmp 0x91c9e
leaq 0x30976e(%rip), %rdi    # 0x39b400
leaq 0xf2627(%rip), %rsi     # 0x1842c0
callq 0x96a0
cmpb $0x0, -0x1(%rbp)
je 0x91cb9
leaq 0x309755(%rip), %rdi    # 0x39b400
leaq 0xf2526(%rip), %rsi     # 0x1841d8
callq 0x96a0
jmp 0x91ccc
leaq 0x309740(%rip), %rdi    # 0x39b400
leaq 0xf2454(%rip), %rsi     # 0x18411b
callq 0x96a0
leaq 0x2db230(%rip), %rax    # 0x36cf03
movzbl (%rax), %eax
cmpl $0x82, %eax
jne 0x91cf2
leaq 0x30971c(%rip), %rdi    # 0x39b400
leaq 0xf24ed(%rip), %rsi     # 0x1841d8
callq 0x96a0
jmp 0x91d05
leaq 0x309707(%rip), %rdi    # 0x39b400
leaq 0xf241b(%rip), %rsi     # 0x18411b
callq 0x96a0
leaq -0x140(%rbp), %rdi
leaq 0x2db23d(%rip), %rax    # 0x36cf50
movl (%rax), %edx
leaq 0xf278c(%rip), %rsi     # 0x1844a8
movb $0x0, %al
callq 0x9060
leaq -0x140(%rbp), %rsi
leaq 0x3096cf(%rip), %rdi    # 0x39b400
callq 0x96a0
leaq -0x140(%rbp), %rdi
movsd 0xdd2e3(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %edx
leaq 0xf2753(%rip), %rsi     # 0x1844a8
movb $0x0, %al
callq 0x9060
leaq -0x140(%rbp), %rsi
leaq 0x309696(%rip), %rdi    # 0x39b400
callq 0x96a0
leaq 0x2db1de(%rip), %rax    # 0x36cf54
cmpl $0x0, (%rax)
je 0x91d84
movzbl -0x2(%rbp), %eax
cmpl $0x0, %eax
jne 0x91d99
leaq 0x309675(%rip), %rdi    # 0x39b400
leaq 0xf2389(%rip), %rsi     # 0x18411b
callq 0x96a0
jmp 0x91dac
leaq 0x309660(%rip), %rdi    # 0x39b400
leaq 0xf2431(%rip), %rsi     # 0x1841d8
callq 0x96a0
movss 0xdd56c(%rip), %xmm0    # 0x16f320
movss %xmm0, -0x1c(%rbp)
leaq -0x140(%rbp), %rdi
cvttss2si -0x1c(%rbp), %edx
leaq 0xf26dc(%rip), %rsi     # 0x1844a8
movb $0x0, %al
callq 0x9060
leaq -0x140(%rbp), %rsi
leaq 0x30961f(%rip), %rdi    # 0x39b400
callq 0x96a0
leaq 0x309613(%rip), %rdi    # 0x39b400
callq 0x830d0
movl $0x2253, %edi           # imm = 0x2253
callq 0x8c270
jmp 0x92a60
leaq 0x1e5ca8(%rip), %rax    # 0x277ab0
cmpq $0x20000000, (%rax)     # imm = 0x20000000
jne 0x91eff
xorps %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
jbe 0x91e53
movsd 0xdd201(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
movsd 0xdd2e4(%rip), %xmm1    # 0x16f118
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %edx
leaq 0x3095bd(%rip), %rdi    # 0x39b400
leaq 0xf247e(%rip), %rsi     # 0x1842c8
movb $0x0, %al
callq 0x9060
jmp 0x91e79
movsd 0xdd1cd(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %edx
leaq 0x309595(%rip), %rdi    # 0x39b400
leaq 0xf2463(%rip), %rsi     # 0x1842d5
movb $0x0, %al
callq 0x9060
leaq 0x309580(%rip), %rdi    # 0x39b400
callq 0x83270
cmpb $0x0, -0x1(%rbp)
je 0x91eba
leaq 0x1e840e(%rip), %rax    # 0x27a2a0
movl (%rax), %edx
leaq 0x30a5e1(%rip), %rax    # 0x39c47c
movl (%rax), %ecx
leaq 0x30955c(%rip), %rdi    # 0x39b400
leaq 0xf2437(%rip), %rsi     # 0x1842e2
movl $0x2, %r8d
movb $0x0, %al
callq 0x9060
jmp 0x91ee4
leaq 0x1e83df(%rip), %rax    # 0x27a2a0
movl (%rax), %edx
leaq 0x30a5b2(%rip), %rax    # 0x39c47c
movl (%rax), %ecx
leaq 0x30952d(%rip), %rdi    # 0x39b400
leaq 0xf2408(%rip), %rsi     # 0x1842e2
xorl %r8d, %r8d
movb $0x0, %al
callq 0x9060
leaq 0x309515(%rip), %rdi    # 0x39b400
callq 0x83270
movl $0x1d6b, %edi           # imm = 0x1D6B
callq 0x8c270
jmp 0x92a5e
leaq 0x1e5baa(%rip), %rax    # 0x277ab0
cmpq $0x20, (%rax)
jne 0x92071
movsd 0xdd110(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x24(%rbp)
leaq 0xf2328(%rip), %rdi     # 0x184253
callq 0x86190
movl -0x24(%rbp), %edi
callq 0x7b520
callq 0x86230
leaq 0xf2312(%rip), %rdi     # 0x184256
callq 0x86190
cvttsd2si -0x18(%rbp), %edi
callq 0x7b520
callq 0x86230
leaq 0xf22fa(%rip), %rdi     # 0x184259
callq 0x86190
movzbl -0x1(%rbp), %edi
callq 0x7b210
callq 0x86230
leaq 0xf2378(%rip), %rdi     # 0x1842f1
callq 0x86190
movl $0x1, %edi
callq 0x7b210
leaq 0x1e8315(%rip), %rax    # 0x27a2a4
cmpl $0x0, (%rax)
je 0x91fb1
movl $0x1, %edi
callq 0x7b210
leaq 0x1e82ff(%rip), %rax    # 0x27a2a4
movl (%rax), %eax
movzwl %ax, %edi
callq 0x7b4b0
jmp 0x91fc2
xorl %edi, %edi
callq 0x7b210
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x7b4b0
movzbl -0x1(%rbp), %edi
callq 0x7b210
movl $0x0, -0x28(%rbp)
cmpl $0xa, -0x28(%rbp)
jge 0x91fea
xorl %edi, %edi
callq 0x7b210
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x91fd2
callq 0x86230
leaq 0xf22fe(%rip), %rdi     # 0x1842f4
callq 0x86190
movl $0x1, %edi
callq 0x7b210
leaq 0x1e8298(%rip), %rax    # 0x27a2a4
cmpl $0x0, (%rax)
je 0x9202e
movl $0x1, %edi
callq 0x7b210
leaq 0x1e8282(%rip), %rax    # 0x27a2a4
movl (%rax), %eax
movzwl %ax, %edi
callq 0x7b4b0
jmp 0x9203f
xorl %edi, %edi
callq 0x7b210
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x7b4b0
movzbl -0x1(%rbp), %edi
callq 0x7b210
movl $0x0, -0x28(%rbp)
cmpl $0xa, -0x28(%rbp)
jge 0x92067
xorl %edi, %edi
callq 0x7b210
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x9204f
callq 0x86230
jmp 0x92a5c
leaq 0x1e5a38(%rip), %rax    # 0x277ab0
cmpq $0x800, (%rax)          # imm = 0x800
jne 0x92181
movl $0xd7, %edi
callq 0x824f0
movl $0x6, %edi
callq 0x7b210
movsd 0xdcf9f(%rip), %xmm0    # 0x16f040
mulsd -0x10(%rbp), %xmm0
callq 0x7b670
callq 0x82630
movb $0x2, -0x29(%rbp)
movzbl -0x2(%rbp), %eax
cmpl $0x0, %eax
jne 0x920c7
movzbl -0x29(%rbp), %eax
orl $0x8, %eax
movb %al, -0x29(%rbp)
leaq 0x2da5b6(%rip), %rax    # 0x36c684
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x920e4
movzbl -0x29(%rbp), %eax
orl $0x30, %eax
movb %al, -0x29(%rbp)
jmp 0x920ee
movzbl -0x29(%rbp), %eax
orl $0x10, %eax
movb %al, -0x29(%rbp)
movl $0xd7, %edi
callq 0x824f0
movl $0x5, %edi
callq 0x7b210
movzbl -0x29(%rbp), %edi
callq 0x7b210
movl $0x1, %edi
callq 0x7b210
cmpb $0x0, -0x1(%rbp)
je 0x92161
leaq 0x2dae26(%rip), %rax    # 0x36cf48
cmpl $0x0, (%rax)
je 0x92137
leaq 0x2dae1a(%rip), %rax    # 0x36cf48
movl (%rax), %edi
callq 0x7b520
jmp 0x9215f
leaq 0x2dae0e(%rip), %rax    # 0x36cf4c
cmpl $0x0, (%rax)
je 0x92153
leaq 0x2dae02(%rip), %rax    # 0x36cf4c
movl (%rax), %edi
callq 0x7b520
jmp 0x9215d
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x7b520
jmp 0x9215f
jmp 0x92168
xorl %edi, %edi
callq 0x7b520
callq 0x82630
movl $0xc8, %edi
callq 0xb8b0
callq 0x91720
jmp 0x92a5a
leaq 0x1e5928(%rip), %rax    # 0x277ab0
cmpq $0x1000000, (%rax)      # imm = 0x1000000
jne 0x921f9
cmpb $0x0, -0x1(%rbp)
je 0x921c3
cmpb $0x0, -0x2(%rbp)
je 0x921b0
leaq 0xf2153(%rip), %rdi     # 0x1842f7
movl $0xfffffe06, %esi       # imm = 0xFFFFFE06
callq 0x82fd0
jmp 0x921c1
leaq 0xf2144(%rip), %rdi     # 0x1842fb
movl $0xfffffe06, %esi       # imm = 0xFFFFFE06
callq 0x82fd0
jmp 0x921ef
cmpb $0x0, -0x2(%rbp)
je 0x921dc
leaq 0xf212f(%rip), %rdi     # 0x1842ff
movl $0xfffffe06, %esi       # imm = 0xFFFFFE06
callq 0x82fd0
jmp 0x921ed
leaq 0xf2120(%rip), %rdi     # 0x184303
movl $0xfffffe06, %esi       # imm = 0xFFFFFE06
callq 0x82fd0
jmp 0x921ef
callq 0x91720
jmp 0x92a58
leaq 0x1e58b0(%rip), %rax    # 0x277ab0
cmpq $0x400000, (%rax)       # imm = 0x400000
jne 0x92227
movsd -0x10(%rbp), %xmm0
callq 0x92a70
movsd -0x18(%rbp), %xmm0
callq 0x92af0
callq 0x91720
jmp 0x92a56
leaq 0x1e5882(%rip), %rax    # 0x277ab0
cmpq $0x10, (%rax)
jne 0x9233c
xorps %xmm0, %xmm0
callq 0x88f10
leaq 0x2dad81(%rip), %rax    # 0x36cfc8
cmpl $0x0, (%rax)
je 0x9225e
movsd 0xdcdd4(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
leaq 0x1e7f5b(%rip), %rax    # 0x27a1c0
cmpl $0x4e, (%rax)
jne 0x922a8
movsd -0x10(%rbp), %xmm0
leaq 0x30918a(%rip), %rdi    # 0x39b400
leaq 0xf208a(%rip), %rsi     # 0x184307
movb $0x1, %al
callq 0x9060
leaq 0x309175(%rip), %rdi    # 0x39b400
movl $0x26, %esi
callq 0x82fd0
leaq 0xf207f(%rip), %rdi     # 0x18431b
movl $0xe, %esi
callq 0x82fd0
jmp 0x922e4
movsd -0x10(%rbp), %xmm0
leaq 0x30914c(%rip), %rdi    # 0x39b400
leaq 0xf2070(%rip), %rsi     # 0x18432b
movb $0x1, %al
callq 0x9060
leaq 0x309137(%rip), %rdi    # 0x39b400
movl $0x26, %esi
callq 0x82fd0
leaq 0xf646e(%rip), %rdi     # 0x188748
movl $0xe, %esi
callq 0x82fd0
leaq 0x1e7ed5(%rip), %rax    # 0x27a1c0
cmpl $0x38, (%rax)
je 0x922fc
leaq 0x1e7ec9(%rip), %rax    # 0x27a1c0
cmpl $0x39, (%rax)
jne 0x92337
cmpb $0x0, -0x2(%rbp)
je 0x92315
leaq 0xf2036(%rip), %rdi     # 0x18433f
movl $0x22, %esi
callq 0x82fd0
jmp 0x92326
leaq 0xf2037(%rip), %rdi     # 0x184353
movl $0x22, %esi
callq 0x82fd0
leaq 0xf2039(%rip), %rdi     # 0x184366
movl $0x22, %esi
callq 0x82fd0
jmp 0x92a54
movabsq $0x800000000, %rcx      # imm = 0x800000000
leaq 0x1e5763(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x9244c
movl $0x45, %edi
movl $0x1f, %esi
callq 0x8ab80
movsd 0xdccbb(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %edi
callq 0x7b520
movsd 0xdcca5(%rip), %xmm0    # 0x16f028
mulsd -0x18(%rbp), %xmm0
cvttsd2si %xmm0, %edi
callq 0x7b520
movsd 0xdce2f(%rip), %xmm0    # 0x16f1c8
leaq 0x2dabe8(%rip), %rax    # 0x36cf88
addsd (%rax), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %edi
callq 0x7b520
movl $0x2, %edi
callq 0x7b210
cmpb $0x0, -0x1(%rbp)
je 0x923da
xorl %edi, %edi
callq 0x7b210
jmp 0x923e4
movl $0x4, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
leaq 0x2daba6(%rip), %rax    # 0x36cf98
movl (%rax), %eax
movzwl %ax, %edi
callq 0x7b4b0
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
xorl %edi, %edi
callq 0x7b210
callq 0x8ac40
jmp 0x92a52
leaq 0x1e565d(%rip), %rax    # 0x277ab0
cmpq $0x1000, (%rax)         # imm = 0x1000
jne 0x92513
leaq 0x1e7d61(%rip), %rax    # 0x27a1c8
cmpl $0x4f, (%rax)
jne 0x924b0
xorps %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
jbe 0x92483
xorps %xmm0, %xmm0
subsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
cvttsd2si -0x18(%rbp), %edx
leaq 0x308f71(%rip), %rdi    # 0x39b400
leaq 0xf1ee0(%rip), %rsi     # 0x184376
movb $0x0, %al
callq 0x9060
leaq 0x308f5c(%rip), %rdi    # 0x39b400
movl $0xfe, %esi
callq 0x82fd0
jmp 0x924cd
movsd -0x10(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x924cb
xorps %xmm0, %xmm0
subsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
jmp 0x924cd
movsd 0xdcb53(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %edx
leaq 0x308f1b(%rip), %rdi    # 0x39b400
leaq 0xf1e9e(%rip), %rsi     # 0x18438a
movb $0x0, %al
callq 0x9060
leaq 0x308f06(%rip), %rdi    # 0x39b400
movl $0xfd, %esi
callq 0x82fd0
movl $0x1365, %edi           # imm = 0x1365
callq 0x8c270
jmp 0x92a50
movabsq $0x400000000, %rcx      # imm = 0x400000000
leaq 0x1e558c(%rip), %rax    # 0x277ab0
cmpq %rcx, (%rax)
jne 0x925be
movsd 0xdcaf3(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x92569
cvttsd2si -0x10(%rbp), %edx
leaq 0x308ea7(%rip), %rdi    # 0x39b400
leaq 0xf1e3e(%rip), %rsi     # 0x18439e
movb $0x0, %al
callq 0x9060
jmp 0x92583
cvttsd2si -0x10(%rbp), %edx
leaq 0x308e8b(%rip), %rdi    # 0x39b400
leaq 0xf1e2c(%rip), %rsi     # 0x1843a8
movb $0x0, %al
callq 0x9060
leaq 0x308e76(%rip), %rdi    # 0x39b400
callq 0x83490
cmpb $0x0, -0x1(%rbp)
je 0x925a3
leaq 0xf1e15(%rip), %rdi     # 0x1843b1
callq 0x83490
jmp 0x925af
leaq 0xf1e0d(%rip), %rdi     # 0x1843b7
callq 0x83490
movl $0x1386, %edi           # imm = 0x1386
callq 0x8c270
jmp 0x92a4e
leaq 0x1e54eb(%rip), %rax    # 0x277ab0
cmpq $0x200000, (%rax)       # imm = 0x200000
jne 0x92635
movsd 0xdca52(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %edx
leaq 0x308e1a(%rip), %rdi    # 0x39b400
leaq 0xf1dd0(%rip), %rsi     # 0x1843bd
movb $0x0, %al
callq 0x9060
leaq 0x308e05(%rip), %rdi    # 0x39b400
callq 0x83580
cvttsd2si -0x18(%rbp), %edx
leaq 0x308df4(%rip), %rdi    # 0x39b400
leaq 0xf1db7(%rip), %rsi     # 0x1843ca
movb $0x0, %al
callq 0x9060
leaq 0x308ddf(%rip), %rdi    # 0x39b400
callq 0x83580
movl $0x1366, %edi           # imm = 0x1366
callq 0x8c270
jmp 0x92a4c
leaq 0x1e5474(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x927c1
leaq 0x1e5463(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x92670
leaq 0x1e7b5a(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x92670
leaq 0x1e5472(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
jne 0x92670
jmp 0x92723
leaq 0x1e5439(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x926a3
leaq 0x1e7b30(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x926a3
leaq 0x1e5448(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0x926a1
leaq 0x1e543c(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
jne 0x926a3
jmp 0x92721
leaq 0x1e5406(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x926be
leaq 0x1e7afd(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x926be
jmp 0x9271f
leaq 0x1e53eb(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x926d9
leaq 0x1e7ae2(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
jne 0x926d9
jmp 0x9271d
leaq 0x1e53d0(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9271b
leaq 0x1e7ac7(%rip), %rax    # 0x27a1b4
cmpl $0x36, (%rax)
je 0x92716
leaq 0x1e7abb(%rip), %rax    # 0x27a1b4
cmpl $0x33, (%rax)
je 0x92716
leaq 0x1e7aaf(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
je 0x92716
leaq 0x1e7aa3(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0x9271b
jmp 0x92a62
jmp 0x9271d
jmp 0x9271f
jmp 0x92721
jmp 0x92723
movl $0x8e, %edi
callq 0x824f0
movl $0x4a, %edi
callq 0x7b210
movzbl -0x1(%rbp), %edi
callq 0x7b210
leaq 0x1e5369(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x92759
leaq 0x1e7a60(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
je 0x92772
leaq 0x1e5350(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0x9277e
leaq 0x1e7a47(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
jne 0x9277e
movl $0x1, %edi
callq 0x7b210
jmp 0x92785
xorl %edi, %edi
callq 0x7b210
movzbl -0x2(%rbp), %edi
callq 0x7b210
movsd -0x10(%rbp), %xmm0
callq 0x7b670
movss -0x1c(%rbp), %xmm0
callq 0x7b600
callq 0x82590
cmpl $0x0, -0x20(%rbp)
je 0x927bc
movl $0x6, %edi
movl $0x16, %esi
callq 0x90d70
jmp 0x92a4a
leaq 0x1e52e8(%rip), %rax    # 0x277ab0
cmpq $0x4, (%rax)
jne 0x92800
leaq 0x2da72e(%rip), %rax    # 0x36cf03
movb (%rax), %dl
movb -0x1(%rbp), %cl
movb -0x2(%rbp), %al
movsd -0x10(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movl -0x20(%rbp), %r8d
xorl %edi, %edi
movzbl %dl, %esi
movzbl %cl, %edx
movzbl %al, %ecx
callq 0x92b60
jmp 0x92a48
leaq 0x1e52a9(%rip), %rax    # 0x277ab0
cmpq $0x8, (%rax)
jne 0x92895
movsd -0x10(%rbp), %xmm0
leaq 0x308be3(%rip), %rdi    # 0x39b400
leaq 0xf1bb4(%rip), %rsi     # 0x1843d8
movb $0x1, %al
callq 0x9060
xorps %xmm0, %xmm0
callq 0x88f10
leaq 0x308bc6(%rip), %rdi    # 0x39b400
movl $0x26, %esi
callq 0x82fd0
leaq 0xf1b9f(%rip), %rdi     # 0x1843ea
movl $0xe, %esi
callq 0x82fd0
cmpb $0x0, -0x1(%rbp)
je 0x9286e
leaq 0xf1b96(%rip), %rdi     # 0x1843f8
movl $0x6a, %esi
callq 0x82fd0
jmp 0x9287f
leaq 0xf1b91(%rip), %rdi     # 0x184406
movl $0x6a, %esi
callq 0x82fd0
leaq 0xf180e(%rip), %rdi     # 0x184094
movl $0x6b, %esi
callq 0x82fd0
jmp 0x92a46
leaq 0x1e5214(%rip), %rax    # 0x277ab0
cmpq $0x80, (%rax)
jne 0x928d9
movl $0x45, %edi
movl $0x6, %esi
callq 0x84080
movsd 0xf031c(%rip), %xmm0    # 0x182bd8
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %edi
callq 0x7b520
movl $0x1, %edi
callq 0x84130
jmp 0x92a44
leaq 0x1e51d0(%rip), %rax    # 0x277ab0
cmpq $0x2000000, (%rax)      # imm = 0x2000000
jne 0x92941
leaq 0x1e76c8(%rip), %rax    # 0x279fb8
movl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpb $0x0, -0x1(%rbp)
je 0x92906
movl -0x24(%rbp), %eax
andl $-0x9, %eax
movl %eax, -0x24(%rbp)
jmp 0x9290f
movl -0x24(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %edi
callq 0x92dc0
cmpb $0x0, -0x1(%rbp)
je 0x9292a
movzbl -0x1(%rbp), %ecx
leaq 0x1e778c(%rip), %rax    # 0x27a0b4
movl %ecx, (%rax)
leaq 0x1e776b(%rip), %rax    # 0x27a09c
movl $0x1, (%rax)
callq 0x92e20
jmp 0x92a42
leaq 0x1e5168(%rip), %rax    # 0x277ab0
cmpq $0x100, (%rax)          # imm = 0x100
jne 0x929a4
leaq 0x2da650(%rip), %rax    # 0x36cfa8
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x10(%rbp), %xmm0
leaq 0x2da63b(%rip), %rax    # 0x36cfa8
movsd %xmm0, (%rax)
leaq 0x1e792c(%rip), %rax    # 0x27a2a4
movl (%rax), %esi
xorl %edi, %edi
xorps %xmm2, %xmm2
movl $0x4, %edx
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x8e4f0
movsd -0x38(%rbp), %xmm0
leaq 0x2da60d(%rip), %rax    # 0x36cfa8
movsd %xmm0, (%rax)
jmp 0x92a40
leaq 0x1e5105(%rip), %rax    # 0x277ab0
cmpq $0x100000, (%rax)       # imm = 0x100000
jne 0x92a3e
movsd 0xdc668(%rip), %xmm0    # 0x16f028
mulsd -0x10(%rbp), %xmm0
cvttsd2si %xmm0, %edx
leaq 0x308a30(%rip), %rdi    # 0x39b400
leaq 0xf1a3c(%rip), %rsi     # 0x184413
movb $0x0, %al
callq 0x9060
leaq 0x308a1b(%rip), %rdi    # 0x39b400
callq 0x85d30
movsd 0xdc636(%rip), %xmm0    # 0x16f028
mulsd -0x18(%rbp), %xmm0
cvttsd2si %xmm0, %edx
leaq 0x3089fe(%rip), %rdi    # 0x39b400
leaq 0xf1a13(%rip), %rsi     # 0x18441c
movb $0x0, %al
callq 0x9060
leaq 0x3089e9(%rip), %rdi    # 0x39b400
callq 0x85d30
cmpb $0x0, -0x2(%rbp)
je 0x92a30
leaq 0xf19fc(%rip), %rdi     # 0x184425
callq 0x85d30
jmp 0x92a3c
leaq 0xf19f6(%rip), %rdi     # 0x18442d
callq 0x85d30
jmp 0x92a3e
jmp 0x92a40
jmp 0x92a42
jmp 0x92a44
jmp 0x92a46
jmp 0x92a48
jmp 0x92a4a
jmp 0x92a4c
jmp 0x92a4e
jmp 0x92a50
jmp 0x92a52
jmp 0x92a54
jmp 0x92a56
jmp 0x92a58
jmp 0x92a5a
jmp 0x92a5c
jmp 0x92a5e
jmp 0x92a60
jmp 0x92a62
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax,%rax)