// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/skytraq.cpp
// Function: bamboo::decode_stqglo(bamboo::raw_t*)
static int decode_stqglo(raw_t *raw)
{
    geph_t geph={0};
    int i,prn,sat,m;
    unsigned char *p=raw->buff+4;
    
    trace(4,"decode_stqglo: len=%d\n",raw->len);
    
    if (raw->len<19) {
        trace(2,"stq glo string length error: len=%d\n",raw->len);
        return -1;
    }
    if (raw->outtype) {
        sprintf(raw->msgtype,"SKYTRAQ GLSTR (%4d): prn=%2d no=%d",raw->len,
                U1(p+1)-64,U1(p+2));
    }
    prn=U1(p+1)-64;
    if (!(sat=satno(SYS_GLO,prn))) {
        trace(2,"stq glo string satellite number error: prn=%d\n",prn);
        return -1;
    }
    m=U1(p+2); /* string number */
    if (m<1||4<m) {
        return 0; /* non-immediate info and almanac */
    }
    setbitu(raw->subfrm[sat-1]+(m-1)*10,1,4,m);
    for (i=0;i<9;i++) {
        setbitu(raw->subfrm[sat-1]+(m-1)*10,5+i*8,8,p[3+i]);
    }
    if (m!=4) return 0;
    
    /* decode glonass ephemeris strings */
    geph.tof=raw->time;
    if (!decode_glostr(raw->subfrm[sat-1],&geph)||geph.sat!=sat) return 0;
    
    if (!strstr(raw->opt,"-EPHALL")) {
        if (geph.iode==raw->nav.geph[prn-1].iode) return 0; /* unchanged */
    }
    /* keep freq channel number */
    geph.frq=raw->nav.geph[prn-1].frq;
    raw->nav.geph[prn-1]=geph;
    raw->ephsat=sat;
    return 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
leaq -0xe0(%rbp), %rdi
movl $0x98, %edx
xorl %esi, %esi
callq 0x8390
movl 0x81a78(%rbx), %edx
leaq 0x1e544(%rip), %rsi     # 0x75931
movl $0x4, %edi
xorl %eax, %eax
callq 0x4d55d
movl 0x81a78(%rbx), %edx
cmpl $0x12, %edx
jg 0x57415
leaq 0x1e53d(%rip), %rsi     # 0x75948
movl $0x2, %edi
jmp 0x57556
cmpl $0x0, 0x81a8c(%rbx)
je 0x57445
leaq 0x70e70(%rbx), %rdi
movzbl 0x81a95(%rbx), %ecx
addl $-0x40, %ecx
movzbl 0x81a96(%rbx), %r8d
leaq 0x1e52f(%rip), %rsi     # 0x7596d
xorl %eax, %eax
callq 0x8120
movzbl 0x81a95(%rbx), %r12d
leal -0x40(%r12), %r14d
movl $0x4, %edi
movl %r14d, %esi
callq 0x4d28d
testl %eax, %eax
je 0x57547
movzbl 0x81a96(%rbx), %ecx
leal -0x5(%rcx), %edx
xorl %r15d, %r15d
cmpb $-0x4, %dl
jb 0x57563
movq %r12, -0x30(%rbp)
movq %rax, -0x38(%rbp)
decl %eax
cltq
imulq $0x17c, %rax, %rax      # imm = 0x17C
leaq (%rbx,%rax), %rdx
addq %rbx, %rax
addq $0x70f70, %rax          # imm = 0x70F70
movq %rax, -0x40(%rbp)
leaq (%rcx,%rcx,4), %rax
leaq 0x70f66(%rdx,%rax,2), %r13
movq %r13, %rdi
movl $0x1, %esi
movl $0x4, %edx
movq %rcx, -0x48(%rbp)
callq 0x4da98
movl $0x5, %r14d
movl $0x81a97, %r12d         # imm = 0x81A97
movzbl (%rbx,%r12), %ecx
movq %r13, %rdi
movl %r14d, %esi
movl $0x8, %edx
callq 0x4da98
addl $0x8, %r14d
incq %r12
cmpq $0x81aa0, %r12          # imm = 0x81AA0
jne 0x574cf
cmpl $0x4, -0x48(%rbp)
jne 0x57563
movups (%rbx), %xmm0
leaq -0xe0(%rbp), %rsi
movups %xmm0, 0x28(%rsi)
movq -0x40(%rbp), %rdi
callq 0x35012
testl %eax, %eax
je 0x57563
movq -0x38(%rbp), %r14
cmpl %r14d, -0xe0(%rbp)
jne 0x57563
leaq 0x82a90(%rbx), %rdi
leaq 0x15197(%rip), %rsi     # 0x6c6c7
callq 0x8160
testq %rax, %rax
je 0x57578
movq 0x1d88(%rbx), %rax
movq -0x30(%rbp), %rsi
jmp 0x5759b
leaq 0x1e442(%rip), %rsi     # 0x75990
movl $0x2, %edi
movl %r14d, %edx
xorl %eax, %eax
callq 0x4d55d
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0xdc(%rbp), %ecx
movq 0x1d88(%rbx), %rax
movq -0x30(%rbp), %rsi
movl %esi, %edx
imulq $0x98, %rdx, %rdx
cmpl -0x2694(%rax,%rdx), %ecx
je 0x57563
imulq $0x98, %rsi, %rcx
leaq (%rcx,%rax), %rdi
addq $-0x2698, %rdi          # imm = 0xD968
movl 0x8(%rdi), %eax
leaq -0xe0(%rbp), %rsi
movl %eax, 0x8(%rsi)
movl $0x98, %edx
callq 0x84f0
movl %r14d, 0x70e40(%rbx)
movl $0x2, %r15d
jmp 0x57563