// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_type1020(bamboo::rtcm_t*)
static int decode_type1020(rtcm_t *rtcm)
{
    geph_t geph={0};
    double tk_h,tk_m,tk_s,toe,tow,tod,tof;
    char *msg;
    int i=24+12,prn,sat,week,tb,bn,sys=SYS_GLO;
    
    if (i+348<=rtcm->len*8) {
        prn        =getbitu(rtcm->buff,i, 6);           i+= 6;
        geph.frq   =getbitu(rtcm->buff,i, 5)-7;         i+= 5+2+2;
        tk_h       =getbitu(rtcm->buff,i, 5);           i+= 5;
        tk_m       =getbitu(rtcm->buff,i, 6);           i+= 6;
        tk_s       =getbitu(rtcm->buff,i, 1)*30.0;      i+= 1;
        bn         =getbitu(rtcm->buff,i, 1);           i+= 1+1;
        tb         =getbitu(rtcm->buff,i, 7);           i+= 7;
        geph.vel[0]=getbitg(rtcm->buff,i,24)*P2_20*1E3; i+=24;
        geph.pos[0]=getbitg(rtcm->buff,i,27)*P2_11*1E3; i+=27;
        geph.acc[0]=getbitg(rtcm->buff,i, 5)*P2_30*1E3; i+= 5;
        geph.vel[1]=getbitg(rtcm->buff,i,24)*P2_20*1E3; i+=24;
        geph.pos[1]=getbitg(rtcm->buff,i,27)*P2_11*1E3; i+=27;
        geph.acc[1]=getbitg(rtcm->buff,i, 5)*P2_30*1E3; i+= 5;
        geph.vel[2]=getbitg(rtcm->buff,i,24)*P2_20*1E3; i+=24;
        geph.pos[2]=getbitg(rtcm->buff,i,27)*P2_11*1E3; i+=27;
        geph.acc[2]=getbitg(rtcm->buff,i, 5)*P2_30*1E3; i+= 5+1;
        geph.gamn  =getbitg(rtcm->buff,i,11)*P2_40;     i+=11+3;
        geph.taun  =getbitg(rtcm->buff,i,22)*P2_30;
    }
    else {
        trace(2,"rtcm3 1020 length error: len=%d\n",rtcm->len);
        return -1;
    }
    if (!(sat=satno(sys,prn))) {
        trace(2,"rtcm3 1020 satellite number error: prn=%d\n",prn);
        return -1;
    }
    trace(4,"decode_type1020: prn=%d tk=%02.0f:%02.0f:%02.0f\n",prn,tk_h,tk_m,tk_s);
    
    if (rtcm->outtype) {
        msg=rtcm->msgtype+strlen(rtcm->msgtype);
        sprintf(msg," prn=%2d tk=%02.0f:%02.0f:%02.0f frq=%2d bn=%d tb=%d",
                prn,tk_h,tk_m,tk_s,geph.frq,bn,tb);
    }
    geph.sat=sat;
    geph.svh=bn;
    geph.iode=tb&0x7F;
    if (rtcm->time.time==0) rtcm->time=utc2gpst(timeget());
    tow=time2gpst(gpst2utc(rtcm->time),&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 */
    
    if (!strstr(rtcm->opt,"-EPHALL")) {
        if (fabs(timediff(geph.toe,rtcm->nav.geph[prn-1].toe))<1.0&&
            geph.svh==rtcm->nav.geph[prn-1].svh) return 0; /* unchanged */
    }
    rtcm->nav.geph[prn-1]=geph;
    rtcm->ephsat=sat;
    return 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl 0x9f0c0(%rdi), %edx
cmpl $0x30, %edx
jl 0x3d49c
movq %rdi, %rbx
leaq 0x9f0c4(%rdi), %r12
movq %r12, %rdi
movl $0x24, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, %r14d
movq %r12, %rdi
movl $0x2a, %esi
movl $0x5, %edx
callq 0x4d9d6
movl %eax, %r15d
movq %r12, %rdi
movl $0x33, %esi
movl $0x5, %edx
callq 0x4d9d6
movl %eax, -0x30(%rbp)
movq %r12, %rdi
movl $0x38, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, -0x48(%rbp)
movq %r12, %rdi
movl $0x3e, %esi
movl $0x1, %edx
callq 0x4d9d6
movl %eax, -0x40(%rbp)
movq %r12, %rdi
movl $0x3f, %esi
movl $0x1, %edx
callq 0x4d9d6
movl %eax, %r13d
movq %r12, %rdi
movl $0x41, %esi
movl $0x7, %edx
callq 0x4d9d6
movl %eax, -0x34(%rbp)
movq %r12, %rdi
movl $0x49, %esi
movl $0x17, %edx
callq 0x4d9d6
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x110(%rbp)
movq %r12, %rdi
movl $0x48, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d0bf
movapd -0x110(%rbp), %xmm0
orpd 0x2da19(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x110(%rbp)
movq %r12, %rdi
movl $0x61, %esi
movl $0x1a, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x100(%rbp)
movq %r12, %rdi
movl $0x60, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d111
movapd -0x100(%rbp), %xmm0
orpd 0x2d9c7(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x100(%rbp)
movq %r12, %rdi
movl $0x7c, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xf0(%rbp)
movq %r12, %rdi
movl $0x7b, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d163
movapd -0xf0(%rbp), %xmm0
orpd 0x2d975(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xf0(%rbp)
movq %r12, %rdi
movl $0x81, %esi
movl $0x17, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xe0(%rbp)
movq %r12, %rdi
movl $0x80, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d1b5
movapd -0xe0(%rbp), %xmm0
orpd 0x2d923(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xe0(%rbp)
movq %r12, %rdi
movl $0x99, %esi
movl $0x1a, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xd0(%rbp)
movq %r12, %rdi
movl $0x98, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d207
movapd -0xd0(%rbp), %xmm0
orpd 0x2d8d1(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xd0(%rbp)
movq %r12, %rdi
movl $0xb4, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xc0(%rbp)
movq %r12, %rdi
movl $0xb3, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d259
movapd -0xc0(%rbp), %xmm0
orpd 0x2d87f(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xc0(%rbp)
movq %r12, %rdi
movl $0xb9, %esi
movl $0x17, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xb0(%rbp)
movq %r12, %rdi
movl $0xb8, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d2ab
movapd -0xb0(%rbp), %xmm0
orpd 0x2d82d(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xb0(%rbp)
movq %r12, %rdi
movl $0xd1, %esi
movl $0x1a, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xa0(%rbp)
movq %r12, %rdi
movl $0xd0, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d2fd
movapd -0xa0(%rbp), %xmm0
orpd 0x2d7db(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xa0(%rbp)
movq %r12, %rdi
movl $0xec, %esi
movl $0x4, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x90(%rbp)
movq %r12, %rdi
movl $0xeb, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d34f
movapd -0x90(%rbp), %xmm0
orpd 0x2d789(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x90(%rbp)
movq %r12, %rdi
movl $0xf2, %esi
movl $0xa, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x80(%rbp)
movq %r12, %rdi
movl $0xf1, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d398
movapd -0x80(%rbp), %xmm0
orpd 0x2d73d(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x80(%rbp)
movq %r12, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x15, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x70(%rbp)
movq %r12, %rdi
movl $0xff, %esi
movl $0x1, %edx
callq 0x4d9d6
testl %eax, %eax
je 0x3d3e1
movapd -0x70(%rbp), %xmm0
orpd 0x2d6f4(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x70(%rbp)
movl $0x4, %edi
movl %r14d, %esi
callq 0x4d28d
testl %eax, %eax
je 0x3d4aa
movl %eax, %r12d
movl -0x40(%rbp), %eax
movl -0x30(%rbp), %ecx
cvtsi2sd %rax, %xmm2
movl -0x48(%rbp), %eax
addl $-0x7, %r15d
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
cvtsi2sd %rax, %xmm1
mulsd 0x31a28(%rip), %xmm2    # 0x6ee48
leaq 0x31e72(%rip), %rsi     # 0x6f299
movl $0x4, %edi
movl %r14d, %edx
movsd %xmm0, -0x48(%rbp)
movsd %xmm1, -0x58(%rbp)
movsd %xmm2, -0x40(%rbp)
movb $0x3, %al
callq 0x4d55d
cmpl $0x0, 0xc(%rbx)
je 0x3d48c
leaq 0x9b9d0(%rbx), %rdi
callq 0x8290
leaq (%rbx,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
leaq 0x31e61(%rip), %rsi     # 0x6f2ca
movl %r14d, %edx
movsd -0x48(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x40(%rbp), %xmm2
movl %r15d, %ecx
movl %r13d, %r8d
movl -0x34(%rbp), %r9d
movb $0x3, %al
callq 0x8120
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x3d4ca
movsd 0x18(%rbx), %xmm0
jmp 0x3d4e3
leaq 0x31daa(%rip), %rsi     # 0x6f24d
movl $0x2, %edi
jmp 0x3d4b9
leaq 0x31dbd(%rip), %rsi     # 0x6f26e
movl $0x2, %edi
movl %r14d, %edx
xorl %eax, %eax
callq 0x4d55d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3d81e
callq 0x4f542
movq %rax, %rdi
callq 0x4fa70
movq %rax, %rdi
movq %rax, 0x10(%rbx)
movsd %xmm0, 0x18(%rbx)
callq 0x4f9b0
leaq -0x50(%rbp), %rsi
movq %rax, %rdi
callq 0x4f2b1
movsd %xmm0, -0x30(%rbp)
movsd 0x2d3cf(%rip), %xmm1    # 0x6a8d0
callq 0x8850
movapd %xmm0, %xmm2
movsd -0x30(%rbp), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x58(%rbp), %xmm1
mulsd 0x2d393(%rip), %xmm1    # 0x6a8b8
movsd -0x48(%rbp), %xmm0
mulsd 0x2d38e(%rip), %xmm0    # 0x6a8c0
addsd %xmm1, %xmm0
addsd -0x40(%rbp), %xmm0
addsd 0x2e885(%rip), %xmm0    # 0x6bdc8
movsd 0x2e8a5(%rip), %xmm1    # 0x6bdf0
addsd %xmm2, %xmm1
movsd %xmm1, -0x48(%rbp)
ucomisd %xmm0, %xmm1
movsd %xmm2, -0x118(%rbp)
jbe 0x3d56c
addsd 0x2d366(%rip), %xmm0    # 0x6a8d0
jmp 0x3d586
movsd 0x2e884(%rip), %xmm1    # 0x6bdf8
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x3d586
addsd 0x2e87a(%rip), %xmm0    # 0x6be00
movl -0x50(%rbp), %edi
addsd -0x30(%rbp), %xmm0
callq 0x4f24a
movq %rax, %rdi
callq 0x4fa70
movq %rax, -0x40(%rbp)
movsd %xmm0, -0x58(%rbp)
xorps %xmm1, %xmm1
cvtsi2sdl -0x34(%rbp), %xmm1
mulsd 0x2d504(%rip), %xmm1    # 0x6aab8
addsd 0x2e80c(%rip), %xmm1    # 0x6bdc8
movsd -0x48(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movl %r15d, -0x5c(%rbp)
movl %r13d, -0x4c(%rbp)
jbe 0x3d5dc
movq %r14, %r15
addsd 0x2d2f6(%rip), %xmm1    # 0x6a8d0
jmp 0x3d5fd
movsd -0x118(%rbp), %xmm0
addsd 0x2e80c(%rip), %xmm0    # 0x6bdf8
movq %r14, %r15
ucomisd %xmm0, %xmm1
jbe 0x3d5fd
addsd 0x2e803(%rip), %xmm1    # 0x6be00
movl -0x50(%rbp), %edi
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x4f24a
movq %rax, %rdi
callq 0x4fa70
movq %rax, %r13
movsd %xmm0, -0x30(%rbp)
leaq 0x9fd48(%rbx), %rdi
leaq 0x2f09b(%rip), %rsi     # 0x6c6c7
callq 0x8160
testq %rax, %rax
jne 0x3d691
movq 0x88(%rbx), %rax
leal -0x1(%r15), %ecx
movslq %ecx, %rcx
imulq $0x98, %rcx, %r14
movq 0x18(%rax,%r14), %rsi
movsd 0x20(%rax,%r14), %xmm1
movq %r13, %rdi
movsd -0x30(%rbp), %xmm0
callq 0x4f51b
andpd 0x2c2c4(%rip), %xmm0    # 0x69930
movsd 0x2c2ac(%rip), %xmm1    # 0x69920
ucomisd %xmm0, %xmm1
jbe 0x3d691
movq 0x88(%rbx), %rcx
xorl %eax, %eax
movl -0x4c(%rbp), %edx
cmpl 0xc(%rcx,%r14), %edx
je 0x3d81e
movsd 0x2f68f(%rip), %xmm0    # 0x6cd28
movsd 0x2f697(%rip), %xmm1    # 0x6cd38
movapd -0x110(%rbp), %xmm2
mulsd %xmm0, %xmm2
movapd -0xe0(%rbp), %xmm5
mulsd %xmm0, %xmm5
movapd -0xb0(%rbp), %xmm8
mulsd %xmm0, %xmm8
movsd 0x2f661(%rip), %xmm0    # 0x6cd30
movapd -0x100(%rbp), %xmm3
mulsd %xmm1, %xmm3
movapd -0xd0(%rbp), %xmm6
mulsd %xmm1, %xmm6
movapd -0xa0(%rbp), %xmm9
mulsd %xmm1, %xmm9
movsd 0x2dd7b(%rip), %xmm1    # 0x6b478
movapd -0xf0(%rbp), %xmm4
mulsd %xmm0, %xmm4
movapd -0xc0(%rbp), %xmm7
mulsd %xmm0, %xmm7
movapd -0x90(%rbp), %xmm10
mulsd %xmm0, %xmm10
mulsd %xmm1, %xmm2
mulsd %xmm1, %xmm3
mulsd %xmm1, %xmm4
mulsd %xmm1, %xmm5
mulsd %xmm1, %xmm6
mulsd %xmm1, %xmm7
mulsd %xmm1, %xmm8
mulsd %xmm1, %xmm9
mulsd %xmm1, %xmm10
movapd -0x70(%rbp), %xmm1
mulsd %xmm0, %xmm1
movl -0x34(%rbp), %edx
andl $0x7f, %edx
movq 0x88(%rbx), %rax
movslq %r15d, %rcx
imulq $0x98, %rcx, %rcx
movl %r12d, -0x98(%rax,%rcx)
movl %edx, -0x94(%rax,%rcx)
movl -0x5c(%rbp), %edx
movl %edx, -0x90(%rax,%rcx)
movl -0x4c(%rbp), %edx
movl %edx, -0x8c(%rax,%rcx)
xorl %edx, %edx
movq %rdx, -0x88(%rax,%rcx)
movq %r13, -0x80(%rax,%rcx)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x78(%rax,%rcx)
movq -0x40(%rbp), %rsi
movq %rsi, -0x70(%rax,%rcx)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x68(%rax,%rcx)
movsd %xmm3, -0x60(%rax,%rcx)
movsd %xmm6, -0x58(%rax,%rcx)
movsd %xmm9, -0x50(%rax,%rcx)
movsd %xmm2, -0x48(%rax,%rcx)
movsd %xmm5, -0x40(%rax,%rcx)
movsd %xmm8, -0x38(%rax,%rcx)
movsd %xmm4, -0x30(%rax,%rcx)
movsd %xmm7, -0x28(%rax,%rcx)
movsd %xmm10, -0x20(%rax,%rcx)
movsd %xmm1, -0x18(%rax,%rcx)
movapd -0x80(%rbp), %xmm0
mulsd 0x2f539(%rip), %xmm0    # 0x6cd40
movsd %xmm0, -0x10(%rax,%rcx)
movq %rdx, -0x8(%rax,%rcx)
movl %r12d, 0x9bdd4(%rbx)
movl $0x2, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq