// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
leaq 0x2bf168(%rip), %rax    # 0x32101a
leaq 0x1c7085(%rip), %rcx    # 0x228f3e
movb (%rcx), %cl
orb (%rax), %cl
jne 0x627de
movl %edx, %r15d
movl %esi, %r14d
movl %edi, %ebx
leaq 0x1a09fe(%rip), %r12    # 0x2028d0
movq (%r12), %rax
cmpq $0x1, %rax
je 0x626a2
cmpq $0x4, %rax
je 0x62533
cmpq $0x8, %rax
je 0x62404
cmpq $0x10, %rax
movapd %xmm0, -0x40(%rbp)
je 0x6202d
cmpq $0x20, %rax
je 0x622fa
cmpq $0x80, %rax
je 0x62058
cmpq $0x100, %rax            # imm = 0x100
je 0x624b8
cmpq $0x800, %rax            # imm = 0x800
je 0x62185
cmpq $0x1000, %rax           # imm = 0x1000
je 0x62092
movabsq $0x800000000, %rcx      # imm = 0x800000000
cmpq %rcx, %rax
movapd -0x40(%rbp), %xmm0
je 0x6255f
cmpq $0x100000, %rax         # imm = 0x100000
je 0x62224
cmpq $0x200000, %rax         # imm = 0x200000
je 0x62649
cmpq $0x400000, %rax         # imm = 0x400000
je 0x623eb
cmpq $0x1000000, %rax        # imm = 0x1000000
je 0x624f7
cmpq $0x2000000, %rax        # imm = 0x2000000
je 0x6246a
cmpq $0x20000000, %rax       # imm = 0x20000000
je 0x620fc
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
je 0x62391
movabsq $0x400000000, %rcx      # imm = 0x400000000
cmpq %rcx, %rax
je 0x62298
cmpq $0x40000, %rax          # imm = 0x40000
jne 0x627de
testb %bl, %bl
je 0x62a50
leaq 0x2c3e7f(%rip), %rax    # 0x325e58
movl (%rax), %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
cmpl $0x1, %edx
adcl $0x0, %edx
movl %edx, %ecx
negl %ecx
testb %r14b, %r14b
cmovel %edx, %ecx
testl %ecx, %ecx
leaq 0x2c3e55(%rip), %rax    # 0x325e50
movl (%rax), %edx
leaq 0xa8f44(%rip), %rax     # 0x10af48
leaq 0xa8f4e(%rip), %rsi     # 0x10af59
cmovgq %rax, %rsi
leaq 0x2c420a(%rip), %rbx    # 0x326220
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0x191, %esi            # imm = 0x191
jmp 0x62a5c
xorpd %xmm0, %xmm0
callq 0x5bd83
leaq 0x295dab(%rip), %rax    # 0x2f7de8
cmpl $0x0, (%rax)
je 0x62749
movapd -0x40(%rbp), %xmm0
mulsd 0x90fd5(%rip), %xmm0    # 0xf3028
jmp 0x6274e
pushq $0x45
popq %rdi
pushq $0x6
popq %rsi
callq 0x582b6
movapd -0x40(%rbp), %xmm0
mulsd 0xa61e0(%rip), %xmm0    # 0x108250
cvttsd2si %xmm0, %edi
callq 0x525e2
pushq $0x1
popq %rdi
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x58354
leaq 0x1a2f4f(%rip), %rax    # 0x204fe8
cmpl $0x4f, (%rax)
movapd -0x40(%rbp), %xmm2
xorpd %xmm0, %xmm0
jne 0x627f0
movapd %xmm2, %xmm3
cmpltsd %xmm0, %xmm3
subsd %xmm2, %xmm0
andpd %xmm3, %xmm0
andnpd %xmm2, %xmm3
orpd %xmm0, %xmm3
movapd %xmm3, -0x40(%rbp)
cvttsd2si %xmm1, %edx
leaq 0x2c414c(%rip), %rbx    # 0x326220
leaq 0xa8f53(%rip), %rsi     # 0x10b02e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0xfe, %esi
callq 0x576d4
movapd -0x40(%rbp), %xmm2
jmp 0x627fe
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0xa8e70(%rip), %rcx     # 0x10af80
leaq 0xa8e76(%rip), %rsi     # 0x10af8d
cmovaq %rcx, %rsi
leaq 0xa68de(%rip), %rcx     # 0x108a00
mulsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %edx
leaq 0x2c40ee(%rip), %r14    # 0x326220
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
callq 0x578d5
xorl %r8d, %r8d
testb %bl, %bl
setne %r8b
addl %r8d, %r8d
leaq 0x1a2f69(%rip), %rax    # 0x2050c0
movl (%rax), %edx
leaq 0x2c513c(%rip), %rax    # 0x32729c
movl (%rax), %ecx
leaq 0xa8e31(%rip), %rsi     # 0x10af9a
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
callq 0x578d5
movl $0x1d6b, %edi           # imm = 0x1D6B
jmp 0x62a3a
movl $0xd7, %edi
callq 0x5707f
pushq $0x6
popq %rdi
callq 0x523f2
movapd -0x40(%rbp), %xmm0
mulsd 0x90eac(%rip), %xmm0    # 0xf3050
callq 0x526bd
callq 0x57171
testb %r14b, %r14b
sete %al
shlb $0x3, %al
leaq 0x2952e6(%rip), %rcx    # 0x2f74a4
movb (%rcx), %r14b
andb $0x1, %r14b
shlb $0x5, %r14b
orb %al, %r14b
orb $0x12, %r14b
movl $0xd7, %edi
callq 0x5707f
pushq $0x5
popq %rdi
callq 0x523f2
movzbl %r14b, %edi
callq 0x523f2
pushq $0x1
popq %rdi
callq 0x523f2
testb %bl, %bl
je 0x62839
leaq 0x295b66(%rip), %rax    # 0x2f7d68
movl (%rax), %edi
testl %edi, %edi
jne 0x6283b
leaq 0x295b59(%rip), %rax    # 0x2f7d6c
movl (%rax), %eax
testl %eax, %eax
movl $0xf4240, %edi          # imm = 0xF4240
cmovnel %eax, %edi
jmp 0x6283b
mulsd 0x90dfc(%rip), %xmm0    # 0xf3028
cvttsd2si %xmm0, %edx
leaq 0x2c3fe9(%rip), %rbx    # 0x326220
leaq 0xa8e8d(%rip), %rsi     # 0x10b0cb
movq %rbx, %rdi
xorl %eax, %eax
movsd %xmm1, -0x30(%rbp)
callq 0x9060
leaq 0x1(%rbx), %r15
movq %r15, %rdi
callq 0x579af
movsd -0x30(%rbp), %xmm0
mulsd 0x90dc2(%rip), %xmm0    # 0xf3028
cvttsd2si %xmm0, %edx
leaq 0xa8e63(%rip), %rsi     # 0x10b0d4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %r15, %rdi
callq 0x579af
testb %r14b, %r14b
je 0x62865
leaq 0xa8e4b(%rip), %rdi     # 0x10b0de
jmp 0x6286c
mulsd 0x90d88(%rip), %xmm0    # 0xf3028
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
cvttsd2si %xmm0, %edx
leaq 0xa8dad(%rip), %rax     # 0x10b060
leaq 0xa8d9c(%rip), %rsi     # 0x10b056
cmovbq %rax, %rsi
leaq 0x2c3f5b(%rip), %r14    # 0x326220
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
callq 0x57a21
testb %bl, %bl
leaq 0xa8d8f(%rip), %rax     # 0x10b06f
leaq 0xa8d82(%rip), %rdi     # 0x10b069
cmoveq %rax, %rdi
callq 0x57a21
movl $0x1386, %edi           # imm = 0x1386
jmp 0x62a3a
mulsd 0x90d26(%rip), %xmm0    # 0xf3028
cvttsd2si %xmm0, %r14d
leaq 0xa8c0d(%rip), %rdi     # 0x10af1b
movsd %xmm1, -0x30(%rbp)
callq 0x59a28
movl %r14d, %edi
callq 0x525e2
callq 0x59aab
leaq 0xa8bf2(%rip), %rdi     # 0x10af1e
callq 0x59a28
cvttsd2si -0x30(%rbp), %edi
callq 0x525e2
callq 0x59aab
leaq 0xa8bda(%rip), %rdi     # 0x10af21
callq 0x59a28
movzbl %bl, %ebx
movl %ebx, %edi
callq 0x523f2
callq 0x59aab
leaq 0xa8c47(%rip), %rdi     # 0x10afa9
callq 0x59a28
pushq $0x1
popq %rdi
callq 0x523f2
leaq 0x1a2d4e(%rip), %r14    # 0x2050c4
cmpl $0x0, (%r14)
je 0x62882
pushq $0x1
popq %rdi
callq 0x523f2
movzwl (%r14), %eax
jmp 0x6288d
leaq 0x2c3e88(%rip), %r15    # 0x326220
movabsq $0x49504144524550, %rax # imm = 0x49504144524550
movq %rax, (%r15)
movq %r15, %rdi
callq 0x9120
movl $0x5350502c, (%r15,%rax) # imm = 0x5350502C
movb $0x0, 0x4(%r15,%rax)
leaq 0x2959b2(%rip), %r13    # 0x2f7d74
movl (%r13), %r12d
movq %r15, %rdi
callq 0x9120
addq %r15, %rax
testl %r12d, %r12d
je 0x6291d
movw $0x4b, 0x4(%rax)
movl $0x4c43472c, (%rax)     # imm = 0x4C43472C
jmp 0x6292a
movsd %xmm1, -0x30(%rbp)
callq 0x62a72
movsd -0x30(%rbp), %xmm0
callq 0x62ac5
jmp 0x6284f
leaq 0x2c3e15(%rip), %r14    # 0x326220
leaq 0xa8c7e(%rip), %rsi     # 0x10b090
movq %r14, %rdi
movb $0x1, %al
callq 0x9060
xorpd %xmm0, %xmm0
callq 0x5bd83
pushq $0x26
popq %rsi
movq %r14, %rdi
callq 0x576d4
leaq 0xa8c6b(%rip), %rdi     # 0x10b0a2
pushq $0xe
popq %rsi
callq 0x576d4
testb %bl, %bl
leaq 0xa8c76(%rip), %rax     # 0x10b0be
leaq 0xa8c61(%rip), %rdi     # 0x10b0b0
cmoveq %rax, %rdi
pushq $0x6a
popq %rsi
callq 0x576d4
leaq 0xa88fa(%rip), %rdi     # 0x10ad5c
pushq $0x6b
popq %rsi
jmp 0x62a5c
leaq 0x1a2967(%rip), %rax    # 0x204dd8
movl (%rax), %eax
xorl %ecx, %ecx
testb %bl, %bl
sete %cl
andl $-0x9, %eax
leal (%rax,%rcx,8), %edi
callq 0x62cc2
testb %bl, %bl
je 0x62495
movzbl %bl, %eax
leaq 0x1a2a41(%rip), %rcx    # 0x204ed4
movl %eax, (%rcx)
leaq 0x1a2a20(%rip), %rax    # 0x204ebc
movl $0x1, (%rax)
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x62d03
leaq 0x295909(%rip), %rbx    # 0x2f7dc8
movsd (%rbx), %xmm0
movsd %xmm0, -0x30(%rbp)
movaps -0x40(%rbp), %xmm0
movsd %xmm0, (%rbx)
leaq 0x1a2bed(%rip), %rax    # 0x2050c4
movl (%rax), %esi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
xorl %edi, %edi
callq 0x5faee
movsd -0x30(%rbp), %xmm0
movsd %xmm0, (%rbx)
jmp 0x627de
testb %r14b, %r14b
leaq 0xa8ab2(%rip), %rax     # 0x10afb3
leaq 0xa8aa7(%rip), %rcx     # 0x10afaf
cmoveq %rax, %rcx
leaq 0xa8aa8(%rip), %rax     # 0x10afbb
leaq 0xa8a9d(%rip), %rdi     # 0x10afb7
cmoveq %rax, %rdi
testb %bl, %bl
cmovneq %rcx, %rdi
movl $0xfffffe06, %esi       # imm = 0xFFFFFE06
callq 0x576d4
jmp 0x6284f
leaq 0x2957e9(%rip), %rax    # 0x2f7d23
movzbl (%rax), %esi
movzbl %bl, %edx
movzbl %r14b, %ecx
xorl %edi, %edi
movl %r15d, %r8d
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x62b01
pushq $0x45
popq %rdi
pushq $0x1f
popq %rsi
movsd %xmm1, -0x30(%rbp)
callq 0x5d27d
movapd -0x40(%rbp), %xmm0
mulsd 0x90aac(%rip), %xmm0    # 0xf3028
cvttsd2si %xmm0, %edi
callq 0x525e2
movsd -0x30(%rbp), %xmm0
mulsd 0x90a96(%rip), %xmm0    # 0xf3028
cvttsd2si %xmm0, %edi
callq 0x525e2
leaq 0x295806(%rip), %rax    # 0x2f7da8
movsd (%rax), %xmm0
addsd 0x93602(%rip), %xmm0    # 0xf5bb0
cvttsd2si %xmm0, %eax
pushq $0x64
popq %rcx
cltd
idivl %ecx
movl %eax, %edi
callq 0x525e2
pushq $0x2
popq %rdi
callq 0x523f2
xorl %edi, %edi
testb %bl, %bl
sete %dil
shll $0x2, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
leaq 0x2957d3(%rip), %rax    # 0x2f7db8
movzwl (%rax), %edi
callq 0x52599
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
xorl %edi, %edi
callq 0x523f2
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5d2f6
mulsd 0x909d7(%rip), %xmm0    # 0xf3028
cvttsd2si %xmm0, %edx
leaq 0x2c3bc4(%rip), %rbx    # 0x326220
leaq 0xa8a12(%rip), %rsi     # 0x10b075
movq %rbx, %rdi
xorl %eax, %eax
movsd %xmm1, -0x30(%rbp)
callq 0x9060
movq %rbx, %rdi
callq 0x57acc
cvttsd2si -0x30(%rbp), %edx
leaq 0xa89fc(%rip), %rsi     # 0x10b082
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
callq 0x57acc
movl $0x1366, %edi           # imm = 0x1366
jmp 0x62a3a
leaq 0x1a292b(%rip), %r13    # 0x204fd4
movl (%r13), %eax
cmpl $0x33, %eax
je 0x627de
cmpl $0x36, %eax
je 0x627de
movl $0x8e, %edi
movaps %xmm0, -0x40(%rbp)
movss %xmm2, -0x30(%rbp)
callq 0x5707f
pushq $0x4a
popq %rdi
callq 0x523f2
movzbl %bl, %edi
callq 0x523f2
cmpq $0x1, (%r12)
sete %al
movl (%r13), %ecx
cmpl $0x41, %ecx
sete %dl
cmpl $0x50, %ecx
sete %cl
orb %dl, %cl
andb %al, %cl
movzbl %cl, %edi
callq 0x523f2
movzbl %r14b, %edi
callq 0x523f2
movaps -0x40(%rbp), %xmm0
callq 0x526bd
movss -0x30(%rbp), %xmm0
callq 0x52673
callq 0x570f8
testl %r15d, %r15d
je 0x627de
pushq $0x6
popq %rdi
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6166c
movapd -0x40(%rbp), %xmm0
leaq 0x1a288b(%rip), %r12    # 0x204fe0
cmpl $0x4e, (%r12)
leaq 0xa885e(%rip), %rax     # 0x10afbf
leaq 0xa887b(%rip), %rsi     # 0x10afe3
cmoveq %rax, %rsi
leaq 0xa8860(%rip), %rax     # 0x10afd3
leaq 0xacc22(%rip), %rbx     # 0x10f39c
cmoveq %rax, %rbx
leaq 0x2c3a9b(%rip), %r15    # 0x326220
movq %r15, %rdi
movb $0x1, %al
callq 0x9060
pushq $0x26
popq %rsi
movq %r15, %rdi
callq 0x576d4
pushq $0xe
popq %rsi
movq %rbx, %rdi
callq 0x576d4
movl (%r12), %eax
andl $-0x2, %eax
cmpl $0x38, %eax
jne 0x627de
testb %r14b, %r14b
leaq 0xa8850(%rip), %rax     # 0x10b00b
leaq 0xa8835(%rip), %rdi     # 0x10aff7
cmoveq %rax, %rdi
pushq $0x22
popq %rbx
movl %ebx, %esi
callq 0x576d4
leaq 0xa8847(%rip), %rdi     # 0x10b01e
movl %ebx, %esi
jmp 0x62a5c
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
ucomisd %xmm0, %xmm2
jbe 0x627fe
subsd %xmm2, %xmm0
movapd %xmm0, %xmm2
mulsd 0x90822(%rip), %xmm2    # 0xf3028
cvttsd2si %xmm2, %edx
leaq 0x2c3a0f(%rip), %rbx    # 0x326220
leaq 0xa882a(%rip), %rsi     # 0x10b042
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9060
movq %rbx, %rdi
movl $0xfd, %esi
callq 0x576d4
movl $0x1365, %edi           # imm = 0x1365
jmp 0x62a3a
xorl %edi, %edi
callq 0x525e2
callq 0x57171
movl $0xc8, %edi
callq 0xae83
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x61bf1
leaq 0xa887a(%rip), %rdi     # 0x10b0e6
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x579af
xorl %edi, %edi
callq 0x523f2
movw $0x3e8, %ax             # imm = 0x3E8
movzwl %ax, %edi
callq 0x52599
movl %ebx, %edi
callq 0x523f2
pushq $0xa
popq %r15
subl $0x1, %r15d
jb 0x628af
xorl %edi, %edi
callq 0x523f2
jmp 0x628a0
callq 0x59aab
leaq 0xa86f1(%rip), %rdi     # 0x10afac
callq 0x59a28
pushq $0x1
popq %rdi
callq 0x523f2
cmpl $0x0, (%r14)
je 0x628dc
pushq $0x1
popq %rdi
callq 0x523f2
movzwl (%r14), %eax
jmp 0x628e7
xorl %edi, %edi
callq 0x523f2
movw $0x3e8, %ax             # imm = 0x3E8
movzwl %ax, %edi
callq 0x52599
movl %ebx, %edi
callq 0x523f2
pushq $0xa
popq %rbx
subl $0x1, %ebx
jb 0x62907
xorl %edi, %edi
callq 0x523f2
jmp 0x628f9
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x59aab
movabsq $0x59434147454c2c, %rcx # imm = 0x59434147454C2C
movq %rcx, (%rax)
movq %r15, %rdi
callq 0x9120
addq %r15, %rax
testb %bl, %bl
je 0x62944
movb $0x0, 0x2(%rax)
movw $0x312c, (%rax)         # imm = 0x312C
jmp 0x6294d
movb $0x0, 0x2(%rax)
movw $0x302c, (%rax)         # imm = 0x302C
leaq 0x2953cf(%rip), %rax    # 0x2f7d23
movb (%rax), %bl
movq %r15, %rdi
callq 0x9120
addq %r15, %rax
cmpb $-0x7e, %bl
jne 0x62971
movb $0x0, 0x2(%rax)
movw $0x312c, (%rax)         # imm = 0x312C
jmp 0x6297a
movb $0x0, 0x2(%rax)
movw $0x302c, (%rax)         # imm = 0x302C
leaq 0x2953ef(%rip), %rax    # 0x2f7d70
movl (%rax), %edx
leaq 0xa87d6(%rip), %rbx     # 0x10b160
leaq -0x140(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9060
movq %r15, %rdi
movq %r12, %rsi
callq 0x96c0
movapd -0x40(%rbp), %xmm0
mulsd 0x90672(%rip), %xmm0    # 0xf3028
cvttsd2si %xmm0, %edx
movq %r12, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9060
movq %r15, %rdi
movq %r12, %rsi
callq 0x96c0
movl (%r13), %ebx
movq %r15, %rdi
callq 0x9120
addq %r15, %rax
testb %r14b, %r14b
je 0x629f5
testl %ebx, %ebx
je 0x629f5
movb $0x0, 0x2(%rax)
movw $0x312c, (%rax)         # imm = 0x312C
jmp 0x629fe
movb $0x0, 0x2(%rax)
movw $0x302c, (%rax)         # imm = 0x302C
leaq 0xa875b(%rip), %rsi     # 0x10b160
leaq -0x140(%rbp), %rbx
movq %rbx, %rdi
movl $0x12c, %edx            # imm = 0x12C
xorl %eax, %eax
callq 0x9060
leaq 0x2c37fe(%rip), %r14    # 0x326220
movq %r14, %rdi
movq %rbx, %rsi
callq 0x96c0
movq %r14, %rdi
callq 0x57791
movl $0x2253, %edi           # imm = 0x2253
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5e18e
leaq 0xa8512(%rip), %rdi     # 0x10af69
movl $0x192, %esi            # imm = 0x192
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x576d4