// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_z12_pbn()
void parse_z12_pbn()
{
double tow;
double jd;
double x,y,z;
float clk_ofs;
float drift;
int week;
int leaps;

   log_packet_id("z12_pbn");

   tsip_rptr = 10;

   tow = (double) tsip_dword() / 1000.0;

   jd = jd_gps - GPS_EPOCH;
   week = (int) (jd / 7.0);
   obs_tow = tow;
   jd_obs = GPS_EPOCH + ((double) week * 7.0) + jtime(0,0,0,tow);


   jd = (jd_gps - jd_zda);
   jd *= (24.0*60.0*60.0);
   leaps = (int) (jd);
   if((leaps >= 18) && (leaps <= 32) && (have_utc_ofs == 0)) {
      if(!user_set_utc_ofs) utc_offset = leaps;
      check_utc_ofs(112);
   }

   z12_site[0] = tsip_byte();  // site name
   z12_site[1] = tsip_byte();
   z12_site[2] = tsip_byte();
   z12_site[3] = tsip_byte();
   z12_site[4] = 0;
   strcpy(rinex_site, z12_site);
   if(1 && strstr(marker_name, DEFAULT_NAME)) {
      strcpy(marker_name, z12_site);
   }

   x = tsip_double();  // ecef coords
   y = tsip_double();
   z = tsip_double();
   ecef_to_lla(x,y,z);
if(debug_file && show_debug_info) {
fprintf(debug_file, "PBN: tow %f  jd_obs:%f  ecef:%f %f %f  lat:%f lon:%f  alt:%f\n", tow, jd_obs, x,y,x, elat*180.0/PI,elon*180.0/PI,ealt);
}

   if(x && y && z) {
      lat = elat;
      lon = elon;
      alt = ealt;
   }

   clk_ofs = tsip_single();

   tsip_single();  // ecef velocity
   tsip_single();
   tsip_single();

   drift = tsip_single();

   pdop = (DATA_SIZE) (((double) tsip_word()) / 100.0);
   have_dops |= PDOP;

in_mpc = 0;
poll_z12_time(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
leaq 0x9300a(%rip), %rdi     # 0x10d0aa
callq 0x520bf
leaq 0x2a81a8(%rip), %rax    # 0x322254
movw $0xa, (%rax)
callq 0x51cf3
movl %eax, %eax
cvtsi2sd %rax, %xmm0
divsd 0x78f73(%rip), %xmm0    # 0xf3038
leaq 0x27d46c(%rip), %rbx    # 0x2f7538
movsd (%rbx), %xmm2
addsd 0x7b830(%rip), %xmm2    # 0xf5908
movsd 0x7b8a0(%rip), %xmm1    # 0xf5980
divsd %xmm1, %xmm2
leaq 0x27d48d(%rip), %rax    # 0x2f7578
cvttpd2dq %xmm2, %xmm2
cvtdq2pd %xmm2, %xmm2
movsd %xmm0, (%rax)
mulsd %xmm1, %xmm2
addsd 0x7b80d(%rip), %xmm2    # 0xf5910
movapd %xmm2, -0x30(%rbp)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
movsd %xmm0, -0x38(%rbp)
callq 0xc2faf
addsd -0x30(%rbp), %xmm0
leaq 0x27d44c(%rip), %r14    # 0x2f7570
movsd %xmm0, (%r14)
movsd (%rbx), %xmm0
subsd 0x2dbc7b(%rip), %xmm0   # 0x355db0
mulsd 0x78edb(%rip), %xmm0    # 0xf3018
cvttsd2si %xmm0, %eax
leal -0x12(%rax), %ecx
cmpl $0xe, %ecx
ja 0x7a172
leaq 0x27d1cc(%rip), %rcx    # 0x2f731c
cmpl $0x0, (%rcx)
jne 0x7a172
leaq 0x27d5d8(%rip), %rcx    # 0x2f7734
cmpl $0x0, (%rcx)
jne 0x7a16a
leaq 0x27d5c0(%rip), %rcx    # 0x2f7728
movl %eax, (%rcx)
pushq $0x70
popq %rdi
callq 0x51a91
callq 0x51c47
leaq 0x2adaf3(%rip), %rbx    # 0x327c71
movb %al, (%rbx)
callq 0x51c47
movb %al, 0x1(%rbx)
callq 0x51c47
movb %al, 0x2(%rbx)
callq 0x51c47
movb %al, 0x3(%rbx)
movb $0x0, 0x4(%rbx)
leaq 0x1ae39d(%rip), %rdi    # 0x228540
movq %rbx, %rsi
callq 0x9330
leaq 0x1ae29e(%rip), %rdi    # 0x228450
leaq 0x7acaa(%rip), %rsi     # 0xf4e63
callq 0x9090
testq %rax, %rax
je 0x7a1d6
leaq 0x1ae286(%rip), %rdi    # 0x228450
leaq 0x2adaa0(%rip), %rsi    # 0x327c71
callq 0x9330
callq 0x51e6f
movsd %xmm0, -0x30(%rbp)
callq 0x51e6f
movsd %xmm0, -0x18(%rbp)
callq 0x51e6f
movapd %xmm0, %xmm2
movsd -0x30(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movsd %xmm2, -0x40(%rbp)
callq 0x5562d
leaq 0x1ae182(%rip), %rax    # 0x228390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x7a27c
leaq 0x1886a7(%rip), %rax    # 0x2028c4
cmpb $0x0, (%rax)
je 0x7a27c
movsd (%r14), %xmm1
movsd 0x7b679(%rip), %xmm6    # 0xf58a8
movsd 0x2dc861(%rip), %xmm5   # 0x356a98
mulsd %xmm6, %xmm5
movsd 0x7b65d(%rip), %xmm0    # 0xf58a0
divsd %xmm0, %xmm5
mulsd 0x2dc851(%rip), %xmm6   # 0x356aa0
divsd %xmm0, %xmm6
movsd 0x2dc84d(%rip), %xmm7   # 0x356aa8
leaq 0x92e50(%rip), %rsi     # 0x10d0b2
movsd -0x38(%rbp), %xmm0
movsd -0x30(%rbp), %xmm2
movsd -0x18(%rbp), %xmm3
movapd %xmm2, %xmm4
movb $0x8, %al
callq 0x9560
xorpd %xmm0, %xmm0
movsd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x7a28d
jnp 0x7a2e0
movsd -0x18(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x7a29a
jnp 0x7a2e0
movsd -0x40(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x7a2a7
jnp 0x7a2e0
movsd 0x2dc7e9(%rip), %xmm0   # 0x356a98
leaq 0x27cd1a(%rip), %rax    # 0x2f6fd0
movsd %xmm0, (%rax)
movsd 0x2dc7de(%rip), %xmm0   # 0x356aa0
leaq 0x27cd0f(%rip), %rax    # 0x2f6fd8
movsd %xmm0, (%rax)
movsd 0x2dc7d3(%rip), %xmm0   # 0x356aa8
leaq 0x27cd04(%rip), %rax    # 0x2f6fe0
movsd %xmm0, (%rax)
callq 0x51dc3
callq 0x51dc3
callq 0x51dc3
callq 0x51dc3
callq 0x51dc3
callq 0x51c63
movzwl %ax, %eax
cvtsi2sd %eax, %xmm0
divsd 0x78d53(%rip), %xmm0    # 0xf3060
leaq 0x1931d0(%rip), %rax    # 0x20d4e4
orb $0x1, (%rax)
andl $0x0, 0x2e1b0e(%rip)    # 0x35be2c
leaq 0x1931c3(%rip), %rax    # 0x20d4e8
movsd %xmm0, (%rax)
pushq $0x1
popq %rdi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x64e93