// File: /workspace/github_cpp_makefile_star2_O3/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 0x587be
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x7354d
leaq 0x1cba26(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
leal -0x21(%rbx), %eax
cmpb $-0x20, %al
jb 0x7383d
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movzbl %bl, %eax
imulq $0x348, %rax, %r14      # imm = 0x348
leaq 0x1cba3e(%rip), %r15    # 0x23efb0
leaq (%r15,%r14), %rbx
movsd %xmm0, 0x248(%r15,%r14)
callq 0x588d2
movzwl %ax, %eax
movl %eax, 0x250(%r15,%r14)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x735a6
leaq 0x1cb9cd(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x254(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x735c5
leaq 0x1cb9ae(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x258(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x735e4
leaq 0x1cb98f(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x25c(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x73603
leaq 0x1cb970(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x260(%rbx)
callq 0x588d2
movzwl %ax, %eax
movl %eax, 0x264(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x268(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x270(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x278(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x280(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x288(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x290(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x73696
leaq 0x1cb8dd(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x298(%rbx)
callq 0x587be
cmpl $0x100, %eax            # imm = 0x100
jb 0x736b5
leaq 0x1cb8be(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x29c(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2a0(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2a8(%rbx)
callq 0x58b08
movsd %xmm0, 0x2b0(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2b8(%rbx)
callq 0x58b08
movsd %xmm0, 0x2c0(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2c8(%rbx)
callq 0x58b08
movsd %xmm0, 0x2d0(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2d8(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2e0(%rbx)
callq 0x58b08
movsd %xmm0, 0x2e8(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2f0(%rbx)
callq 0x58b08
movsd %xmm0, 0x2f8(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x300(%rbx)
callq 0x58b08
movsd %xmm0, 0x308(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x310(%rbx)
callq 0x58a30
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x318(%rbx)
callq 0x58b08
movsd %xmm0, 0x320(%rbx)
callq 0x58b08
movsd %xmm0, 0x328(%rbx)
callq 0x58b08
movsd %xmm0, 0x330(%rbx)
callq 0x58b08
movsd %xmm0, 0x338(%rbx)
callq 0x58b08
movsd %xmm0, 0x340(%rbx)
leaq 0x1cb772(%rip), %rax    # 0x23ef70
xorl %ecx, %ecx
cmpl $0x0, (%rax)
sete %cl
movl %ecx, 0x244(%rbx)
xorps %xmm0, %xmm0
ucomisd 0x248(%rbx), %xmm0
jbe 0x73823
movl $0x0, 0x244(%rbx)
movsd 0x2d0(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jne 0x7383d
jp 0x7383d
movl $0x0, 0x244(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq