// File: jkingan[P]ladyheather/heathgps.cpp
// Function: primary_timing(int)
void primary_timing(int get_tsip)
{
int i;

   // process the receiver primary timing message.  For TSIP receivers, gets
   // the timing message.

   if(get_tsip) log_packet_id("Packet 0x8F.AB (Primary timing)");

   skip_starloc_time = 0;
   last_pri_tow = pt_tow;
   ++got_timing_msg;    // prevents keyboard lockup with high nav rate receivers
   ++roll_timing_msg;   // used to reset queues during startup rollover detection

   if(timeout_extended) {  // com timeout has been increased due to special commands
      --timeout_extended;
      if(timeout_extended <= 0) { // it's safe to restore the com timeout to its normal value
         com[RCVR_PORT].com_timeout = com[RCVR_PORT].user_timeout;
      }
   }

   if(get_tsip) {
      have_pri_time = 1;
      pri_tow = this_pri_tow = pt_tow = tsip_dword();
      gps_week = tsip_word();
      faked_tow = 0;

      i = (int) (s16) tsip_word();
      if(!user_set_utc_ofs && (i >= 0) && (i < 64)) {    // filter bogus values
         utc_offset = i;
         if(utc_offset != 0) utc_offset_flag = utc_offset;
         if(tsip_type == STARLOC_TYPE) {
            if(utc_offset_flag && (utc_offset == 0)) {
               utc_offset = utc_offset_flag;  // sometimes sends random 0 utc_offset value
            }
            tsip_byte();  // STARLOC_TYPE always sends bogus 0 time_flags value
         }
         else time_flags = tsip_byte();
      }
      else if(STARLOC) tsip_byte(); // STARLOC_TYPE always sends bogus 0 time_flags value 
      else time_flags = tsip_byte();
//sprintf(debug_text4, "time flag byte: %02X", time_flags);

      pri_seconds = pt_sec = tsip_byte();
      pri_minutes = pt_min = tsip_byte();
      pri_hours = pt_hh = tsip_byte();
      pri_day = tsip_byte();
      pri_month = tsip_byte();
      pri_year = tsip_word();
      pri_frac = 0.0;

      if(STARLOC) {
         if(show_debug_info && debug_file) fprintf(debug_file, "starloc time: %04d/%02d/%02d %02d:%02d:%02d\n", pri_year,pri_month,pri_day, pri_hours,pri_minutes,pri_seconds);
         if((pri_year < 1980) || (pri_year > 2100)) {  // totally bogus time/date
            goto pt_err;
         }
         fix_starloc_time();  // try to fixup time stamp skips
      }

      check_tsip_end(1);

      if(have_week == 0) need_redraw = 2007;
      have_week = 1;

      if(have_tow == 0) need_redraw = 2008;
      have_tow = 1;

      check_utc_ofs(2);
   }

   pri_month = fix_month(pri_month);

   if(have_utc_ofs) time_flags &= (~TFLAGS_NO_UTC_OFS);
   else             time_flags |= TFLAGS_NO_UTC_OFS;

   last_time_msec = this_time_msec;  // used to measure timing message jitter
   this_time_msec = GetMsecs();

   if(tsip_type == STARLOC_TYPE) {
      if(time_flags & TFLAGS_UTC) {  // stupid DATUM receiver can output UTC time
         gps_to_utc();               // but always says it is GPS time.  We always run
      }                              // those turds in GPS mode and convert to UTC
   }

   check_for_leapsecond();  // see if the time represents a leapsecond

   if(force_day) {
      pri_day = force_day;
      pri_month = force_month;
      pri_year = force_year;
   }

   fix_rollover();

   if(log_db) request_sig_levels();

   if(rcvr_type != TSIP_RCVR) ;  // ggggg
   else if(user_pps_len) {  // send string of user specified bytes each time a timing message is received
      for(i=0; i<user_pps_len; i++) {
         sendout(RCVR_PORT, user_pps_cmd[i], ADD_CHAR);
      } 
      sendout(RCVR_PORT, 0, FLUSH_COM);
   }

   if     (rcvr_type == SCPI_RCVR) ;
   else if(rcvr_type == STAR_RCVR) ;
   else if(rcvr_type == UCCM_RCVR) ;
   else if(tsip_error) {
      goto pt_exit; 
   }

   if(just_read) goto pt_exit; 

   if(1) {   // filter bogus time values
      pt_err:
      i = 0;

//    if(pri_tow >= (60L*60L*24L*7L))   { write_log_error("tow", pri_tow);            ++i; }
      if(pri_seconds > 61)              { write_log_error("seconds>61", pri_seconds); ++i; } 
      if(pri_seconds < 0)               { write_log_error("seconds<0", pri_seconds);  ++i; } 

      if(pri_minutes > 60)              { write_log_error("minutes>60", pri_minutes); ++i; } 
      if(pri_minutes < 0)               { write_log_error("minutes<0", pri_minutes);  ++i; } 

      if(pri_hours > 24)                { write_log_error("hours>24", pri_hours);     ++i; } // accomodate weird leap seconds
      if(pri_hours < 0)                 { write_log_error("hours<0", pri_hours);      ++i; } // accomodate weird leap seconds

      if(pri_day > 31)                  { write_log_error("day>31", pri_day);         ++i; } 
      if(pri_day <= 0)                  { write_log_error("day<=0", pri_day);         ++i; } 

      if(pri_month > 12)                { write_log_error("month>12", pri_month);     ++i; } 
      if(pri_month <= 0)                { write_log_error("month<=0", pri_month);     ++i; } 

      if(pri_year < 1980)               { write_log_error("year<1980", pri_year);     ++i; } 
      if(pri_year > 2100)               { write_log_error("year>2100", pri_year);     ++i; } 


      if(i) {
         if(STARLOC) bad_starloc_time = i;  // inhibt duplicated time stamp errs when bogus time seen
         goto pt_exit;
      }
   }

   // the time message seems to have valid time
   seconds = pri_seconds;     // save GPS/UTC time and date in global variables
   minutes = pri_minutes;
   hours = pri_hours;
   day = pri_day;
   month = pri_month;
   year = pri_year;
   raw_frac = pri_frac;

   tow = pri_tow;  
   this_tow = tow;
   survey_tow = tow;


   jd_utc = jd_gps = jdate(year,month,day) + jtime(hours,minutes,seconds,raw_frac);
   if(elapsed_time_set == 0) {
      jd_elapsed = jd_utc;
      elapsed_time_set = 1;
   }

   if(jd_utc == last_jd_utc) ++stuck_clock;
   else stuck_clock = 0;
   last_jd_utc = jd_utc;

   if(last_kbd_jd == 0.0) last_kbd_jd = jd_utc;

   calc_msg_ofs();

   if(no_poll) show_version_header();

   primary_misc();

   if(stuck_clock > 5) ;  // clock has stopped, avoid continuous screen dumps
   else if(leap_time && leap_dump) {  // do screen dump if leap-second seen
      refresh_page();
      leap_dumped = 1;
      if(!have_leap_info) have_leap_info = 99; // show the "Leap: captured" status
      dump_screen(0, 0, "leap_sec");
   }

   pt_exit:
   // every time we see the 8F.AB (or a time code) message, 
   // ... we request a different minor status message from the receiver
   request_misc_msg();  
   if(PALISADE) {  // these don't output secondary timing message (or primary timing for that matter)
      secondary_timing(0);
   }
   else if((ACU_GG || ACU_360 || ACUTIME) && (have_sec_timing == 0)) {
      secondary_timing(0);
   }
   return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0xa257d
leaq 0xe2f20(%rip), %rdi     # 0x185498
callq 0x7add0
movl $0x0, 0x328a2d(%rip)    # 0x3cafb4
movl 0x328a3f(%rip), %eax    # 0x3cafcc
movl %eax, 0x328a29(%rip)    # 0x3cafbc
leaq 0x2ca082(%rip), %rax    # 0x36c61c
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ca076(%rip), %rax    # 0x36c61c
movl %ecx, (%rax)
leaq 0x2ca071(%rip), %rax    # 0x36c620
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2ca065(%rip), %rax    # 0x36c620
movl %ecx, (%rax)
leaq 0x2f3c24(%rip), %rax    # 0x3961e8
cmpl $0x0, (%rax)
je 0xa260a
leaq 0x2f3c18(%rip), %rax    # 0x3961e8
movl (%rax), %ecx
addl $-0x1, %ecx
leaq 0x2f3c0c(%rip), %rax    # 0x3961e8
movl %ecx, (%rax)
leaq 0x2f3c03(%rip), %rax    # 0x3961e8
cmpl $0x0, (%rax)
jg 0xa2608
leaq 0x2caecf(%rip), %rax    # 0x36d4c0
movsd 0x17a00(%rax), %xmm0
leaq 0x2caec0(%rip), %rax    # 0x36d4c0
movsd %xmm0, 0x179f8(%rax)
jmp 0xa260a
cmpl $0x0, -0x4(%rbp)
je 0xa28d3
leaq 0x1fba9d(%rip), %rax    # 0x29e0b8
movl $0x1, (%rax)
callq 0x7a680
movl %eax, %ecx
movl %ecx, 0x32899e(%rip)    # 0x3cafcc
movl %ecx, 0x328984(%rip)    # 0x3cafb8
leaq 0x2ca2e9(%rip), %rax    # 0x36c924
movl %ecx, (%rax)
callq 0x7a560
movw %ax, %cx
leaq 0x2ca2cc(%rip), %rax    # 0x36c918
movw %cx, (%rax)
leaq 0x2ca2d2(%rip), %rax    # 0x36c928
movl $0x0, (%rax)
callq 0x7a560
cwtl
movl %eax, -0x8(%rbp)
leaq 0x2ca2a8(%rip), %rax    # 0x36c914
cmpl $0x0, (%rax)
jne 0xa26ff
cmpl $0x0, -0x8(%rbp)
jl 0xa26ff
cmpl $0x40, -0x8(%rbp)
jge 0xa26ff
movl -0x8(%rbp), %ecx
leaq 0x2ca279(%rip), %rax    # 0x36c908
movl %ecx, (%rax)
leaq 0x2ca270(%rip), %rax    # 0x36c908
cmpl $0x0, (%rax)
je 0xa26af
leaq 0x2ca264(%rip), %rax    # 0x36c908
movl (%rax), %ecx
leaq 0x2ca263(%rip), %rax    # 0x36c910
movl %ecx, (%rax)
leaq 0x1d7afe(%rip), %rax    # 0x27a1b4
cmpl $0x53, (%rax)
jne 0xa26ec
leaq 0x2ca24e(%rip), %rax    # 0x36c910
cmpl $0x0, (%rax)
je 0xa26e5
leaq 0x2ca23a(%rip), %rax    # 0x36c908
cmpl $0x0, (%rax)
jne 0xa26e5
leaq 0x2ca236(%rip), %rax    # 0x36c910
movl (%rax), %ecx
leaq 0x2ca225(%rip), %rax    # 0x36c908
movl %ecx, (%rax)
callq 0x7a510
jmp 0xa26fd
callq 0x7a510
movzbl %al, %ecx
leaq 0x2c9f89(%rip), %rax    # 0x36c684
movl %ecx, (%rax)
jmp 0xa2732
leaq 0x1d53aa(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa271f
leaq 0x1d7aa1(%rip), %rax    # 0x27a1b4
cmpl $0x53, (%rax)
jne 0xa271f
callq 0x7a510
jmp 0xa2730
callq 0x7a510
movzbl %al, %ecx
leaq 0x2c9f56(%rip), %rax    # 0x36c684
movl %ecx, (%rax)
jmp 0xa2732
callq 0x7a510
movzbl %al, %ecx
movl %ecx, 0x328888(%rip)    # 0x3cafc8
leaq 0x2c9f99(%rip), %rax    # 0x36c6e0
movl %ecx, (%rax)
callq 0x7a510
movzbl %al, %ecx
movl %ecx, 0x32886d(%rip)    # 0x3cafc4
leaq 0x2c9f86(%rip), %rax    # 0x36c6e4
movl %ecx, (%rax)
callq 0x7a510
movzbl %al, %ecx
movl %ecx, 0x328852(%rip)    # 0x3cafc0
leaq 0x2c9f73(%rip), %rax    # 0x36c6e8
movl %ecx, (%rax)
callq 0x7a510
movzbl %al, %ecx
leaq 0x2c9f66(%rip), %rax    # 0x36c6ec
movl %ecx, (%rax)
callq 0x7a510
movzbl %al, %ecx
leaq 0x2c9f59(%rip), %rax    # 0x36c6f0
movl %ecx, (%rax)
callq 0x7a560
movzwl %ax, %ecx
leaq 0x2c9f4c(%rip), %rax    # 0x36c6f4
movl %ecx, (%rax)
leaq 0x2c9f47(%rip), %rax    # 0x36c6f8
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
leaq 0x1d52f1(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa2873
leaq 0x1d79e4(%rip), %rax    # 0x27a1b4
cmpl $0x53, (%rax)
jne 0xa2873
leaq 0x1d52c4(%rip), %rax    # 0x277aa4
cmpb $0x0, (%rax)
je 0xa284b
leaq 0x1fad84(%rip), %rax    # 0x29d570
cmpq $0x0, (%rax)
je 0xa284b
leaq 0x1fad77(%rip), %rax    # 0x29d570
movq (%rax), %rdi
leaq 0x2c9ef1(%rip), %rax    # 0x36c6f4
movl (%rax), %edx
leaq 0x2c9ee4(%rip), %rax    # 0x36c6f0
movl (%rax), %ecx
leaq 0x2c9ed7(%rip), %rax    # 0x36c6ec
movl (%rax), %r8d
leaq 0x2c9ec9(%rip), %rax    # 0x36c6e8
movl (%rax), %r9d
leaq 0x2c9ebb(%rip), %rax    # 0x36c6e4
movl (%rax), %r10d
leaq 0x2c9ead(%rip), %rax    # 0x36c6e0
movl (%rax), %eax
leaq 0xe2c7c(%rip), %rsi     # 0x1854b8
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x9550
leaq 0x2c9ea2(%rip), %rax    # 0x36c6f4
cmpl $0x7bc, (%rax)          # imm = 0x7BC
jl 0xa2869
leaq 0x2c9e93(%rip), %rax    # 0x36c6f4
cmpl $0x834, (%rax)          # imm = 0x834
jle 0xa286e
jmp 0xa2a8e
callq 0xa2290
movl $0x1, %edi
callq 0x7aee0
leaq 0x2c9c88(%rip), %rax    # 0x36c50c
cmpl $0x0, (%rax)
jne 0xa2896
leaq 0x1d5194(%rip), %rax    # 0x277a24
movl $0x7d7, (%rax)          # imm = 0x7D7
leaq 0x2c9c6f(%rip), %rax    # 0x36c50c
movl $0x1, (%rax)
leaq 0x2c9c5e(%rip), %rax    # 0x36c508
cmpl $0x0, (%rax)
jne 0xa28bc
leaq 0x1d516e(%rip), %rax    # 0x277a24
movl $0x7d8, (%rax)          # imm = 0x7D8
leaq 0x2c9c45(%rip), %rax    # 0x36c508
movl $0x1, (%rax)
movl $0x2, %edi
callq 0x7a270
leaq 0x2c9e16(%rip), %rax    # 0x36c6f0
movl (%rax), %edi
callq 0x9c2e0
movl %eax, %ecx
leaq 0x2c9e06(%rip), %rax    # 0x36c6f0
movl %ecx, (%rax)
leaq 0x2c9c09(%rip), %rax    # 0x36c4fc
cmpl $0x0, (%rax)
je 0xa290f
leaq 0x2c9d85(%rip), %rax    # 0x36c684
movl (%rax), %ecx
andl $-0x9, %ecx
leaq 0x2c9d79(%rip), %rax    # 0x36c684
movl %ecx, (%rax)
jmp 0xa2924
leaq 0x2c9d6e(%rip), %rax    # 0x36c684
movl (%rax), %ecx
orl $0x8, %ecx
leaq 0x2c9d62(%rip), %rax    # 0x36c684
movl %ecx, (%rax)
leaq 0x2c9fc5(%rip), %rax    # 0x36c8f0
movsd (%rax), %xmm0
leaq 0x2c9fc2(%rip), %rax    # 0x36c8f8
movsd %xmm0, (%rax)
callq 0xb630
leaq 0x2c9faa(%rip), %rax    # 0x36c8f0
movsd %xmm0, (%rax)
leaq 0x1d7863(%rip), %rax    # 0x27a1b4
cmpl $0x53, (%rax)
jne 0xa296e
leaq 0x2c9d27(%rip), %rax    # 0x36c684
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xa296c
callq 0x7fcb0
jmp 0xa296e
callq 0xa1d60
leaq 0x2c9fd6(%rip), %rax    # 0x36c950
cmpl $0x0, (%rax)
je 0xa29b5
leaq 0x2c9fca(%rip), %rax    # 0x36c950
movl (%rax), %ecx
leaq 0x2c9d5d(%rip), %rax    # 0x36c6ec
movl %ecx, (%rax)
leaq 0x2c9fbc(%rip), %rax    # 0x36c954
movl (%rax), %ecx
leaq 0x2c9d4f(%rip), %rax    # 0x36c6f0
movl %ecx, (%rax)
leaq 0x2c9fae(%rip), %rax    # 0x36c958
movl (%rax), %ecx
leaq 0x2c9d41(%rip), %rax    # 0x36c6f4
movl %ecx, (%rax)
callq 0xa1fb0
leaq 0x1fac34(%rip), %rax    # 0x29d5f5
cmpb $0x0, (%rax)
je 0xa29cb
callq 0x8bfa0
leaq 0x1d50de(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
je 0xa29da
jmp 0xa2a34
leaq 0x2f3a43(%rip), %rax    # 0x396424
cmpl $0x0, (%rax)
je 0xa2a32
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
leaq 0x2f3a2d(%rip), %rcx    # 0x396424
cmpl (%rcx), %eax
jge 0xa2a21
movslq -0x8(%rbp), %rcx
movl $0xa, %edi
xorl %edx, %edx
leaq 0x2f3913(%rip), %rax    # 0x396320
movzbl (%rax,%rcx), %esi
callq 0xd160
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0xa29ed
movl $0xa, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0xd160
jmp 0xa2a34
leaq 0x1d5075(%rip), %rax    # 0x277ab0
cmpq $0x10, (%rax)
jne 0xa2a43
jmp 0xa2a7b
leaq 0x1d5066(%rip), %rax    # 0x277ab0
cmpq $0x1000, (%rax)         # imm = 0x1000
jne 0xa2a55
jmp 0xa2a79
leaq 0x1d5054(%rip), %rax    # 0x277ab0
cmpq $0x8, (%rax)
jne 0xa2a64
jmp 0xa2a77
leaq 0x1fb6e5(%rip), %rax    # 0x29e150
cmpl $0x0, (%rax)
je 0xa2a75
jmp 0xa2f1c
jmp 0xa2a77
jmp 0xa2a79
jmp 0xa2a7b
leaq 0x2f3776(%rip), %rax    # 0x3961f8
cmpb $0x0, (%rax)
je 0xa2a8c
jmp 0xa2f1c
jmp 0xa2a8e
movl $0x0, -0x8(%rbp)
leaq 0x2c9c44(%rip), %rax    # 0x36c6e0
cmpl $0x3d, (%rax)
jle 0xa2abf
leaq 0x2c9c38(%rip), %rax    # 0x36c6e0
movl (%rax), %esi
leaq 0xe2a34(%rip), %rdi     # 0x1854e5
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9c1a(%rip), %rax    # 0x36c6e0
cmpl $0x0, (%rax)
jge 0xa2ae9
leaq 0x2c9c0e(%rip), %rax    # 0x36c6e0
movl (%rax), %esi
leaq 0xe2a15(%rip), %rdi     # 0x1854f0
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9bf4(%rip), %rax    # 0x36c6e4
cmpl $0x3c, (%rax)
jle 0xa2b13
leaq 0x2c9be8(%rip), %rax    # 0x36c6e4
movl (%rax), %esi
leaq 0xe29f5(%rip), %rdi     # 0x1854fa
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9bca(%rip), %rax    # 0x36c6e4
cmpl $0x0, (%rax)
jge 0xa2b3d
leaq 0x2c9bbe(%rip), %rax    # 0x36c6e4
movl (%rax), %esi
leaq 0xe29d6(%rip), %rdi     # 0x185505
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9ba4(%rip), %rax    # 0x36c6e8
cmpl $0x18, (%rax)
jle 0xa2b67
leaq 0x2c9b98(%rip), %rax    # 0x36c6e8
movl (%rax), %esi
leaq 0xe29b6(%rip), %rdi     # 0x18550f
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9b7a(%rip), %rax    # 0x36c6e8
cmpl $0x0, (%rax)
jge 0xa2b91
leaq 0x2c9b6e(%rip), %rax    # 0x36c6e8
movl (%rax), %esi
leaq 0xe2995(%rip), %rdi     # 0x185518
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9b54(%rip), %rax    # 0x36c6ec
cmpl $0x1f, (%rax)
jle 0xa2bbb
leaq 0x2c9b48(%rip), %rax    # 0x36c6ec
movl (%rax), %esi
leaq 0xe2973(%rip), %rdi     # 0x185520
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9b2a(%rip), %rax    # 0x36c6ec
cmpl $0x0, (%rax)
jg 0xa2be5
leaq 0x2c9b1e(%rip), %rax    # 0x36c6ec
movl (%rax), %esi
leaq 0xe2950(%rip), %rdi     # 0x185527
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9b04(%rip), %rax    # 0x36c6f0
cmpl $0xc, (%rax)
jle 0xa2c0f
leaq 0x2c9af8(%rip), %rax    # 0x36c6f0
movl (%rax), %esi
leaq 0xe292d(%rip), %rdi     # 0x18552e
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9ada(%rip), %rax    # 0x36c6f0
cmpl $0x0, (%rax)
jg 0xa2c39
leaq 0x2c9ace(%rip), %rax    # 0x36c6f0
movl (%rax), %esi
leaq 0xe290c(%rip), %rdi     # 0x185537
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9ab4(%rip), %rax    # 0x36c6f4
cmpl $0x7bc, (%rax)          # imm = 0x7BC
jge 0xa2c66
leaq 0x2c9aa5(%rip), %rax    # 0x36c6f4
movl (%rax), %esi
leaq 0xe28e8(%rip), %rdi     # 0x185540
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
leaq 0x2c9a87(%rip), %rax    # 0x36c6f4
cmpl $0x834, (%rax)          # imm = 0x834
jle 0xa2c93
leaq 0x2c9a78(%rip), %rax    # 0x36c6f4
movl (%rax), %esi
leaq 0xe28c5(%rip), %rdi     # 0x18554a
callq 0x120d60
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0xa2cc3
leaq 0x1d4e10(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa2cbe
leaq 0x1d7507(%rip), %rax    # 0x27a1b4
cmpl $0x53, (%rax)
jne 0xa2cbe
movl -0x8(%rbp), %ecx
leaq 0x1dfb14(%rip), %rax    # 0x2827d0
movl %ecx, (%rax)
jmp 0xa2f1c
leaq 0x2c9a16(%rip), %rax    # 0x36c6e0
movl (%rax), %ecx
leaq 0x2c99d5(%rip), %rax    # 0x36c6a8
movl %ecx, (%rax)
leaq 0x2c9a08(%rip), %rax    # 0x36c6e4
movl (%rax), %ecx
leaq 0x2c99c7(%rip), %rax    # 0x36c6ac
movl %ecx, (%rax)
leaq 0x2c99fa(%rip), %rax    # 0x36c6e8
movl (%rax), %ecx
leaq 0x2c99b9(%rip), %rax    # 0x36c6b0
movl %ecx, (%rax)
leaq 0x2c99ec(%rip), %rax    # 0x36c6ec
movl (%rax), %ecx
leaq 0x2c99ab(%rip), %rax    # 0x36c6b4
movl %ecx, (%rax)
leaq 0x2c99de(%rip), %rax    # 0x36c6f0
movl (%rax), %ecx
leaq 0x2c999d(%rip), %rax    # 0x36c6b8
movl %ecx, (%rax)
leaq 0x2c99d0(%rip), %rax    # 0x36c6f4
movl (%rax), %ecx
leaq 0x2c998f(%rip), %rax    # 0x36c6bc
movl %ecx, (%rax)
leaq 0x2c99c2(%rip), %rax    # 0x36c6f8
movsd (%rax), %xmm0
leaq 0x2c997f(%rip), %rax    # 0x36c6c0
movsd %xmm0, (%rax)
leaq 0x2c9bd8(%rip), %rax    # 0x36c924
movl (%rax), %ecx
leaq 0x2c9bc7(%rip), %rax    # 0x36c91c
movl %ecx, (%rax)
leaq 0x2c9bbe(%rip), %rax    # 0x36c91c
movl (%rax), %ecx
leaq 0x2c9bb9(%rip), %rax    # 0x36c920
movl %ecx, (%rax)
leaq 0x2c9bac(%rip), %rax    # 0x36c91c
movl (%rax), %eax
movl %eax, %ecx
leaq 0x2c9bb5(%rip), %rax    # 0x36c930
movq %rcx, (%rax)
leaq 0x2c9937(%rip), %rax    # 0x36c6bc
movl (%rax), %edi
leaq 0x2c992a(%rip), %rax    # 0x36c6b8
movl (%rax), %esi
leaq 0x2c991d(%rip), %rax    # 0x36c6b4
movl (%rax), %edx
callq 0x122140
movsd %xmm0, -0x10(%rbp)
leaq 0x2c9906(%rip), %rax    # 0x36c6b0
movl (%rax), %edi
leaq 0x2c98f9(%rip), %rax    # 0x36c6ac
movl (%rax), %esi
leaq 0x2c98ec(%rip), %rax    # 0x36c6a8
movl (%rax), %edx
leaq 0x2c98fb(%rip), %rax    # 0x36c6c0
movsd (%rax), %xmm0
callq 0x122210
movaps %xmm0, %xmm1
movsd -0x10(%rbp), %xmm0
addsd %xmm1, %xmm0
leaq 0x2c9937(%rip), %rax    # 0x36c718
movsd %xmm0, (%rax)
leaq 0x2c9924(%rip), %rax    # 0x36c710
movsd %xmm0, (%rax)
leaq 0x1d77dd(%rip), %rax    # 0x27a5d4
cmpl $0x0, (%rax)
jne 0xa2e1f
leaq 0x2c990d(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
leaq 0x1d77ca(%rip), %rax    # 0x27a5d8
movsd %xmm0, (%rax)
leaq 0x1d77bb(%rip), %rax    # 0x27a5d4
movl $0x1, (%rax)
leaq 0x2c98ea(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
leaq 0x2c9937(%rip), %rax    # 0x36c768
ucomisd (%rax), %xmm0
jne 0xa2e50
jp 0xa2e50
leaq 0x2c9924(%rip), %rax    # 0x36c764
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x2c9918(%rip), %rax    # 0x36c764
movl %ecx, (%rax)
jmp 0xa2e5d
leaq 0x2c990d(%rip), %rax    # 0x36c764
movl $0x0, (%rax)
leaq 0x2c98ac(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
leaq 0x2c98f9(%rip), %rax    # 0x36c768
movsd %xmm0, (%rax)
leaq 0x2c98f6(%rip), %rax    # 0x36c770
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xa2e9f
jp 0xa2e9f
leaq 0x2c9880(%rip), %rax    # 0x36c710
movsd (%rax), %xmm0
leaq 0x2c98d5(%rip), %rax    # 0x36c770
movsd %xmm0, (%rax)
callq 0x823f0
leaq 0x2f3355(%rip), %rax    # 0x396200
cmpb $0x0, (%rax)
je 0xa2eb5
callq 0x9c6d0
callq 0x7cc70
leaq 0x2c98a3(%rip), %rax    # 0x36c764
cmpl $0x5, (%rax)
jle 0xa2ec8
jmp 0xa2f1a
leaq 0x2c9761(%rip), %rax    # 0x36c630
cmpb $0x0, (%rax)
je 0xa2f18
leaq 0x2c9756(%rip), %rax    # 0x36c631
cmpb $0x0, (%rax)
je 0xa2f18
callq 0xb0d0
leaq 0x2c9746(%rip), %rax    # 0x36c632
movb $0x1, (%rax)
leaq 0x2c9582(%rip), %rax    # 0x36c478
cmpl $0x0, (%rax)
jne 0xa2f08
leaq 0x2c9576(%rip), %rax    # 0x36c478
movl $0x63, (%rax)
xorl %esi, %esi
leaq 0xe2643(%rip), %rdx     # 0x185554
movl %esi, %edi
callq 0x12810
jmp 0xa2f1a
jmp 0xa2f1c
callq 0xa2fd0
leaq 0x1d4b88(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa2f46
leaq 0x1d727f(%rip), %rax    # 0x27a1b4
cmpl $0x50, (%rax)
jne 0xa2f46
xorl %edi, %edi
callq 0xa3470
jmp 0xa2fca
leaq 0x1d4b63(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa2f6b
leaq 0x1d725a(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa2f6b
leaq 0x1d4b72(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0xa2fb5
leaq 0x1d4b3e(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa2f9c
leaq 0x1d7235(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa2f9c
leaq 0x1d4b4d(%rip), %rax    # 0x277ad8
cmpl $0x33, (%rax)
je 0xa2fb5
leaq 0x1d4b41(%rip), %rax    # 0x277ad8
cmpl $0x47, (%rax)
je 0xa2fb5
leaq 0x1d4b0d(%rip), %rax    # 0x277ab0
cmpq $0x1, (%rax)
jne 0xa2fc8
leaq 0x1d7204(%rip), %rax    # 0x27a1b4
cmpl $0x41, (%rax)
jne 0xa2fc8
leaq 0x2c94c4(%rip), %rax    # 0x36c480
cmpl $0x0, (%rax)
jne 0xa2fc8
xorl %edi, %edi
callq 0xa3470
jmp 0xa2fca
addq $0x20, %rsp
popq %rbp
retq