// File: /workspace/github_cpp_makefile_star2_O1/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 0x37ae2(%rip), %rsi     # 0x6d14c
movl $0x3, %edi
xorl %eax, %eax
callq 0x4ded0
movq %r14, %rdi
movl $0x1, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, -0x48(%rbp)
movq %r14, %rdi
movl $0x7, %esi
movl $0x2, %edx
callq 0x4e341
movq %r14, %rdi
movl $0x9, %esi
movl $0x5, %edx
callq 0x4e341
movl %eax, -0x70(%rbp)
movq %r14, %rdi
movl $0xe, %esi
movl $0x6, %edx
callq 0x4e341
movl %eax, -0x6c(%rbp)
movq %r14, %rdi
movl $0x14, %esi
movl $0x1, %edx
callq 0x4e341
movq %rax, -0x78(%rbp)
movq %r14, %rdi
movl $0x16, %esi
movl $0x17, %edx
callq 0x4e341
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x60(%rbp)
movq %r14, %rdi
movl $0x15, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x35720
movapd -0x60(%rbp), %xmm0
orpd 0x353b2(%rip), %xmm0    # 0x6aad0
jmp 0x35725
movapd -0x60(%rbp), %xmm0
mulsd 0x375fb(%rip), %xmm0    # 0x6cd28
mulsd 0x35d43(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x50(%rbx)
movq %r14, %rdi
movl $0x2e, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x60(%rbp)
movq %r14, %rdi
movl $0x2d, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x35780
movapd -0x60(%rbp), %xmm0
orpd 0x35352(%rip), %xmm0    # 0x6aad0
jmp 0x35785
movapd -0x60(%rbp), %xmm0
mulsd 0x375a3(%rip), %xmm0    # 0x6cd30
mulsd 0x35ce3(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x68(%rbx)
movq %r14, %rdi
movl $0x33, %esi
movl $0x1a, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x60(%rbp)
movq %r14, %rdi
movl $0x32, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x357e0
movapd -0x60(%rbp), %xmm0
orpd 0x352f2(%rip), %xmm0    # 0x6aad0
jmp 0x357e5
movapd -0x60(%rbp), %xmm0
mulsd 0x3754b(%rip), %xmm0    # 0x6cd38
mulsd 0x35c83(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x38(%rbx)
movq %r14, %rdi
movl $0x51, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, -0x60(%rbp)
movq %r14, %rdi
movl $0x55, %esi
movl $0x3, %edx
callq 0x4e341
movl %eax, 0xc(%rbx)
movq %r14, %rdi
movl $0x58, %esi
movl $0x1, %edx
callq 0x4e341
movq %r14, %rdi
movl $0x59, %esi
movl $0x7, %edx
callq 0x4e341
movl %eax, %r15d
movq %r14, %rdi
movl $0x66, %esi
movl $0x17, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0x65, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x35891
movapd -0x40(%rbp), %xmm0
orpd 0x35241(%rip), %xmm0    # 0x6aad0
jmp 0x35896
movapd -0x40(%rbp), %xmm0
mulsd 0x3748a(%rip), %xmm0    # 0x6cd28
mulsd 0x35bd2(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x58(%rbx)
movq %r14, %rdi
movl $0x7e, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0x7d, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x358f1
movapd -0x40(%rbp), %xmm0
orpd 0x351e1(%rip), %xmm0    # 0x6aad0
jmp 0x358f6
movapd -0x40(%rbp), %xmm0
mulsd 0x37432(%rip), %xmm0    # 0x6cd30
mulsd 0x35b72(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x70(%rbx)
movq %r14, %rdi
movl $0x83, %esi
movl $0x1a, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0x82, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x35951
movapd -0x40(%rbp), %xmm0
orpd 0x35181(%rip), %xmm0    # 0x6aad0
jmp 0x35956
movapd -0x40(%rbp), %xmm0
mulsd 0x373da(%rip), %xmm0    # 0x6cd38
mulsd 0x35b12(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x40(%rbx)
movq %r14, %rdi
movl $0xa1, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, %r13d
movq %r14, %rdi
movl $0xa5, %esi
movl $0x1, %edx
callq 0x4e341
movq %r14, %rdi
movl $0xa7, %esi
movl $0xa, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xa6, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x359d8
movapd -0x40(%rbp), %xmm0
orpd 0x350fa(%rip), %xmm0    # 0x6aad0
jmp 0x359dd
movapd -0x40(%rbp), %xmm0
mulsd 0x3735b(%rip), %xmm0    # 0x6cd40
movsd %xmm0, 0x88(%rbx)
movq %r14, %rdi
movl $0xb2, %esi
movl $0x2, %edx
callq 0x4e341
movq %r14, %rdi
movl $0xb4, %esi
movl $0x1, %edx
callq 0x4e341
movq %r14, %rdi
movl $0xb6, %esi
movl $0x17, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xb5, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x35a57
movapd -0x40(%rbp), %xmm0
orpd 0x3507b(%rip), %xmm0    # 0x6aad0
jmp 0x35a5c
movapd -0x40(%rbp), %xmm0
mulsd 0x372c4(%rip), %xmm0    # 0x6cd28
mulsd 0x35a0c(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x60(%rbx)
movq %r14, %rdi
movl $0xce, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xcd, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x35ab7
movapd -0x40(%rbp), %xmm0
orpd 0x3501b(%rip), %xmm0    # 0x6aad0
jmp 0x35abc
movapd -0x40(%rbp), %xmm0
mulsd 0x3726c(%rip), %xmm0    # 0x6cd30
mulsd 0x359ac(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x78(%rbx)
movq %r14, %rdi
movl $0xd3, %esi
movl $0x1a, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xd2, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
movl %r15d, -0x68(%rbp)
je 0x35b1b
movapd -0x40(%rbp), %xmm0
orpd 0x34fb7(%rip), %xmm0    # 0x6aad0
jmp 0x35b20
movapd -0x40(%rbp), %xmm0
mulsd 0x37210(%rip), %xmm0    # 0x6cd38
mulsd 0x35948(%rip), %xmm0    # 0x6b478
movsd %xmm0, 0x48(%rbx)
movq %r14, %rdi
movl $0xf1, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, %r15d
movq %r14, %rdi
movl $0xf6, %esi
movl $0x15, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x40(%rbp)
movq %r14, %rdi
movl $0xf5, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x35b90
movapd -0x40(%rbp), %xmm0
orpd 0x34f42(%rip), %xmm0    # 0x6aad0
jmp 0x35b95
movapd -0x40(%rbp), %xmm0
mulsd 0x37193(%rip), %xmm0    # 0x6cd30
movsd %xmm0, 0x80(%rbx)
movq %r14, %rdi
movl $0x10c, %esi            # imm = 0x10C
movl $0x4, %edx
callq 0x4e341
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 0x4e341
testl %eax, %eax
je 0x35beb
movapd -0x40(%rbp), %xmm0
orpd 0x34ee7(%rip), %xmm0    # 0x6aad0
jmp 0x35bf0
movapd -0x40(%rbp), %xmm0
mulsd 0x37138(%rip), %xmm0    # 0x6cd30
movsd %xmm0, 0x90(%rbx)
movq %r14, %rdi
movl $0x110, %esi            # imm = 0x110
movl $0x5, %edx
callq 0x4e341
movl %eax, 0x14(%rbx)
movq %r14, %rdi
movl $0x123, %esi            # imm = 0x123
movl $0x1, %edx
callq 0x4e341
movq %r14, %rdi
movl $0x124, %esi            # imm = 0x124
movl $0x4, %edx
callq 0x4e341
movl %eax, 0x10(%rbx)
movq %r14, %rdi
movl $0x12b, %esi            # imm = 0x12B
movl $0xb, %edx
callq 0x4e341
movq %r14, %rdi
movl $0x136, %esi            # imm = 0x136
movl $0x5, %edx
callq 0x4e341
movl %eax, %r12d
movq %r14, %rdi
movl $0x13b, %esi            # imm = 0x13B
movl $0x2, %edx
callq 0x4e341
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 0x35cb9
leaq 0x374bc(%rip), %rsi     # 0x6d15c
xorl %ebx, %ebx
movl $0x3, %edi
movl %r13d, %r8d
movl %r15d, %r9d
xorl %eax, %eax
callq 0x4ded0
jmp 0x35e4b
movl $0x4, %edi
movl %r12d, %esi
callq 0x4dbc5
movl %eax, (%rbx)
testl %eax, %eax
je 0x35d87
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 0x5034e
leaq -0x64(%rbp), %rsi
movq %rax, %rdi
callq 0x4fc2d
movsd %xmm0, -0x48(%rbp)
movsd 0x34bbb(%rip), %xmm1    # 0x6a8d0
callq 0x8860
xorps %xmm1, %xmm1
cvtsi2sdl -0x70(%rbp), %xmm1
cvtsi2sdl -0x6c(%rbp), %xmm2
mulsd 0x34b89(%rip), %xmm2    # 0x6a8b8
mulsd 0x34b89(%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 0x36067(%rip), %xmm0    # 0x6bdc8
movsd 0x36087(%rip), %xmm1    # 0x6bdf0
addsd %xmm3, %xmm1
movsd %xmm1, -0x60(%rbp)
ucomisd %xmm0, %xmm1
movsd %xmm3, -0x40(%rbp)
jbe 0x35da4
addsd 0x34b4b(%rip), %xmm0    # 0x6a8d0
jmp 0x35dbe
leaq 0x373f7(%rip), %rsi     # 0x6d185
xorl %ebx, %ebx
movl $0x2, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0x4ded0
jmp 0x35e4b
movsd 0x3604c(%rip), %xmm1    # 0x6bdf8
addsd %xmm3, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x35dbe
addsd 0x36042(%rip), %xmm0    # 0x6be00
movl -0x64(%rbp), %edi
addsd -0x48(%rbp), %xmm0
callq 0x4fbc6
movq %rax, %rdi
callq 0x5040e
movq %rax, 0x28(%rbx)
movsd %xmm0, 0x30(%rbx)
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
mulsd 0x34ccc(%rip), %xmm1    # 0x6aab8
addsd 0x35fd4(%rip), %xmm1    # 0x6bdc8
movsd -0x60(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x35e09
addsd 0x34ac9(%rip), %xmm1    # 0x6a8d0
jmp 0x35e24
movsd -0x40(%rbp), %xmm0
addsd 0x35fe2(%rip), %xmm0    # 0x6bdf8
ucomisd %xmm0, %xmm1
jbe 0x35e24
addsd 0x35fdc(%rip), %xmm1    # 0x6be00
movl -0x64(%rbp), %edi
movsd -0x48(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x4fbc6
movq %rax, %rdi
callq 0x5040e
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