// File: /workspace/github_cpp_makefile_star2_O2/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
xorl %eax, %eax
cmpl $0x10, %esi
setne %al
cmpl $0x4, %esi
leal 0x5a(%rax,%rax), %r11d
pushq $0x59
popq %r10
cmovnel %r11d, %r10d
movq %rdi, %r15
movl 0x9f0c0(%rdi), %edi
shll $0x3, %edi
cmpl %edi, %r10d
jle 0x3b79b
pushq $-0x1
popq %rbx
jmp 0x3b95f
movq %r9, -0x38(%rbp)
movq %r8, -0x60(%rbp)
movq %rcx, -0x50(%rbp)
movq %rdx, -0x68(%rbp)
leal 0x4(,%rax,2), %eax
movq %rax, -0x40(%rbp)
leaq 0x9f0c4(%r15), %r13
movl %esi, -0x44(%rbp)
cmpl $0x4, %esi
jne 0x3b7e6
pushq $0x24
popq %rsi
pushq $0x11
popq %rdx
movq %r13, %rdi
callq 0x459f7
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x3b61c
pushq $0x35
jmp 0x3b805
pushq $0x24
popq %rsi
pushq $0x14
popq %rdx
movq %r13, %rdi
callq 0x459f7
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movq %r15, %rdi
callq 0x3b289
pushq $0x38
popq %r14
pushq $0x4
popq %rdx
movq %r13, %rdi
movl %r14d, %esi
callq 0x459f7
movl %eax, -0x2c(%rbp)
leal 0x4(%r14), %esi
pushq $0x1
popq %rbx
movq %r13, %rdi
movl %ebx, %edx
callq 0x459f7
movq -0x68(%rbp), %r12
movl %eax, (%r12)
leal 0x5(%r14), %esi
movq %r13, %rdi
movl %ebx, %edx
callq 0x459f7
movq -0x38(%rbp), %rcx
movl %eax, (%rcx)
leal 0x6(%r14), %esi
movq %r13, %rdi
pushq $0x4
popq %rbx
movl %ebx, %edx
callq 0x459f7
movq -0x50(%rbp), %rcx
movl %eax, (%rcx)
leal 0xa(%r14), %esi
pushq $0x10
popq %rdx
movq %r13, %rdi
callq 0x459f7
movq %rax, -0x38(%rbp)
leal 0x1a(%r14), %esi
movq %r13, %rdi
movl %ebx, %edx
callq 0x459f7
movq %rax, -0x58(%rbp)
leal 0x1e(%r14), %esi
movq %r13, %rdi
movq -0x40(%rbp), %r13
movl %r13d, %edx
callq 0x459f7
movl %eax, %ebx
leal (%r14,%r13), %eax
addl $0x1e, %eax
movl %eax, -0x40(%rbp)
movslq -0x2c(%rbp), %rax
leaq 0x29445(%rip), %rcx     # 0x64cf0
movsd (%rcx,%rax,8), %xmm0
movq -0x60(%rbp), %rax
movsd %xmm0, (%rax)
movq 0x10(%r15), %rdi
movsd 0x18(%r15), %xmm0
leaq -0xb0(%rbp), %r14
pushq $0x2
popq %rdx
movq %r14, %rsi
callq 0x47a48
movq %r12, %r13
movl (%r12), %r9d
movq -0x50(%rbp), %r12
movl (%r12), %r10d
subq $0x8, %rsp
leaq 0x29f7a(%rip), %rsi     # 0x65868
pushq $0x4
popq %rdi
movq %r14, %rdx
movl -0x44(%rbp), %ecx
movl %ebx, %r8d
xorl %eax, %eax
pushq -0x58(%rbp)
pushq -0x38(%rbp)
pushq %r10
callq 0x455bc
addq $0x20, %rsp
cmpl $0x0, 0xc(%r15)
je 0x3b956
leaq 0x9b9d0(%r15), %rdi
callq 0x8290
leaq (%r15,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
movl (%r12), %r8d
movl (%r13), %r10d
subq $0x8, %rsp
leaq 0x29f76(%rip), %rsi     # 0x658b4
leaq -0xb0(%rbp), %rdx
movl %ebx, %ecx
movl -0x2c(%rbp), %r9d
xorl %eax, %eax
pushq %r10
callq 0x8110
popq %rcx
popq %rdx
movq 0x10(%rbp), %rax
movl -0x40(%rbp), %ecx
movl %ecx, (%rax)
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq