// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]eph_converter/src/Broadcast.cpp
// Function: BroadcastEphUtils::pz902wgs84(int, double, double*, double*, char const*)
void BroadcastEphUtils::pz902wgs84(int mjd, double sod, double* pos,
		double *xsat, const char* trans) {
	double factor, biase[3], mat[3][3], vec[3];
	int i, j;
	if (timdif(mjd, sod, 54362, 86367.0) >= 0.0) {
		factor = 1.0;
//		biase[0] = -0.36e-3;
//		biase[1] = 0.08e-3;
//		biase[2] = 0.18e-3;

		biase[0] = 0.008e-3;
		biase[1] = 0.001e-3;
		biase[2] = 0.001e-3;
		for (i = 0; i < 3; i++)
			for (j = 0; j < 3; j++) {
				if (i == j) {
					mat[i][j] = 1.0;
				} else {
					mat[i][j] = 0.0;
				}
			}
	} else {
		if (strstr(trans, "MCC") != NULL) {
			factor = 1.0 + 22.0e-9;
			biase[0] = -0.47e-3;
			biase[1] = -0.51e-3;
			biase[2] = -1.56e-3;
			mat[0][0] = 1.0;
			mat[0][1] = -1.728e-6;
			mat[0][2] = -1.7e-8;
			mat[1][0] = 1.728e-6;
			mat[1][1] = 1.0;
			mat[1][2] = 7.6e-8;
			mat[2][0] = 1.7e-8;
			mat[2][1] = -7.6e-8;
			mat[2][2] = 1.0;
		} else if (strstr(trans, "RUS") != NULL) {
			factor = 1.0 - 1.2e-7;
			biase[0] = -1.1e-3;
			biase[1] = -0.3e-3;
			biase[2] = -0.9e-3;
			mat[0][0] = 1.0;
			mat[0][1] = -8.2e-7;
			mat[0][2] = 0.0;
			mat[1][0] = 8.2e-7;
			mat[1][1] = 1.0;
			mat[1][2] = 0.0;
			mat[2][0] = 0.0;
			mat[2][1] = 0.0;
			mat[2][2] = 1.0;
		} else if (strstr(trans, "LMU") != NULL) {
			factor = 1.0;
			biase[0] = 0.0;
			biase[1] = 0.0;
			biase[2] = 0.0;
			mat[0][0] = 1.0;
			mat[0][1] = -1.6e-6;
			mat[0][2] = 0.0;
			mat[1][0] = 1.6e-6;
			mat[1][1] = 1.0;
			mat[1][2] = 0.0;
			mat[2][0] = 0.0;
			mat[2][1] = 0.0;
			mat[2][2] = 1.0;
		} else if (strstr(trans, "MIT") != NULL) {
			factor = 1.0;
			biase[0] = 0.0;
			biase[1] = 2.5e-3;
			biase[2] = 0.0;
			mat[0][0] = 1.0;
			mat[0][1] = -1.9e-6;
			mat[0][2] = 0.0;
			mat[1][0] = 1.9e-6;
			mat[1][1] = 1.0;
			mat[1][2] = 0.0;
			mat[2][0] = 0.0;
			mat[2][1] = 0.0;
			mat[2][2] = 1.0;
		} else {
			printf("***ERROR(pz902wgs84): unknown transformation type %s!\n",
					trans);
			exit(1);
		}
	}
	matmpy((double*) mat, pos, vec, 3, 3, 1);
	for (i = 0; i < 3; i++)
		xsat[i] = biase[i] + factor * vec[i];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %r8, %r15
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %edi
movsd 0x4895(%rip), %xmm1     # 0xcd70
movl $0xd45a, %esi           # imm = 0xD45A
callq 0xae54
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x85ae
leaq 0x4a26(%rip), %rsi      # 0xcf20
movq %r15, %rdi
callq 0x30b0
movabsq $0x3ff0000000000000, %r12 # imm = 0x3FF0000000000000
testq %rax, %rax
je 0x8617
movabsq $-0x40c132b55ef1fddf, %rax # imm = 0xBF3ECD4AA10E0221
movq %rax, -0x40(%rbp)
movabsq $-0x40bf49cf56eac860, %rax # imm = 0xBF40B630A91537A0
movq %rax, -0x38(%rbp)
movabsq $-0x40a670e2c12ad81b, %rax # imm = 0xBF598F1D3ED527E5
movq %rax, -0x30(%rbp)
movq %r12, -0x90(%rbp)
movabsq $-0x4143024be83e75e5, %rax # imm = 0xBEBCFDB417C18A1B
movq %rax, -0x88(%rbp)
movabsq $-0x41adbf135956bc02, %rax # imm = 0xBE5240ECA6A943FE
movq %rax, -0x80(%rbp)
movabsq $0x3ebcfdb417c18a1b, %rax # imm = 0x3EBCFDB417C18A1B
movq %rax, -0x78(%rbp)
movq %r12, -0x70(%rbp)
movabsq $0x3e7466ae23ae1ed1, %rax # imm = 0x3E7466AE23AE1ED1
movq %rax, -0x68(%rbp)
movabsq $0x3e5240eca6a943fe, %rax # imm = 0x3E5240ECA6A943FE
movq %rax, -0x60(%rbp)
movabsq $-0x418b9951dc51e12f, %rax # imm = 0xBE7466AE23AE1ED1
movq %rax, -0x58(%rbp)
movsd 0x47cf(%rip), %xmm0     # 0xcd78
jmp 0x8767
movabsq $0x3ee0c6f7a0b5ed8d, %rax # imm = 0x3EE0C6F7A0B5ED8D
movq %rax, -0x40(%rbp)
movabsq $0x3eb0c6f7a0b5ed8d, %rax # imm = 0x3EB0C6F7A0B5ED8D
movq %rax, -0x38(%rbp)
movq %rax, -0x30(%rbp)
leaq -0x90(%rbp), %rax
xorl %ecx, %ecx
movsd 0x4749(%rip), %xmm1     # 0xcd28
cmpq $0x3, %rcx
je 0x860d
xorl %edx, %edx
cmpq $0x3, %rdx
je 0x8604
movapd %xmm1, %xmm0
cmpq %rdx, %rcx
je 0x85fa
xorpd %xmm0, %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
jmp 0x85e7
incq %rcx
addq $0x18, %rax
jmp 0x85df
movsd %xmm1, -0x28(%rbp)
jmp 0x8770
leaq 0x4906(%rip), %rsi      # 0xcf24
movq %r15, %rdi
callq 0x30b0
testq %rax, %rax
je 0x869f
movabsq $-0x40adfa43fe5c91d1, %rax # imm = 0xBF5205BC01A36E2F
movq %rax, -0x40(%rbp)
movabsq $-0x40cc56d5cfaacd9f, %rax # imm = 0xBF33A92A30553261
movq %rax, -0x38(%rbp)
movabsq $-0x40b28240b780346e, %rax # imm = 0xBF4D7DBF487FCB92
movq %rax, -0x30(%rbp)
movq %r12, -0x90(%rbp)
movabsq $-0x41547c40ee31cc56, %rax # imm = 0xBEAB83BF11CE33AA
movq %rax, -0x88(%rbp)
andq $0x0, -0x80(%rbp)
movabsq $0x3eab83bf11ce33aa, %rax # imm = 0x3EAB83BF11CE33AA
movq %rax, -0x78(%rbp)
movq %r12, -0x70(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x68(%rbp)
andq $0x0, -0x58(%rbp)
movsd 0x46e6(%rip), %xmm0     # 0xcd80
jmp 0x8767
leaq 0x4882(%rip), %rsi      # 0xcf28
movq %r15, %rdi
callq 0x30b0
testq %rax, %rax
je 0x86f2
andq $0x0, -0x30(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r12, -0x90(%rbp)
movabsq $-0x4145280d654350b8, %rax # imm = 0xBEBAD7F29ABCAF48
movq %rax, -0x88(%rbp)
andq $0x0, -0x80(%rbp)
movabsq $0x3ebad7f29abcaf48, %rax # imm = 0x3EBAD7F29ABCAF48
movq %rax, -0x78(%rbp)
movq %r12, -0x70(%rbp)
jmp 0x8755
leaq 0x4833(%rip), %rsi      # 0xcf2c
movq %r15, %rdi
callq 0x30b0
testq %rax, %rax
je 0x87ca
andq $0x0, -0x40(%rbp)
movabsq $0x3f647ae147ae147b, %rax # imm = 0x3F647AE147AE147B
movq %rax, -0x38(%rbp)
andq $0x0, -0x30(%rbp)
movq %r12, -0x90(%rbp)
movabsq $-0x41401f8fe83fefda, %rax # imm = 0xBEBFE07017C01026
movq %rax, -0x88(%rbp)
andq $0x0, -0x80(%rbp)
movabsq $0x3ebfe07017c01026, %rax # imm = 0x3EBFE07017C01026
movq %rax, -0x78(%rbp)
movq %r12, -0x70(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x68(%rbp)
andq $0x0, -0x58(%rbp)
movsd 0x45c1(%rip), %xmm0     # 0xcd28
movsd %xmm0, -0x28(%rbp)
movq %r12, -0x50(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
pushq $0x3
popq %rcx
pushq $0x1
popq %r9
movq %r14, %rsi
movl %ecx, %r8d
callq 0xac55
xorl %eax, %eax
movsd -0x28(%rbp), %xmm1
cmpq $0x3, %rax
je 0x87ba
movsd -0xb0(%rbp,%rax,8), %xmm0
mulsd %xmm1, %xmm0
addsd -0x40(%rbp,%rax,8), %xmm0
movsd %xmm0, (%rbx,%rax,8)
incq %rax
jmp 0x8797
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x475f(%rip), %rdi      # 0xcf30
movq %r15, %rsi
xorl %eax, %eax
callq 0x3040
pushq $0x1
popq %rdi
callq 0x3320
nop