// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_star_pos()
void parse_star_pos()    
{
int dd,mm,yy;
int hrs,mins,secs;
int ff;
char s[2];
char dir[2];
static int last_sec = (-99);
static double last_jd = 0.0;
double xlat,xlon,xalt;
int bad_msg;
double this_jd;
double delta_jd;
static int fix_count = 0;
char *sss;

   // position and time info

   log_packet_id("Star posn/time");

   fake_msec = 0.0;
   saw_star_time = 1;
   restart_count = 0;

   bad_msg = 0;
   xlat = lat;
   xlon = lon;
   xalt = alt;

   dd = mm = hrs = mins = secs = 99;
   yy = 9999;

   if(star_type == OSA_TYPE) {
      sss = strstr(nmea_msg, "LAT:");
      if(sss) {
         sss += 4;
         zpad(sss, 7);
         sscanf(sss, "%3d%2d%2d", &hrs,&mins,&secs);
         if(mins < 0) bad_msg |= 0x01;
         if(mins >= 60) bad_msg |= 0x01;
         if(secs < 0) bad_msg |= 0x01;
         if(secs >= 60) bad_msg |= 0x01;
         if(hrs < 0) {
            mins = 0-mins;
            secs = 0-secs;
         }

         lat = (double) hrs + ((double) mins/60.0) + ((double) secs/3600.0);
         if(lat < -90.0) bad_msg |= 0x01;
         if(lat > 90.0) bad_msg |= 0x01;
         lat = lat * PI/180.0;
      }
      else return;

      sss = strstr(nmea_msg, "LON:");
      if(sss) {
         sss += 4;
         zpad(sss, 8);
         sscanf(sss, "%4d%2d%2d", &hrs,&mins,&secs);
         if(mins < 0) bad_msg |= 0x02;
         if(mins >= 60) bad_msg |= 0x02;
         if(secs < 0) bad_msg |= 0x02;
         if(secs >= 60) bad_msg |= 0x02;

         if(hrs < 0) {
            mins = 0-mins;
            secs = 0-secs;
         }

         lon = (double) hrs + ((double) mins/60.0) + ((double) secs/3600.0);
         if(lon < -180.0) bad_msg |= 0x02;
         if(lon > 180.0)  bad_msg |= 0x02;
         lon = lon * PI/180.0;
      }
      else return;

      sss = strstr(nmea_msg, "HEI:");
      if(sss) {
         sss += 4;
         zpad(sss, 8);
         alt = atof(sss) / 100.0;
         if(alt < -4000.0) bad_msg |= 0x04;  // message probaly corrupted
         if(alt > 40000.0) bad_msg |= 0x04;  // message probaly corrupted
      }
      else return;

      sss = strstr(nmea_msg, "DATE:");
      if(sss) {
         sss += 5;
         zpad(sss, 8);
         sscanf(sss, "%2d%2d%4d", &dd,&mm,&yy);
         if(dd <= 0) bad_msg |= 0x08;
         if(dd > 31) bad_msg |= 0x08;
         if(mm <= 0) bad_msg |= 0x08;
         if(mm > 12) bad_msg |= 0x08;
         if(yy < 1980) bad_msg |= 0x08;
      }
      else return;

      sss = strstr(nmea_msg, "TIME:");
      if(sss) {
         sss += 5;
         zpad(sss, 6);
         if(strlen(sss) != 6) bad_msg |= 0x20;
         sscanf(sss, "%2d%2d%2d", &hrs,&mins,&secs);
         if(hrs < 0) bad_msg |= 0x20;
         if(hrs > 24) bad_msg |= 0x20;
         if(mins < 0) bad_msg |= 0x20;
         if(mins > 60) bad_msg |= 0x20;
         if(secs < 0) bad_msg |= 0x20;
         if(secs > 60) bad_msg |= 0x20;
      }
      else return;


      if(bad_msg) {  // corrupted message, fake the correct date/time/etc
         lat = xlat; // alt value 50989 seen in corrupted message after data loss reset
         lon = xlon;   
         alt = xalt;   

         gregorian(0, jd_utc+jtime(0,0,1,0.0-rollover));
if(debug_file) fprintf(debug_file, "yymmdd:%04d/%02d/%02d  %02d:%02d:%02d\n", yy,mm,dd, hrs,mins,secs);
if(debug_file) fprintf(debug_file, "greg:  %04d/%02d/%02d  %02d:%02d:%02d\n", g_year,g_month,g_day, g_hours,g_minutes,g_seconds);
         yy = g_year;
         mm = g_month;
         dd = g_day;
         hrs = g_hours;
         mins = g_minutes;
         secs = g_seconds;
if(debug_file) fprintf(debug_file, "bad pos msg:%02X\n", bad_msg);
      }
   }
   else {
      if(get_msg_field()) {  // lat
         strupr(msg_field);
         sscanf(msg_field, "%d%c%d%c%d%c%c", &dd,&s[0],&mm,&s[0],&ff,&s[0],&dir[0]);
         lat = (double) dd;
         lat += ((double) mm)/60.0;
         lat += ((double) ff)/(60.0*10000.0);
         if(dir[0] == 'S') lat *= (-1.0);
         lat = lat * PI/180.0;
      }

      if(get_msg_field()) {  // lon
         strupr(msg_field);
         sscanf(msg_field, "%d%c%d%c%d%c%c", &dd,&s[0],&mm,&s[0],&ff,&s[0],&dir[0]);
         lon = (double) dd;
         lon += ((double) mm)/60.0;
         lon += ((double) ff)/(60.0*10000.0);
         if(dir[0] == 'W') lon *= (-1.0);
         lon = lon * PI/180.0;
      }

      if(get_msg_field()) {  // alt
         alt = atof(msg_field);
      }

      if(get_msg_field()) { // dd/mm/yyyy
         sscanf(msg_field, "%d%c%d%c%d", &dd,&s[0],&mm,&s[0],&yy);
      }
      else return;
      if(get_msg_field()) { // hrs/mins/secs
         sscanf(msg_field, "%d%c%d%c%d", &hrs,&s[0],&mins,&s[0],&secs);
      }
      else return;
   }

   if(((dd == 99) && (mm == 99) && ((yy == 99) || (yy == 9999))) || ((hrs == 99) && (mins == 99) && (secs == 99))) { // no date / time avail
      get_clock_time();     // substitute system clock

      yy = clk_year % 100;
      yy += 2000;
      mm = clk_month;
      dd = clk_day;

      hrs =  clk_hours;
      mins = clk_minutes;
      secs = clk_seconds;
   }

   // the Star 4 occasionally produces skipped time stamps, we try to fix
   // them, by backing this one up by a second
   this_jd = jdate(yy,mm,dd) + jtime(hrs,mins,secs, 0.0);
   delta_jd = this_jd - (last_jd + jtime(0,0,2, 0.0));
if(debug_file) fprintf(debug_file, "thisjd:%f  lastjd:%f  delta:%.12f (%f)\n", this_jd,last_jd, delta_jd, delta_jd*60.0*60.0*24.0);
   if(this_jd < last_jd) ; 
   else if(star_type == OSA_TYPE) ;
   else if(FIX_STAR_TIME && (secs != (SCPI_STATUS_SECOND+2)) && (fabs(delta_jd) <= 0.0000001)) {            // time stamp skip detected
      this_jd -= jtime(0,0,1, 0.0); // ... back this time up a second
      ++fix_count;

      gregorian(0, this_jd);
      yy = g_year;
      mm = g_month;
      dd = g_day;
      hrs = g_hours;
      mins = g_minutes;
      secs = g_seconds;
if(debug_file) fprintf(debug_file, "!! time stamp skip fixed! %02d:%02d:%02d\n", hrs,mins,secs);
   }

   last_jd = this_jd;

   if((star_type == NEC_TYPE) && (secs == last_sec)) {
      dup_star_time = 1;
   }
   else if(FIX_STAR_TIME || (last_sec != secs)) {
      last_sec = secs;

      pri_year = yy;
      pri_month = mm;
      pri_day = dd;
      pri_hours = hrs;
      pri_minutes = mins;
      pri_seconds = secs;
      pri_frac = 0.0;

      if(timing_mode == TMODE_GPS) {     // convert utc time to gps time
         utc_to_gps();
      }
      else {
         adjust_rcvr_time(0.0);  // incorporarte possibly negative fractional second into time variables
      }

      if((seconds == (SCPI_STATUS_SECOND+1)) && (last_misc_second == (SCPI_STATUS_SECOND+2))) {
         if(debug_file) fprintf(debug_file, "fake timestamp backsteped!!!\n");
      } 
      else if(seconds != last_misc_second) {
         update_gps_screen(1554);
      }

      if(pri_seconds == SCPI_STATUS_SECOND) {
         if(star_type == OSA_TYPE) { 
            queue_star_cmd("INFO_VIS_SAT;", STAR_VIS_MSG);     // !!! multi-line response
            queue_star_cmd("INFO_CHAN", STAR_TRACK_MSG);   // !!! multi-line response
         }
         else {
            queue_star_cmd("INFO_TRACK_SAT;", STAR_TRACK_MSG);   // !!! multi-line response
//          queue_star_cmd("INFO_GPS_POS;",   STAR_POS_MSG);
            queue_star_cmd("INFO_VIS_SAT;",   STAR_VIS_MSG);     // !!! multi-line response
//          queue_star_cmd("INFO_GPS_POS;",   STAR_POS_MSG);
         }
      }
      if(pri_seconds == (SCPI_STATUS_SECOND+0)) start_fake_seconds(6);
      if(pri_seconds == (SCPI_STATUS_SECOND+1)) start_fake_seconds(7);
      if(pri_seconds == (SCPI_STATUS_SECOND+2)) start_fake_seconds(8); 
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x9354d(%rip), %rdi     # 0x1240b9
callq 0x58e77
leaq 0x27cb80(%rip), %rax    # 0x30d6f8
movq $0x0, (%rax)
leaq 0x18a46e(%rip), %rax    # 0x21aff4
movl $0x1, (%rax)
leaq 0x2a6479(%rip), %rax    # 0x33700c
movl $0x0, (%rax)
leaq 0x27c430(%rip), %rax    # 0x30cfd0
movsd (%rax), %xmm0
leaq 0x27c42d(%rip), %rax    # 0x30cfd8
movsd (%rax), %xmm1
leaq 0x27c42a(%rip), %rax    # 0x30cfe0
movsd (%rax), %xmm2
movl $0x63, %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x30(%rbp)
movl %eax, -0x3c(%rbp)
movl %eax, -0x34(%rbp)
movl %eax, -0x38(%rbp)
movl $0x270f, -0x40(%rbp)    # imm = 0x270F
leaq 0x18a40c(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x910c7
movsd %xmm2, -0x90(%rbp)
movsd %xmm1, -0x70(%rbp)
movsd %xmm0, -0x50(%rbp)
leaq 0x2aac32(%rip), %rdi    # 0x33b830
leaq 0x934c3(%rip), %rsi     # 0x1240c8
callq 0x9090
testq %rax, %rax
je 0x91715
movq %rax, %rbx
addq $0x4, %rbx
movq %rbx, %rdi
movl $0x7, %esi
callq 0x8fd78
leaq 0x9349f(%rip), %rsi     # 0x1240cd
leaq -0x3c(%rbp), %r14
leaq -0x30(%rbp), %r15
leaq -0x2c(%rbp), %r12
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x9360
movl (%r15), %r13d
movl (%r12), %r15d
movl (%r14), %eax
testl %eax, %eax
jns 0x90c6b
movl %r13d, %ecx
negl %ecx
movl %ecx, -0x30(%rbp)
movl %r15d, %ecx
negl %ecx
movl %ecx, -0x2c(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl -0x30(%rbp), %xmm1
divsd 0x78386(%rip), %xmm1    # 0x109008
addsd %xmm0, %xmm1
xorps %xmm2, %xmm2
cvtsi2sdl -0x2c(%rbp), %xmm2
divsd 0x7837a(%rip), %xmm2    # 0x109010
addsd %xmm1, %xmm2
movsd 0x7ab76(%rip), %xmm0    # 0x10b818
movapd %xmm2, -0x80(%rbp)
mulsd %xmm2, %xmm0
divsd 0x7ab6d(%rip), %xmm0    # 0x10b820
leaq 0x27c316(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
leaq 0x2aab6b(%rip), %rdi    # 0x33b830
leaq 0x9340b(%rip), %rsi     # 0x1240d7
callq 0x9090
testq %rax, %rax
je 0x91715
movq %rax, %r14
movl %r13d, %ebx
shrl $0x1f, %ebx
cmpl $0x3c, %r13d
movl $0x1, %eax
cmovgel %eax, %ebx
cmpl $0x3c, %r15d
movapd -0x80(%rbp), %xmm0
andpd 0x78480(%rip), %xmm0    # 0x109180
cmovael %eax, %ebx
ucomisd 0x7ac05(%rip), %xmm0    # 0x10b910
cmoval %eax, %ebx
addq $0x4, %r14
movq %r14, %rdi
movl $0x8, %esi
callq 0x8fd78
leaq 0x933b6(%rip), %rsi     # 0x1240dc
leaq -0x3c(%rbp), %r15
leaq -0x30(%rbp), %r12
leaq -0x2c(%rbp), %r13
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x9360
movl (%r12), %eax
leal 0x2(%rbx), %ecx
cmpl $0x3c, %eax
movl (%r13), %r12d
cmovael %ecx, %ebx
testl %r12d, %r12d
cmovsl %ecx, %ebx
movl (%r15), %ecx
testl %ecx, %ecx
jns 0x90d70
negl %eax
movl %eax, -0x30(%rbp)
movl %r12d, %eax
negl %eax
movl %eax, -0x2c(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl -0x30(%rbp), %xmm1
divsd 0x78281(%rip), %xmm1    # 0x109008
addsd %xmm0, %xmm1
xorps %xmm2, %xmm2
cvtsi2sdl -0x2c(%rbp), %xmm2
divsd 0x78275(%rip), %xmm2    # 0x109010
addsd %xmm1, %xmm2
movsd 0x7aa71(%rip), %xmm0    # 0x10b818
movapd %xmm2, -0x80(%rbp)
mulsd %xmm2, %xmm0
divsd 0x7aa68(%rip), %xmm0    # 0x10b820
leaq 0x27c219(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
leaq 0x2aaa66(%rip), %rdi    # 0x33b830
leaq 0x93315(%rip), %rsi     # 0x1240e6
callq 0x9090
testq %rax, %rax
je 0x91715
movq %rax, %r14
addq $0x4, %r14
movq %r14, %rdi
movl $0x8, %esi
callq 0x8fd78
movq %r14, %rdi
callq 0x9470
divsd 0x7825d(%rip), %xmm0    # 0x109060
leaq 0x27c1d6(%rip), %rax    # 0x30cfe0
movsd %xmm0, -0x88(%rbp)
movsd %xmm0, (%rax)
leaq 0x2aaa13(%rip), %rdi    # 0x33b830
leaq 0x932c7(%rip), %rsi     # 0x1240eb
callq 0x9090
testq %rax, %rax
je 0x91715
movq %rax, %r14
addq $0x5, %r14
movq %r14, %rdi
movl $0x8, %esi
callq 0x8fd78
leaq 0x932a4(%rip), %rsi     # 0x1240f1
leaq -0x38(%rbp), %rdx
leaq -0x34(%rbp), %rcx
leaq -0x40(%rbp), %r8
movq %r14, %rdi
xorl %eax, %eax
callq 0x9360
leaq 0x2aa9c6(%rip), %rdi    # 0x33b830
leaq 0x9328a(%rip), %rsi     # 0x1240fb
callq 0x9090
testq %rax, %rax
je 0x91715
movq %rax, %r14
movl %ebx, %eax
orl $0x2, %eax
cmpl $0x3c, %r12d
movapd -0x80(%rbp), %xmm0
andpd 0x782e8(%rip), %xmm0    # 0x109180
cmovgel %eax, %ebx
ucomisd 0x7a97d(%rip), %xmm0    # 0x10b820
cmoval %eax, %ebx
movl %ebx, %eax
orl $0x4, %eax
movsd 0x8d815(%rip), %xmm0    # 0x11e6c8
movsd -0x88(%rbp), %xmm1
ucomisd %xmm1, %xmm0
cmoval %eax, %ebx
ucomisd 0x7a9e6(%rip), %xmm1    # 0x10b8b0
cmoval %eax, %ebx
movl %ebx, %eax
orl $0x8, %eax
movl -0x38(%rbp), %ecx
addl $-0x20, %ecx
movl -0x34(%rbp), %edx
addl $-0xd, %edx
cmpl $-0x1f, %ecx
cmovbl %eax, %ebx
cmpl $-0xc, %edx
cmovbl %eax, %ebx
cmpl $0x7bc, -0x40(%rbp)     # imm = 0x7BC
cmovll %eax, %ebx
addq $0x5, %r14
movq %r14, %rdi
movl $0x6, %esi
callq 0x8fd78
movq %r14, %rdi
callq 0x9120
movl %ebx, %r13d
orl $0x20, %r13d
cmpq $0x6, %rax
cmovnel %r13d, %ebx
leaq 0x91e76(%rip), %rsi     # 0x122d99
leaq -0x30(%rbp), %r12
leaq -0x2c(%rbp), %r8
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
movq %r8, %r14
xorl %eax, %eax
callq 0x9360
cmpl $0x19, (%r15)
cmovael %r13d, %ebx
cmpl $0x3d, (%r12)
cmovael %r13d, %ebx
cmpl $0x3d, (%r14)
cmovael %r13d, %ebx
testl %ebx, %ebx
je 0x912e1
leaq 0x27c06a(%rip), %rax    # 0x30cfd0
movsd -0x50(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x27c062(%rip), %rax    # 0x30cfd8
movsd -0x70(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x27c05a(%rip), %rax    # 0x30cfe0
movsd -0x90(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq 0x27c597(%rip), %rax    # 0x30d530
movsd (%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
leaq 0x18a4b7(%rip), %rax    # 0x21b460
xorpd %xmm0, %xmm0
subsd (%rax), %xmm0
xorl %edi, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0xd41e0
addsd -0x50(%rbp), %xmm0
xorl %edi, %edi
callq 0xd0c46
leaq 0x1ad3be(%rip), %r14    # 0x23e390
movq (%r14), %rdi
testq %rdi, %rdi
je 0x91006
movl -0x40(%rbp), %edx
movl -0x34(%rbp), %ecx
movl -0x38(%rbp), %r8d
movl -0x3c(%rbp), %r9d
movl -0x30(%rbp), %r10d
movl -0x2c(%rbp), %r11d
leaq 0x9310a(%rip), %rsi     # 0x124101
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x9560
addq $0x10, %rsp
movq (%r14), %rdi
testq %rdi, %rdi
je 0x9105e
leaq 0x27c68f(%rip), %rax    # 0x30d6a4
movl (%rax), %edx
leaq 0x27c67e(%rip), %rax    # 0x30d69c
movl (%rax), %ecx
leaq 0x27c679(%rip), %rax    # 0x30d6a0
movl (%rax), %r8d
leaq 0x27c677(%rip), %rax    # 0x30d6a8
movl (%rax), %r9d
leaq 0x27c671(%rip), %rax    # 0x30d6ac
movl (%rax), %r10d
leaq 0x27c66b(%rip), %rax    # 0x30d6b0
movl (%rax), %r11d
leaq 0x930d9(%rip), %rsi     # 0x124128
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x9560
addq $0x10, %rsp
leaq 0x27c63f(%rip), %rax    # 0x30d6a4
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x27c62b(%rip), %rax    # 0x30d69c
movl (%rax), %eax
movl %eax, -0x34(%rbp)
leaq 0x27c623(%rip), %rax    # 0x30d6a0
movl (%rax), %eax
movl %eax, -0x38(%rbp)
leaq 0x27c61f(%rip), %rax    # 0x30d6a8
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
leaq 0x27c617(%rip), %rax    # 0x30d6ac
movl (%rax), %eax
movl %eax, -0x30(%rbp)
leaq 0x27c60f(%rip), %rax    # 0x30d6b0
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x912e1
leaq 0x93096(%rip), %rsi     # 0x12414f
movl %ebx, %edx
xorl %eax, %eax
callq 0x9560
jmp 0x912e1
callq 0x811da
testl %eax, %eax
je 0x91185
leaq 0x2aa965(%rip), %rbx    # 0x33ba40
movq %rbx, %rdi
callq 0x9899
subq $0x8, %rsp
leaq -0x52(%rbp), %r12
leaq -0x42(%rbp), %rcx
leaq -0x58(%rbp), %r13
leaq 0x93067(%rip), %rsi     # 0x124161
leaq -0x38(%rbp), %r14
leaq -0x34(%rbp), %r15
movq %rbx, %rdi
leaq 0x27bec4(%rip), %rbx    # 0x30cfd0
movq %r14, %rdx
movq %r15, %r8
movq %rcx, %r9
xorl %eax, %eax
pushq %r12
pushq %rcx
pushq %r13
callq 0x9360
addq $0x20, %rsp
xorps %xmm0, %xmm0
cvtsi2sdl (%r14), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl (%r15), %xmm1
divsd 0x77ecb(%rip), %xmm1    # 0x109008
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl (%r13), %xmm0
divsd 0x8d56e(%rip), %xmm0    # 0x11e6c0
addsd %xmm1, %xmm0
movsd %xmm0, (%rbx)
cmpb $0x53, (%r12)
jne 0x9116d
xorpd 0x78037(%rip), %xmm0    # 0x1091a0
movlpd %xmm0, (%rbx)
movsd (%rbx), %xmm0
mulsd 0x7a69f(%rip), %xmm0    # 0x10b818
divsd 0x7a69f(%rip), %xmm0    # 0x10b820
movsd %xmm0, (%rbx)
callq 0x811da
testl %eax, %eax
je 0x91243
leaq 0x2aa8a7(%rip), %rbx    # 0x33ba40
movq %rbx, %rdi
callq 0x9899
subq $0x8, %rsp
leaq -0x52(%rbp), %r12
leaq -0x42(%rbp), %rcx
leaq -0x58(%rbp), %r13
leaq 0x92fa9(%rip), %rsi     # 0x124161
leaq -0x38(%rbp), %r14
leaq -0x34(%rbp), %r15
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %r8
movq %rcx, %r9
xorl %eax, %eax
pushq %r12
pushq %rcx
pushq %r13
callq 0x9360
addq $0x20, %rsp
xorps %xmm0, %xmm0
cvtsi2sdl (%r14), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl (%r15), %xmm1
divsd 0x77e14(%rip), %xmm1    # 0x109008
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdl (%r13), %xmm0
divsd 0x8d4b7(%rip), %xmm0    # 0x11e6c0
addsd %xmm1, %xmm0
leaq 0x27bdc4(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
cmpb $0x57, (%r12)
jne 0x9122b
xorpd 0x77f79(%rip), %xmm0    # 0x1091a0
movlpd %xmm0, (%rax)
movsd (%rax), %xmm0
mulsd 0x7a5e1(%rip), %xmm0    # 0x10b818
divsd 0x7a5e1(%rip), %xmm0    # 0x10b820
movsd %xmm0, (%rax)
callq 0x811da
testl %eax, %eax
je 0x91263
leaq 0x2aa7ed(%rip), %rdi    # 0x33ba40
callq 0x9470
leaq 0x27bd81(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x811da
testl %eax, %eax
je 0x91715
subq $0x8, %rsp
leaq -0x40(%rbp), %r10
leaq 0x2aa7c1(%rip), %rdi    # 0x33ba40
leaq 0x8cdbb(%rip), %rsi     # 0x11e041
leaq -0x38(%rbp), %rdx
leaq -0x34(%rbp), %r8
leaq -0x42(%rbp), %rcx
movq %rcx, %r9
xorl %eax, %eax
pushq %r10
callq 0x9360
addq $0x10, %rsp
callq 0x811da
testl %eax, %eax
je 0x91715
subq $0x8, %rsp
leaq -0x2c(%rbp), %r10
leaq 0x2aa782(%rip), %rdi    # 0x33ba40
leaq 0x8cd7c(%rip), %rsi     # 0x11e041
leaq -0x3c(%rbp), %rdx
leaq -0x30(%rbp), %r8
leaq -0x42(%rbp), %rcx
movq %rcx, %r9
xorl %eax, %eax
pushq %r10
callq 0x9360
addq $0x10, %rsp
cmpl $0x63, -0x38(%rbp)
jne 0x912fc
cmpl $0x63, -0x34(%rbp)
jne 0x912fc
movl -0x40(%rbp), %eax
cmpl $0x63, %eax
je 0x9130e
cmpl $0x270f, %eax           # imm = 0x270F
je 0x9130e
cmpl $0x63, -0x3c(%rbp)
jne 0x9137a
cmpl $0x63, -0x30(%rbp)
jne 0x9137a
cmpl $0x63, -0x2c(%rbp)
jne 0x9137a
callq 0xa495
leaq 0x27c3ae(%rip), %rax    # 0x30d6c8
movslq (%rax), %rax
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x64, %ecx, %ecx
subl %ecx, %eax
addl $0x7d0, %eax            # imm = 0x7D0
movl %eax, -0x40(%rbp)
leaq 0x27c37b(%rip), %rax    # 0x30d6c0
movl (%rax), %eax
movl %eax, -0x34(%rbp)
leaq 0x27c373(%rip), %rax    # 0x30d6c4
movl (%rax), %eax
movl %eax, -0x38(%rbp)
leaq 0x27c36f(%rip), %rax    # 0x30d6cc
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
leaq 0x27c367(%rip), %rax    # 0x30d6d0
movl (%rax), %eax
movl %eax, -0x30(%rbp)
leaq 0x27c35f(%rip), %rax    # 0x30d6d4
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x40(%rbp), %edi
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
callq 0xd4110
movsd %xmm0, -0x50(%rbp)
movl -0x3c(%rbp), %edi
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
xorpd %xmm0, %xmm0
callq 0xd41e0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd 0x2e0af7(%rip), %xmm0   # 0x371ea8
movsd %xmm0, -0x70(%rbp)
xorpd %xmm0, %xmm0
xorl %edi, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xd41e0
movsd -0x50(%rbp), %xmm4
addsd -0x70(%rbp), %xmm0
movapd %xmm4, %xmm2
subsd %xmm0, %xmm2
leaq 0x1acfaf(%rip), %rbx    # 0x23e390
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x9142e
movsd 0x2e0ab7(%rip), %xmm1   # 0x371ea8
movsd 0x77c0f(%rip), %xmm0    # 0x109008
movapd %xmm2, %xmm3
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm3
mulsd 0x77c33(%rip), %xmm3    # 0x109040
leaq 0x90cba(%rip), %rsi     # 0x1220ce
movapd %xmm4, %xmm0
movb $0x4, %al
movapd %xmm2, -0x70(%rbp)
callq 0x9560
movapd -0x70(%rbp), %xmm2
movsd -0x50(%rbp), %xmm4
movsd 0x2e0a72(%rip), %xmm0   # 0x371ea8
ucomisd %xmm4, %xmm0
ja 0x9151a
leaq 0x189ba1(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
je 0x9151a
leaq 0x27bf95(%rip), %rax    # 0x30d3ec
cmpl $0x0, (%rax)
je 0x9151a
cmpl $0x22, -0x2c(%rbp)
je 0x9151a
andpd 0x77d0e(%rip), %xmm2    # 0x109180
movsd 0x8cd36(%rip), %xmm0    # 0x11e1b0
ucomisd %xmm2, %xmm0
jb 0x9151a
xorpd %xmm0, %xmm0
xorl %edi, %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0xd41e0
movsd -0x50(%rbp), %xmm1
subsd %xmm0, %xmm1
incl 0x2e0a0b(%rip)          # 0x371eb0
xorl %edi, %edi
movsd %xmm1, -0x50(%rbp)
movapd %xmm1, %xmm0
callq 0xd0c46
leaq 0x27c1e8(%rip), %rax    # 0x30d6a4
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x27c1d4(%rip), %rax    # 0x30d69c
movl (%rax), %eax
movl %eax, -0x34(%rbp)
leaq 0x27c1cc(%rip), %rax    # 0x30d6a0
movl (%rax), %eax
movl %eax, -0x38(%rbp)
leaq 0x27c1c8(%rip), %rax    # 0x30d6a8
movl (%rax), %edx
movl %edx, -0x3c(%rbp)
leaq 0x27c1c0(%rip), %rax    # 0x30d6ac
movl (%rax), %ecx
movl %ecx, -0x30(%rbp)
leaq 0x27c1b8(%rip), %rax    # 0x30d6b0
movl (%rax), %r8d
movl %r8d, -0x2c(%rbp)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x91515
leaq 0x92c62(%rip), %rsi     # 0x124170
xorl %eax, %eax
callq 0x9560
movsd -0x50(%rbp), %xmm4
movsd %xmm4, 0x2e0986(%rip)   # 0x371ea8
leaq 0x189abf(%rip), %rax    # 0x21afe8
cmpl $0x4e, (%rax)
jne 0x9154b
movl -0x2c(%rbp), %eax
cmpl 0xd90f5(%rip), %eax     # 0x16a62c
jne 0x9154b
leaq 0x189ab0(%rip), %rax    # 0x21aff0
movl $0x1, (%rax)
jmp 0x91715
leaq 0x27be9a(%rip), %rax    # 0x30d3ec
cmpl $0x0, (%rax)
jne 0x91566
movl 0xd90cf(%rip), %eax     # 0x16a62c
cmpl -0x2c(%rbp), %eax
je 0x91715
movl -0x2c(%rbp), %eax
movl %eax, 0xd90bd(%rip)     # 0x16a62c
movl -0x40(%rbp), %ecx
leaq 0x27bf9b(%rip), %rdx    # 0x30d514
movl %ecx, (%rdx)
movl -0x34(%rbp), %ecx
leaq 0x27bf8b(%rip), %rdx    # 0x30d510
movl %ecx, (%rdx)
movl -0x38(%rbp), %ecx
leaq 0x27bf7b(%rip), %rdx    # 0x30d50c
movl %ecx, (%rdx)
movl -0x3c(%rbp), %ecx
leaq 0x27bf6b(%rip), %rdx    # 0x30d508
movl %ecx, (%rdx)
movl -0x30(%rbp), %ecx
leaq 0x27bf5b(%rip), %rdx    # 0x30d504
movl %ecx, (%rdx)
leaq 0x27bf4e(%rip), %r14    # 0x30d500
movl %eax, (%r14)
leaq 0x27bf5c(%rip), %rax    # 0x30d518
movq $0x0, (%rax)
leaq 0x27bef3(%rip), %rax    # 0x30d4bd
cmpb $0x0, (%rax)
je 0x915da
xorpd %xmm0, %xmm0
callq 0x5c907
jmp 0x91604
leaq 0x27c147(%rip), %rax    # 0x30d728
xorps %xmm0, %xmm0
cvtsi2sdl (%rax), %xmm0
callq 0x5c907
leaq 0x27beb0(%rip), %rax    # 0x30d4a4
andb $-0x2, (%rax)
leaq 0x27bdce(%rip), %rax    # 0x30d3cc
movl $0x1, (%rax)
leaq 0x27bebd(%rip), %rax    # 0x30d4c8
movl (%rax), %eax
movl %eax, %edx
xorl $0x21, %edx
movl 0xd8d58(%rip), %ecx     # 0x16a370
movl %ecx, %esi
xorl $0x22, %esi
orl %edx, %esi
jne 0x91641
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x9164a
leaq 0x92b6a(%rip), %rdi     # 0x12419a
movl $0x1d, %esi
movl $0x1, %edx
callq 0x9750
jmp 0x9164a
cmpl %ecx, %eax
je 0x9164a
callq 0x7327e
cmpl $0x20, (%r14)
jne 0x9169d
leaq 0x189991(%rip), %rax    # 0x21afe8
cmpl $0x4f, (%rax)
jne 0x9167b
leaq 0x92b55(%rip), %rdi     # 0x1241b8
movl $0xcd, %esi
callq 0x5ee52
leaq 0x92b52(%rip), %rdi     # 0x1241c6
movl $0xce, %esi
jmp 0x91698
leaq 0x92b4e(%rip), %rdi     # 0x1241d0
movl $0xce, %esi
callq 0x5ee52
leaq 0x92b25(%rip), %rdi     # 0x1241b8
movl $0xcd, %esi
callq 0x5ee52
cmpl $0x20, (%r14)
jne 0x916c5
callq 0xaea1
addsd 0x77988(%rip), %xmm0    # 0x109038
leaq 0x27c041(%rip), %rax    # 0x30d6f8
movsd %xmm0, (%rax)
movl $0x0, 0x2e0793(%rip)    # 0x371e58
cmpl $0x21, (%r14)
jne 0x916ed
callq 0xaea1
addsd 0x77960(%rip), %xmm0    # 0x109038
leaq 0x27c019(%rip), %rax    # 0x30d6f8
movsd %xmm0, (%rax)
movl $0x0, 0x2e076b(%rip)    # 0x371e58
cmpl $0x22, (%r14)
jne 0x91715
callq 0xaea1
addsd 0x77938(%rip), %xmm0    # 0x109038
leaq 0x27bff1(%rip), %rax    # 0x30d6f8
movsd %xmm0, (%rax)
movl $0x0, 0x2e0743(%rip)    # 0x371e58
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq