// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_type1007(bamboo::rtcm_t*)
static int decode_type1007(rtcm_t *rtcm)
{
    char des[32]="";
    char *msg;
    int i=24+12,j,staid,n,setup;
    
    n=getbitu(rtcm->buff,i+12,8);
    
    if (i+28+8*n<=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);
    }
    else {
        trace(2,"rtcm3 1007 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;
    rtcm->sta.antsno[0]='\0';
    return 5;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x93d0
movl $0x24, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
addl $0xc, %esi
movl $0x8, %edx
callq 0x8bfc0
movl %eax, -0x48(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1c, %eax
movl -0x48(%rbp), %ecx
shll $0x3, %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x70002
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0xc, %edx
callq 0x8bfc0
movl %eax, -0x44(%rbp)
movl -0x3c(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %ecx
xorl %eax, %eax
cmpl -0x48(%rbp), %ecx
movb %al, -0x4d(%rbp)
jge 0x6ffa6
cmpl $0x1f, -0x40(%rbp)
setl %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
testb $0x1, %al
jne 0x6ffaf
jmp 0x6ffe5
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x8, %edx
callq 0x8bfc0
movb %al, %cl
movslq -0x40(%rbp), %rax
movb %cl, -0x30(%rbp,%rax)
movl -0x3c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x6ff8f
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x3c(%rbp), %esi
movl $0x8, %edx
callq 0x8bfc0
movl %eax, -0x4c(%rbp)
jmp 0x7002b
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %edx
movl $0x2, %edi
leaq 0x512d0(%rip), %rsi     # 0xc12e8
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x700de
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x70076
movq -0x10(%rbp), %rax
addq $0x9b9d0, %rax          # imm = 0x9B9D0
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
callq 0x92e0
movq %rax, %rcx
movq -0x58(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movl -0x44(%rbp), %edx
leaq 0x5129a(%rip), %rsi     # 0xc1309
movb $0x0, %al
callq 0x9150
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x79f30
cmpl $0x0, %eax
jne 0x70090
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x700de
movq -0x10(%rbp), %rdi
addq $0x6ef38, %rdi          # imm = 0x6EF38
addq $0x80, %rdi
leaq -0x30(%rbp), %rsi
movslq -0x48(%rbp), %rdx
callq 0x93b0
movq -0x10(%rbp), %rax
movslq -0x48(%rbp), %rcx
movb $0x0, 0x6efb8(%rax,%rcx)
movl -0x4c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x6f0f8(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x6eff8(%rax)
movl $0x5, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)