// File: DoubleString[P]RtConverter/src/Rtklib/rtcm2.cpp
// Function: bamboo::decode_type17(bamboo::rtcm_t*)
static int decode_type17(rtcm_t *rtcm)
{
    eph_t eph={0};
    double toc,sqrtA;
    int i=48,week,prn,sat;
    
    trace(4,"decode_type17: len=%d\n",rtcm->len);
    
    if (i+480<=rtcm->len*8) {
        week      =getbitu(rtcm->buff,i,10);              i+=10;
        eph.idot  =getbits(rtcm->buff,i,14)*P2_43*SC2RAD; i+=14;
        eph.iode  =getbitu(rtcm->buff,i, 8);              i+= 8;
        toc       =getbitu(rtcm->buff,i,16)*16.0;         i+=16;
        eph.f1    =getbits(rtcm->buff,i,16)*P2_43;        i+=16;
        eph.f2    =getbits(rtcm->buff,i, 8)*P2_55;        i+= 8;
        eph.crs   =getbits(rtcm->buff,i,16)*P2_5;         i+=16;
        eph.deln  =getbits(rtcm->buff,i,16)*P2_43*SC2RAD; i+=16;
        eph.cuc   =getbits(rtcm->buff,i,16)*P2_29;        i+=16;
        eph.e     =getbitu(rtcm->buff,i,32)*P2_33;        i+=32;
        eph.cus   =getbits(rtcm->buff,i,16);              i+=16;
        sqrtA     =getbitu(rtcm->buff,i,32)*P2_19;        i+=32;
        eph.toes  =getbitu(rtcm->buff,i,16);              i+=16;
        eph.OMG0  =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.cic   =getbits(rtcm->buff,i,16)*P2_29;        i+=16;
        eph.i0    =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.cis   =getbits(rtcm->buff,i,16)*P2_29;        i+=16;
        eph.omg   =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.crc   =getbits(rtcm->buff,i,16)*P2_5;         i+=16;
        eph.OMGd  =getbits(rtcm->buff,i,24)*P2_43*SC2RAD; i+=24;
        eph.M0    =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.iodc  =getbitu(rtcm->buff,i,10);              i+=10;
        eph.f0    =getbits(rtcm->buff,i,22)*P2_31;        i+=22;
        prn       =getbitu(rtcm->buff,i, 5);              i+= 5+3;
        eph.tgd[0]=getbits(rtcm->buff,i, 8)*P2_31;        i+= 8;
        eph.code  =getbitu(rtcm->buff,i, 2);              i+= 2;
        eph.sva   =getbitu(rtcm->buff,i, 4);              i+= 4;
        eph.svh   =getbitu(rtcm->buff,i, 6);              i+= 6;
        eph.flag  =getbitu(rtcm->buff,i, 1);
    }
    else {
        trace(2,"rtcm2 17 length error: len=%d\n",rtcm->len);
        return -1;
    }
    if (prn==0) prn=32;
    sat=satno(SYS_GPS,prn);
    eph.sat=sat;
    eph.week=adjgpsweek(week);
    eph.toe=gpst2time(eph.week,eph.toes);
    eph.toc=gpst2time(eph.week,toc);
    eph.ttr=rtcm->time;
    eph.A=sqrtA*sqrtA;
    rtcm->nav.eph[sat-1]=eph;
    rtcm->ephsat=sat;
    return 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x10(%rbp)
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x120, %edx            # imm = 0x120
callq 0x93d0
movl $0x30, -0x144(%rbp)
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %edx
movl $0x4, %edi
leaq 0x54469(%rip), %rsi     # 0xc084b
movb $0x0, %al
callq 0x8b980
movl -0x144(%rbp), %eax
addl $0x1e0, %eax            # imm = 0x1E0
movq -0x10(%rbp), %rcx
movl 0x9f0c0(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jg 0x6cb40
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0xa, %edx
callq 0x8bfc0
movl %eax, -0x148(%rbp)
movl -0x144(%rbp), %eax
addl $0xa, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0xe, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x52a08(%rip), %xmm1    # 0xbee68
movsd %xmm1, -0x188(%rbp)
mulsd %xmm1, %xmm0
movsd 0x518e4(%rip), %xmm1    # 0xbdd58
movsd %xmm1, -0x180(%rbp)
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movl -0x144(%rbp), %eax
addl $0xe, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x8, %edx
movl %edx, -0x18c(%rbp)
callq 0x8bfc0
movl %eax, -0x12c(%rbp)
movl -0x144(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x10, %edx
movl %edx, -0x174(%rbp)
callq 0x8bfc0
movl -0x174(%rbp), %edx
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x529bd(%rip), %xmm1    # 0xbeec0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x138(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
callq 0x8c050
movl -0x18c(%rbp), %edx
movsd -0x188(%rbp), %xmm1
cvtsi2sd %eax, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
callq 0x8c050
movl -0x174(%rbp), %edx
cvtsi2sd %eax, %xmm0
movsd 0x52932(%rip), %xmm1    # 0xbeeb8
mulsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x144(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
callq 0x8c050
movl -0x174(%rbp), %edx
cvtsi2sd %eax, %xmm0
movsd 0x528b2(%rip), %xmm1    # 0xbee78
mulsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
callq 0x8c050
movsd -0x188(%rbp), %xmm2
movsd -0x180(%rbp), %xmm1
movl -0x174(%rbp), %edx
cvtsi2sd %eax, %xmm0
mulsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, -0xb0(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x5281e(%rip), %xmm1    # 0xbee70
mulsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x20, %edx
movl %edx, -0x178(%rbp)
callq 0x8bfc0
movl -0x174(%rbp), %edx
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x527bd(%rip), %xmm1    # 0xbee60
mulsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movl -0x144(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
callq 0x8c050
movl -0x178(%rbp), %edx
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
callq 0x8bfc0
movl -0x174(%rbp), %edx
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd 0x508c3(%rip), %xmm1    # 0xbcfe0
mulsd %xmm1, %xmm0
movsd %xmm0, -0x140(%rbp)
movl -0x144(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
callq 0x8bfc0
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x68(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x20, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x50848(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd 0x515bc(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movsd %xmm0, -0xc8(%rbp)
movl -0x144(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x10, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x52692(%rip), %xmm1    # 0xbee70
mulsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x20, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x507bb(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd 0x5152f(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movsd %xmm0, -0xd0(%rbp)
movl -0x144(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x10, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x52605(%rip), %xmm1    # 0xbee70
mulsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x20, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x5072e(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd 0x514a2(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movsd %xmm0, -0xc0(%rbp)
movl -0x144(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x10, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x52580(%rip), %xmm1    # 0xbee78
mulsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0x144(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x18, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x5252e(%rip), %xmm1    # 0xbee68
mulsd %xmm1, %xmm0
movsd 0x51412(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
movl -0x144(%rbp), %eax
addl $0x18, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x20, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x50650(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd 0x513c4(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movl -0x144(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0xa, %edx
callq 0x8bfc0
movl %eax, -0x128(%rbp)
movl -0x144(%rbp), %eax
addl $0xa, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x16, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x505d2(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x144(%rbp), %eax
addl $0x16, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x5, %edx
callq 0x8bfc0
movl %eax, -0x14c(%rbp)
movl -0x144(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x8, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x50563(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x144(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x2, %edx
callq 0x8bfc0
movl %eax, -0x118(%rbp)
movl -0x144(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x4, %edx
callq 0x8bfc0
movl %eax, -0x124(%rbp)
movl -0x144(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x6, %edx
callq 0x8bfc0
movl %eax, -0x120(%rbp)
movl -0x144(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x144(%rbp)
movq -0x10(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x144(%rbp), %esi
movl $0x1, %edx
callq 0x8bfc0
movl %eax, -0x114(%rbp)
jmp 0x6cb69
movq -0x10(%rbp), %rax
movl 0x9f0c0(%rax), %edx
movl $0x2, %edi
leaq 0x53d0c(%rip), %rsi     # 0xc0862
movb $0x0, %al
callq 0x8b980
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6cca2
cmpl $0x0, -0x14c(%rbp)
jne 0x6cb7c
movl $0x20, -0x14c(%rbp)
movl -0x14c(%rbp), %esi
movl $0x1, %edi
callq 0x8b1b0
movl %eax, -0x150(%rbp)
movl -0x150(%rbp), %eax
movl %eax, -0x130(%rbp)
movl -0x148(%rbp), %edi
callq 0x8f7e0
movl %eax, -0x11c(%rbp)
movl -0x11c(%rbp), %edi
movsd -0x68(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x160(%rbp)
movsd %xmm0, -0x158(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x158(%rbp), %rax
movq %rax, -0x108(%rbp)
movl -0x11c(%rbp), %edi
movsd -0x138(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x170(%rbp)
movsd %xmm0, -0x168(%rbp)
movq -0x170(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0xf0(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0xe8(%rbp)
movsd -0x140(%rbp), %xmm0
mulsd -0x140(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdi
movl -0x150(%rbp), %eax
subl $0x1, %eax
cltq
imulq $0x120, %rax, %rax      # imm = 0x120
addq %rax, %rdi
leaq -0x130(%rbp), %rsi
movl $0x120, %edx            # imm = 0x120
callq 0x9610
movl -0x150(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x9bdd4(%rax)
movl $0x2, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nop