// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_ssr1_head(bamboo::rtcm_t*, int, int*, int*, double*, int*, int*)
static int decode_ssr1_head(rtcm_t *rtcm, int sys, int *sync, int *iod,
                            double *udint, int *refd, int *hsize)
{
    double tod,tow;
    char *msg,tstr[64];
    int i=24+12,nsat,udi,provid=0,solid=0,ns;
    
    ns=sys==SYS_QZS?4:6;
    
    if (i+(sys==SYS_GLO?53:50+ns)>rtcm->len*8) return -1;
    
    if (sys==SYS_GLO) {
        tod=getbitu(rtcm->buff,i,17); i+=17;
        adjday_glot(rtcm,tod);
    }
    else {
        tow=getbitu(rtcm->buff,i,20); i+=20;
        adjweek(rtcm,tow);
    }
    udi   =getbitu(rtcm->buff,i, 4); i+= 4;
    *sync =getbitu(rtcm->buff,i, 1); i+= 1;
    *refd =getbitu(rtcm->buff,i, 1); i+= 1; /* satellite ref datum */
    *iod  =getbitu(rtcm->buff,i, 4); i+= 4; /* iod */
    provid=getbitu(rtcm->buff,i,16); i+=16; /* provider id */
    solid =getbitu(rtcm->buff,i, 4); i+= 4; /* solution id */
    nsat  =getbitu(rtcm->buff,i,ns); i+=ns;
    *udint=ssrudint[udi];
    
    time2str(rtcm->time,tstr,2);
    trace(4,"decode_ssr1_head: time=%s sys=%d nsat=%d sync=%d iod=%d provid=%d solid=%d\n",
          tstr,sys,nsat,*sync,*iod,provid,solid);
    
    if (rtcm->outtype) {
        msg=rtcm->msgtype+strlen(rtcm->msgtype);
        sprintf(msg," %s nsat=%2d iod=%2d udi=%2d sync=%d",tstr,nsat,*iod,udi,
                *sync);
    }
    *hsize=i;
    return nsat;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, %rbx
movq %rdi, %r15
xorl %eax, %eax
cmpl $0x10, %esi
setne %al
cmpl $0x4, %esi
leal 0x5a(%rax,%rax), %edi
movl $0x59, %r9d
cmovnel %edi, %r9d
movl 0x9f0c0(%r15), %edi
shll $0x3, %edi
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpl %edi, %r9d
jg 0x435cc
movq %r8, -0x68(%rbp)
movq %rcx, -0x48(%rbp)
movq %rdx, -0x50(%rbp)
leal 0x4(,%rax,2), %eax
movq %rax, -0x38(%rbp)
leaq 0x9f0c4(%r15), %r13
movl %esi, -0x3c(%rbp)
movq %r13, %rdi
cmpl $0x4, %esi
jne 0x43445
movl $0x24, %esi
movl $0x11, %edx
callq 0x4e341
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x432c4
movl $0x35, %r14d
jmp 0x43469
movl $0x24, %esi
movl $0x14, %edx
callq 0x4e341
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x4302b
movl $0x38, %r14d
movq %r13, %rdi
movl %r14d, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, -0x2c(%rbp)
leal 0x4(%r14), %esi
movq %r13, %rdi
movl $0x1, %edx
callq 0x4e341
movq -0x50(%rbp), %rcx
movl %eax, (%rcx)
leal 0x5(%r14), %esi
movq %r13, %rdi
movl $0x1, %edx
callq 0x4e341
movl %eax, (%rbx)
leal 0x6(%r14), %esi
movq %r13, %rdi
movl $0x4, %edx
callq 0x4e341
movq -0x48(%rbp), %r12
movl %eax, (%r12)
leal 0xa(%r14), %esi
movq %r13, %rdi
movl $0x10, %edx
callq 0x4e341
movq %rax, -0x60(%rbp)
leal 0x1a(%r14), %esi
movq %r13, %rdi
movl $0x4, %edx
callq 0x4e341
movq %rax, -0x58(%rbp)
leal 0x1e(%r14), %esi
movq %r13, %rdi
movq -0x38(%rbp), %rbx
movl %ebx, %edx
callq 0x4e341
movl %eax, %r13d
leal (%r14,%rbx), %eax
addl $0x1e, %eax
movl %eax, -0x38(%rbp)
movq -0x50(%rbp), %rbx
movslq -0x2c(%rbp), %rax
leaq 0x2b6e9(%rip), %rcx     # 0x6ec00
movsd (%rcx,%rax,8), %xmm0
movq -0x68(%rbp), %rax
movsd %xmm0, (%rax)
movq 0x10(%r15), %rdi
movsd 0x18(%r15), %xmm0
leaq -0xb0(%rbp), %r14
movq %r14, %rsi
movl $0x2, %edx
callq 0x50696
movl (%rbx), %r9d
movl (%r12), %r10d
subq $0x8, %rsp
leaq 0x2c318(%rip), %rsi     # 0x6f86c
movl $0x4, %edi
movq %r14, %rdx
movl -0x3c(%rbp), %ecx
movl %r13d, %r8d
xorl %eax, %eax
pushq -0x58(%rbp)
pushq -0x60(%rbp)
pushq %r10
callq 0x4ded0
addq $0x20, %rsp
cmpl $0x0, 0xc(%r15)
je 0x435c3
leaq 0x9b9d0(%r15), %rdi
callq 0x8290
leaq (%r15,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
movq -0x48(%rbp), %rax
movl (%rax), %r8d
movl (%rbx), %r10d
subq $0x8, %rsp
leaq 0x2c310(%rip), %rsi     # 0x6f8b8
leaq -0xb0(%rbp), %rdx
movl %r13d, %ecx
movl -0x2c(%rbp), %r9d
xorl %eax, %eax
pushq %r10
callq 0x8120
addq $0x10, %rsp
movq 0x10(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, (%rax)
movl %r13d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq