LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::getbits3(unsigned char const*, int, int, int, int, int, int)
static int getbits3(const unsigned char *buff, int p1, int l1, int p2, int l2,
                    int p3, int l3)
{
    if (getbitu(buff,p1,1))
        return (int)((getbits(buff,p1,l1)<<(l2+l3))+
                   (getbitu(buff,p2,l2)<<l3)+getbitu(buff,p3,l3));
    else
        return (int)getbitu3(buff,p1,l1,p2,l2,p3,l3);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl $0x1, %edx
callq 0x8bfc0
cmpl $0x0, %eax
je 0x64a6b
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x8c050
movl -0x20(%rbp), %ecx
addl 0x10(%rbp), %ecx
shll %cl, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
callq 0x8bfc0
movl %eax, %edx
movl -0x2c(%rbp), %eax
movl 0x10(%rbp), %ecx
shll %cl, %edx
movl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movl 0x10(%rbp), %edx
callq 0x8bfc0
movl %eax, %ecx
movl -0x28(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x64a8e
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
movl -0x24(%rbp), %r9d
movl 0x10(%rbp), %eax
movl %eax, (%rsp)
callq 0x64aa0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::test_glostr(unsigned char const*)
extern int test_glostr(const unsigned char *buff)
{
    static const unsigned char xor_8bit[256]={ /* xor of 8 bits */
        0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
        1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
        1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
        0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
        1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
        0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
        0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
        1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
    };
    static const unsigned char mask_hamming[][12]={ /* mask of hamming codes */
        {0x55,0x55,0x5A,0xAA,0xAA,0xAA,0xB5,0x55,0x6A,0xD8,0x08},
        {0x66,0x66,0x6C,0xCC,0xCC,0xCC,0xD9,0x99,0xB3,0x68,0x10},
        {0x87,0x87,0x8F,0x0F,0x0F,0x0F,0x1E,0x1E,0x3C,0x70,0x20},
        {0x07,0xF8,0x0F,0xF0,0x0F,0xF0,0x1F,0xE0,0x3F,0x80,0x40},
        {0xF8,0x00,0x0F,0xFF,0xF0,0x00,0x1F,0xFF,0xC0,0x00,0x80},
        {0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x01,0x00},
        {0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00},
        {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8}
    };
    unsigned char cs;
    int i,j,n=0;
    
    for (i=0;i<8;i++) {
        for (j=0,cs=0;j<11;j++) {
            cs^=xor_8bit[buff[j]&mask_hamming[i][j]];
        }
        if (cs) n++;
    }
    return n==0||(n==2&&cs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x8, -0x10(%rbp)
jge 0x64bd3
movl $0x0, -0x14(%rbp)
movb $0x0, -0x9(%rbp)
cmpl $0xb, -0x14(%rbp)
jge 0x64bb7
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movslq -0x10(%rbp), %rdx
leaq 0x5a4ec(%rip), %rcx     # 0xbf070
imulq $0xc, %rdx, %rdx
addq %rdx, %rcx
movslq -0x14(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
andl %ecx, %eax
movslq %eax, %rcx
leaq 0x5a3d1(%rip), %rax     # 0xbef70
movzbl (%rax,%rcx), %ecx
movzbl -0x9(%rbp), %eax
xorl %ecx, %eax
movb %al, -0x9(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x64b67
cmpb $0x0, -0x9(%rbp)
je 0x64bc6
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x64bc8
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x64b56
movb $0x1, %al
cmpl $0x0, -0x18(%rbp)
movb %al, -0x19(%rbp)
je 0x64bf9
xorl %eax, %eax
cmpl $0x2, -0x18(%rbp)
movb %al, -0x1a(%rbp)
jne 0x64bf3
cmpb $0x0, -0x9(%rbp)
setne %al
movb %al, -0x1a(%rbp)
movb -0x1a(%rbp), %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::decode_frame(unsigned char const*, bamboo::eph_t*, bamboo::alm_t*, double*, double*, int*)
extern int decode_frame(const unsigned char *buff, eph_t *eph, alm_t *alm,
                        double *ion, double *utc, int *leaps)
{
    int id=getbitu(buff,43,3); /* subframe id */
    
    trace(3,"decodefrm: id=%d\n",id);
    
    switch (id) {
        case 1: return decode_subfrm1(buff,eph);
        case 2: return decode_subfrm2(buff,eph);
        case 3: return decode_subfrm3(buff,eph);
        case 4: return decode_subfrm4(buff,alm,ion,utc,leaps);
        case 5: return decode_subfrm5(buff,alm,ion,utc,leaps);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2b, %esi
movl $0x3, %edx
movl %edx, -0x4c(%rbp)
callq 0x8bfc0
movl -0x4c(%rbp), %edi
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %edx
leaq 0x59ded(%rip), %rsi     # 0xbf303
xorl %eax, %eax
callq 0x8b980
movl -0x3c(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x4, %eax
ja 0x655b7
movq -0x48(%rbp), %rax
leaq 0x599d4(%rip), %rcx     # 0xbef10
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x655d0
movl %eax, -0x4(%rbp)
jmp 0x655be
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x658f0
movl %eax, -0x4(%rbp)
jmp 0x655be
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x65b90
movl %eax, -0x4(%rbp)
jmp 0x655be
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
callq 0x65f90
movl %eax, -0x4(%rbp)
jmp 0x655be
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
callq 0x66050
movl %eax, -0x4(%rbp)
jmp 0x655be
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::decode_subfrm4(unsigned char const*, bamboo::alm_t*, double*, double*, int*)
static int decode_subfrm4(const unsigned char *buff, alm_t *alm, double *ion,
                          double *utc, int *leaps)
{
    int dataid=getbitu(buff,48,2);
    
    trace(4,"decode_subfrm4: dataid=%d\n",dataid);
    trace(5,"decode_subfrm4: buff="); traceb(5,buff,30);
    
    if (dataid==1) { /* gps */
        decode_gps_subfrm4(buff,alm,ion,utc,leaps);
    }
    else if (dataid==3) { /* qzss */
        decode_qzs_subfrm45(buff,alm,ion,utc,leaps);
    }
    return 4;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl $0x30, %esi
movl $0x2, %edx
callq 0x8bfc0
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %edx
movl $0x4, %edi
leaq 0x59412(%rip), %rsi     # 0xbf3e3
movb $0x0, %al
callq 0x8b980
movl $0x5, %edi
leaq 0x5941a(%rip), %rsi     # 0xbf3fe
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rsi
movl $0x5, %edi
movl $0x1e, %edx
callq 0x95900
cmpl $0x1, -0x2c(%rbp)
jne 0x6601f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x66d70
jmp 0x66040
cmpl $0x3, -0x2c(%rbp)
jne 0x6603e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x671c0
jmp 0x66040
movl $0x4, %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::decode_subfrm5(unsigned char const*, bamboo::alm_t*, double*, double*, int*)
static int decode_subfrm5(const unsigned char *buff, alm_t *alm, double *ion,
                          double *utc, int *leaps)
{
    int dataid=getbitu(buff,48,2);
    
    trace(4,"decode_subfrm5: dataid=%d\n",dataid);
    trace(5,"decode_subfrm5: buff="); traceb(5,buff,30);
    
    if (dataid==1) { /* gps */
        decode_gps_subfrm5(buff,alm);
    }
    else if (dataid==3) { /* qzss */
        decode_qzs_subfrm45(buff,alm,ion,utc,leaps);
    }
    return 5;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl $0x30, %esi
movl $0x2, %edx
callq 0x8bfc0
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %edx
movl $0x4, %edi
leaq 0x5939c(%rip), %rsi     # 0xbf42d
movb $0x0, %al
callq 0x8b980
movl $0x5, %edi
leaq 0x593a4(%rip), %rsi     # 0xbf448
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rsi
movl $0x5, %edi
movl $0x1e, %edx
callq 0x95900
cmpl $0x1, -0x2c(%rbp)
jne 0x660d3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x67bd0
jmp 0x660f4
cmpl $0x3, -0x2c(%rbp)
jne 0x660f2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
callq 0x671c0
jmp 0x660f4
movl $0x5, %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::free_raw(bamboo::raw_t*)
extern void free_raw(raw_t *raw)
{
    half_cyc_t *p,*next;
    
    trace(3,"free_raw:\n");
    
    free(raw->obs.data ); raw->obs.data =NULL; raw->obs.n =0;
    free(raw->obuf.data); raw->obuf.data=NULL; raw->obuf.n=0;
    free(raw->nav.eph  ); raw->nav.eph  =NULL; raw->nav.n =0;
    free(raw->nav.alm  ); raw->nav.alm  =NULL; raw->nav.na=0;
    free(raw->nav.geph ); raw->nav.geph =NULL; raw->nav.ng=0;
    free(raw->nav.seph ); raw->nav.seph =NULL; raw->nav.ns=0;
    
    /* free half-cycle correction list */
    for (p=raw->half_cyc;p;p=next) {
        next=p->next;
        free(p);
    }
    raw->half_cyc=NULL;
    
    /* free receiver dependent data */
    switch (raw->format) {
       // case STRFMT_CMR : free_cmr (raw); break;
        case STRFMT_RT17: free_rt17(raw); break;
    }
    raw->rcv_data=NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x3, %edi
leaq 0x588a2(%rip), %rsi     # 0xbf32a
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rax
movq 0x1d28(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x1d28(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x1d20(%rax)
movq -0x8(%rbp), %rax
movq 0x1d38(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x1d38(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x1d30(%rax)
movq -0x8(%rbp), %rax
movq 0x1d80(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x1d80(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x1d40(%rax)
movq -0x8(%rbp), %rax
movq 0x1da8(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x1da8(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x1d68(%rax)
movq -0x8(%rbp), %rax
movq 0x1d88(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x1d88(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x1d48(%rax)
movq -0x8(%rbp), %rax
movq 0x1d90(%rax), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x1d90(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x1d50(%rax)
movq -0x8(%rbp), %rax
movq 0x82b90(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x66bd2
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9900
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x66bac
movq -0x8(%rbp), %rax
movq $0x0, 0x82b90(%rax)
movq -0x8(%rbp), %rax
movl 0x82b98(%rax), %eax
subl $0xc, %eax
jne 0x66bfb
jmp 0x66bf2
movq -0x8(%rbp), %rdi
callq 0x67dd0
movq -0x8(%rbp), %rax
movq $0x0, 0x82ba0(%rax)
addq $0x20, %rsp
popq %rbp
retq
// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::input_raw(bamboo::raw_t*, int, unsigned char)
extern int input_raw(raw_t *raw, int format, unsigned char data)
{
    trace(5,"input_raw: format=%d data=0x%02x\n",format,data);
    
    switch (format) {
//        case STRFMT_OEM4 : return input_oem4 (raw,data);
//        case STRFMT_OEM3 : return input_oem3 (raw,data);
        case STRFMT_UBX  : return input_ubx  (raw,data);
//        case STRFMT_SS2  : return input_ss2  (raw,data);
//        case STRFMT_CRES : return input_cres (raw,data);
        case STRFMT_STQ  : return input_stq  (raw,data);
//        case STRFMT_GW10 : return input_gw10 (raw,data);
//        case STRFMT_JAVAD: return input_javad(raw,data);
//        case STRFMT_NVS  : return input_nvs  (raw,data);
        case STRFMT_BINEX: return input_bnx  (raw,data);
        case STRFMT_RT17 : return input_rt17 (raw,data);
//        case STRFMT_SEPT : return input_sbf  (raw,data);
//        case STRFMT_CMR  : return input_cmr  (raw,data);
//        case STRFMT_TERSUS: return input_tersus(raw,data);
//        case STRFMT_LEXR : return input_lexr (raw,data);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movb %al, -0x15(%rbp)
movl -0x14(%rbp), %edx
movzbl -0x15(%rbp), %ecx
leaq 0x58703(%rip), %rsi     # 0xbf335
xorl %eax, %eax
movl $0x5, %edi
callq 0x8b980
movl -0x14(%rbp), %eax
addl $-0x4, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x8, %eax
ja 0x66cab
movq -0x20(%rbp), %rax
leaq 0x582ca(%rip), %rcx     # 0xbef24
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movzbl -0x15(%rbp), %esi
callq 0xa8760
movl %eax, -0x4(%rbp)
jmp 0x66cb2
movq -0x10(%rbp), %rdi
movzbl -0x15(%rbp), %esi
callq 0x99cb0
movl %eax, -0x4(%rbp)
jmp 0x66cb2
movq -0x10(%rbp), %rdi
movzbl -0x15(%rbp), %esi
callq 0x5aa90
movl %eax, -0x4(%rbp)
jmp 0x66cb2
movq -0x10(%rbp), %rdi
movzbl -0x15(%rbp), %esi
callq 0x67fd0
movl %eax, -0x4(%rbp)
jmp 0x66cb2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::input_rawf(bamboo::raw_t*, int, _IO_FILE*)
extern int input_rawf(raw_t *raw, int format, FILE *fp)
{
    trace(4,"input_rawf: format=%d\n",format);
    
    switch (format) {
//        case STRFMT_OEM4 : return input_oem4f (raw,fp);
//        case STRFMT_OEM3 : return input_oem3f (raw,fp);
        case STRFMT_UBX  : return input_ubxf  (raw,fp);
//        case STRFMT_SS2  : return input_ss2f  (raw,fp);
//        case STRFMT_CRES : return input_cresf (raw,fp);
        case STRFMT_STQ  : return input_stqf  (raw,fp);
//        case STRFMT_GW10 : return input_gw10f (raw,fp);
//        case STRFMT_JAVAD: return input_javadf(raw,fp);
//        case STRFMT_NVS  : return input_nvsf  (raw,fp);
        case STRFMT_BINEX: return input_bnxf  (raw,fp);
        case STRFMT_RT17 : return input_rt17f (raw,fp);
//        case STRFMT_SEPT : return input_sbff  (raw,fp);
//        case STRFMT_CMR  : return input_cmrf  (raw,fp);
//        case STRFMT_TERSUS: return input_tersusf(raw,fp);
//        case STRFMT_LEXR : return input_lexrf (raw,fp);
    }
    return -2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl -0x14(%rbp), %edx
leaq 0x5867a(%rip), %rsi     # 0xbf357
xorl %eax, %eax
movl $0x4, %edi
callq 0x8b980
movl -0x14(%rbp), %eax
addl $-0x4, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x8, %eax
ja 0x66d56
movq -0x28(%rbp), %rax
leaq 0x58243(%rip), %rcx     # 0xbef48
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xa8b30
movl %eax, -0x4(%rbp)
jmp 0x66d5d
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x9a110
movl %eax, -0x4(%rbp)
jmp 0x66d5d
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x5b080
movl %eax, -0x4(%rbp)
jmp 0x66d5d
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x68a80
movl %eax, -0x4(%rbp)
jmp 0x66d5d
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::free_rt17(bamboo::raw_t*)
EXPORT void free_rt17(raw_t *Raw)
{
    rt17_t *rt17 = NULL;
    
    if (Raw->format != STRFMT_RT17)
        return;
 
    if ((rt17 = (rt17_t*) Raw->rcv_data))
    {
        if (rt17->MessageBuffer)
        {
            memset(rt17->MessageBuffer, 0, MBUFF_LENGTH);
            free(rt17->MessageBuffer);
            rt17->MessageBuffer = NULL;
        }

        if (rt17->PacketBuffer)
        {
            memset(rt17->PacketBuffer, 0, PBUFF_LENGTH);
            free(rt17->PacketBuffer);
            rt17->PacketBuffer = NULL;
        }

        memset(rt17, 0, sizeof(rt17_t));
        free(rt17);
        Raw->rcv_data = NULL;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpl $0xc, 0x82b98(%rax)
je 0x67df6
jmp 0x67ea3
movq -0x8(%rbp), %rax
movq 0x82ba0(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x67ea3
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x67e43
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %esi, %esi
movl $0x2000, %edx           # imm = 0x2000
callq 0x93d0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x9900
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x67e7b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
movl $0x105, %edx            # imm = 0x105
callq 0x93d0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x9900
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x93d0
movq -0x10(%rbp), %rdi
callq 0x9900
movq -0x8(%rbp), %rax
movq $0x0, 0x82ba0(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::init_rt17(bamboo::raw_t*)
EXPORT int init_rt17(raw_t *Raw)
{
	rt17_t *rt17 = NULL;
    unsigned char *MessageBuffer = NULL, *PacketBuffer = NULL;

    if (Raw->format != STRFMT_RT17)
       return 0;
 
    if (!(rt17 = (rt17_t*) calloc(1, sizeof(rt17_t))))
    {
        tracet(0, "RT17: unable to allocate RT17 dependent private data structure.\n");
        return 0;
    }
    Raw->rcv_data = (void*) rt17;
    
    if (!(MessageBuffer = (unsigned char*) calloc(MBUFF_LENGTH, sizeof(unsigned char))))
    {
        tracet(0, "RT17: unable to allocate RT17 message buffer.\n");
        free_rt17(Raw);
        return 0;
    }
    rt17->MessageBuffer = MessageBuffer;

    if (!(PacketBuffer = (unsigned char*) calloc(PBUFF_LENGTH, sizeof(unsigned char))))
    {
        tracet(0, "RT17: unable to allocate RT17 packet buffer.\n");
        free_rt17(Raw);
        return 0;
    }
    rt17->PacketBuffer = PacketBuffer;

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpl $0xc, 0x82b98(%rax)
je 0x67eed
movl $0x0, -0x4(%rbp)
jmp 0x67fc5
movl $0x1, %edi
movl $0x38, %esi
callq 0x94f0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x67f22
xorl %edi, %edi
leaq 0x57679(%rip), %rsi     # 0xbf588
movb $0x0, %al
callq 0x95890
movl $0x0, -0x4(%rbp)
jmp 0x67fc5
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x82ba0(%rax)
movl $0x2000, %edi           # imm = 0x2000
movl $0x1, %esi
callq 0x94f0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x67f6c
xorl %edi, %edi
leaq 0x57676(%rip), %rsi     # 0xbf5c9
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rdi
callq 0x67dd0
movl $0x0, -0x4(%rbp)
jmp 0x67fc5
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x105, %edi            # imm = 0x105
movl $0x1, %esi
callq 0x94f0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x67fb2
xorl %edi, %edi
leaq 0x5765f(%rip), %rsi     # 0xbf5f8
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rdi
callq 0x67dd0
movl $0x0, -0x4(%rbp)
jmp 0x67fc5
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::SyncPacket(bamboo::rt17_t*, unsigned char)
static int SyncPacket(rt17_t *rt17, unsigned char Data)
{
    unsigned char Type, *PacketBuffer = rt17->PacketBuffer;

    PacketBuffer[0] = PacketBuffer[1];
    PacketBuffer[1] = PacketBuffer[2];
    PacketBuffer[2] = PacketBuffer[3];
    PacketBuffer[3] = Data;

    Type = PacketBuffer[2];

    /*
    | Byte 0 must be an STX character.
    | Byte 1 = status byte which we always ignore (for now).
    | Byte 2 = packet type which must be GENOUT (0x40) RAWDATA (0x57) or RETSVDATA (0x55) (for now).
    | Byte 3 = data length which must be non-zero for any packet we're interested in.
    */
    return ((PacketBuffer[0] == STX) && (Data != 0) && ((Type == GENOUT) || (Type == RAWDATA) || (Type == RETSVDATA)));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb 0x1(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
movb 0x2(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x18(%rbp), %rax
movb 0x3(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x2(%rax)
movb -0x9(%rbp), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x18(%rbp), %rax
movb 0x2(%rax), %al
movb %al, -0xa(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2, %ecx
movb %al, -0x19(%rbp)
jne 0x68585
movzbl -0x9(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x19(%rbp)
je 0x68585
movzbl -0xa(%rbp), %ecx
movb $0x1, %al
cmpl $0x40, %ecx
movb %al, -0x1a(%rbp)
je 0x6857f
movzbl -0xa(%rbp), %ecx
movb $0x1, %al
cmpl $0x57, %ecx
movb %al, -0x1a(%rbp)
je 0x6857f
movzbl -0xa(%rbp), %eax
cmpl $0x55, %eax
sete %al
movb %al, -0x1a(%rbp)
movb -0x1a(%rbp), %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
popq %rbp
retq
nop
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::ClearPacketBuffer(bamboo::rt17_t*)
static void ClearPacketBuffer(rt17_t *rt17)
{
    unsigned char *PacketBuffer = rt17->PacketBuffer;
    int i;

    for (i = 0; i < 4; i++)
        PacketBuffer[i] = 0;

    rt17->PacketLength = rt17->PacketBytes = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jge 0x685c8
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x685ab
movq -0x8(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x28(%rax)
popq %rbp
retq
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::CheckPacketChecksum(unsigned char*)
static int CheckPacketChecksum(unsigned char *PacketBuffer)
{
    unsigned char Checksum = 0;
    unsigned char *p = &PacketBuffer[1];        /* Starting with status */
    unsigned int Length = PacketBuffer[3] + 3; /* status, type, length, data */
  
    /* Compute the packet checksum */
    while (Length > 0)
    {
        Checksum += *p++;
        Length--;
    }

    /*
    | Make sure our computed checksum matches the one at the end of the packet.
    | (Note that the above loop by design very conveniently left *p pointing
    |  to the checksum byte at the end of the packet.)
    */ 
    return (Checksum == *p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movb $0x0, -0x9(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movzbl 0x3(%rax), %eax
addl $0x3, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jbe 0x68632
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %ecx
movzbl -0x9(%rbp), %eax
addl %ecx, %eax
movb %al, -0x9(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x68606
movzbl -0x9(%rbp), %eax
movq -0x18(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
popq %rbp
retq
nopl (%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeRetsvdata(bamboo::raw_t*)
static int DecodeRetsvdata(raw_t *Raw)
{
    rt17_t *rt17 = (rt17_t*) Raw->rcv_data;
    unsigned char *PacketBuffer = rt17->PacketBuffer;
    int Ret = 0;
    char *Subtype_s = NULL;
    unsigned char Subtype = PacketBuffer[4];

    if (Subtype < (sizeof(RetsvdataTable) / sizeof(char*)))
        Subtype_s = (char*) RetsvdataTable[Subtype];
  
    if (!Subtype_s)
        Subtype_s = "Unknown";
 
    tracet(3, "RT17: Trimble packet type=0x55 (RETSVDATA), Subtype=%d (%s), Length=%d.\n", Subtype, Subtype_s, rt17->PacketLength);
      
    /* Process (or possibly ignore) the message */
    switch (Subtype)
    {
    case 1:
        Ret = DecodeGPSEphemeris(Raw);
        break;
    case 3:
        Ret = DecodeIONAndUTCData(Raw);
        break;
    case 9:
        Ret = DecodeGLONASSEphemeris(Raw);
        break;
    case 11:
        Ret = DecodeGalileoEphemeris(Raw);
        break;
    case 14:
        Ret = DecodeQZSSEphemeris(Raw);
        break;
    case 21:
        Ret = DecodeBeidouEphemeris(Raw);
        break;
    default:
        tracet(3, "RT17: Packet not processed.\n");      
    }

    return Ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x82ba0(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movb 0x4(%rax), %al
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %eax
cmpq $0x17, %rax
jae 0x686af
movzbl -0x29(%rbp), %eax
movl %eax, %ecx
leaq 0x8f839(%rip), %rax     # 0xf7ee0
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x686c1
leaq 0x571f5(%rip), %rax     # 0xbf8b2
movq %rax, -0x28(%rbp)
movzbl -0x29(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x28(%rax), %r8d
leaq 0x57932(%rip), %rsi     # 0xc000a
xorl %eax, %eax
movl $0x3, %edi
callq 0x95890
movzbl -0x29(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x14, %eax
ja 0x6875d
movq -0x38(%rbp), %rax
leaq 0x56d60(%rip), %rcx     # 0xbf460
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
callq 0x69dc0
movl %eax, -0x1c(%rbp)
jmp 0x68770
movq -0x8(%rbp), %rdi
callq 0x6a640
movl %eax, -0x1c(%rbp)
jmp 0x68770
movq -0x8(%rbp), %rdi
callq 0x6a820
movl %eax, -0x1c(%rbp)
jmp 0x68770
movq -0x8(%rbp), %rdi
callq 0x6a850
movl %eax, -0x1c(%rbp)
jmp 0x68770
movq -0x8(%rbp), %rdi
callq 0x6a880
movl %eax, -0x1c(%rbp)
jmp 0x68770
movq -0x8(%rbp), %rdi
callq 0x6a8b0
movl %eax, -0x1c(%rbp)
jmp 0x68770
movl $0x3, %edi
leaq 0x57660(%rip), %rsi     # 0xbfdc9
movb $0x0, %al
callq 0x95890
movl -0x1c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::ClearMessageBuffer(bamboo::rt17_t*)
static void ClearMessageBuffer(rt17_t *rt17)
{
   unsigned char *MessageBuffer = rt17->MessageBuffer;
   int i;
   
   for (i = 0; i < 4; i++)
       MessageBuffer[i] = 0;

    rt17->MessageLength = rt17->MessageBytes = 0;
    rt17->Reply = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jge 0x687b7
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6879a
movq -0x8(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x30(%rax)
popq %rbp
retq
nopw (%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeRawdata(bamboo::raw_t*)
static int DecodeRawdata(raw_t *Raw)
{
    rt17_t *rt17 = (rt17_t*) Raw->rcv_data;
    unsigned char *MessageBuffer = rt17->MessageBuffer;
    int Ret = 0;
    unsigned int rif;
    char *RecordType_s = NULL;
    unsigned char RecordType = MessageBuffer[4];
 
    if (RecordType < (sizeof(RawdataTable) / sizeof(char*)))
        RecordType_s = (char*) RawdataTable[RecordType];

    if (!RecordType_s)
        RecordType_s = "Unknown";
  
    tracet(3, "RT17: Trimble packet type=0x57 (RAWDATA), Recordtype=%d (%s), Length=%d.\n", RecordType, RecordType_s, rt17->MessageLength);
      
    /*
    | Reassemble origional message by removing packet headers,
    | trailers and page framing.
    */
    UnwrapRawdata(rt17, &rif);

    /* Process (or possibly ignore) the message */
    switch (RecordType)
    {
    case 0:
        Ret = DecodeType17(Raw, rif);
        break;
    case 7:
        Ret = DecodeType29(Raw);
        break;
    default:
        tracet(3, "RT17: Packet not processed.\n");      
    }

    return Ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x82ba0(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movb 0x4(%rax), %al
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %eax
cmpq $0x8, %rax
jae 0x6883e
movzbl -0x29(%rbp), %eax
movl %eax, %ecx
leaq 0x8f66a(%rip), %rax     # 0xf7ea0
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x68850
leaq 0x57066(%rip), %rax     # 0xbf8b2
movq %rax, -0x28(%rbp)
movzbl -0x29(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x20(%rax), %r8d
leaq 0x57518(%rip), %rsi     # 0xbfd7f
xorl %eax, %eax
movl $0x3, %edi
callq 0x95890
movq -0x10(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x691f0
movzbl -0x29(%rbp), %eax
movl %eax, -0x30(%rbp)
testl %eax, %eax
je 0x68897
jmp 0x6888d
movl -0x30(%rbp), %eax
subl $0x7, %eax
je 0x688a8
jmp 0x688b6
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x692f0
movl %eax, -0x1c(%rbp)
jmp 0x688c9
movq -0x8(%rbp), %rdi
callq 0x69a70
movl %eax, -0x1c(%rbp)
jmp 0x688c9
movl $0x3, %edi
leaq 0x57507(%rip), %rsi     # 0xbfdc9
movb $0x0, %al
callq 0x95890
movl -0x1c(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::input_rt17f(bamboo::raw_t*, _IO_FILE*)
EXPORT int input_rt17f(raw_t *Raw, FILE *fp)
{
    int i, Data, Ret;
    
    for (i = 0; i < 4096; i++)
    {
	if ((Data = fgetc(fp)) == EOF) return -2;
	    if ((Ret = input_rt17(Raw, (unsigned char) Data))) return Ret;
    }

    return 0; /* return at every 4k bytes */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x1000, -0x1c(%rbp)    # imm = 0x1000
jge 0x68ae6
movq -0x18(%rbp), %rdi
callq 0x9b80
movl %eax, -0x20(%rbp)
cmpl $-0x1, %eax
jne 0x68aba
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x68aed
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
movzbl %al, %esi
callq 0x67fd0
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
je 0x68ad9
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x68aed
jmp 0x68adb
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x68a97
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::UnwrapGenout(bamboo::rt17_t*)
static void UnwrapGenout(rt17_t *rt17)
{
    unsigned char *p_in = rt17->MessageBuffer;
    unsigned char *p_out = p_in;
    unsigned int InputLength, InputLengthTotal = rt17->MessageLength;
    unsigned int OutputLength, OutputLengthTotal = 0;

    while (InputLengthTotal > 0)
    {
        InputLength = p_in[3] + 6;
        OutputLength = p_in[3] - 3;
        memmove(p_out, p_in + 7, OutputLength);
        p_in += InputLength;
        p_out += OutputLength;
        OutputLengthTotal += OutputLength;
        InputLengthTotal -= InputLength;  
    }
    rt17->MessageBytes = rt17->MessageLength = OutputLengthTotal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x0, -0x20(%rbp)
jbe 0x68b9e
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
addl $0x6, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
subl $0x3, %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x7, %rsi
movl -0x24(%rbp), %eax
movl %eax, %edx
callq 0x9c00
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl -0x24(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x68b30
movl -0x28(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeGSOF1(bamboo::raw_t*, unsigned char*)
static int DecodeGSOF1(raw_t *Raw, unsigned char *p)
{

    if (p[1] < 6)
        tracet(2, "RT17: GSOF Position Time message record length %d < 6 bytes. Record discarded.\n", p[1]);
    else
        SetWeek(Raw, I2(p+6), ((double) I4(p+2)) * 0.001);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x6, %eax
jge 0x68bfa
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %edx
movl $0x2, %edi
leaq 0x56f20(%rip), %rsi     # 0xbfb11
movb $0x0, %al
callq 0x95890
jmp 0x68c3c
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x6, %rdi
callq 0x69090
cwtl
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
callq 0x690d0
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
cvtsi2sd %eax, %xmm0
movsd 0x55115(%rip), %xmm1    # 0xbdd48
mulsd %xmm1, %xmm0
callq 0x68f80
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeGSOF3(bamboo::raw_t*, unsigned char*)
static int DecodeGSOF3(raw_t *Raw, unsigned char *p)
{
    sta_t *sta = &Raw->sta;
 
    if (p[1] < 24)
        tracet( 2, "RT17: GSOF ECEF Position record length %d < 24 bytes. Record discarded.\n", p[1] );
    else
    {
        sta->pos[0] = R8(p+2);
        sta->pos[1] = R8(p+10);
        sta->pos[2] = R8(p+18);
        sta->del[0] = 0.0;
        sta->del[1] = 0.0;
        sta->del[2] = 0.0;
        sta->hgt    = 0.0;
        sta->deltype = 0;  /* e/n/u */
    }

    return 5;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
addq $0x70c38, %rax          # imm = 0x70C38
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x18, %eax
jge 0x68c9b
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %edx
movl $0x2, %edi
leaq 0x56f49(%rip), %rsi     # 0xbfbd8
movb $0x0, %al
callq 0x95890
jmp 0x68d30
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
callq 0x69120
movq -0x18(%rbp), %rax
movsd %xmm0, 0x1d0(%rax)
movq -0x10(%rbp), %rdi
addq $0xa, %rdi
callq 0x69120
movq -0x18(%rbp), %rax
movsd %xmm0, 0x1d8(%rax)
movq -0x10(%rbp), %rdi
addq $0x12, %rdi
callq 0x69120
movq -0x18(%rbp), %rax
movsd %xmm0, 0x1e0(%rax)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x1e8(%rax)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x1f0(%rax)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x1f8(%rax)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x200(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x1c8(%rax)
movl $0x5, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeGSOF15(bamboo::raw_t*, unsigned char*)
static int DecodeGSOF15(raw_t *Raw, unsigned char *p)
{
    if (p[1] < 15)
        tracet(2, "RT17: GSOF Receiver Serial Number record length %d < 15 bytes. Record discarded.\n", p[1]);
    else
        sprintf(Raw->sta.recsno, "%u", U4(p+2));

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0xf, %eax
jge 0x68d7a
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %edx
movl $0x2, %edi
leaq 0x56eb0(%rip), %rsi     # 0xbfc21
movb $0x0, %al
callq 0x95890
jmp 0x68daf
movq -0x8(%rbp), %rax
addq $0x70c38, %rax          # imm = 0x70C38
addq $0x180, %rax            # imm = 0x180
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
callq 0x691a0
movq -0x18(%rbp), %rdi
movl %eax, %edx
leaq 0x56ecb(%rip), %rsi     # 0xbfc73
movb $0x0, %al
callq 0x9150
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeGSOF16(bamboo::raw_t*, unsigned char*)
static int DecodeGSOF16(raw_t *Raw, unsigned char *p)
{
    if (p[1] < 9)
        tracet( 2, "RT17: GSOF Current Time message record length %d < 9 bytes. Record discarded.\n", p[1] );
    else if (U1(p+10) & M_BIT0) /* If week and milliseconds of week are valid */
        SetWeek(Raw, I2(p+6), ((double) I4(p+2)) * 0.001);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x9, %eax
jge 0x68dfa
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %edx
movl $0x2, %edi
leaq 0x56e85(%rip), %rsi     # 0xbfc76
movb $0x0, %al
callq 0x95890
jmp 0x68e4e
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x68e4c
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x6, %rdi
callq 0x69090
cwtl
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
callq 0x690d0
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
cvtsi2sd %eax, %xmm0
movsd 0x54f05(%rip), %xmm1    # 0xbdd48
mulsd %xmm1, %xmm0
callq 0x68f80
jmp 0x68e4e
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeGSOF26(bamboo::raw_t*, unsigned char*)
static int DecodeGSOF26(raw_t *Raw, unsigned char *p)
{
    if (p[1] < 6)
        tracet(2, "RT17: GSOF Position Time UTC message record length %d < 6 bytes. Record discarded.\n", p[1]);
    else
        SetWeek(Raw, I2(p+6), ((double) I4(p+2)) * 0.001);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x6, %eax
jge 0x68e9a
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %edx
movl $0x2, %edi
leaq 0x56e34(%rip), %rsi     # 0xbfcc5
movb $0x0, %al
callq 0x95890
jmp 0x68edc
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x6, %rdi
callq 0x69090
cwtl
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
callq 0x690d0
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
cvtsi2sd %eax, %xmm0
movsd 0x54e75(%rip), %xmm1    # 0xbdd48
mulsd %xmm1, %xmm0
callq 0x68f80
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::DecodeGSOF41(bamboo::raw_t*, unsigned char*)
static int DecodeGSOF41(raw_t *raw, unsigned char *p)
{
    if (p[1] < 6)
        tracet(2, "RT17: GSOF Base Position and Quality Indicator message record length %d < 6 bytes. Record discarded.\n", p[1]);
    else 
        SetWeek(raw, I2(p+6), ((double) I4(p+2)) * 0.001);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x6, %eax
jge 0x68f2a
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %edx
movl $0x2, %edi
leaq 0x56df8(%rip), %rsi     # 0xbfd19
movb $0x0, %al
callq 0x95890
jmp 0x68f6c
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x6, %rdi
callq 0x69090
cwtl
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
addq $0x2, %rdi
callq 0x690d0
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
cvtsi2sd %eax, %xmm0
movsd 0x54de5(%rip), %xmm1    # 0xbdd48
mulsd %xmm1, %xmm0
callq 0x68f80
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::SetWeek(bamboo::raw_t*, int, double)
static void SetWeek(raw_t *Raw, int Week, double Tow)
{
    rt17_t *rt17 = (rt17_t*) Raw->rcv_data;

    if (!(rt17->Flags & M_WEEK_OPTION))
    {
        if (rt17->Week)
        {
            if (Week != rt17->Week)
            {
                if (Week == (rt17->Week + 1))
                    tracet(2, "RT17: GPS WEEK rolled over from %d to %d.\n", rt17->Week, Week);
                else
                    tracet(2, "RT17: GPS WEEK changed from %d to %d.\n", rt17->Week, Week);
            }
        }
        else
            tracet(2, "RT17: GPS WEEK initially set to %d.\n", Week);

        rt17->Week = Week;
    }

    /* Also update the time if we can */
    if (Week && (Tow != 0.0))
        Raw->time = gpst2time(Week, Tow);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x82ba0(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x6903d
movq -0x20(%rbp), %rax
cmpl $0x0, 0x34(%rax)
je 0x6901d
movl -0xc(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x34(%rcx), %eax
je 0x6901b
movl -0xc(%rbp), %eax
movq -0x20(%rbp), %rcx
movl 0x34(%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x68ffc
movq -0x20(%rbp), %rax
movl 0x34(%rax), %edx
movl -0xc(%rbp), %ecx
movl $0x2, %edi
leaq 0x56b6e(%rip), %rsi     # 0xbfb61
movb $0x0, %al
callq 0x95890
jmp 0x69019
movq -0x20(%rbp), %rax
movl 0x34(%rax), %edx
movl -0xc(%rbp), %ecx
movl $0x2, %edi
leaq 0x56b7a(%rip), %rsi     # 0xbfb8c
movb $0x0, %al
callq 0x95890
jmp 0x6901b
jmp 0x69033
movl -0xc(%rbp), %edx
movl $0x2, %edi
leaq 0x56b87(%rip), %rsi     # 0xbfbb3
movb $0x0, %al
callq 0x95890
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x34(%rax)
cmpl $0x0, -0xc(%rbp)
je 0x6907e
movsd -0x18(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x69055
jp 0x69055
jmp 0x6907e
movl -0xc(%rbp), %edi
movsd -0x18(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x30(%rbp)
movsd %xmm0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::ReadI2(unsigned char*)
static short ReadI2(unsigned char *p) 
{
    union I2 {short i2; unsigned char c[2];} u;
    ENDIAN_TEST et;

    memcpy(&u.i2, p, sizeof(u.i2));

    et.u2 = 0; et.c[0] = 1;  
    if (et.u2 == 1)
    {
        unsigned char t;
        t = u.c[0]; u.c[0] = u.c[1]; u.c[1] = t;
    }
    return u.i2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %ax
movw %ax, -0xa(%rbp)
movw $0x0, -0xc(%rbp)
movb $0x1, -0xc(%rbp)
movzwl -0xc(%rbp), %eax
cmpl $0x1, %eax
jne 0x690c8
movb -0xa(%rbp), %al
movb %al, -0xd(%rbp)
movb -0x9(%rbp), %al
movb %al, -0xa(%rbp)
movb -0xd(%rbp), %al
movb %al, -0x9(%rbp)
movw -0xa(%rbp), %ax
popq %rbp
retq
nop
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::ReadI4(unsigned char*)
static int ReadI4(unsigned char *p)
{
    union i4 {int i4; unsigned char c[4];} u;
    ENDIAN_TEST et;

    memcpy(&u.i4, p, sizeof(u.i4));

    et.u2 = 0; et.c[0] = 1;  
    if (et.u2 == 1)
    {
        unsigned char t;
        t = u.c[0]; u.c[0] = u.c[3]; u.c[3] = t;
        t = u.c[1]; u.c[1] = u.c[2]; u.c[2] = t;
    }   
    return u.i4;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xc(%rbp)
movw $0x0, -0xe(%rbp)
movb $0x1, -0xe(%rbp)
movzwl -0xe(%rbp), %eax
cmpl $0x1, %eax
jne 0x69118
movb -0xc(%rbp), %al
movb %al, -0xf(%rbp)
movb -0x9(%rbp), %al
movb %al, -0xc(%rbp)
movb -0xf(%rbp), %al
movb %al, -0x9(%rbp)
movb -0xb(%rbp), %al
movb %al, -0xf(%rbp)
movb -0xa(%rbp), %al
movb %al, -0xb(%rbp)
movb -0xf(%rbp), %al
movb %al, -0xa(%rbp)
movl -0xc(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::ReadR8(unsigned char*)
static double ReadR8(unsigned char *p)
{
    ENDIAN_TEST et;
    union R8 {double d; unsigned char c[8];} u;

    memcpy(&u.d, p, sizeof(u.d));
 
    et.u2 = 0; et.c[0] = 1;  
    if (et.u2 == 1)
    {
        unsigned char t;
        t = u.c[0]; u.c[0] = u.c[7]; u.c[7] = t;
        t = u.c[1]; u.c[1] = u.c[6]; u.c[6] = t;
        t = u.c[2]; u.c[2] = u.c[5]; u.c[5] = t;
        t = u.c[3]; u.c[3] = u.c[4]; u.c[4] = t;  
    }
    return u.d;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movw $0x0, -0xa(%rbp)
movb $0x1, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
cmpl $0x1, %eax
jne 0x6918e
movb -0x18(%rbp), %al
movb %al, -0x19(%rbp)
movb -0x11(%rbp), %al
movb %al, -0x18(%rbp)
movb -0x19(%rbp), %al
movb %al, -0x11(%rbp)
movb -0x17(%rbp), %al
movb %al, -0x19(%rbp)
movb -0x12(%rbp), %al
movb %al, -0x17(%rbp)
movb -0x19(%rbp), %al
movb %al, -0x12(%rbp)
movb -0x16(%rbp), %al
movb %al, -0x19(%rbp)
movb -0x13(%rbp), %al
movb %al, -0x16(%rbp)
movb -0x19(%rbp), %al
movb %al, -0x13(%rbp)
movb -0x15(%rbp), %al
movb %al, -0x19(%rbp)
movb -0x14(%rbp), %al
movb %al, -0x15(%rbp)
movb -0x19(%rbp), %al
movb %al, -0x14(%rbp)
movsd -0x18(%rbp), %xmm0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: DoubleString[P]RtConverter/src/Rtklib/rt17.cpp
// Function: bamboo::ReadU4(unsigned char*)
static unsigned int ReadU4(unsigned char *p)
{
    ENDIAN_TEST et;
    union U4 {unsigned int u4; unsigned char c[4];} u;

    memcpy(&u.u4, p, sizeof(u.u4));
 
    et.u2 = 0; et.c[0] = 1;  
    if (et.u2 == 1)
    {
        unsigned char t;
        t = u.c[0]; u.c[0] = u.c[3]; u.c[3] = t;
        t = u.c[1]; u.c[1] = u.c[2]; u.c[2] = t;
    }   
    return u.u4;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movw $0x0, -0xa(%rbp)
movb $0x1, -0xa(%rbp)
movzwl -0xa(%rbp), %eax
cmpl $0x1, %eax
jne 0x691e8
movb -0x10(%rbp), %al
movb %al, -0x11(%rbp)
movb -0xd(%rbp), %al
movb %al, -0x10(%rbp)
movb -0x11(%rbp), %al
movb %al, -0xd(%rbp)
movb -0xf(%rbp), %al
movb %al, -0x11(%rbp)
movb -0xe(%rbp), %al
movb %al, -0xf(%rbp)
movb -0x11(%rbp), %al
movb %al, -0xe(%rbp)
movl -0x10(%rbp), %eax
popq %rbp
retq
nopl (%rax)