// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr6(bamboo::rtcm_t*, int)
static int decode_ssr6(rtcm_t *rtcm, int sys)
{
    double udint,hrclk;
    int i,j,type,nsat,sync,iod,prn,sat,np,offp;
    
    type=getbitu(rtcm->buff,24,12);
    
    if ((nsat=decode_ssr2_head(rtcm,sys,&sync,&iod,&udint,&i))<0) {
        trace(2,"rtcm3 %d length error: len=%d\n",type,rtcm->len);
        return -1;
    }
    switch (sys) {
        case SYS_GPS: np=6; offp=  0; break;
        case SYS_GLO: np=5; offp=  0; break;
        case SYS_GAL: np=6; offp=  0; break;
        case SYS_QZS: np=4; offp=192; break;
        case SYS_CMP: np=6; offp=  1; break;
        case SYS_SBS: np=6; offp=120; break;
        default: return sync?0:10;
    }
    for (j=0;j<nsat&&i+22+np<=rtcm->len*8;j++) {
        prn  =getbitu(rtcm->buff,i,np)+offp; i+=np;
        hrclk=getbits(rtcm->buff,i,22)*1E-4; i+=22;
        
        if (!(sat=satno(sys,prn))) {
            trace(2,"rtcm3 %d satellite number error: prn=%d\n",type,prn);
            continue;
        }
        rtcm->ssr[sat-1].t0 [2]=rtcm->time;
        rtcm->ssr[sat-1].udi[2]=udint;
        rtcm->ssr[sat-1].iod[2]=iod;
        rtcm->ssr[sat-1].hrclk=hrclk;
        rtcm->ssr[sat-1].update=1;
    }
    return sync?0:10;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %r14d
movq %rdi, %rbx
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
pushq $0x18
popq %rsi
pushq $0xc
popq %rdx
movq %rdi, -0x80(%rbp)
callq 0x459f7
movl %eax, %r15d
leaq -0x34(%rbp), %rdx
leaq -0x48(%rbp), %rcx
leaq -0x88(%rbp), %r8
leaq -0x4c(%rbp), %r9
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3b973
testl %eax, %eax
js 0x39af0
movl %eax, %r13d
pushq $0x6
popq %rdx
leal -0x1(%r14), %eax
cmpl $0x7, %eax
ja 0x39b12
movl $0x0, -0x2c(%rbp)
leaq 0x2b1b1(%rip), %rcx     # 0x64c8c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %r14, -0x40(%rbp)
movl %r15d, -0x30(%rbp)
jmpq *%rax
pushq $0x78
jmp 0x39b2c
movl 0x9f0c0(%rbx), %ecx
leaq 0x2b446(%rip), %rsi     # 0x64f43
pushq $0x2
popq %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0x455bc
pushq $-0x1
popq %rax
jmp 0x39c5a
cmpl $0x10, %r14d
je 0x39b36
cmpl $0x20, %r14d
jne 0x39c4e
movl %r15d, -0x30(%rbp)
movq %r14, -0x40(%rbp)
pushq $0x1
popq %rax
movl %eax, -0x2c(%rbp)
jmp 0x39b48
pushq $0x5
jmp 0x39b47
movl %r15d, -0x30(%rbp)
movq %r14, -0x40(%rbp)
movl $0xc0, -0x2c(%rbp)
pushq $0x4
popq %rdx
movl -0x4c(%rbp), %r14d
leaq 0x10(%rbx), %rax
movq %rax, -0x78(%rbp)
leaq 0x6f148(%rbx), %rax
movq %rax, -0x70(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x44(%rbp)
movq %rbx, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
subl $0x1, %r13d
jb 0x39c4e
leal (%rdx,%r14), %eax
addl $0x16, %eax
movl 0x9f0c0(%rbx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x39c4e
movq -0x80(%rbp), %r12
movq %r12, %rdi
movl %r14d, %esi
movq %rdx, %r15
callq 0x459f7
movl %eax, %ebx
addl -0x2c(%rbp), %ebx
leal (%r14,%r15), %esi
movq %r12, %rdi
pushq $0x16
popq %rdx
callq 0x45a39
movl %eax, %r12d
addl %r15d, %r14d
addl $0x16, %r14d
movq -0x40(%rbp), %rdi
movl %ebx, %esi
callq 0x452fd
testl %eax, %eax
je 0x39c2b
cvtsi2sd %r12d, %xmm0
mulsd 0x26d28(%rip), %xmm0    # 0x60910
decl %eax
cltq
imulq $0x498, %rax, %rax      # imm = 0x498
movq -0x78(%rbp), %rcx
movups (%rcx), %xmm1
movq -0x70(%rbp), %rcx
movups %xmm1, 0x20(%rcx,%rax)
movsd -0x68(%rbp), %xmm1
movsd %xmm1, 0x70(%rcx,%rax)
movl -0x44(%rbp), %edx
movl %edx, 0x98(%rcx,%rax)
movsd %xmm0, 0x100(%rcx,%rax)
movb $0x1, 0x490(%rcx,%rax)
jmp 0x39c41
pushq $0x2
popq %rdi
leaq 0x2bc0a(%rip), %rsi     # 0x6583f
movl -0x30(%rbp), %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x455bc
movq -0x60(%rbp), %rbx
movq -0x58(%rbp), %rdx
jmp 0x39b7a
xorl %ecx, %ecx
cmpl $0x0, -0x34(%rbp)
pushq $0xa
popq %rax
cmovnel %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq