// File: DoubleString[P]RtConverter/src/Rtklib/binex.cpp
// Function: bamboo::decode_bnx_01_06(bamboo::raw_t*, unsigned char*, int)
static int decode_bnx_01_06(raw_t *raw, unsigned char *buff, int len)
{
    eph_t eph={0};
    unsigned char *p=buff;
    double tow,ura,sqrtA;
    int prn,flag;
    
    trace(4,"binex 0x01-06: len=%d\n",len);
    
    if (len>=127) {
        prn       =U1(p);        p+=1;
        eph.week  =U2(p);        p+=2;
        tow       =I4(p);        p+=4;
        eph.toes  =I4(p);        p+=4;
        eph.tgd[0]=R4(p);        p+=4;
        eph.iodc  =I4(p);        p+=4;
        eph.f2    =R4(p);        p+=4;
        eph.f1    =R4(p);        p+=4;
        eph.f0    =R4(p);        p+=4;
        eph.iode  =I4(p);        p+=4;
        eph.deln  =R4(p)*SC2RAD; p+=4;
        eph.M0    =R8(p);        p+=8;
        eph.e     =R8(p);        p+=8;
        sqrtA     =R8(p);        p+=8;
        eph.cic   =R4(p);        p+=4;
        eph.crc   =R4(p);        p+=4;
        eph.cis   =R4(p);        p+=4;
        eph.crs   =R4(p);        p+=4;
        eph.cuc   =R4(p);        p+=4;
        eph.cus   =R4(p);        p+=4;
        eph.OMG0  =R8(p);        p+=8;
        eph.omg   =R8(p);        p+=8;
        eph.i0    =R8(p);        p+=8;
        eph.OMGd  =R4(p)*SC2RAD; p+=4;
        eph.idot  =R4(p)*SC2RAD; p+=4;
        ura       =R4(p)*0.1;    p+=4;
        eph.svh   =U2(p);        p+=2;
        flag      =U2(p);
    }
    else {
        trace(2,"binex 0x01-06: length error len=%d\n",len);
        return -1;
    }
    if (!(eph.sat=satno(SYS_QZS,prn))) {
        trace(2,"binex 0x01-06: satellite error prn=%d\n",prn);
        return 0;
    }
    eph.A=sqrtA*sqrtA;
    eph.toe=gpst2time(eph.week,eph.toes);
    eph.toc=gpst2time(eph.week,eph.toes);
    eph.ttr=adjweek(eph.toe,tow);
    eph.fit=(flag&0x01)?0.0:2.0; /* 0:2hr,1:>2hr */
    eph.sva=uraindex(ura);
    eph.code=2; /* codes on L2 channel */
    
    if (!strstr(raw->opt,"-EPHALL")) {
        if (raw->nav.eph[eph.sat-1].iode==eph.iode&&
            raw->nav.eph[eph.sat-1].iodc==eph.iodc) return 0; /* unchanged */
    }
    raw->nav.eph[eph.sat-1]=eph;
    raw->ephsat=eph.sat;
    return 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
leaq -0x140(%rbp), %rdi
xorl %esi, %esi
movl $0x120, %edx            # imm = 0x120
callq 0x93d0
movq -0x18(%rbp), %rax
movq %rax, -0x148(%rbp)
movl -0x1c(%rbp), %edx
movl $0x4, %edi
leaq 0x600ce(%rip), %rsi     # 0xbea01
movb $0x0, %al
callq 0x8b980
cmpl $0x7f, -0x1c(%rbp)
jl 0x5edb5
movq -0x148(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x164(%rbp)
movq -0x148(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5b2b0
movzwl %ax, %eax
movl %eax, -0x12c(%rbp)
movq -0x148(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f860
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x150(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f860
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f860
movl %eax, -0x138(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f860
movl %eax, -0x13c(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd 0x5f27e(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f8e0
movsd %xmm0, -0xc8(%rbp)
movq -0x148(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f8e0
movsd %xmm0, -0xe8(%rbp)
movq -0x148(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f8e0
movsd %xmm0, -0x160(%rbp)
movq -0x148(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0xa8(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0xa0(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f8e0
movsd %xmm0, -0xd8(%rbp)
movq -0x148(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f8e0
movsd %xmm0, -0xd0(%rbp)
movq -0x148(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f8e0
movsd %xmm0, -0xe0(%rbp)
movq -0x148(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd 0x5f06b(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd 0x5f035(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movsd %xmm0, -0xb0(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5f880
cvtss2sd %xmm0, %xmm0
movsd 0x5eff7(%rip), %xmm1    # 0xbdd50
mulsd %xmm1, %xmm0
movsd %xmm0, -0x158(%rbp)
movq -0x148(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5b2b0
movzwl %ax, %eax
movl %eax, -0x130(%rbp)
movq -0x148(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x5b2b0
movzwl %ax, %eax
movl %eax, -0x168(%rbp)
jmp 0x5edd7
movl -0x1c(%rbp), %edx
movl $0x2, %edi
leaq 0x5fc54(%rip), %rsi     # 0xbea18
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5f033
movl -0x164(%rbp), %esi
movl $0x10, %edi
callq 0x8b1b0
movl %eax, -0x140(%rbp)
cmpl $0x0, %eax
jne 0x5ee17
movl -0x164(%rbp), %edx
movl $0x2, %edi
leaq 0x5fc38(%rip), %rsi     # 0xbea3c
movb $0x0, %al
callq 0x8b980
movl $0x0, -0x4(%rbp)
jmp 0x5f033
movsd -0x160(%rbp), %xmm0
mulsd -0x160(%rbp), %xmm0
movsd %xmm0, -0xf0(%rbp)
movl -0x12c(%rbp), %edi
movsd -0x78(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x178(%rbp)
movsd %xmm0, -0x170(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x170(%rbp), %rax
movq %rax, -0x118(%rbp)
movl -0x12c(%rbp), %edi
movsd -0x78(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x188(%rbp)
movsd %xmm0, -0x180(%rbp)
movq -0x188(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x180(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x120(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movsd -0x150(%rbp), %xmm1
movq -0x1a8(%rbp), %rdi
movsd -0x1a0(%rbp), %xmm0
callq 0x5f940
movq %rax, -0x198(%rbp)
movsd %xmm0, -0x190(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0xf8(%rbp)
movl -0x168(%rbp), %eax
andl $0x1, %eax
xorps %xmm0, %xmm0
movsd 0x5e834(%rip), %xmm1    # 0xbd750
movsd %xmm1, -0x1b8(%rbp)
cmpl $0x0, %eax
movsd %xmm0, -0x1b0(%rbp)
jne 0x5ef41
movsd -0x1b8(%rbp), %xmm0
movsd %xmm0, -0x1b0(%rbp)
movsd -0x1b0(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x158(%rbp), %xmm0
callq 0x5fa10
movl %eax, -0x134(%rbp)
movl $0x2, -0x128(%rbp)
movq -0x10(%rbp), %rdi
addq $0x82a90, %rdi          # imm = 0x82A90
leaq 0x5f8e2(%rip), %rsi     # 0xbe85f
callq 0x91b0
cmpq $0x0, %rax
jne 0x5efeb
movq -0x10(%rbp), %rax
movq 0x1d80(%rax), %rax
movl -0x140(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x120, %rcx, %rcx      # imm = 0x120
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x13c(%rbp), %eax
jne 0x5efe9
movq -0x10(%rbp), %rax
movq 0x1d80(%rax), %rax
movl -0x140(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x120, %rcx, %rcx      # imm = 0x120
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x138(%rbp), %eax
jne 0x5efe9
movl $0x0, -0x4(%rbp)
jmp 0x5f033
jmp 0x5efeb
movq -0x10(%rbp), %rax
movq 0x1d80(%rax), %rdi
movl -0x140(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x120, %rax, %rax      # imm = 0x120
addq %rax, %rdi
leaq -0x140(%rbp), %rsi
movl $0x120, %edx            # imm = 0x120
callq 0x9610
movl -0x140(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x70e40(%rax)
movl $0x2, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nop