// File: /workspace/github_cpp_makefile_star2_O3/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 0x9d3d8(%rip), %rdi     # 0x123162
callq 0x58dc2
leaq 0x2b24be(%rip), %rax    # 0x338254
movw $0xa, (%rax)
callq 0x58964
movl %eax, %eax
cvtsi2sd %rax, %xmm0
divsd 0x83289(%rip), %xmm0    # 0x109038
leaq 0x287782(%rip), %rbx    # 0x30d538
movsd (%rbx), %xmm2
addsd 0x85ace(%rip), %xmm2    # 0x10b890
movsd 0x85b3e(%rip), %xmm1    # 0x10b908
divsd %xmm1, %xmm2
leaq 0x2877a3(%rip), %rax    # 0x30d578
cvttpd2dq %xmm2, %xmm2
cvtdq2pd %xmm2, %xmm2
movsd %xmm0, (%rax)
mulsd %xmm1, %xmm2
addsd 0x85aab(%rip), %xmm2    # 0x10b898
movapd %xmm2, -0x30(%rbp)
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
movsd %xmm0, -0x38(%rbp)
callq 0xd492e
addsd -0x30(%rbp), %xmm0
leaq 0x287762(%rip), %r14    # 0x30d570
movsd %xmm0, (%r14)
movsd (%rbx), %xmm0
subsd 0x2e5f91(%rip), %xmm0   # 0x36bdb0
mulsd 0x831f1(%rip), %xmm0    # 0x109018
cvttsd2si %xmm0, %ecx
leal -0x12(%rcx), %eax
cmpl $0xe, %eax
ja 0x85e97
leaq 0x2874e2(%rip), %rax    # 0x30d31c
cmpl $0x0, (%rax)
jne 0x85e97
leaq 0x2878ee(%rip), %rdx    # 0x30d734
cmpl $0x0, (%rdx)
je 0x85e56
leaq 0x2878d6(%rip), %rcx    # 0x30d728
movl (%rcx), %ecx
jmp 0x85e5f
leaq 0x2878cb(%rip), %rdx    # 0x30d728
movl %ecx, (%rdx)
leaq 0x2876ae(%rip), %rdx    # 0x30d514
cmpl $0x7e1, (%rdx)          # imm = 0x7E1
setge %dl
cmpl $0x12, %ecx
setl %sil
andb %dl, %sil
cmpl $0x11, %ecx
setl %cl
orb %sil, %cl
jne 0x85e97
leaq 0x1929b9(%rip), %rcx    # 0x218844
movl $0x840, (%rcx)          # imm = 0x840
movl $0x70, (%rax)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85ead
leaq 0x1b90c6(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
leaq 0x2b7dbd(%rip), %rbx    # 0x33dc71
movb %al, (%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85ecc
leaq 0x1b90a7(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x1(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85ee5
leaq 0x1b908e(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x2(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x85efe
leaq 0x1b9075(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movb %al, 0x3(%rbx)
movb $0x0, 0x4(%rbx)
leaq 0x1b8634(%rip), %rdi    # 0x23e540
movq %rbx, %rsi
callq 0x9340
leaq 0x1b8535(%rip), %rdi    # 0x23e450
leaq 0x84ec6(%rip), %rsi     # 0x10ade8
callq 0x9090
testq %rax, %rax
je 0x85f3f
leaq 0x1b851d(%rip), %rdi    # 0x23e450
leaq 0x2b7d37(%rip), %rsi    # 0x33dc71
callq 0x9340
callq 0x58b08
movsd %xmm0, -0x30(%rbp)
callq 0x58b08
movsd %xmm0, -0x18(%rbp)
callq 0x58b08
movapd %xmm0, %xmm2
movsd -0x30(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movsd %xmm2, -0x40(%rbp)
callq 0x5c9bb
leaq 0x1b8419(%rip), %rax    # 0x23e390
movq (%rax), %rdi
testq %rdi, %rdi
je 0x85fe5
leaq 0x19293e(%rip), %rax    # 0x2188c4
cmpb $0x0, (%rax)
je 0x85fe5
movsd (%r14), %xmm1
movsd 0x85898(%rip), %xmm6    # 0x10b830
movsd 0x2e6af8(%rip), %xmm5   # 0x36ca98
mulsd %xmm6, %xmm5
movsd 0x8587c(%rip), %xmm0    # 0x10b828
divsd %xmm0, %xmm5
mulsd 0x2e6ae8(%rip), %xmm6   # 0x36caa0
divsd %xmm0, %xmm6
movsd 0x2e6ae4(%rip), %xmm7   # 0x36caa8
leaq 0x9d19f(%rip), %rsi     # 0x12316a
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 0x85ff6
jnp 0x86049
movsd -0x18(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x86003
jnp 0x86049
movsd -0x40(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x86010
jnp 0x86049
movsd 0x2e6a80(%rip), %xmm0   # 0x36ca98
leaq 0x286fb1(%rip), %rax    # 0x30cfd0
movsd %xmm0, (%rax)
movsd 0x2e6a75(%rip), %xmm0   # 0x36caa0
leaq 0x286fa6(%rip), %rax    # 0x30cfd8
movsd %xmm0, (%rax)
movsd 0x2e6a6a(%rip), %xmm0   # 0x36caa8
leaq 0x286f9b(%rip), %rax    # 0x30cfe0
movsd %xmm0, (%rax)
callq 0x58a30
callq 0x58a30
callq 0x58a30
callq 0x58a30
callq 0x58a30
callq 0x588d2
movzwl %ax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x82fe7(%rip), %xmm0    # 0x109060
leaq 0x19d464(%rip), %rax    # 0x2234e4
orb $0x1, (%rax)
leaq 0x19d45e(%rip), %rax    # 0x2234e8
movsd %xmm0, (%rax)
movl $0x0, 0x2ebd94(%rip)    # 0x371e2c
movl $0x1, %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x6e25f