// File: DoubleString[P]RtConverter/src/Rtklib/binex.cpp
// Function: bamboo::decode_bnx_01_03(bamboo::raw_t*, unsigned char*, int)
static int decode_bnx_01_03(raw_t *raw, unsigned char *buff, int len)
{
    seph_t seph={0};
    unsigned char *p=buff;
    double tow,tod,tof;
    int prn,week,iodn;
    
    trace(4,"binex 0x01-03: len=%d\n",len);
    
    if (len>=98) {
        prn        =U1(p);     p+=1;
        week       =U2(p);     p+=2;
        tow        =U4(p);     p+=4;
        seph.af0   =R8(p);     p+=8;
        tod        =R4(p);     p+=4;
        tof        =U4(p);     p+=4;
        seph.pos[0]=R8(p)*1E3; p+=8;
        seph.vel[0]=R8(p)*1E3; p+=8;
        seph.acc[0]=R8(p)*1E3; p+=8;
        seph.pos[1]=R8(p)*1E3; p+=8;
        seph.vel[1]=R8(p)*1E3; p+=8;
        seph.acc[1]=R8(p)*1E3; p+=8;
        seph.pos[2]=R8(p)*1E3; p+=8;
        seph.vel[2]=R8(p)*1E3; p+=8;
        seph.acc[2]=R8(p)*1E3; p+=8;
        seph.svh   =U1(p);     p+=1;
        seph.sva   =U1(p);     p+=1;
        iodn       =U1(p);
    }
    else {
        trace(2,"binex 0x01-03 length error: len=%d\n",len);
        return -1;
    }
    if (!(seph.sat=satno(SYS_SBS,prn))) {
        trace(2,"binex 0x01-03 satellite error: prn=%d\n",prn);
        return -1;
    }
    seph.t0=gpst2time(week,tow);
    seph.tof=adjweek(seph.t0,tof);
    
    if (!strstr(raw->opt,"-EPHALL")) {
        if (fabs(timediff(seph.t0,raw->nav.seph[prn-MINPRNSBS].t0))<1.0&&
            seph.sva==raw->nav.seph[prn-MINPRNSBS].sva) return 0; /* unchanged */
    }
    raw->nav.seph[prn-MINPRNSBS]=seph;
    raw->ephsat=seph.sat;
    return 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
movl $0x88, %edx
callq 0x93d0
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0x1c(%rbp), %edx
movl $0x4, %edi
leaq 0x614b6(%rip), %rsi     # 0xbe8c9
movb $0x0, %al
callq 0x8b980
cmpl $0x62, -0x1c(%rbp)
jl 0x5d70a
movq -0xb0(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0xcc(%rbp)
movq -0xb0(%rbp), %rax
incq %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5b2b0
movzwl %ax, %eax
movl %eax, -0xd0(%rbp)
movq -0xb0(%rbp), %rax
addq $0x2, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5be80
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0xb8(%rbp)
movq -0xb0(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd %xmm0, -0x30(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0xc0(%rbp)
movq -0xb0(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5be80
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0xc8(%rbp)
movq -0xb0(%rbp), %rax
addq $0x4, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5ff01(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5fed2(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5fea3(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5fe74(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5fe45(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5fe16(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5fde7(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5fdb8(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
callq 0x5f8e0
movsd 0x5fd89(%rip), %xmm1    # 0xbd428
mulsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0xb0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x7c(%rbp)
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x80(%rbp)
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0xd4(%rbp)
jmp 0x5d72c
movl -0x1c(%rbp), %edx
movl $0x2, %edi
leaq 0x611c7(%rip), %rsi     # 0xbe8e0
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5d93c
movl -0xcc(%rbp), %esi
movl $0x2, %edi
callq 0x8b1b0
movl %eax, -0xa8(%rbp)
cmpl $0x0, %eax
jne 0x5d76c
movl -0xcc(%rbp), %edx
movl $0x2, %edi
leaq 0x611ab(%rip), %rsi     # 0xbe904
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5d93c
movl -0xd0(%rbp), %edi
movsd -0xb8(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0xe8(%rbp)
movsd %xmm0, -0xe0(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x100(%rbp)
movsd -0xc8(%rbp), %xmm1
movq -0x108(%rbp), %rdi
movsd -0x100(%rbp), %xmm0
callq 0x5f940
movq %rax, -0xf8(%rbp)
movsd %xmm0, -0xf0(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
addq $0x82a90, %rdi          # imm = 0x82A90
leaq 0x61040(%rip), %rsi     # 0xbe85f
callq 0x91b0
cmpq $0x0, %rax
jne 0x5d8f4
movq -0xa0(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x10(%rbp), %rax
movq 0x1d90(%rax), %rax
movl -0xcc(%rbp), %ecx
subl $0x78, %ecx
movslq %ecx, %rcx
imulq $0x88, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x128(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rdi
movsd -0x110(%rbp), %xmm0
movq -0x128(%rbp), %rsi
movsd -0x120(%rbp), %xmm1
callq 0x8e8e0
movaps %xmm0, %xmm1
movaps 0x5f972(%rip), %xmm0    # 0xbd220
pand %xmm0, %xmm1
movsd 0x5e5a6(%rip), %xmm0    # 0xbbe60
ucomisd %xmm1, %xmm0
jbe 0x5d8f2
movl -0x80(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x1d90(%rcx), %rcx
movl -0xcc(%rbp), %edx
subl $0x78, %edx
movslq %edx, %rdx
imulq $0x88, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x28(%rcx), %eax
jne 0x5d8f2
movl $0x0, -0x4(%rbp)
jmp 0x5d93c
jmp 0x5d8f4
movq -0x10(%rbp), %rax
movq 0x1d90(%rax), %rdi
movl -0xcc(%rbp), %eax
subl $0x78, %eax
cltq
imulq $0x88, %rax, %rax
addq %rax, %rdi
leaq -0xa8(%rbp), %rsi
movl $0x88, %edx
callq 0x9610
movl -0xa8(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x70e40(%rax)
movl $0x2, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopl (%rax,%rax)