// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::tropmapf(bamboo::gtime_t, double const*, double const*, double*)
extern double tropmapf(gtime_t time, const double pos[], const double azel[],
                       double *mapfw)
{
#ifdef IERS_MODEL
    const double ep[]={2000,1,1,12,0,0};
    double mjd,lat,lon,hgt,zd,gmfh,gmfw;
#endif
    trace(4,"tropmapf: pos=%10.6f %11.6f %6.1f azel=%5.1f %4.1f\n",
          pos[0]*R2D,pos[1]*R2D,pos[2],azel[0]*R2D,azel[1]*R2D);
    
    if (pos[2]<-1000.0||pos[2]>20000.0) {
        if (mapfw) *mapfw=0.0;
        return 0.0;
    }
#ifdef IERS_MODEL
    mjd=51544.5+(timediff(time,epoch2time(ep)))/86400.0;
    lat=pos[0];
    lon=pos[1];
    hgt=pos[2]-geoidh(pos); /* height in m (mean sea level) */
    zd =pi/2.0-azel[1];
    
    /* call GMF */
    gmf_(&mjd,&lat,&lon,&hgt,&zd,&gmfh,&gmfw);
    
    if (mapfw) *mapfw=gmfw;
    return gmfh;
#else
    return nmf(time,pos,azel,mapfw); /* NMF */
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rcx, %rbx
movapd %xmm0, %xmm1
movsd 0x10(%rsi), %xmm2
movsd 0x1e92e(%rip), %xmm0    # 0x6acc8
ucomisd %xmm2, %xmm0
ja 0x4c49c
ucomisd 0x1ea2c(%rip), %xmm2    # 0x6add8
ja 0x4c49c
movsd 0x8(%rdx), %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm3, %xmm0
jae 0x4c4a0
movsd %xmm3, -0x20(%rbp)
movsd %xmm2, -0x38(%rbp)
movsd (%rsi), %xmm0
mulsd 0x18315(%rip), %xmm0    # 0x646f0
movapd %xmm0, -0x30(%rbp)
movapd %xmm1, %xmm0
callq 0x47b2f
addsd 0x1e9ef(%rip), %xmm0    # 0x6ade0
divsd 0x1e9ef(%rip), %xmm0    # 0x6ade8
xorpd %xmm1, %xmm1
movapd -0x30(%rbp), %xmm2
cmpltsd %xmm1, %xmm2
movsd 0x15869(%rip), %xmm1    # 0x61c78
andpd %xmm2, %xmm1
addsd %xmm1, %xmm0
mulsd 0x144e9(%rip), %xmm0    # 0x60908
callq 0x8bf0
movsd %xmm0, -0x40(%rbp)
movaps -0x30(%rbp), %xmm0
andps 0x134fc(%rip), %xmm0    # 0x5f930
movaps %xmm0, -0x30(%rbp)
leaq 0x1e551(%rip), %r14     # 0x6a990
xorl %r15d, %r15d
cmpq $0x3, %r15
je 0x4c4b2
movq %r14, %rdi
movaps -0x30(%rbp), %xmm0
callq 0x4d361
movsd %xmm0, -0x48(%rbp)
leaq 0x78(%r14), %rdi
movapd -0x30(%rbp), %xmm0
callq 0x4d361
mulsd -0x40(%rbp), %xmm0
movsd -0x48(%rbp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, -0x80(%rbp,%r15,8)
leaq 0xf0(%r14), %rdi
movaps -0x30(%rbp), %xmm0
callq 0x4d361
movsd %xmm0, -0x60(%rbp,%r15,8)
incq %r15
addq $0x28, %r14
jmp 0x4c442
xorpd %xmm0, %xmm0
testq %rbx, %rbx
je 0x4c572
andq $0x0, (%rbx)
jmp 0x4c572
movsd -0x20(%rbp), %xmm0
callq 0x8160
movsd 0x1345c(%rip), %xmm1    # 0x5f920
divsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x8160
movsd 0x1e911(%rip), %xmm1    # 0x6adf0
addsd %xmm0, %xmm1
movsd 0x1e90d(%rip), %xmm2    # 0x6adf8
divsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd 0x1e905(%rip), %xmm1    # 0x6ae00
divsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x1e8fd(%rip), %xmm0    # 0x6ae08
divsd %xmm1, %xmm0
addsd -0x30(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
divsd 0x14f43(%rip), %xmm1    # 0x61468
movsd %xmm1, -0x38(%rbp)
testq %rbx, %rbx
je 0x4c54c
movsd -0x60(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
movsd -0x50(%rbp), %xmm3
movsd -0x20(%rbp), %xmm0
callq 0x4d3b6
movsd %xmm0, (%rbx)
movsd -0x80(%rbp), %xmm1
movsd -0x78(%rbp), %xmm2
movsd -0x70(%rbp), %xmm3
movsd -0x20(%rbp), %xmm0
callq 0x4d3b6
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq