// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]eph_converter/src/Com.cpp
// Function: xyzblh(double*, double, double, double, double, double, double, double*)
void xyzblh(double* x, double scale, double a0, double b0, double dx, double dy,
		double dz, double* geod) {
	double a, b;
	long double xp, yp, zp, s, e2, rhd, rbd, n, zps, tmp1, tmp2;
	int i;

	if (a0 == 0 || b0 == 0) {
		a = 6378137.0;
		b = 298.257223563;  //alpha = (a-b)/a
	} else {
		a = a0;
		b = b0;
	}
	for (i = 0; i < 3; i++)
		geod[i] = 0;
	xp = x[0] * scale + dx;
	yp = x[1] * scale + dy;
	zp = x[2] * scale + dz;

	if (b <= 6000000)
		b = a - a / b;
	e2 = (a * a - b * b) / (a * a);
	s = sqrt(xp * xp + yp * yp);
	geod[1] = atan(yp / xp);
	if (geod[1] < 0) {
		if (yp > 0)
			geod[1] += PI;
		if (yp < 0)
			geod[1] += 2 * PI;
	} else {
		if (yp < 0)
			geod[1] += PI;
	}
	zps = zp / s;
	geod[2] = sqrt(xp * xp + yp * yp + zp * zp) - a;
	geod[0] = atan(zps / (1.0 - e2 * a / (a + geod[2])));
	n = 1;
	rhd = rbd = 1;
	while (rbd * n > 1e-4 || rhd > 1e-4) {
		n = a / sqrt(1.0 - e2 * sin(geod[0]) * sin(geod[0]));
		tmp1 = geod[0];
		tmp2 = geod[2];
		geod[2] = s / cos(geod[0]) - n;
		geod[0] = atan(zps / (1.0 - e2 * n / (n + geod[2])));
		rbd = ABS(tmp1 - geod[0]);
		rhd = ABS(tmp2 - geod[2]);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
xorps %xmm6, %xmm6
movups %xmm6, (%rsi)
movq $0x0, 0x10(%rsi)
xorpd %xmm8, %xmm8
movapd %xmm2, %xmm7
cmpeqpd %xmm8, %xmm7
movapd %xmm1, %xmm6
cmpeqpd %xmm8, %xmm6
orpd %xmm7, %xmm6
movd %xmm6, %eax
testb $0x1, %al
je 0xaefe
movsd 0x33aa(%rip), %xmm2     # 0xe2a8
je 0xaf08
movsd 0x33a8(%rip), %xmm1     # 0xe2b0
movsd (%rdi), %xmm6
mulsd %xmm0, %xmm6
addsd %xmm3, %xmm6
movsd %xmm6, -0xf0(%rbp)
fldl -0xf0(%rbp)
fld %st(0)
fstpt -0x3c(%rbp)
movsd 0x8(%rdi), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
movsd %xmm3, -0x18(%rbp)
movsd %xmm3, -0xf8(%rbp)
fldl -0xf8(%rbp)
fld %st(0)
fstpt -0x24(%rbp)
mulsd 0x10(%rdi), %xmm0
addsd %xmm5, %xmm0
movsd %xmm0, -0x100(%rbp)
fldl -0x100(%rbp)
fstpt -0x54(%rbp)
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
movapd %xmm1, %xmm3
subsd %xmm0, %xmm3
movapd %xmm2, %xmm0
cmpnlesd 0x3335(%rip), %xmm0     # 0xe2b8
andpd %xmm0, %xmm2
andnpd %xmm3, %xmm0
orpd %xmm2, %xmm0
mulsd %xmm0, %xmm0
movapd %xmm1, -0x70(%rbp)
mulsd %xmm1, %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, -0xe8(%rbp)
fldl -0xe8(%rbp)
fstpt -0x48(%rbp)
fmul %st, %st(0)
fxch %st(1)
fmul %st, %st(0)
faddp %st, %st(1)
fld %st(0)
fstpt -0x30(%rbp)
fstpt (%rsp)
callq 0x33d0
fstpt -0x7c(%rbp)
fldt -0x24(%rbp)
fldt -0x3c(%rbp)
fdivrp %st, %st(1)
fstpt (%rsp)
callq 0x3470
fstpl -0xe0(%rbp)
movsd -0xe0(%rbp), %xmm0
movsd %xmm0, 0x8(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0xb02b
movsd -0x18(%rbp), %xmm2
ucomisd %xmm1, %xmm2
jbe 0xb016
addsd 0x2d57(%rip), %xmm0     # 0xdd68
movsd %xmm0, 0x8(%rbx)
ucomisd %xmm2, %xmm1
jbe 0xb03f
movsd 0x8(%rbx), %xmm0
addsd 0x2d37(%rip), %xmm0     # 0xdd60
jmp 0xb03a
ucomisd -0x18(%rbp), %xmm1
jbe 0xb03f
addsd 0x2d2e(%rip), %xmm0     # 0xdd68
movsd %xmm0, 0x8(%rbx)
fldt -0x7c(%rbp)
fldt -0x54(%rbp)
fdiv %st, %st(1)
fxch %st(1)
fstpt -0x24(%rbp)
fmul %st, %st(0)
fldt -0x30(%rbp)
faddp %st, %st(1)
fstpt (%rsp)
callq 0x33d0
movapd -0x70(%rbp), %xmm1
movsd %xmm1, -0xd8(%rbp)
fldl -0xd8(%rbp)
fsubr %st, %st(1)
fxch %st(1)
fstpl -0xd0(%rbp)
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, 0x10(%rbx)
fldt -0x48(%rbp)
fld %st(1)
fstpt -0x3c(%rbp)
fmulp %st, %st(1)
addsd %xmm0, %xmm1
movsd %xmm1, -0xc8(%rbp)
fdivl -0xc8(%rbp)
fld1
fsubp %st, %st(1)
fldt -0x24(%rbp)
fdivp %st, %st(1)
fstpt (%rsp)
callq 0x3470
fstpl (%rbx)
fldt -0x48(%rbp)
fchs
fstpt -0x10c(%rbp)
fldl 0x31fb(%rip)            # 0xe2c0
fstpt -0x30(%rbp)
fldz
fstp %st(0)
movsd (%rbx), %xmm0
callq 0x30a0
movsd %xmm0, -0xc0(%rbp)
movsd (%rbx), %xmm0
callq 0x30a0
movsd %xmm0, -0xb8(%rbp)
fldt -0x10c(%rbp)
fmull -0xc0(%rbp)
fmull -0xb8(%rbp)
fld1
faddp %st, %st(1)
fstpt (%rsp)
callq 0x33d0
fldt -0x3c(%rbp)
fdivp %st, %st(1)
fstpt -0x70(%rbp)
movsd (%rbx), %xmm0
movsd %xmm0, -0xb0(%rbp)
fldl -0xb0(%rbp)
fstpt -0x18(%rbp)
fldl 0x10(%rbx)
fstpt -0x54(%rbp)
callq 0x34e0
movsd %xmm0, -0xa8(%rbp)
fldt -0x7c(%rbp)
fdivl -0xa8(%rbp)
fldt -0x70(%rbp)
fsubr %st, %st(1)
fxch %st(1)
fstpl -0xa0(%rbp)
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, 0x10(%rbx)
movsd %xmm0, -0x98(%rbp)
fld %st(0)
faddl -0x98(%rbp)
fldt -0x48(%rbp)
fmulp %st, %st(2)
fdivrp %st, %st(1)
fld1
fsubp %st, %st(1)
fldt -0x24(%rbp)
fdivp %st, %st(1)
fstpt (%rsp)
callq 0x3470
fstpl -0x90(%rbp)
movsd -0x90(%rbp), %xmm0
movsd %xmm0, (%rbx)
movsd %xmm0, -0x88(%rbp)
fldt -0x18(%rbp)
fsubl -0x88(%rbp)
fld %st(0)
fchs
fxch %st(1)
fucomi %st(1), %st
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fldt -0x54(%rbp)
fsubl 0x10(%rbx)
fld %st(0)
fchs
fxch %st(1)
fucomi %st(1), %st
fxch %st(1)
fcmovnbe %st(1), %st
fstp %st(1)
fldt -0x70(%rbp)
fmulp %st, %st(2)
fldt -0x30(%rbp)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
ja 0xb0ca
fldt -0x30(%rbp)
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
fldz
ja 0xb0ca
fstp %st(0)
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %rbp
retq