// File: /workspace/github_cpp_makefile_star2_O1/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 0x587d1
movl %eax, %ebx
cmpl $0x100, %eax            # imm = 0x100
jb 0x7370c
leaq 0x1cb867(%rip), %rax    # 0x23ef70
orb $0x8, (%rax)
leal -0x21(%rbx), %eax
cmpb $-0x20, %al
jb 0x73a06
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movzbl %bl, %eax
imulq $0x348, %rax, %r14      # imm = 0x348
leaq 0x1cb87f(%rip), %r15    # 0x23efb0
leaq (%r15,%r14), %rbx
movsd %xmm0, 0x248(%r15,%r14)
callq 0x588f0
movzwl %ax, %eax
movl %eax, 0x250(%r15,%r14)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x73765
leaq 0x1cb80e(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x254(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x73784
leaq 0x1cb7ef(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x258(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x737a3
leaq 0x1cb7d0(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x25c(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x737c2
leaq 0x1cb7b1(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x260(%rbx)
callq 0x588f0
movzwl %ax, %eax
movl %eax, 0x264(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x268(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x270(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x278(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x280(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x288(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x290(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x73855
leaq 0x1cb71e(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x298(%rbx)
callq 0x587d1
cmpl $0x100, %eax            # imm = 0x100
jb 0x73874
leaq 0x1cb6ff(%rip), %rcx    # 0x23ef70
orb $0x8, (%rcx)
movzbl %al, %eax
movl %eax, 0x29c(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2a0(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2a8(%rbx)
callq 0x58b86
movsd %xmm0, 0x2b0(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2b8(%rbx)
callq 0x58b86
movsd %xmm0, 0x2c0(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2c8(%rbx)
callq 0x58b86
movsd %xmm0, 0x2d0(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2d8(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2e0(%rbx)
callq 0x58b86
movsd %xmm0, 0x2e8(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x2f0(%rbx)
callq 0x58b86
movsd %xmm0, 0x2f8(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x300(%rbx)
callq 0x58b86
movsd %xmm0, 0x308(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x310(%rbx)
callq 0x58aae
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x318(%rbx)
callq 0x58b86
movsd %xmm0, 0x320(%rbx)
callq 0x58b86
movsd %xmm0, 0x328(%rbx)
callq 0x58b86
movsd %xmm0, 0x330(%rbx)
callq 0x58b86
movsd %xmm0, 0x338(%rbx)
callq 0x58b86
movsd %xmm0, 0x340(%rbx)
movl $0x1, 0x244(%rbx)
leaq 0x1cb5a9(%rip), %rax    # 0x23ef70
xorl %ecx, %ecx
cmpl $0x0, (%rax)
sete %cl
movl %ecx, 0x244(%rbx)
xorps %xmm0, %xmm0
ucomisd 0x248(%rbx), %xmm0
jbe 0x739ec
movl $0x0, 0x244(%rbx)
movsd 0x2d0(%rbx), %xmm1
ucomisd %xmm0, %xmm1
jne 0x73a06
jp 0x73a06
movl $0x0, 0x244(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq