// File: DoubleString[P]RtConverter/src/Rnxobs/Com.cpp
// Function: bamboo::bds_code_cor(char*, int, char (*) [4], double, double*)
void bds_code_cor(char *ctype, int nfreq, char cfreq[MAXFREQ][LEN_FREQ],
		double elev, double *bias) {
	int isat, i, idx, ifreq[3] = { 0 };
	double alpha;
	static double coef[2][3][10] = { -0.11, -0.11, -0.09, -0.07, -0.02, -0.08,
			0.13, 0.24, 0.25, 0.33, -0.06, -0.11, -0.07, -0.05, -0.01, 0.06,
			0.11, 0.19, 0.26, 0.28, -0.27, -0.23, -0.21, -0.15, -0.11, -0.04,
			0.05, 0.14, 0.19, 0.32, -0.13, -0.20, -0.17, -0.12, -0.04, 0.10,
			0.32, 0.61, 0.82, 0.92, -0.12, -0.16, -0.12, -0.09, -0.01, 0.10,
			0.25, 0.42, 0.56, 0.64, -0.22, -0.15, -0.13, -0.10, -0.04, 0.05,
			0.14, 0.27, 0.36, 0.47 };
	if (nfreq > 3) {
		printf("the number of frequency is more than 3");
		printf(
				"***ERROR(bds_code_cor):the number of frequency is more than 3!\n");
		exit(1);
	}
	if (strstr(ctype, "BEIDOU-2I")) {
		isat = 0;
	} else if (strstr(ctype, "BEIDOU-2M")) {
		isat = 1;
	} else {
		return;
	}
	for (i = 0; i < nfreq; i++) {
		if (strstr(cfreq[i], "L2") || strstr(cfreq[i],"L1"))
			ifreq[i] = 0;
		if (strstr(cfreq[i], "L7"))
			ifreq[i] = 1;
		if (strstr(cfreq[i], "L6"))
			ifreq[i] = 2;
	}
	if (elev <= 0.0) {
		for (i = 0; i < nfreq; i++)
			bias[i] = coef[isat][ifreq[i]][0];
	} else if (elev >= 90.0) {
		for (i = 0; i < nfreq; i++)
			bias[i] = coef[isat][ifreq[i]][9];
	} else {
		idx = (int) (elev / 10.0);
		for (i = 0; i < nfreq; i++) {
			alpha = (coef[isat][ifreq[i]][idx + 1] - coef[isat][ifreq[i]][idx])
					/ 10.0;
			bias[i] = alpha * (elev - idx * 10.0) + coef[isat][ifreq[i]][idx];
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x93d0
cmpl $0x3, -0xc(%rbp)
jle 0x38b78
leaq 0x84854(%rip), %rdi     # 0xbd3ad
movb $0x0, %al
callq 0x9090
leaq 0x8486d(%rip), %rdi     # 0xbd3d4
movb $0x0, %al
callq 0x9090
movl $0x1, %edi
callq 0x9910
movq -0x8(%rbp), %rdi
leaq 0x84891(%rip), %rsi     # 0xbd414
callq 0x91b0
cmpq $0x0, %rax
je 0x38b97
movl $0x0, -0x2c(%rbp)
jmp 0x38bbd
movq -0x8(%rbp), %rdi
leaq 0x8487c(%rip), %rsi     # 0xbd41e
callq 0x91b0
cmpq $0x0, %rax
je 0x38bb6
movl $0x1, -0x2c(%rbp)
jmp 0x38bbb
jmp 0x38e78
jmp 0x38bbd
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x38c88
movq -0x18(%rbp), %rdi
movslq -0x30(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
leaq 0x846e5(%rip), %rsi     # 0xbd2cb
callq 0x91b0
cmpq $0x0, %rax
jne 0x38c12
movq -0x18(%rbp), %rdi
movslq -0x30(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
leaq 0x846c1(%rip), %rsi     # 0xbd2c8
callq 0x91b0
cmpq $0x0, %rax
je 0x38c1e
movslq -0x30(%rbp), %rax
movl $0x0, -0x40(%rbp,%rax,4)
movq -0x18(%rbp), %rdi
movslq -0x30(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
leaq 0x846ed(%rip), %rsi     # 0xbd321
callq 0x91b0
cmpq $0x0, %rax
je 0x38c4b
movslq -0x30(%rbp), %rax
movl $0x1, -0x40(%rbp,%rax,4)
movq -0x18(%rbp), %rdi
movslq -0x30(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
leaq 0x846bd(%rip), %rsi     # 0xbd31e
callq 0x91b0
cmpq $0x0, %rax
je 0x38c78
movslq -0x30(%rbp), %rax
movl $0x2, -0x40(%rbp,%rax,4)
jmp 0x38c7a
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x38bc4
xorps %xmm0, %xmm0
ucomisd -0x20(%rbp), %xmm0
jb 0x38ce7
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x38ce2
movslq -0x2c(%rbp), %rcx
leaq 0xbeec4(%rip), %rax     # 0xf7b70
imulq $0xf0, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movslq -0x40(%rbp,%rcx,4), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x38c99
jmp 0x38e78
movsd -0x20(%rbp), %xmm0
movsd 0x84304(%rip), %xmm1    # 0xbcff8
ucomisd %xmm1, %xmm0
jb 0x38d50
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x38d4b
movslq -0x2c(%rbp), %rcx
leaq 0xbee5c(%rip), %rax     # 0xf7b70
imulq $0xf0, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movslq -0x40(%rbp,%rcx,4), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movsd 0x48(%rax), %xmm0
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x38d01
jmp 0x38e76
movsd -0x20(%rbp), %xmm0
movsd 0x842a3(%rip), %xmm1    # 0xbd000
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x38e74
movslq -0x2c(%rbp), %rcx
leaq 0xbedea(%rip), %rax     # 0xf7b70
imulq $0xf0, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movslq -0x40(%rbp,%rcx,4), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movslq -0x2c(%rbp), %rcx
leaq 0xbedb7(%rip), %rax     # 0xf7b70
imulq $0xf0, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movslq -0x40(%rbp,%rcx,4), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd 0x8421c(%rip), %xmm1    # 0xbd000
divsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
cvtsi2sdl -0x34(%rbp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
movsd 0x841e5(%rip), %xmm3    # 0xbd000
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
movslq -0x2c(%rbp), %rcx
leaq 0xbed42(%rip), %rax     # 0xf7b70
imulq $0xf0, %rcx, %rcx
addq %rcx, %rax
movslq -0x30(%rbp), %rcx
movslq -0x40(%rbp,%rcx,4), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x38d6f
jmp 0x38e76
jmp 0x38e78
addq $0x50, %rsp
popq %rbp
retq
nop