// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rcvraw.cpp
// Function: bamboo::decode_glostr(unsigned char const*, bamboo::geph_t*)
extern int decode_glostr(const unsigned char *buff, geph_t *geph)
{
    double tow,tod,tof,toe;
    int P,P1,P2,P3,P4,tk_h,tk_m,tk_s,tb,ln,NT,slot,M,week;
    int i=1,frn1,frn2,frn3,frn4;
    
    trace(3,"decode_glostr:\n");
    
    /* frame 1 */
    frn1        =getbitu(buff,i, 4);           i+= 4+2;
    P1          =getbitu(buff,i, 2);           i+= 2;
    tk_h        =getbitu(buff,i, 5);           i+= 5;
    tk_m        =getbitu(buff,i, 6);           i+= 6;
    tk_s        =getbitu(buff,i, 1)*30;        i+= 1;
    geph->vel[0]=getbitg(buff,i,24)*P2_20*1E3; i+=24;
    geph->acc[0]=getbitg(buff,i, 5)*P2_30*1E3; i+= 5;
    geph->pos[0]=getbitg(buff,i,27)*P2_11*1E3; i+=27+4;
    
    /* frame 2 */
    frn2        =getbitu(buff,i, 4);           i+= 4;
    geph->svh   =getbitu(buff,i, 3);           i+= 3;
    P2          =getbitu(buff,i, 1);           i+= 1;
    tb          =getbitu(buff,i, 7);           i+= 7+5;
    geph->vel[1]=getbitg(buff,i,24)*P2_20*1E3; i+=24;
    geph->acc[1]=getbitg(buff,i, 5)*P2_30*1E3; i+= 5;
    geph->pos[1]=getbitg(buff,i,27)*P2_11*1E3; i+=27+4;
    
    /* frame 3 */
    frn3        =getbitu(buff,i, 4);           i+= 4;
    P3          =getbitu(buff,i, 1);           i+= 1;
    geph->gamn  =getbitg(buff,i,11)*P2_40;     i+=11+1;
    P           =getbitu(buff,i, 2);           i+= 2;
    ln          =getbitu(buff,i, 1);           i+= 1;
    geph->vel[2]=getbitg(buff,i,24)*P2_20*1E3; i+=24;
    geph->acc[2]=getbitg(buff,i, 5)*P2_30*1E3; i+= 5;
    geph->pos[2]=getbitg(buff,i,27)*P2_11*1E3; i+=27+4;
    
    /* frame 4 */
    frn4        =getbitu(buff,i, 4);           i+= 4;
    geph->taun  =getbitg(buff,i,22)*P2_30;     i+=22;
    geph->dtaun =getbitg(buff,i, 5)*P2_30;     i+= 5;
    geph->age   =getbitu(buff,i, 5);           i+= 5+14;
    P4          =getbitu(buff,i, 1);           i+= 1;
    geph->sva   =getbitu(buff,i, 4);           i+= 4+3;
    NT          =getbitu(buff,i,11);           i+=11;
    slot        =getbitu(buff,i, 5);           i+= 5;
    M           =getbitu(buff,i, 2);
    
    if (frn1!=1||frn2!=2||frn3!=3||frn4!=4) {
        trace(3,"decode_glostr error: frn=%d %d %d %d %d\n",frn1,frn2,frn3,frn4);
        return 0;
    }
    if (!(geph->sat=satno(SYS_GLO,slot))) {
        trace(2,"decode_glostr error: slot=%d\n",slot);
        return 0;
    }
    geph->frq=0;
    geph->iode=tb;
    tow=time2gpst(gpst2utc(geph->tof),&week);
    tod=fmod(tow,86400.0); tow-=tod;
    tof=tk_h*3600.0+tk_m*60.0+tk_s-10800.0; /* lt->utc */
    if      (tof<tod-43200.0) tof+=86400.0;
    else if (tof>tod+43200.0) tof-=86400.0;
    geph->tof=utc2gpst(gpst2time(week,tow+tof));
    toe=tb*900.0-10800.0; /* lt->utc */
    if      (toe<tod-43200.0) toe+=86400.0;
    else if (toe>tod+43200.0) toe-=86400.0;
    geph->toe=utc2gpst(gpst2time(week,tow+toe)); /* utc->gpst */
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x3811c(%rip), %rsi     # 0x6d14c
movl $0x3, %edi
xorl %eax, %eax
callq 0x4d55d
movq %r14, %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, -0x48(%rbp)
movq %r14, %rdi
movl $0x7, %esi
movl $0x2, %edx
callq 0x4d9d6
movq %r14, %rdi
movl $0x9, %esi
movl $0x5, %edx
callq 0x4d9d6
movl %eax, -0x70(%rbp)
movq %r14, %rdi
movl $0xe, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, -0x6c(%rbp)
movq %r14, %rdi
movl $0x14, %esi
movl $0x1, %edx
callq 0x4d9d6
movq %rax, -0x78(%rbp)
movq %r14, %rdi
movl $0x16, %esi
movl $0x17, %edx
callq 0x4d9d6
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x60(%rbp)
movq %r14, %rdi
movl $0x15, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x350e6
movapd -0x60(%rbp), %xmm0
orpd 0x359ec(%rip), %xmm0    # 0x6aad0
jmp 0x350eb
movapd -0x60(%rbp), %xmm0
mulsd 0x37c35(%rip), %xmm0    # 0x6cd28
mulsd 0x3637d(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x50(%rbx)
movq %r14, %rdi
movl $0x2e, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x60(%rbp)
movq %r14, %rdi
movl $0x2d, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x35146
movapd -0x60(%rbp), %xmm0
orpd 0x3598c(%rip), %xmm0    # 0x6aad0
jmp 0x3514b
movapd -0x60(%rbp), %xmm0
mulsd 0x37bdd(%rip), %xmm0    # 0x6cd30
mulsd 0x3631d(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x68(%rbx)
movq %r14, %rdi
movl $0x33, %esi
movl $0x1a, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x60(%rbp)
movq %r14, %rdi
movl $0x32, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x351a6
movapd -0x60(%rbp), %xmm0
orpd 0x3592c(%rip), %xmm0    # 0x6aad0
jmp 0x351ab
movapd -0x60(%rbp), %xmm0
mulsd 0x37b85(%rip), %xmm0    # 0x6cd38
mulsd 0x362bd(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x38(%rbx)
movq %r14, %rdi
movl $0x51, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, -0x60(%rbp)
movq %r14, %rdi
movl $0x55, %esi
movl $0x3, %edx
callq 0x4d9d6
movl %eax, 0xc(%rbx)
movq %r14, %rdi
movl $0x58, %esi
movl $0x1, %edx
callq 0x4d9d6
movq %r14, %rdi
movl $0x59, %esi
movl $0x7, %edx
callq 0x4d9d6
movl %eax, %r15d
movq %r14, %rdi
movl $0x66, %esi
movl $0x17, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0x65, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x35257
movapd -0x40(%rbp), %xmm0
orpd 0x3587b(%rip), %xmm0    # 0x6aad0
jmp 0x3525c
movapd -0x40(%rbp), %xmm0
mulsd 0x37ac4(%rip), %xmm0    # 0x6cd28
mulsd 0x3620c(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x58(%rbx)
movq %r14, %rdi
movl $0x7e, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0x7d, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x352b7
movapd -0x40(%rbp), %xmm0
orpd 0x3581b(%rip), %xmm0    # 0x6aad0
jmp 0x352bc
movapd -0x40(%rbp), %xmm0
mulsd 0x37a6c(%rip), %xmm0    # 0x6cd30
mulsd 0x361ac(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x70(%rbx)
movq %r14, %rdi
movl $0x83, %esi
movl $0x1a, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0x82, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x35317
movapd -0x40(%rbp), %xmm0
orpd 0x357bb(%rip), %xmm0    # 0x6aad0
jmp 0x3531c
movapd -0x40(%rbp), %xmm0
mulsd 0x37a14(%rip), %xmm0    # 0x6cd38
mulsd 0x3614c(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x40(%rbx)
movq %r14, %rdi
movl $0xa1, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %r13d
movq %r14, %rdi
movl $0xa5, %esi
movl $0x1, %edx
callq 0x4d9d6
movq %r14, %rdi
movl $0xa7, %esi
movl $0xa, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xa6, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3539e
movapd -0x40(%rbp), %xmm0
orpd 0x35734(%rip), %xmm0    # 0x6aad0
jmp 0x353a3
movapd -0x40(%rbp), %xmm0
mulsd 0x37995(%rip), %xmm0    # 0x6cd40
movsd %xmm0, 0x88(%rbx)
movq %r14, %rdi
movl $0xb2, %esi
movl $0x2, %edx
callq 0x4d9d6
movq %r14, %rdi
movl $0xb4, %esi
movl $0x1, %edx
callq 0x4d9d6
movq %r14, %rdi
movl $0xb6, %esi
movl $0x17, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xb5, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3541d
movapd -0x40(%rbp), %xmm0
orpd 0x356b5(%rip), %xmm0    # 0x6aad0
jmp 0x35422
movapd -0x40(%rbp), %xmm0
mulsd 0x378fe(%rip), %xmm0    # 0x6cd28
mulsd 0x36046(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x60(%rbx)
movq %r14, %rdi
movl $0xce, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xcd, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3547d
movapd -0x40(%rbp), %xmm0
orpd 0x35655(%rip), %xmm0    # 0x6aad0
jmp 0x35482
movapd -0x40(%rbp), %xmm0
mulsd 0x378a6(%rip), %xmm0    # 0x6cd30
mulsd 0x35fe6(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x78(%rbx)
movq %r14, %rdi
movl $0xd3, %esi
movl $0x1a, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xd2, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
movl %r15d, -0x68(%rbp)
je 0x354e1
movapd -0x40(%rbp), %xmm0
orpd 0x355f1(%rip), %xmm0    # 0x6aad0
jmp 0x354e6
movapd -0x40(%rbp), %xmm0
mulsd 0x3784a(%rip), %xmm0    # 0x6cd38
mulsd 0x35f82(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x48(%rbx)
movq %r14, %rdi
movl $0xf1, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %r15d
movq %r14, %rdi
movl $0xf6, %esi
movl $0x15, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xf5, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x35556
movapd -0x40(%rbp), %xmm0
orpd 0x3557c(%rip), %xmm0    # 0x6aad0
jmp 0x3555b
movapd -0x40(%rbp), %xmm0
mulsd 0x377cd(%rip), %xmm0    # 0x6cd30
movsd %xmm0, 0x80(%rbx)
movq %r14, %rdi
movl $0x10c, %esi            # imm = 0x10C
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0x10b, %esi            # imm = 0x10B
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x355b1
movapd -0x40(%rbp), %xmm0
orpd 0x35521(%rip), %xmm0    # 0x6aad0
jmp 0x355b6
movapd -0x40(%rbp), %xmm0
mulsd 0x37772(%rip), %xmm0    # 0x6cd30
movsd %xmm0, 0x90(%rbx)
movq %r14, %rdi
movl $0x110, %esi            # imm = 0x110
movl $0x5, %edx
callq 0x4d9d6
movl %eax, 0x14(%rbx)
movq %r14, %rdi
movl $0x123, %esi            # imm = 0x123
movl $0x1, %edx
callq 0x4d9d6
movq %r14, %rdi
movl $0x124, %esi            # imm = 0x124
movl $0x4, %edx
callq 0x4d9d6
movl %eax, 0x10(%rbx)
movq %r14, %rdi
movl $0x12b, %esi            # imm = 0x12B
movl $0xb, %edx
callq 0x4d9d6
movq %r14, %rdi
movl $0x136, %esi            # imm = 0x136
movl $0x5, %edx
callq 0x4d9d6
movl %eax, %r12d
movq %r14, %rdi
movl $0x13b, %esi            # imm = 0x13B
movl $0x2, %edx
callq 0x4d9d6
movl -0x48(%rbp), %edx
movl %edx, %eax
xorl $0x1, %eax
movl -0x60(%rbp), %ecx
movl %ecx, %esi
xorl $0x2, %esi
orl %eax, %esi
movl %r13d, %eax
xorl $0x3, %eax
orl %esi, %eax
movl %r15d, %esi
xorl $0x4, %esi
orl %eax, %esi
je 0x3567f
leaq 0x37af6(%rip), %rsi     # 0x6d15c
xorl %ebx, %ebx
movl $0x3, %edi
movl %r13d, %r8d
movl %r15d, %r9d
xorl %eax, %eax
callq 0x4d55d
jmp 0x35811
movl $0x4, %edi
movl %r12d, %esi
callq 0x4d28d
movl %eax, (%rbx)
testl %eax, %eax
je 0x3574d
movq -0x78(%rbp), %r14
leal (%r14,%r14), %eax
shll $0x5, %r14d
subl %eax, %r14d
movl $0x0, 0x8(%rbx)
movl -0x68(%rbp), %r15d
movl %r15d, 0x4(%rbx)
movq 0x28(%rbx), %rdi
movsd 0x30(%rbx), %xmm0
callq 0x4f9b0
leaq -0x64(%rbp), %rsi
movq %rax, %rdi
callq 0x4f2b1
movsd %xmm0, -0x48(%rbp)
movsd 0x351f5(%rip), %xmm1    # 0x6a8d0
callq 0x8850
xorps %xmm1, %xmm1
cvtsi2sdl -0x70(%rbp), %xmm1
cvtsi2sdl -0x6c(%rbp), %xmm2
mulsd 0x351c3(%rip), %xmm2    # 0x6a8b8
mulsd 0x351c3(%rip), %xmm1    # 0x6a8c0
movapd %xmm0, %xmm3
addsd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movsd -0x48(%rbp), %xmm2
subsd %xmm3, %xmm2
movsd %xmm2, -0x48(%rbp)
addsd %xmm1, %xmm0
addsd 0x366a1(%rip), %xmm0    # 0x6bdc8
movsd 0x366c1(%rip), %xmm1    # 0x6bdf0
addsd %xmm3, %xmm1
movsd %xmm1, -0x60(%rbp)
ucomisd %xmm0, %xmm1
movsd %xmm3, -0x40(%rbp)
jbe 0x3576a
addsd 0x35185(%rip), %xmm0    # 0x6a8d0
jmp 0x35784
leaq 0x37a31(%rip), %rsi     # 0x6d185
xorl %ebx, %ebx
movl $0x2, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0x4d55d
jmp 0x35811
movsd 0x36686(%rip), %xmm1    # 0x6bdf8
addsd %xmm3, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x35784
addsd 0x3667c(%rip), %xmm0    # 0x6be00
movl -0x64(%rbp), %edi
addsd -0x48(%rbp), %xmm0
callq 0x4f24a
movq %rax, %rdi
callq 0x4fa70
movq %rax, 0x28(%rbx)
movsd %xmm0, 0x30(%rbx)
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
mulsd 0x35306(%rip), %xmm1    # 0x6aab8
addsd 0x3660e(%rip), %xmm1    # 0x6bdc8
movsd -0x60(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x357cf
addsd 0x35103(%rip), %xmm1    # 0x6a8d0
jmp 0x357ea
movsd -0x40(%rbp), %xmm0
addsd 0x3661c(%rip), %xmm0    # 0x6bdf8
ucomisd %xmm0, %xmm1
jbe 0x357ea
addsd 0x36616(%rip), %xmm1    # 0x6be00
movl -0x64(%rbp), %edi
movsd -0x48(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x4f24a
movq %rax, %rdi
callq 0x4fa70
movq %rax, 0x18(%rbx)
movsd %xmm0, 0x20(%rbx)
movl $0x1, %ebx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq