// File: DoubleString[P]RtConverter/src/Rtklib/rtcm2.cpp
// Function: bamboo::decode_type1(bamboo::rtcm_t*)
static int decode_type1(rtcm_t *rtcm)
{
    int i=48,fact,udre,prn,sat,iod;
    double prc,rrc;
    
    trace(4,"decode_type1: len=%d\n",rtcm->len);
    
    while (i+40<=rtcm->len*8) {
        fact=getbitu(rtcm->buff,i, 1); i+= 1;
        udre=getbitu(rtcm->buff,i, 2); i+= 2;
        prn =getbitu(rtcm->buff,i, 5); i+= 5;
        prc =getbits(rtcm->buff,i,16); i+=16;
        rrc =getbits(rtcm->buff,i, 8); i+= 8;
        iod =getbits(rtcm->buff,i, 8); i+= 8;
        if (prn==0) prn=32;
        if (prc==0x80000000||rrc==0xFFFF8000) {
            trace(2,"rtcm2 1 prc/rrc indicates satellite problem: prn=%d\n",prn);
            continue;
        }
        if (rtcm->dgps) {
            sat=satno(SYS_GPS,prn);
            rtcm->dgps[sat-1].t0=rtcm->time;
            rtcm->dgps[sat-1].prc=prc*(fact?0.32:0.02);
            rtcm->dgps[sat-1].rrc=rrc*(fact?0.032:0.002);
            rtcm->dgps[sat-1].iod=iod;
            rtcm->dgps[sat-1].udre=udre;
        }
    }
    return 7;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl $0x30, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x9f0c0(%rax), %edx
movl $0x4, %edi
leaq 0x54a30(%rip), %rsi     # 0xc0769
movb $0x0, %al
callq 0x8b980
movl -0xc(%rbp), %eax
addl $0x28, %eax
movq -0x8(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x6bff6
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0xc(%rbp), %esi
movl $0x1, %edx
callq 0x8bfc0
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0xc(%rbp), %esi
movl $0x2, %edx
callq 0x8bfc0
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0xc(%rbp), %esi
movl $0x5, %edx
callq 0x8bfc0
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x5, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0xc(%rbp), %esi
movl $0x10, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x28(%rbp)
movl -0xc(%rbp), %eax
addl $0x10, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0xc(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0xc(%rbp), %eax
addl $0x8, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0xc(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
movl %eax, -0x20(%rbp)
movl -0xc(%rbp), %eax
addl $0x8, %eax
movl %eax, -0xc(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x6be4c
movl $0x20, -0x18(%rbp)
movsd -0x28(%rbp), %xmm0
movsd 0x5470f(%rip), %xmm1    # 0xc0568
ucomisd %xmm1, %xmm0
jne 0x6be63
jp 0x6be63
jmp 0x6be78
movsd -0x30(%rbp), %xmm0
movsd 0x54700(%rip), %xmm1    # 0xc0570
ucomisd %xmm1, %xmm0
jne 0x6be93
jp 0x6be93
movl -0x18(%rbp), %edx
movl $0x2, %edi
leaq 0x548f8(%rip), %rsi     # 0xc077f
movb $0x0, %al
callq 0x8b980
jmp 0x6bd40
movq -0x8(%rbp), %rax
cmpq $0x0, 0x6f140(%rax)
je 0x6bff1
movl -0x18(%rbp), %esi
movl $0x1, %edi
callq 0x8b1b0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x6f140(%rax), %rax
movl -0x1c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq 0x10(%rcx), %rdx
movq %rdx, (%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x8(%rax)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x10(%rbp), %eax
movsd 0x54690(%rip), %xmm0    # 0xc0588
movsd 0x51e88(%rip), %xmm1    # 0xbdd88
movsd %xmm1, -0x40(%rbp)
cmpl $0x0, %eax
movsd %xmm0, -0x38(%rbp)
jne 0x6bf19
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x48(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
mulsd %xmm1, %xmm0
movq -0x8(%rbp), %rax
movq 0x6f140(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x10(%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movl -0x10(%rbp), %eax
movsd 0x5461c(%rip), %xmm0    # 0xc0578
movsd 0x5461c(%rip), %xmm1    # 0xc0580
movsd %xmm1, -0x58(%rbp)
cmpl $0x0, %eax
movsd %xmm0, -0x50(%rbp)
jne 0x6bf7d
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x60(%rbp), %xmm0
movsd -0x50(%rbp), %xmm1
mulsd %xmm1, %xmm0
movq -0x8(%rbp), %rax
movq 0x6f140(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x18(%rax)
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x6f140(%rax), %rax
movl -0x1c(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
cvtsi2sdl -0x14(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x6f140(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
jmp 0x6bd40
movl $0x7, %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)