// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::ionppp(double const*, double const*, double, double, double*)
extern double ionppp(const double *pos, const double *azel, double re,
                     double hion, double *posp)
{
    double cosaz,rp,ap,sinap,tanap;
    
    rp=re/(re+hion)*cos(azel[1]);
    ap=pi/2.0-azel[1]-asin(rp);
    sinap=sin(ap);
    tanap=tan(ap);
    cosaz=cos(azel[0]);
    posp[0]=asin(sin(pos[0])*cos(ap)+cos(pos[0])*sinap*cosaz);
    
    if ((pos[0]> 70.0*D2R&& tanap*cosaz>tan(pi/2.0-pos[0]))||
        (pos[0]<-70.0*D2R&&-tanap*cosaz>tan(pi/2.0+pos[0]))) {
        posp[1]=pos[1]+pi-asin(sinap*sin(azel[0])/cos(posp[0]));
    }
    else {
        posp[1]=pos[1]+asin(sinap*sin(azel[0])/cos(posp[0]));
    }
    return 1.0/sqrt(1.0-rp*rp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
addsd %xmm0, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x8(%rsi), %xmm0
callq 0x8bf0
mulsd -0x30(%rbp), %xmm0
movsd 0x15fda(%rip), %xmm1    # 0x6a930
subsd 0x8(%r14), %xmm1
movsd %xmm1, -0x30(%rbp)
movsd %xmm0, -0x48(%rbp)
callq 0x8a80
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movapd %xmm1, %xmm0
callq 0x8150
movsd %xmm0, -0x38(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x83a0
movaps %xmm0, -0x60(%rbp)
movsd (%r14), %xmm0
callq 0x8bf0
movsd %xmm0, -0x20(%rbp)
movsd (%r15), %xmm0
callq 0x8150
movsd %xmm0, -0x40(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x8bf0
movsd %xmm0, -0x30(%rbp)
movsd (%r15), %xmm0
callq 0x8bf0
mulsd -0x38(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
mulsd -0x40(%rbp), %xmm1
addsd %xmm1, %xmm0
callq 0x8a80
movsd %xmm0, (%rbx)
movsd (%r15), %xmm0
ucomisd 0x20346(%rip), %xmm0    # 0x74d40
jbe 0x54a30
movapd -0x60(%rbp), %xmm1
mulsd -0x20(%rbp), %xmm1
movapd %xmm1, -0x30(%rbp)
movsd 0x15f1d(%rip), %xmm1    # 0x6a930
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x83a0
movapd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x54a75
movsd (%r15), %xmm0
movsd 0x20310(%rip), %xmm1    # 0x74d48
ucomisd %xmm0, %xmm1
jbe 0x54ac6
movapd -0x60(%rbp), %xmm1
xorpd 0x16081(%rip), %xmm1    # 0x6aad0
movsd -0x20(%rbp), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, -0x20(%rbp)
addsd 0x15ecb(%rip), %xmm0    # 0x6a930
callq 0x83a0
movsd -0x20(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x54ac6
movsd 0x8(%r15), %xmm0
addsd 0x15e8d(%rip), %xmm0    # 0x6a910
movsd %xmm0, -0x30(%rbp)
movsd (%r14), %xmm0
callq 0x8150
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd (%rbx), %xmm0
callq 0x8bf0
movsd -0x20(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x8a80
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x54b05
movsd 0x8(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd (%r14), %xmm0
callq 0x8150
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd (%rbx), %xmm0
callq 0x8bf0
movsd -0x20(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x8a80
addsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x8(%rbx)
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
movsd 0x14e05(%rip), %xmm2    # 0x69920
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x54b33
sqrtsd %xmm0, %xmm0
jmp 0x54b40
callq 0x84e0
movsd 0x14de0(%rip), %xmm2    # 0x69920
divsd %xmm0, %xmm2
movapd %xmm2, %xmm0
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq