// File: /workspace/github_cpp_makefile_star2_O1/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 0x9d269(%rip), %rdi     # 0x123082
callq 0x58e77
leaq 0x2b242f(%rip), %rax    # 0x338254
movw $0xa, (%rax)
callq 0x589b0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
divsd 0x831fa(%rip), %xmm0    # 0x109038
leaq 0x2876f3(%rip), %rbx    # 0x30d538
movsd (%rbx), %xmm2
addsd 0x85a2f(%rip), %xmm2    # 0x10b880
movsd 0x85aa7(%rip), %xmm1    # 0x10b900
divsd %xmm1, %xmm2
leaq 0x287714(%rip), %rax    # 0x30d578
cvttpd2dq %xmm2, %xmm2
cvtdq2pd %xmm2, %xmm2
movsd %xmm0, (%rax)
mulsd %xmm1, %xmm2
addsd 0x85a0c(%rip), %xmm2    # 0x10b888
movapd %xmm2, -0x30(%rbp)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
movsd %xmm0, -0x38(%rbp)
callq 0xd41e0
addsd -0x30(%rbp), %xmm0
leaq 0x2876d3(%rip), %r14    # 0x30d570
movsd %xmm0, (%r14)
movsd (%rbx), %xmm0
subsd 0x2e5f02(%rip), %xmm0   # 0x36bdb0
mulsd 0x83162(%rip), %xmm0    # 0x109018
cvttsd2si %xmm0, %ecx
leal -0x12(%rcx), %eax
cmpl $0xe, %eax
ja 0x85f24
leaq 0x287453(%rip), %rax    # 0x30d31c
cmpl $0x0, (%rax)
jne 0x85f24
leaq 0x28785f(%rip), %rdx    # 0x30d734
cmpl $0x0, (%rdx)
jne 0x85ee3
leaq 0x287847(%rip), %rdx    # 0x30d728
movl %ecx, (%rdx)
leaq 0x28762a(%rip), %rcx    # 0x30d514
cmpl $0x7e1, (%rcx)          # imm = 0x7E1
setge %cl
leaq 0x28782e(%rip), %rdx    # 0x30d728
movl (%rdx), %edx
cmpl $0x12, %edx
setl %sil
andb %cl, %sil
cmpl $0x11, %edx
setl %cl
orb %sil, %cl
jne 0x85f24
leaq 0x19292c(%rip), %rcx    # 0x218844
movl $0x840, (%rcx)          # imm = 0x840
movl $0x70, (%rax)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85f3a
leaq 0x1b9039(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x2b7d30(%rip), %rbx    # 0x33dc71
movb %al, (%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85f59
leaq 0x1b901a(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x1(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85f72
leaq 0x1b9001(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x2(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x85f8b
leaq 0x1b8fe8(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x3(%rbx)
movb $0x0, 0x4(%rbx)
leaq 0x1b85a7(%rip), %rdi    # 0x23e540
movq %rbx, %rsi
callq 0x9340
leaq 0x1b84a8(%rip), %rdi    # 0x23e450
leaq 0x84e29(%rip), %rsi     # 0x10add8
callq 0x9090
testq %rax, %rax
je 0x85fcc
leaq 0x1b8490(%rip), %rdi    # 0x23e450
leaq 0x2b7caa(%rip), %rsi    # 0x33dc71
callq 0x9340
callq 0x58b86
movsd %xmm0, -0x30(%rbp)
callq 0x58b86
movsd %xmm0, -0x18(%rbp)
callq 0x58b86
movapd %xmm0, %xmm2
movsd -0x30(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movsd %xmm2, -0x40(%rbp)
callq 0x5cad5
leaq 0x1b838c(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x86072
leaq 0x1928b1(%rip), %rax    # 0x2188c4
cmpb $0x0, (%rax)
je 0x86072
movsd (%r14), %xmm1
movsd 0x857fb(%rip), %xmm6    # 0x10b820
movsd 0x2e6a6b(%rip), %xmm5   # 0x36ca98
mulsd %xmm6, %xmm5
movsd 0x857df(%rip), %xmm0    # 0x10b818
divsd %xmm0, %xmm5
mulsd 0x2e6a5b(%rip), %xmm6   # 0x36caa0
divsd %xmm0, %xmm6
movsd 0x2e6a57(%rip), %xmm7   # 0x36caa8
leaq 0x9d032(%rip), %rsi     # 0x12308a
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 0x86083
jnp 0x860d6
movsd -0x18(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x86090
jnp 0x860d6
movsd -0x40(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x8609d
jnp 0x860d6
movsd 0x2e69f3(%rip), %xmm0   # 0x36ca98
leaq 0x286f24(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
movsd 0x2e69e8(%rip), %xmm0   # 0x36caa0
leaq 0x286f19(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
movsd 0x2e69dd(%rip), %xmm0   # 0x36caa8
leaq 0x286f0e(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x58aae
callq 0x58aae
callq 0x58aae
callq 0x58aae
callq 0x58aae
callq 0x588f0
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x82f5a(%rip), %xmm0    # 0x109060
leaq 0x19d3d7(%rip), %rax    # 0x2234e4
orb $0x1, (%rax)
leaq 0x19d3d1(%rip), %rax    # 0x2234e8
movsd %xmm0, (%rax)
movl $0x0, 0x2ebd07(%rip)    # 0x371e2c
movl $0x1, %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x6e34a