// File: DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::decode_subfrm3(unsigned char const*, bamboo::eph_t*)
static int decode_subfrm3(const unsigned char *buff, eph_t *eph)
{
    double tow,toc;
    int i=48,iode;
    
    trace(4,"decode_subfrm3:\n");
    trace(5,"decode_subfrm3: buff="); traceb(5,buff,30);
    
    eph->cic =getbits(buff,i,16)*P2_29;        i+=16;
    eph->OMG0=getbits(buff,i,32)*P2_31*SC2RAD; i+=32;
    eph->cis =getbits(buff,i,16)*P2_29;        i+=16;
    eph->i0  =getbits(buff,i,32)*P2_31*SC2RAD; i+=32;
    eph->crc =getbits(buff,i,16)*P2_5;         i+=16;
    eph->omg =getbits(buff,i,32)*P2_31*SC2RAD; i+=32;
    eph->OMGd=getbits(buff,i,24)*P2_43*SC2RAD; i+=24;
    iode     =getbitu(buff,i, 8);              i+= 8;
    eph->idot=getbits(buff,i,14)*P2_43*SC2RAD;
    
    /* check iode and iodc consistency */
    if (iode!=eph->iode||iode!=(eph->iodc&0xFF)) return 0;
    
    /* adjustment for week handover */
    tow=time2gpst(eph->ttr,&eph->week);
    toc=time2gpst(eph->toc,NULL);
    if      (eph->toes<tow-302400.0) {eph->week++; tow-=604800.0;}
    else if (eph->toes>tow+302400.0) {eph->week--; tow+=604800.0;}
    eph->toe=gpst2time(eph->week,eph->toes);
    eph->toc=gpst2time(eph->week,toc);
    eph->ttr=gpst2time(eph->week,tow);
    
    return 3;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x30, -0x2c(%rbp)
movl $0x4, %edi
leaq 0x59806(%rip), %rsi     # 0xbf3bc
movb $0x0, %al
callq 0x8b980
movl $0x5, %edi
leaq 0x59804(%rip), %rsi     # 0xbf3cd
movb $0x0, %al
callq 0x8b980
movq -0x10(%rbp), %rsi
movl $0x5, %edi
movl $0x1e, %edx
callq 0x95900
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x10, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x59270(%rip), %xmm1    # 0xbee70
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0xb8(%rax)
movl -0x2c(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x20, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x573a2(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd 0x58116(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x68(%rax)
movl -0x2c(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x10, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x591fb(%rip), %xmm1    # 0xbee70
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0xc0(%rax)
movl -0x2c(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x20, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x5732d(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd 0x580a1(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x60(%rax)
movl -0x2c(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x10, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x5918e(%rip), %xmm1    # 0xbee78
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x98(%rax)
movl -0x2c(%rbp), %eax
addl $0x10, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x20, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x572b8(%rip), %xmm1    # 0xbcfd8
mulsd %xmm1, %xmm0
movsd 0x5802c(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x70(%rax)
movl -0x2c(%rbp), %eax
addl $0x20, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x18, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x59109(%rip), %xmm1    # 0xbee68
mulsd %xmm1, %xmm0
movsd 0x57fed(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x88(%rax)
movl -0x2c(%rbp), %eax
addl $0x18, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0x8, %edx
callq 0x8bfc0
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl $0xe, %edx
callq 0x8c050
cvtsi2sd %eax, %xmm0
movsd 0x590aa(%rip), %xmm1    # 0xbee68
mulsd %xmm1, %xmm0
movsd 0x57f8e(%rip), %xmm1    # 0xbdd58
mulsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x90(%rax)
movl -0x30(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x65dfa
movl -0x30(%rbp), %eax
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
andl $0xff, %ecx
cmpl %ecx, %eax
je 0x65e06
movl $0x0, -0x4(%rbp)
jmp 0x65f80
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x48(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rsi
addq $0x14, %rsi
movq -0x40(%rbp), %rdi
movsd -0x38(%rbp), %xmm0
callq 0x8e540
movsd %xmm0, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x38(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rdi
movsd -0x48(%rbp), %xmm0
xorl %eax, %eax
movl %eax, %esi
callq 0x8e540
movsd %xmm0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movsd 0xc8(%rax), %xmm1
movsd -0x20(%rbp), %xmm0
movsd 0x57ee7(%rip), %xmm2    # 0xbdd60
subsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x65ea8
movq -0x18(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
movsd -0x20(%rbp), %xmm0
movsd 0x57ecb(%rip), %xmm1    # 0xbdd68
subsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0x65ee8
movq -0x18(%rbp), %rax
movsd 0xc8(%rax), %xmm0
movsd 0x57ea4(%rip), %xmm1    # 0xbdd60
addsd -0x20(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x65ee6
movq -0x18(%rbp), %rax
movl 0x14(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x14(%rax)
movsd 0x57e8c(%rip), %xmm0    # 0xbdd68
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0x65ee8
movq -0x18(%rbp), %rax
movl 0x14(%rax), %edi
movq -0x18(%rbp), %rax
movsd 0xc8(%rax), %xmm0
callq 0x8e4a0
movq %rax, -0x60(%rbp)
movsd %xmm0, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq -0x58(%rbp), %rcx
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movl 0x14(%rax), %edi
movsd -0x28(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x70(%rbp)
movsd %xmm0, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, 0x30(%rax)
movq -0x68(%rbp), %rcx
movq %rcx, 0x38(%rax)
movq -0x18(%rbp), %rax
movl 0x14(%rax), %edi
movsd -0x20(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x80(%rbp)
movsd %xmm0, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq -0x80(%rbp), %rcx
movq %rcx, 0x40(%rax)
movq -0x78(%rbp), %rcx
movq %rcx, 0x48(%rax)
movl $0x3, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)