// File: /workspace/github_cpp_makefile_star2_O3/istellartech[P]OpenTsiolkovsky/src/coordinate_transform.cpp
// Function: distance_surface(Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, 3, 1, 0, 3, 1>)
double distance_surface(Vector3d pos0_LLH_, Vector3d pos1_LLH_){
    double const earth_radius = 6378137; // 地球半径 m
    Vector3d pos0_ECEF_ = posECEF(pos0_LLH_);
    Vector3d pos1_ECEF_ = posECEF(pos1_LLH_);
    double theta = acos(pos0_ECEF_.dot(pos1_ECEF_) /
                        pos0_ECEF_.norm() / pos1_ECEF_.norm()); // radius
    return earth_radius * theta;
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rsi, %rbx
movsd (%rdi), %xmm3
movsd 0x8(%rdi), %xmm2
movsd 0x10(%rdi), %xmm0
movaps %xmm0, 0xc0(%rsp)
movsd 0x1b20(%rip), %xmm0     # 0x25d10
divsd %xmm0, %xmm3
movsd 0x1b1c(%rip), %xmm1     # 0x25d18
mulsd %xmm1, %xmm3
movsd %xmm3, 0x8(%rsp)
divsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, 0x10(%rsp)
movapd %xmm3, %xmm0
callq 0x50f0
movsd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x50f0
movsd 0x20(%rsp), %xmm1
mulsd 0x41a4(%rip), %xmm1     # 0x283e0
mulsd %xmm0, %xmm1
addsd 0xe28(%rip), %xmm1      # 0x25070
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
movapd %xmm1, %xmm0
jb 0x2425c
sqrtsd %xmm0, %xmm0
jmp 0x24261
callq 0x52e0
movapd %xmm0, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x5690
movaps %xmm0, 0x90(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x5690
movaps %xmm0, 0xb0(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x5690
movaps %xmm0, 0x80(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x50f0
movaps %xmm0, 0x70(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x50f0
movaps %xmm0, 0xa0(%rsp)
movsd (%rbx), %xmm3
movsd 0x8(%rbx), %xmm2
movsd 0x10(%rbx), %xmm0
movaps %xmm0, 0x60(%rsp)
movsd 0x1a32(%rip), %xmm0     # 0x25d10
divsd %xmm0, %xmm3
movsd 0x1a2e(%rip), %xmm1     # 0x25d18
mulsd %xmm1, %xmm3
movsd %xmm3, 0x8(%rsp)
divsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd %xmm2, 0x10(%rsp)
movapd %xmm3, %xmm0
callq 0x50f0
movsd %xmm0, 0x30(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x50f0
movsd 0x30(%rsp), %xmm1
mulsd 0x40b6(%rip), %xmm1     # 0x283e0
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm0
addsd 0xd36(%rip), %xmm0      # 0x25070
ucomisd 0x19f6(%rip), %xmm0     # 0x25d38
jb 0x2434a
sqrtsd %xmm0, %xmm0
jmp 0x2434f
callq 0x52e0
movapd 0x20(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movapd %xmm1, 0x20(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x5690
movaps %xmm0, 0x50(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x5690
movaps %xmm0, 0x30(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x5690
movaps %xmm0, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x50f0
movaps %xmm0, 0x10(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x50f0
movapd 0x404e(%rip), %xmm2     # 0x28400
divpd 0x20(%rsp), %xmm2
movapd 0xc0(%rsp), %xmm4
movapd %xmm4, %xmm3
addsd %xmm2, %xmm3
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
movapd 0x60(%rsp), %xmm5
addsd %xmm5, %xmm1
mulpd 0x402d(%rip), %xmm2     # 0x28410
unpcklpd %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0]
addpd %xmm4, %xmm2
movapd 0xa0(%rsp), %xmm5
unpcklpd %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0]
mulpd %xmm2, %xmm5
movapd 0x90(%rsp), %xmm0
unpcklpd 0x80(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm0, %xmm3
movapd 0xb0(%rsp), %xmm4
unpcklpd 0x70(%rsp), %xmm4       # xmm4 = xmm4[0],mem[0]
mulpd %xmm3, %xmm4
movapd 0x50(%rsp), %xmm0
unpcklpd 0x40(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
movapd 0x30(%rsp), %xmm6
unpcklpd 0x10(%rsp), %xmm6       # xmm6 = xmm6[0],mem[0]
mulpd %xmm1, %xmm6
movapd %xmm4, %xmm1
mulpd %xmm6, %xmm1
movapd %xmm5, %xmm2
unpckhpd %xmm5, %xmm2            # xmm2 = xmm2[1],xmm5[1]
movapd %xmm5, %xmm3
mulsd %xmm2, %xmm3
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm3, %xmm0
addsd %xmm1, %xmm0
mulpd %xmm4, %xmm4
movapd %xmm4, %xmm1
unpckhpd %xmm4, %xmm1            # xmm1 = xmm1[1],xmm4[1]
mulsd %xmm5, %xmm5
addsd %xmm1, %xmm5
addsd %xmm4, %xmm5
xorps %xmm1, %xmm1
sqrtsd %xmm5, %xmm1
divsd %xmm1, %xmm0
mulpd %xmm6, %xmm6
mulsd %xmm2, %xmm2
movapd %xmm6, %xmm1
unpckhpd %xmm6, %xmm1            # xmm1 = xmm1[1],xmm6[1]
addsd %xmm2, %xmm1
addsd %xmm6, %xmm1
sqrtsd %xmm1, %xmm1
divsd %xmm1, %xmm0
callq 0x5360
mulsd 0x3d43(%rip), %xmm0     # 0x28208
addq $0xd0, %rsp
popq %rbx
retq