// File: /workspace/github_cpp_makefile_star2_O1/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 0x8c00
mulsd -0x30(%rbp), %xmm0
movsd 0x15536(%rip), %xmm1    # 0x6a930
subsd 0x8(%r14), %xmm1
movsd %xmm1, -0x30(%rbp)
movsd %xmm0, -0x48(%rbp)
callq 0x8a90
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 0x8c00
movsd %xmm0, -0x20(%rbp)
movsd (%r15), %xmm0
callq 0x8150
movsd %xmm0, -0x40(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x8c00
movsd %xmm0, -0x30(%rbp)
movsd (%r15), %xmm0
callq 0x8c00
mulsd -0x38(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
mulsd -0x40(%rbp), %xmm1
addsd %xmm1, %xmm0
callq 0x8a90
movsd %xmm0, (%rbx)
movsd (%r15), %xmm1
ucomisd 0x1f8c2(%rip), %xmm1    # 0x74d60
jbe 0x554cb
movapd -0x60(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
movapd %xmm0, -0x30(%rbp)
movsd 0x15479(%rip), %xmm0    # 0x6a930
subsd %xmm1, %xmm0
callq 0x83a0
movapd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x55515
movsd (%r15), %xmm0
movsd 0x1f890(%rip), %xmm1    # 0x74d68
ucomisd %xmm0, %xmm1
jbe 0x55566
movapd -0x60(%rbp), %xmm1
xorpd 0x155e1(%rip), %xmm1    # 0x6aad0
movsd -0x20(%rbp), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, -0x20(%rbp)
addsd 0x1542b(%rip), %xmm0    # 0x6a930
callq 0x83a0
movsd -0x20(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x55566
movsd 0x8(%r15), %xmm0
addsd 0x153ed(%rip), %xmm0    # 0x6a910
movsd %xmm0, -0x30(%rbp)
movsd (%r14), %xmm0
callq 0x8150
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd (%rbx), %xmm0
callq 0x8c00
movsd -0x20(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x8a90
movsd -0x30(%rbp), %xmm1
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x555a5
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 0x8c00
movsd -0x20(%rbp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x8a90
addsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x8(%rbx)
movsd -0x48(%rbp), %xmm1
mulsd %xmm1, %xmm1
movsd 0x14365(%rip), %xmm2    # 0x69920
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x555d3
sqrtsd %xmm0, %xmm0
jmp 0x555e0
callq 0x84e0
movsd 0x14340(%rip), %xmm2    # 0x69920
divsd %xmm0, %xmm2
movapd %xmm2, %xmm0
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq