// File: /workspace/github_cpp_makefile_star2_O1/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 0x3dbfe
movq %rdi, %rbx
leaq 0x9f0c4(%rdi), %r12
movq %r12, %rdi
movl $0x24, %esi
movl $0x6, %edx
callq 0x4e341
movl %eax, %r14d
movq %r12, %rdi
movl $0x2a, %esi
movl $0x5, %edx
callq 0x4e341
movl %eax, %r15d
movq %r12, %rdi
movl $0x33, %esi
movl $0x5, %edx
callq 0x4e341
movl %eax, -0x30(%rbp)
movq %r12, %rdi
movl $0x38, %esi
movl $0x6, %edx
callq 0x4e341
movl %eax, -0x48(%rbp)
movq %r12, %rdi
movl $0x3e, %esi
movl $0x1, %edx
callq 0x4e341
movl %eax, -0x40(%rbp)
movq %r12, %rdi
movl $0x3f, %esi
movl $0x1, %edx
callq 0x4e341
movl %eax, %r13d
movq %r12, %rdi
movl $0x41, %esi
movl $0x7, %edx
callq 0x4e341
movl %eax, -0x34(%rbp)
movq %r12, %rdi
movl $0x49, %esi
movl $0x17, %edx
callq 0x4e341
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x110(%rbp)
movq %r12, %rdi
movl $0x48, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3d782
movapd -0x110(%rbp), %xmm0
orpd 0x2d356(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x110(%rbp)
movq %r12, %rdi
movl $0x61, %esi
movl $0x1a, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x100(%rbp)
movq %r12, %rdi
movl $0x60, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3d7d4
movapd -0x100(%rbp), %xmm0
orpd 0x2d304(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x100(%rbp)
movq %r12, %rdi
movl $0x7c, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xf0(%rbp)
movq %r12, %rdi
movl $0x7b, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3d826
movapd -0xf0(%rbp), %xmm0
orpd 0x2d2b2(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xf0(%rbp)
movq %r12, %rdi
movl $0x81, %esi
movl $0x17, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xe0(%rbp)
movq %r12, %rdi
movl $0x80, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3d878
movapd -0xe0(%rbp), %xmm0
orpd 0x2d260(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xe0(%rbp)
movq %r12, %rdi
movl $0x99, %esi
movl $0x1a, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xd0(%rbp)
movq %r12, %rdi
movl $0x98, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3d8ca
movapd -0xd0(%rbp), %xmm0
orpd 0x2d20e(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xd0(%rbp)
movq %r12, %rdi
movl $0xb4, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xc0(%rbp)
movq %r12, %rdi
movl $0xb3, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3d91c
movapd -0xc0(%rbp), %xmm0
orpd 0x2d1bc(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xc0(%rbp)
movq %r12, %rdi
movl $0xb9, %esi
movl $0x17, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xb0(%rbp)
movq %r12, %rdi
movl $0xb8, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3d96e
movapd -0xb0(%rbp), %xmm0
orpd 0x2d16a(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xb0(%rbp)
movq %r12, %rdi
movl $0xd1, %esi
movl $0x1a, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0xa0(%rbp)
movq %r12, %rdi
movl $0xd0, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3d9c0
movapd -0xa0(%rbp), %xmm0
orpd 0x2d118(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0xa0(%rbp)
movq %r12, %rdi
movl $0xec, %esi
movl $0x4, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x90(%rbp)
movq %r12, %rdi
movl $0xeb, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3da12
movapd -0x90(%rbp), %xmm0
orpd 0x2d0c6(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x90(%rbp)
movq %r12, %rdi
movl $0xf2, %esi
movl $0xa, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x80(%rbp)
movq %r12, %rdi
movl $0xf1, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3da5b
movapd -0x80(%rbp), %xmm0
orpd 0x2d07a(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x80(%rbp)
movq %r12, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x15, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movapd %xmm0, -0x70(%rbp)
movq %r12, %rdi
movl $0xff, %esi
movl $0x1, %edx
callq 0x4e341
testl %eax, %eax
je 0x3daa4
movapd -0x70(%rbp), %xmm0
orpd 0x2d031(%rip), %xmm0    # 0x6aad0
movapd %xmm0, -0x70(%rbp)
movl $0x4, %edi
movl %r14d, %esi
callq 0x4dbc5
testl %eax, %eax
je 0x3dc0c
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 0x31365(%rip), %xmm2    # 0x6ee48
leaq 0x317af(%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 0x4ded0
cmpl $0x0, 0xc(%rbx)
je 0x3db4f
leaq 0x9b9d0(%rbx), %rdi
callq 0x8290
leaq (%rbx,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
leaq 0x3179e(%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
cmpq $0x0, 0x10(%rbx)
jne 0x3db6c
callq 0x4febe
movq %rax, %rdi
callq 0x5040e
movq %rax, 0x10(%rbx)
movsd %xmm0, 0x18(%rbx)
movq 0x10(%rbx), %rdi
movsd 0x18(%rbx), %xmm0
callq 0x5034e
leaq -0x50(%rbp), %rsi
movq %rax, %rdi
callq 0x4fc2d
movsd %xmm0, -0x30(%rbp)
movsd 0x2cd3d(%rip), %xmm1    # 0x6a8d0
callq 0x8860
movapd %xmm0, %xmm2
movsd -0x30(%rbp), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x58(%rbp), %xmm1
mulsd 0x2cd01(%rip), %xmm1    # 0x6a8b8
movsd -0x48(%rbp), %xmm0
mulsd 0x2ccfc(%rip), %xmm0    # 0x6a8c0
addsd %xmm1, %xmm0
addsd -0x40(%rbp), %xmm0
addsd 0x2e1f3(%rip), %xmm0    # 0x6bdc8
movsd 0x2e213(%rip), %xmm1    # 0x6bdf0
addsd %xmm2, %xmm1
movsd %xmm1, -0x48(%rbp)
ucomisd %xmm0, %xmm1
movsd %xmm2, -0x118(%rbp)
jbe 0x3dc2c
addsd 0x2ccd4(%rip), %xmm0    # 0x6a8d0
jmp 0x3dc46
leaq 0x31648(%rip), %rsi     # 0x6f24d
movl $0x2, %edi
jmp 0x3dc1b
leaq 0x3165b(%rip), %rsi     # 0x6f26e
movl $0x2, %edi
movl %r14d, %edx
xorl %eax, %eax
callq 0x4ded0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3dede
movsd 0x2e1c4(%rip), %xmm1    # 0x6bdf8
addsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x3dc46
addsd 0x2e1ba(%rip), %xmm0    # 0x6be00
movl -0x50(%rbp), %edi
addsd -0x30(%rbp), %xmm0
callq 0x4fbc6
movq %rax, %rdi
callq 0x5040e
movq %rax, -0x40(%rbp)
movsd %xmm0, -0x58(%rbp)
xorps %xmm1, %xmm1
cvtsi2sdl -0x34(%rbp), %xmm1
mulsd 0x2ce44(%rip), %xmm1    # 0x6aab8
addsd 0x2e14c(%rip), %xmm1    # 0x6bdc8
movsd -0x48(%rbp), %xmm0
ucomisd %xmm1, %xmm0
movl %r15d, -0x5c(%rbp)
movl %r13d, -0x4c(%rbp)
jbe 0x3dc9c
movq %r14, %r15
addsd 0x2cc36(%rip), %xmm1    # 0x6a8d0
jmp 0x3dcbd
movsd -0x118(%rbp), %xmm0
addsd 0x2e14c(%rip), %xmm0    # 0x6bdf8
movq %r14, %r15
ucomisd %xmm0, %xmm1
jbe 0x3dcbd
addsd 0x2e143(%rip), %xmm1    # 0x6be00
movl -0x50(%rbp), %edi
movsd -0x30(%rbp), %xmm0
addsd %xmm1, %xmm0
callq 0x4fbc6
movq %rax, %rdi
callq 0x5040e
movq %rax, %r13
movsd %xmm0, -0x30(%rbp)
leaq 0x9fd48(%rbx), %rdi
leaq 0x2e9db(%rip), %rsi     # 0x6c6c7
callq 0x8160
testq %rax, %rax
jne 0x3dd51
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 0x4fe97
andpd 0x2bc04(%rip), %xmm0    # 0x69930
movsd 0x2bbec(%rip), %xmm1    # 0x69920
ucomisd %xmm0, %xmm1
jbe 0x3dd51
movq 0x88(%rbx), %rcx
xorl %eax, %eax
movl -0x4c(%rbp), %edx
cmpl 0xc(%rcx,%r14), %edx
je 0x3dede
movsd 0x2efcf(%rip), %xmm0    # 0x6cd28
movsd 0x2efd7(%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 0x2efa1(%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 0x2d6bb(%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 0x2ee79(%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