// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::decode_gps_subfrm4(unsigned char const*, bamboo::alm_t*, double*, double*, int*)
static void decode_gps_subfrm4(const unsigned char *buff, alm_t *alm,
                               double *ion, double *utc, int *leaps)
{
    int i,sat,svid=getbitu(buff,50,6);
    
    if (25<=svid&&svid<=32) { /* page 2,3,4,5,7,8,9,10 */
        
        /* decode almanac */
        sat=getbitu(buff,50,6);
        if (1<=sat&&sat<=32) decode_almanac(buff,sat,alm);
    }
    else if (svid==63) { /* page 25 */
        
        /* decode as and sv config */
        i=56;
        for (sat=1;sat<=32;sat++) {
            if (alm) alm[sat-1].svconf=getbitu(buff,i,4);
            i+=4;
        }
        /* decode sv health */
        i=186;
        for (sat=25;sat<=32;sat++) {
            if (alm) alm[sat-1].svh   =getbitu(buff,i,6);
            i+=6;
        }
    }
    else if (svid==56) { /* page 18 */
        
        /* decode ion/utc parameters */
        if (ion) {
            i=56;
            ion[0]=getbits(buff,i, 8)*P2_30;     i+= 8;
            ion[1]=getbits(buff,i, 8)*P2_27;     i+= 8;
            ion[2]=getbits(buff,i, 8)*P2_24;     i+= 8;
            ion[3]=getbits(buff,i, 8)*P2_24;     i+= 8;
            ion[4]=getbits(buff,i, 8)*pow(2,11); i+= 8;
            ion[5]=getbits(buff,i, 8)*pow(2,14); i+= 8;
            ion[6]=getbits(buff,i, 8)*pow(2,16); i+= 8;
            ion[7]=getbits(buff,i, 8)*pow(2,16);
        }
        if (utc) {
            i=120;
            utc[1]=getbits(buff,i,24)*P2_50;     i+=24;
            utc[0]=getbits(buff,i,32)*P2_30;     i+=32;
            utc[2]=getbits(buff,i, 8)*pow(2,12); i+= 8;
            utc[3]=getbitu(buff,i, 8);
        }
        if (leaps) {
            i=192;
            *leaps=getbits(buff,i,8);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl $0x32, %esi
movl $0x6, %edx
callq 0x8bfc0
movl %eax, -0x34(%rbp)
movl $0x19, %eax
cmpl -0x34(%rbp), %eax
jg 0x66ded
cmpl $0x20, -0x34(%rbp)
jg 0x66ded
movq -0x8(%rbp), %rdi
movl $0x32, %esi
movl $0x6, %edx
callq 0x8bfc0
movl %eax, -0x30(%rbp)
movl $0x1, %eax
cmpl -0x30(%rbp), %eax
jg 0x66de8
cmpl $0x20, -0x30(%rbp)
jg 0x66de8
movq -0x8(%rbp), %rdi
movl -0x30(%rbp), %esi
movq -0x10(%rbp), %rdx
callq 0x67680
jmp 0x671b5
cmpl $0x3f, -0x34(%rbp)
jne 0x66eae
movl $0x38, -0x2c(%rbp)
movl $0x1, -0x30(%rbp)
cmpl $0x20, -0x30(%rbp)
jg 0x66e50
cmpq $0x0, -0x10(%rbp)
je 0x66e3c
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x4, %edx
callq 0x8bfc0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl -0x2c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x66e05
movl $0xba, -0x2c(%rbp)
movl $0x19, -0x30(%rbp)
cmpl $0x20, -0x30(%rbp)
jg 0x66ea9
cmpq $0x0, -0x10(%rbp)
je 0x66e95
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x6, %edx
callq 0x8bfc0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x2c(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x66e5e
jmp 0x671b3
cmpl $0x38, -0x34(%rbp)
jne 0x671b1
cmpq $0x0, -0x18(%rbp)
je 0x670a8
movl $0x38, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x57fa9(%rip), %xmm1    # 0xbee90
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x57fb7(%rip), %xmm1    # 0xbeed0
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x57f7c(%rip), %xmm1    # 0xbeec8
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x57f49(%rip), %xmm1    # 0xbeec8
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x18(%rax)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x2, %edi
movl $0xb, %esi
callq 0x67da0
movaps %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0x2, %edi
movl $0xe, %esi
callq 0x67da0
movaps %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x48(%rbp)
movl $0x2, %edi
movl $0x10, %esi
callq 0x67da0
movaps %xmm0, %xmm1
movsd -0x48(%rbp), %xmm0
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x2, %edi
movl $0x10, %esi
callq 0x67da0
movaps %xmm0, %xmm1
movsd -0x40(%rbp), %xmm0
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x38(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x67188
movl $0x78, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x18, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x55ee1(%rip), %xmm1    # 0xbcfb8
mulsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movl -0x2c(%rbp), %eax
addl $0x18, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x20, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x57d86(%rip), %xmm1    # 0xbee90
mulsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, (%rax)
movl -0x2c(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
movl %edx, -0x64(%rbp)
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x60(%rbp)
movl $0x2, %edi
movl $0xc, %esi
callq 0x67da0
movl -0x64(%rbp), %edx
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
mulsd %xmm1, %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x18(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x671af
movl $0xc0, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x671b1
jmp 0x671b3
jmp 0x671b5
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)