// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::satwavelen(int, int, bamboo::nav_t const*)
extern double satwavelen(int sat, int frq, const nav_t *nav)
{
    const double freq_glo[]={FREQ1_GLO,FREQ2_GLO};
    const double dfrq_glo[]={DFRQ1_GLO,DFRQ2_GLO};
    int i,sys=satsys(sat,NULL);
    
    if (sys==SYS_GLO) {
        if (0<=frq&&frq<=1) { /* L1,L2 */
            for (i=0;i<nav->ng;i++) {
                if (nav->geph[i].sat!=sat) continue;
                return CLIGHT/(freq_glo[frq]+dfrq_glo[frq]*nav->geph[i].frq);
            }
        }
        else if (frq==2) { /* L3 */
            return CLIGHT/FREQ3_GLO;
        }
    }
    else if (sys==SYS_CMP) {
        if      (frq==0) return CLIGHT/FREQ1_CMP; /* B1 */
        else if (frq==1) return CLIGHT/FREQ2_CMP; /* B2 */
        else if (frq==2) return CLIGHT/FREQ3_CMP; /* B3 */
    }
    else if (sys==SYS_GAL) {
        if      (frq==0) return CLIGHT/FREQ1; /* E1 */
        else if (frq==1) return CLIGHT/FREQ7; /* E5b */
        else if (frq==2) return CLIGHT/FREQ5; /* E5a */
        else if (frq==3) return CLIGHT/FREQ6; /* E6 */
        else if (frq==5) return CLIGHT/FREQ8; /* E5ab */
    }
    else { /* GPS,QZS */
        if      (frq==0) return CLIGHT/FREQ1; /* L1 */
        else if (frq==1) return CLIGHT/FREQ2; /* L2 */
        else if (frq==2) return CLIGHT/FREQ5; /* L5 */
        else if (frq==3) return CLIGHT/FREQ6; /* L6/LEX */
        else if (frq==6) return CLIGHT/FREQ9; /* S */
    }
    return 0.0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq 0x33e57(%rip), %rax     # 0xc7750
movq %rax, -0x30(%rbp)
movq 0x33e54(%rip), %rax     # 0xc7758
movq %rax, -0x28(%rbp)
movq 0x33e51(%rip), %rax     # 0xc7760
movq %rax, -0x40(%rbp)
movq 0x33e4e(%rip), %rax     # 0xc7768
movq %rax, -0x38(%rbp)
movl -0xc(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x8b3b0
movl %eax, -0x48(%rbp)
cmpl $0x4, -0x48(%rbp)
jne 0x939fa
xorl %eax, %eax
cmpl -0x10(%rbp), %eax
jg 0x939db
cmpl $0x1, -0x10(%rbp)
jg 0x939db
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x939d9
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x44(%rbp), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
je 0x9397e
jmp 0x939cb
movslq -0x10(%rbp), %rax
movsd -0x30(%rbp,%rax,8), %xmm0
movslq -0x10(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm1
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x44(%rbp), %rcx
imulq $0x98, %rcx, %rcx
addq %rcx, %rax
cvtsi2sdl 0x8(%rax), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd 0x2a3eb(%rip), %xmm0    # 0xbdda8
divsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x93953
jmp 0x939f5
cmpl $0x2, -0x10(%rbp)
jne 0x939f3
movsd 0x33b27(%rip), %xmm0    # 0xc7510
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
jmp 0x939f5
jmp 0x93b54
cmpl $0x20, -0x48(%rbp)
jne 0x93a51
cmpl $0x0, -0x10(%rbp)
jne 0x93a18
movsd 0x33afa(%rip), %xmm0    # 0xc7508
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x1, -0x10(%rbp)
jne 0x93a30
movsd 0x33ad2(%rip), %xmm0    # 0xc74f8
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x2, -0x10(%rbp)
jne 0x93a48
movsd 0x33ac2(%rip), %xmm0    # 0xc7500
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
jmp 0x93a4a
jmp 0x93a4c
jmp 0x93b52
cmpl $0x8, -0x48(%rbp)
jne 0x93add
cmpl $0x0, -0x10(%rbp)
jne 0x93a73
movsd 0x2e35f(%rip), %xmm0    # 0xc1dc8
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x1, -0x10(%rbp)
jne 0x93a8b
movsd 0x33a77(%rip), %xmm0    # 0xc74f8
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x2, -0x10(%rbp)
jne 0x93aa3
movsd 0x33a4f(%rip), %xmm0    # 0xc74e8
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x3, -0x10(%rbp)
jne 0x93abb
movsd 0x33a2f(%rip), %xmm0    # 0xc74e0
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x5, -0x10(%rbp)
jne 0x93ad3
movsd 0x33a27(%rip), %xmm0    # 0xc74f0
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
jmp 0x93ad5
jmp 0x93ad7
jmp 0x93ad9
jmp 0x93adb
jmp 0x93b50
cmpl $0x0, -0x10(%rbp)
jne 0x93af2
movsd 0x2e2dd(%rip), %xmm0    # 0xc1dc8
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x1, -0x10(%rbp)
jne 0x93b07
movsd 0x2e2c0(%rip), %xmm0    # 0xc1dc0
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x2, -0x10(%rbp)
jne 0x93b1c
movsd 0x339d3(%rip), %xmm0    # 0xc74e8
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x3, -0x10(%rbp)
jne 0x93b31
movsd 0x339b6(%rip), %xmm0    # 0xc74e0
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
cmpl $0x6, -0x10(%rbp)
jne 0x93b46
movsd 0x33999(%rip), %xmm0    # 0xc74d8
movsd %xmm0, -0x8(%rbp)
jmp 0x93b5c
jmp 0x93b48
jmp 0x93b4a
jmp 0x93b4c
jmp 0x93b4e
jmp 0x93b50
jmp 0x93b52
jmp 0x93b54
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)