// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_type1008(bamboo::rtcm_t*)
static int decode_type1008(rtcm_t *rtcm)
{
    char des[32]="",sno[32]="";
    char *msg;
    int i=24+12,j,staid,n,m,setup;
    
    n=getbitu(rtcm->buff,i+12,8);
    m=getbitu(rtcm->buff,i+28+8*n,8);
    
    if (i+36+8*(n+m)<=rtcm->len*8) {
        staid=getbitu(rtcm->buff,i,12); i+=12+8;
        for (j=0;j<n&&j<31;j++) {
            des[j]=(char)getbitu(rtcm->buff,i,8); i+=8;
        }
        setup=getbitu(rtcm->buff,i, 8); i+=8+8;
        for (j=0;j<m&&j<31;j++) {
            sno[j]=(char)getbitu(rtcm->buff,i,8); i+=8;
        }
    }
    else {
        trace(2,"rtcm3 1008 length error: len=%d\n",rtcm->len);
        return -1;
    }
    if (rtcm->outtype) {
        msg=rtcm->msgtype+strlen(rtcm->msgtype);
        sprintf(msg," staid=%4d",staid);
    }
    /* test station id */
    if (!test_staid(rtcm,staid)) return -1;
    
    strncpy(rtcm->sta.antdes,des,n); rtcm->sta.antdes[n]='\0';
    rtcm->sta.antsetup=setup;
    strncpy(rtcm->sta.antsno,sno,m); rtcm->sta.antsno[m]='\0';
    return 5;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
leaq 0x9f0c4(%rdi), %r12
movq %r12, %rdi
movl $0x30, %esi
movl $0x8, %edx
callq 0x4d9d6
movl %eax, %r14d
leal 0x40(,%r14,8), %esi
movq %r12, %rdi
movl $0x8, %edx
callq 0x4d9d6
movq %rax, -0x30(%rbp)
addl %r14d, %eax
leal 0x48(,%rax,8), %eax
movl 0x9f0c0(%rbx), %edx
leal (,%rdx,8), %ecx
cmpl %ecx, %eax
jle 0x3bdf8
leaq 0x33308(%rip), %rsi     # 0x6f0ef
movl $0x2, %edi
xorl %eax, %eax
callq 0x4d55d
jmp 0x3bf48
movq %r12, %rdi
movl $0x24, %esi
movl $0xc, %edx
callq 0x4d9d6
movl %eax, -0x38(%rbp)
testl %r14d, %r14d
movq %r14, -0x40(%rbp)
jle 0x3be56
leal -0x1(%r14), %eax
cmpl $0x1e, %eax
movl $0x1e, %r14d
cmovbl %eax, %r14d
incl %r14d
movl $0x38, %r13d
xorl %r15d, %r15d
movq %r12, %rdi
movl %r13d, %esi
movl $0x8, %edx
callq 0x4d9d6
movb %al, -0x80(%rbp,%r15)
addl $0x8, %r13d
incq %r15
cmpq %r15, %r14
jne 0x3be33
jmp 0x3be5c
movl $0x38, %r13d
movq %r12, %rdi
movl %r13d, %esi
movl $0x8, %edx
callq 0x4d9d6
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x30(%rbp)
jle 0x3beb3
addl $0x10, %r13d
movq -0x30(%rbp), %rax
decl %eax
cmpl $0x1e, %eax
movl $0x1e, %r14d
cmovbl %eax, %r14d
incl %r14d
xorl %r15d, %r15d
movq %r12, %rdi
movl %r13d, %esi
movl $0x8, %edx
callq 0x4d9d6
movb %al, -0x60(%rbp,%r15)
addl $0x8, %r13d
incq %r15
cmpq %r15, %r14
jne 0x3be92
cmpl $0x0, 0xc(%rbx)
movl -0x38(%rbp), %r14d
je 0x3bee5
leaq 0x9b9d0(%rbx), %rdi
callq 0x8290
leaq (%rbx,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
leaq 0x33209(%rip), %rsi     # 0x6f0e4
movl %r14d, %edx
xorl %eax, %eax
callq 0x8120
movq %rbx, %rdi
movl %r14d, %esi
callq 0x426d9
testl %eax, %eax
movq -0x40(%rbp), %rax
je 0x3bf48
leaq 0x6efb8(%rbx), %rdi
movslq %eax, %r15
leaq -0x80(%rbp), %rsi
movq %r15, %rdx
callq 0x8350
xorl %r12d, %r12d
movb %r12b, 0x6efb8(%rbx,%r15)
movl -0x34(%rbp), %eax
movl %eax, 0x6f0f8(%rbx)
leaq 0x6eff8(%rbx), %rdi
movslq -0x30(%rbp), %r14
leaq -0x60(%rbp), %rsi
movq %r14, %rdx
callq 0x8350
movb %r12b, 0x6eff8(%rbx,%r14)
movl $0x5, %eax
jmp 0x3bf4d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq