// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathgps.cpp
// Function: parse_tsip_ephem(int, int)
void parse_tsip_ephem(int prn, int len)
{
   // decode the satellite ephemeris message
   prn = tsip_byte();

   if(prn < 1) return;
   if(prn > 32) return;

   sat[prn].t_ephem = (double) tsip_single();
//sprintf(debug_text, "prn:%d  len:%d  flag:%02X  t_ephm:%.9f  polled:%08lX", prn,len, sat[prn].eph_flag, sat[prn].t_ephem, eph_polled);
//if(debug_file) fprintf(debug_file, "prn:%d  len:%d  flag:%02X  t_ephm:%.9f\n", prn,len, sat[prn].eph_flag, sat[prn].t_ephem);

   sat[prn].eph_week = tsip_word();   // !!!!! we need to fix for rollover !!!!!
   sat[prn].codeL2 = tsip_byte();   
   sat[prn].L2Pdata = tsip_byte();  
   sat[prn].sv_accu_raw = tsip_byte();
   sat[prn].sv_health = tsip_byte();
   sat[prn].iodc = tsip_word(); 
   sat[prn].tGD = (double) tsip_single();
check_eph_val(1, prn);
   sat[prn].toc = (double) tsip_single();
check_eph_val(2, prn);
   sat[prn].af2 = (double) tsip_single();
check_eph_val(3, prn);
   sat[prn].af1 = (double) tsip_single();
check_eph_val(4, prn);
   sat[prn].af0 = (double) tsip_single();
check_eph_val(5, prn);
   sat[prn].eph_sv_accu = (double) tsip_single();
check_eph_val(6, prn);
   sat[prn].eph_iode = tsip_byte();
check_eph_val(7, prn);
   sat[prn].fit_interval = tsip_byte();
check_eph_val(8, prn);
   sat[prn].Crs = (double) tsip_single();
check_eph_val(9, prn);
   sat[prn].delta_n = (double) tsip_single();
check_eph_val(10, prn);
   sat[prn].M0 = tsip_double();
check_eph_val(11, prn);
   sat[prn].Cuc = (double) tsip_single();
check_eph_val(12, prn);
   sat[prn].e = tsip_double();
check_eph_val(13, prn);
   sat[prn].Cus = (double) tsip_single();
check_eph_val(14, prn);
   sat[prn].sqrtA = tsip_double();
check_eph_val(15, prn);
   sat[prn].eph_toe = (double) tsip_single();
check_eph_val(16, prn);
   sat[prn].Cic = (double) tsip_single();
check_eph_val(17, prn);
   sat[prn].omega_0 = tsip_double();
check_eph_val(18, prn);
   sat[prn].Cis = (double) tsip_single();
check_eph_val(19, prn);
   sat[prn].io = tsip_double(); 
check_eph_val(20, prn);
   sat[prn].Crc = (double) tsip_single();
check_eph_val(21, prn);
   sat[prn].omega = tsip_double();
check_eph_val(22, prn);
   sat[prn].omega_dot = (double) tsip_single();
check_eph_val(23, prn);
   sat[prn].i_dot = (double) tsip_single();
check_eph_val(24, prn);
   sat[prn].axis = tsip_double(); // sqrt(A)2
check_eph_val(25, prn);
   sat[prn].n = tsip_double();
check_eph_val(26, prn);
   sat[prn].r1me2 = tsip_double();
check_eph_val(27, prn);
   sat[prn].omega_n = tsip_double();
check_eph_val(28, prn);
   sat[prn].odot_n = tsip_double();
check_eph_val(29, prn);

   sat[prn].eph_valid = 1;
   if(tsip_error) sat[prn].eph_valid = 0;
   if(sat[prn].t_ephem < 0.0) sat[prn].eph_valid = 0;
   if(sat[prn].sqrtA == 0.0)  sat[prn].eph_valid = 0;  // missing ephem will have 0.0 sqrtA
if(0 && log_file) fprintf(log_file, "#t_ephem: %f\n", sat[prn].t_ephem);

//sprintf(debug_text2, "omega_0: %.9f", sat[prn].omega_0); 
//if(debug_file) fprintf(debug_file, "omega_0:%.9f\n", sat[prn].omega_0); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
callq 0x51c47
movl %eax, %ebx
leal -0x21(%rbx), %eax
cmpb $-0x20, %al
jb 0x69b9c
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movzbl %bl, %eax
imulq $0x348, %rax, %r14      # imm = 0x348
leaq 0x1bf6bb(%rip), %r15    # 0x228fb0
leaq (%r15,%r14), %rbx
movsd %xmm0, 0x248(%r15,%r14)
callq 0x51c63
movzwl %ax, %eax
movl %eax, 0x250(%r15,%r14)
callq 0x51c47
movzbl %al, %eax
movl %eax, 0x254(%r15,%r14)
callq 0x51c47
movzbl %al, %eax
movl %eax, 0x258(%r15,%r14)
callq 0x51c47
movzbl %al, %eax
movl %eax, 0x25c(%r15,%r14)
callq 0x51c47
movzbl %al, %eax
movl %eax, 0x260(%r15,%r14)
callq 0x51c63
movzwl %ax, %eax
movl %eax, 0x264(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x268(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x270(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x278(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x280(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x288(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x290(%r15,%r14)
callq 0x51c47
movzbl %al, %eax
movl %eax, 0x298(%r15,%r14)
callq 0x51c47
movzbl %al, %eax
movl %eax, 0x29c(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2a0(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2a8(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x2b0(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2b8(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x2c0(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2c8(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x2d0(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2d8(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2e0(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x2e8(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2f0(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x2f8(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x300(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x308(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x310(%r15,%r14)
callq 0x51dc3
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x318(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x320(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x328(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x330(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x338(%r15,%r14)
callq 0x51e6f
movsd %xmm0, 0x340(%r15,%r14)
leaq 0x1bf411(%rip), %rax    # 0x228f70
xorl %ecx, %ecx
cmpl $0x0, (%rax)
sete %cl
movl %ecx, 0x244(%r15,%r14)
xorps %xmm0, %xmm0
ucomisd 0x248(%r15,%r14), %xmm0
jbe 0x69b85
andl $0x0, 0x244(%rbx)
movsd 0x2d0(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jne 0x69b9c
jp 0x69b9c
andl $0x0, 0x244(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq