// File: 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
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x93d0
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x93d0
movl $0x24, -0x5c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x5c(%rbp), %esi
addl $0xc, %esi
movl $0x8, %edx
callq 0x8bfc0
movl %eax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x5c(%rbp), %esi
addl $0x1c, %esi
movl -0x68(%rbp), %eax
shll $0x3, %eax
addl %eax, %esi
movl $0x8, %edx
callq 0x8bfc0
movl %eax, -0x6c(%rbp)
movl -0x5c(%rbp), %eax
addl $0x24, %eax
movl -0x68(%rbp), %ecx
addl -0x6c(%rbp), %ecx
shll $0x3, %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x70294
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x5c(%rbp), %esi
movl $0xc, %edx
callq 0x8bfc0
movl %eax, -0x64(%rbp)
movl -0x5c(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %ecx
xorl %eax, %eax
cmpl -0x68(%rbp), %ecx
movb %al, -0x71(%rbp)
jge 0x701d2
cmpl $0x1f, -0x60(%rbp)
setl %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x701db
jmp 0x70211
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x5c(%rbp), %esi
movl $0x8, %edx
callq 0x8bfc0
movb %al, %cl
movslq -0x60(%rbp), %rax
movb %cl, -0x30(%rbp,%rax)
movl -0x5c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x5c(%rbp)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x701bb
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x5c(%rbp), %esi
movl $0x8, %edx
callq 0x8bfc0
movl %eax, -0x70(%rbp)
movl -0x5c(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %ecx
xorl %eax, %eax
cmpl -0x6c(%rbp), %ecx
movb %al, -0x72(%rbp)
jge 0x70253
cmpl $0x1f, -0x60(%rbp)
setl %al
movb %al, -0x72(%rbp)
movb -0x72(%rbp), %al
testb $0x1, %al
jne 0x7025c
jmp 0x70292
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x5c(%rbp), %esi
movl $0x8, %edx
callq 0x8bfc0
movb %al, %cl
movslq -0x60(%rbp), %rax
movb %cl, -0x50(%rbp,%rax)
movl -0x5c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x5c(%rbp)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x7023c
jmp 0x702bd
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %edx
movl $0x2, %edi
leaq 0x5106a(%rip), %rsi     # 0xc1314
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x70394
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x70308
movq -0x10(%rbp), %rax
addq $0x9b9d0, %rax          # imm = 0x9B9D0
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
callq 0x92e0
movq %rax, %rcx
movq -0x80(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movl -0x64(%rbp), %edx
leaq 0x51008(%rip), %rsi     # 0xc1309
movb $0x0, %al
callq 0x9150
movq -0x10(%rbp), %rdi
movl -0x64(%rbp), %esi
callq 0x79f30
cmpl $0x0, %eax
jne 0x70322
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x70394
movq -0x10(%rbp), %rdi
addq $0x6ef38, %rdi          # imm = 0x6EF38
addq $0x80, %rdi
leaq -0x30(%rbp), %rsi
movslq -0x68(%rbp), %rdx
callq 0x93b0
movq -0x10(%rbp), %rax
movslq -0x68(%rbp), %rcx
movb $0x0, 0x6efb8(%rax,%rcx)
movl -0x70(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x6f0f8(%rax)
movq -0x10(%rbp), %rdi
addq $0x6ef38, %rdi          # imm = 0x6EF38
addq $0xc0, %rdi
leaq -0x50(%rbp), %rsi
movslq -0x6c(%rbp), %rdx
callq 0x93b0
movq -0x10(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movb $0x0, 0x6eff8(%rax,%rcx)
movl $0x5, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq