// File: /workspace/github_cpp_makefile_star2_O3/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 0x54e3(%rip), %xmm1     # 0xdda0
movl $0xd45a, %esi           # imm = 0xD45A
callq 0xb394
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x8990
leaq 0x5674(%rip), %rsi      # 0xdf50
movq %r15, %rdi
callq 0x30b0
movabsq $0x3ff0000000000000, %r12 # imm = 0x3FF0000000000000
testq %rax, %rax
je 0x89f8
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 0x541d(%rip), %xmm0     # 0xdda8
jmp 0x8b46
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 0x5397(%rip), %xmm1     # 0xdd58
xorl %edx, %edx
movapd %xmm1, %xmm0
cmpq %rdx, %rcx
je 0x89d0
xorpd %xmm0, %xmm0
movsd %xmm0, (%rax,%rdx,8)
incq %rdx
cmpq $0x3, %rdx
jne 0x89c3
incq %rcx
addq $0x18, %rax
cmpq $0x3, %rcx
jne 0x89c1
movsd %xmm1, -0x98(%rbp)
jmp 0x8b52
leaq 0x5555(%rip), %rsi      # 0xdf54
movq %r15, %rdi
callq 0x30b0
testq %rax, %rax
je 0x8a80
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)
xorl %eax, %eax
movq %rax, -0x80(%rbp)
movabsq $0x3eab83bf11ce33aa, %rcx # imm = 0x3EAB83BF11CE33AA
movq %rcx, -0x78(%rbp)
movq %r12, -0x70(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x68(%rbp)
movq %rax, -0x58(%rbp)
movsd 0x5335(%rip), %xmm0     # 0xddb0
jmp 0x8b46
leaq 0x54d1(%rip), %rsi      # 0xdf58
movq %r15, %rdi
callq 0x30b0
testq %rax, %rax
je 0x8ad3
xorpd %xmm0, %xmm0
movapd %xmm0, -0x40(%rbp)
xorl %eax, %eax
movq %rax, -0x30(%rbp)
movq %r12, -0x90(%rbp)
movabsq $-0x4145280d654350b8, %rcx # imm = 0xBEBAD7F29ABCAF48
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movabsq $0x3ebad7f29abcaf48, %rcx # imm = 0x3EBAD7F29ABCAF48
movq %rcx, -0x78(%rbp)
movq %r12, -0x70(%rbp)
jmp 0x8b35
leaq 0x5482(%rip), %rsi      # 0xdf5c
movq %r15, %rdi
callq 0x30b0
testq %rax, %rax
je 0x8bb4
xorl %eax, %eax
movq %rax, -0x40(%rbp)
movabsq $0x3f647ae147ae147b, %rcx # imm = 0x3F647AE147AE147B
movq %rcx, -0x38(%rbp)
movq %rax, -0x30(%rbp)
movq %r12, -0x90(%rbp)
movabsq $-0x41401f8fe83fefda, %rcx # imm = 0xBEBFE07017C01026
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movabsq $0x3ebfe07017c01026, %rcx # imm = 0x3EBFE07017C01026
movq %rcx, -0x78(%rbp)
movq %r12, -0x70(%rbp)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x68(%rbp)
movq %rax, -0x58(%rbp)
movsd 0x5212(%rip), %xmm0     # 0xdd58
movsd %xmm0, -0x98(%rbp)
movq %r12, -0x50(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
movq %r14, %rsi
movl $0x3, %ecx
movl $0x3, %r8d
movl $0x1, %r9d
callq 0xb174
xorl %eax, %eax
movsd -0x98(%rbp), %xmm1
movsd -0xb0(%rbp,%rax,8), %xmm0
mulsd %xmm1, %xmm0
addsd -0x40(%rbp,%rax,8), %xmm0
movsd %xmm0, (%rbx,%rax,8)
incq %rax
cmpq $0x3, %rax
jne 0x8b83
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x53a5(%rip), %rdi      # 0xdf60
movq %r15, %rsi
xorl %eax, %eax
callq 0x3050
movl $0x1, %edi
callq 0x3370
nop