// File: /workspace/github_cpp_makefile_star2_O2/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 0x1495d(%rip), %xmm1    # 0x60920
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 0x8160
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 0x8160
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 0x1ecd9(%rip), %xmm0    # 0x6ad40
jbe 0x4c09d
movapd -0x60(%rbp), %xmm1
mulsd -0x20(%rbp), %xmm1
movapd %xmm1, -0x30(%rbp)
movsd 0x148a0(%rip), %xmm1    # 0x60920
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x83a0
movapd -0x30(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x4c0e2
movsd (%r15), %xmm0
movsd 0x1eca3(%rip), %xmm1    # 0x6ad48
ucomisd %xmm0, %xmm1
jbe 0x4c133
movapd -0x60(%rbp), %xmm1
xorpd 0x14a04(%rip), %xmm1    # 0x60ac0
movsd -0x20(%rbp), %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, -0x20(%rbp)
addsd 0x1484e(%rip), %xmm0    # 0x60920
callq 0x83a0
movsd -0x20(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4c133
movsd 0x8(%r15), %xmm0
addsd 0x14810(%rip), %xmm0    # 0x60900
movsd %xmm0, -0x30(%rbp)
movsd (%r14), %xmm0
callq 0x8160
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 0x4c172
movsd 0x8(%r15), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd (%r14), %xmm0
callq 0x8160
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 0x13798(%rip), %xmm2    # 0x5f920
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4c1a0
sqrtsd %xmm0, %xmm0
jmp 0x4c1ad
callq 0x84e0
movsd 0x13773(%rip), %xmm2    # 0x5f920
divsd %xmm0, %xmm2
movapd %xmm2, %xmm0
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq