// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_type1045(bamboo::rtcm_t*)
static int decode_type1045(rtcm_t *rtcm)
{
    eph_t eph={0};
    double toc,sqrtA;
    char *msg;
    int i=24+12,prn,sat,week,e5a_hs,e5a_dvs,rsv,sys=SYS_GAL;
    
    if (i+484<=rtcm->len*8) {
        prn       =getbitu(rtcm->buff,i, 6);              i+= 6;
        week      =getbitu(rtcm->buff,i,12);              i+=12; /* gst-week */
        eph.iode  =getbitu(rtcm->buff,i,10);              i+=10;
        eph.sva   =getbitu(rtcm->buff,i, 8);              i+= 8;
        eph.idot  =getbits(rtcm->buff,i,14)*P2_43*SC2RAD; i+=14;
        toc       =getbitu(rtcm->buff,i,14)*60.0;         i+=14;
        eph.f2    =getbits(rtcm->buff,i, 6)*P2_59;        i+= 6;
        eph.f1    =getbits(rtcm->buff,i,21)*P2_46;        i+=21;
        eph.f0    =getbits(rtcm->buff,i,31)*P2_34;        i+=31;
        eph.crs   =getbits(rtcm->buff,i,16)*P2_5;         i+=16;
        eph.deln  =getbits(rtcm->buff,i,16)*P2_43*SC2RAD; i+=16;
        eph.M0    =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.cuc   =getbits(rtcm->buff,i,16)*P2_29;        i+=16;
        eph.e     =getbitu(rtcm->buff,i,32)*P2_33;        i+=32;
        eph.cus   =getbits(rtcm->buff,i,16)*P2_29;        i+=16;
        sqrtA     =getbitu(rtcm->buff,i,32)*P2_19;        i+=32;
        eph.toes  =getbitu(rtcm->buff,i,14)*60.0;         i+=14;
        eph.cic   =getbits(rtcm->buff,i,16)*P2_29;        i+=16;
        eph.OMG0  =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.cis   =getbits(rtcm->buff,i,16)*P2_29;        i+=16;
        eph.i0    =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.crc   =getbits(rtcm->buff,i,16)*P2_5;         i+=16;
        eph.omg   =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.OMGd  =getbits(rtcm->buff,i,24)*P2_43*SC2RAD; i+=24;
        eph.tgd[0]=getbits(rtcm->buff,i,10)*P2_32;        i+=10; /* E5a/E1 */
        e5a_hs    =getbitu(rtcm->buff,i, 2);              i+= 2; /* OSHS */
        e5a_dvs   =getbitu(rtcm->buff,i, 1);              i+= 1; /* OSDVS */
        rsv       =getbitu(rtcm->buff,i, 7);
    }
    else {
        trace(2,"rtcm3 1045 length error: len=%d\n",rtcm->len);
        return -1;
    }
    trace(4,"decode_type1045: prn=%d iode=%d toe=%.0f\n",prn,eph.iode,eph.toes);
    
    if (rtcm->outtype) {
        msg=rtcm->msgtype+strlen(rtcm->msgtype);
        sprintf(msg," prn=%2d iode=%3d week=%d toe=%6.0f toc=%6.0f hs=%d dvs=%d",
                prn,eph.iode,week,eph.toes,toc,e5a_hs,e5a_dvs);
    }
    if (!(sat=satno(sys,prn))) {
        trace(2,"rtcm3 1045 satellite number error: prn=%d\n",prn);
        return -1;
    }
    if (strstr(rtcm->opt,"-GALINAV")) {
        return 0;
    }
    eph.sat=sat;
    eph.week=week+1024; /* gal-week = gst-week + 1024 */
    eph.toe=gpst2time(eph.week,eph.toes);
    eph.toc=gpst2time(eph.week,toc);
    eph.ttr=rtcm->time;
    eph.A=sqrtA*sqrtA;
    eph.svh=(e5a_hs<<4)+(e5a_dvs<<3);
    eph.code=(1<<1)|(1<<8); /* data source = f/nav e5a + af0-2,toc,sisa for e5a-e1 */
    if (!strstr(rtcm->opt,"-EPHALL")) {
        if (eph.iode==rtcm->nav.eph[sat-1].iode) return 0; /* unchanged */
    }
    rtcm->nav.eph[sat-1]=eph;
    rtcm->ephsat=sat;
    return 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
xorpd %xmm0, %xmm0
movapd %xmm0, -0xd0(%rbp)
movl 0x9f0c0(%rdi), %edx
cmpl $0x41, %edx
jl 0x3ebca
movq %rdi, %rbx
leaq 0x9f0c4(%rdi), %r13
movq %r13, %rdi
movl $0x24, %esi
movl $0x6, %edx
callq 0x4d9d6
movl %eax, -0x2c(%rbp)
movq %r13, %rdi
movl $0x2a, %esi
movl $0xc, %edx
callq 0x4d9d6
movl %eax, -0x40(%rbp)
movq %r13, %rdi
movl $0x36, %esi
movl $0xa, %edx
callq 0x4d9d6
movl %eax, %r12d
movq %r13, %rdi
movl $0x40, %esi
movl $0x8, %edx
callq 0x4d9d6
movl %eax, -0x94(%rbp)
movq %r13, %rdi
movl $0x48, %esi
movl $0xe, %edx
callq 0x4da25
movl %eax, -0x7c(%rbp)
movq %r13, %rdi
movl $0x56, %esi
movl $0xe, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x2c2ec(%rip), %xmm0    # 0x6a8b8
movsd %xmm0, -0x38(%rbp)
movq %r13, %rdi
movl $0x64, %esi
movl $0x6, %edx
callq 0x4da25
movl %eax, -0x98(%rbp)
movq %r13, %rdi
movl $0x6a, %esi
movl $0x15, %edx
callq 0x4da25
movl %eax, -0x90(%rbp)
movq %r13, %rdi
movl $0x7f, %esi
movl $0x1f, %edx
callq 0x4da25
movl %eax, -0x8c(%rbp)
movq %r13, %rdi
movl $0x9e, %esi
movl $0x10, %edx
callq 0x4da25
movl %eax, -0x78(%rbp)
movq %r13, %rdi
movl $0xae, %esi
movl $0x10, %edx
callq 0x4da25
movl %eax, -0x70(%rbp)
movq %r13, %rdi
movl $0xbe, %esi
movl $0x20, %edx
callq 0x4da25
movl %eax, -0x68(%rbp)
movq %r13, %rdi
movl $0xde, %esi
movl $0x10, %edx
callq 0x4da25
movl %eax, -0x74(%rbp)
movq %r13, %rdi
movl $0xee, %esi
movl $0x20, %edx
callq 0x4d9d6
movl %eax, -0x88(%rbp)
movq %r13, %rdi
movl $0x10e, %esi            # imm = 0x10E
movl $0x10, %edx
callq 0x4da25
movl %eax, -0x6c(%rbp)
movq %r13, %rdi
movl $0x11e, %esi            # imm = 0x11E
movl $0x20, %edx
callq 0x4d9d6
movl %eax, -0x84(%rbp)
movq %r13, %rdi
movl $0x13e, %esi            # imm = 0x13E
movl $0xe, %edx
callq 0x4d9d6
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x2c1e2(%rip), %xmm0    # 0x6a8b8
movsd %xmm0, -0x48(%rbp)
movq %r13, %rdi
movl $0x14c, %esi            # imm = 0x14C
movl $0x10, %edx
callq 0x4da25
movl %eax, -0x60(%rbp)
movq %r13, %rdi
movl $0x15c, %esi            # imm = 0x15C
movl $0x20, %edx
callq 0x4da25
movl %eax, -0x58(%rbp)
movq %r13, %rdi
movl $0x17c, %esi            # imm = 0x17C
movl $0x10, %edx
callq 0x4da25
movl %eax, -0x5c(%rbp)
movq %r13, %rdi
movl $0x18c, %esi            # imm = 0x18C
movl $0x20, %edx
callq 0x4da25
movl %eax, -0x54(%rbp)
movq %r13, %rdi
movl $0x1ac, %esi            # imm = 0x1AC
movl $0x10, %edx
callq 0x4da25
movl %eax, -0x64(%rbp)
movq %r13, %rdi
movl $0x1bc, %esi            # imm = 0x1BC
movl $0x20, %edx
callq 0x4da25
movl %eax, -0x50(%rbp)
movq %r13, %rdi
movl $0x1dc, %esi            # imm = 0x1DC
movl $0x18, %edx
callq 0x4da25
movl %eax, -0x4c(%rbp)
movq %r13, %rdi
movl $0x1f4, %esi            # imm = 0x1F4
movl $0xa, %edx
callq 0x4da25
movl %eax, -0x80(%rbp)
movq %r13, %rdi
movl $0x1fe, %esi            # imm = 0x1FE
movl $0x2, %edx
callq 0x4d9d6
movl %eax, %r15d
movq %r13, %rdi
movl $0x200, %esi            # imm = 0x200
movl $0x1, %edx
callq 0x4d9d6
movl %eax, %r14d
movq %r13, %rdi
movq %r15, %r13
movl $0x201, %esi            # imm = 0x201
movl $0x7, %edx
callq 0x4d9d6
leaq 0x30ebd(%rip), %rsi     # 0x6f686
movl $0x4, %edi
movl -0x2c(%rbp), %edx
movl %edx, %r15d
movl %r12d, %ecx
movsd -0x48(%rbp), %xmm0
movb $0x1, %al
callq 0x4d55d
cmpl $0x0, 0xc(%rbx)
je 0x3e829
leaq 0x9b9d0(%rbx), %rdi
callq 0x8290
leaq (%rbx,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
movl %r14d, (%rsp)
leaq 0x30ea5(%rip), %rsi     # 0x6f6b0
movl %r15d, %edx
movl %r12d, %ecx
movl -0x40(%rbp), %r8d
movsd -0x48(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movl %r13d, %r9d
movb $0x2, %al
callq 0x8120
movq %r14, -0xb8(%rbp)
movl $0x8, %edi
movl %r15d, %esi
callq 0x4d28d
testl %eax, %eax
je 0x3ebd8
movq %r13, -0xb0(%rbp)
movl %eax, %r13d
movl %r12d, -0x2c(%rbp)
movl -0x40(%rbp), %r14d
leaq 0x9fd48(%rbx), %r15
leaq 0x2df45(%rip), %rsi     # 0x6c7aa
movq %r15, %rdi
callq 0x8160
xorl %r12d, %r12d
testq %rax, %rax
jne 0x3ebf4
addl $0x400, %r14d           # imm = 0x400
movl %r14d, %edi
movsd -0x48(%rbp), %xmm0
callq 0x4f24a
movq %rax, -0xa8(%rbp)
movsd %xmm0, -0x40(%rbp)
movl %r14d, %edi
movsd -0x38(%rbp), %xmm0
callq 0x4f24a
movq %rax, -0xa0(%rbp)
movsd %xmm0, -0x38(%rbp)
movupd 0x10(%rbx), %xmm0
movapd %xmm0, -0xd0(%rbp)
leaq 0x2de01(%rip), %rsi     # 0x6c6c7
movq %r15, %rdi
callq 0x8160
movq 0x80(%rbx), %rcx
movslq %r13d, %rdx
leaq (%rdx,%rdx,8), %rdx
testq %rax, %rax
movl -0x2c(%rbp), %esi
jne 0x3e8f8
movq %rdx, %rax
shlq $0x5, %rax
cmpl -0x11c(%rcx,%rax), %esi
je 0x3ebf4
xorps %xmm0, %xmm0
cvtsi2sdl -0x7c(%rbp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl -0x70(%rbp), %xmm1
cvtsi2sdl -0x68(%rbp), %xmm2
cvtsi2sdl -0x58(%rbp), %xmm4
cvtsi2sdl -0x54(%rbp), %xmm6
cvtsi2sdl -0x50(%rbp), %xmm5
cvtsi2sdl -0x4c(%rbp), %xmm3
cvtsi2sdl -0x78(%rbp), %xmm7
cvtsi2sdl -0x74(%rbp), %xmm8
cvtsi2sdl -0x6c(%rbp), %xmm9
cvtsi2sdl -0x60(%rbp), %xmm10
cvtsi2sdl -0x5c(%rbp), %xmm11
movsd 0x2e371(%rip), %xmm12   # 0x6ccb8
mulsd %xmm12, %xmm2
mulsd %xmm12, %xmm4
mulsd %xmm12, %xmm6
mulsd %xmm12, %xmm5
movsd 0x2e36c(%rip), %xmm12   # 0x6ccd0
mulsd %xmm12, %xmm0
mulsd %xmm12, %xmm1
mulsd %xmm12, %xmm3
movsd 0x2e35c(%rip), %xmm12   # 0x6ccd8
mulsd %xmm12, %xmm8
mulsd %xmm12, %xmm9
mulsd %xmm12, %xmm10
mulsd %xmm12, %xmm11
movsd 0x2e347(%rip), %xmm13   # 0x6cce0
mulsd %xmm13, %xmm7
xorps %xmm12, %xmm12
cvtsi2sdl -0x64(%rbp), %xmm12
mulsd %xmm13, %xmm12
movsd 0x2d3f2(%rip), %xmm13   # 0x6bda8
mulsd %xmm13, %xmm0
mulsd %xmm13, %xmm1
mulsd %xmm13, %xmm2
mulsd %xmm13, %xmm4
mulsd %xmm13, %xmm6
mulsd %xmm13, %xmm5
mulsd %xmm13, %xmm3
movq -0xb0(%rbp), %rax
shll $0x4, %eax
movq -0xb8(%rbp), %r8
leal (%rax,%r8,8), %eax
shlq $0x5, %rdx
movl %r13d, -0x120(%rcx,%rdx)
movl %esi, -0x11c(%rcx,%rdx)
movl $0x0, -0x118(%rcx,%rdx)
movl -0x94(%rbp), %esi
movl %esi, -0x114(%rcx,%rdx)
movl %eax, -0x110(%rcx,%rdx)
movl %r14d, -0x10c(%rcx,%rdx)
movq $0x102, -0x108(%rcx,%rdx) # imm = 0x102
movq -0xa8(%rbp), %rax
movq %rax, -0x100(%rcx,%rdx)
movl -0x88(%rbp), %eax
movsd -0x40(%rbp), %xmm13
movsd %xmm13, -0xf8(%rcx,%rdx)
xorps %xmm13, %xmm13
cvtsi2sd %rax, %xmm13
movq -0xa0(%rbp), %rax
movq %rax, -0xf0(%rcx,%rdx)
movl -0x84(%rbp), %eax
cvtsi2sd %rax, %xmm14
movsd -0x38(%rbp), %xmm15
movsd %xmm15, -0xe8(%rcx,%rdx)
mulsd 0x2e22b(%rip), %xmm13   # 0x6ccc0
movaps -0xd0(%rbp), %xmm15
movups %xmm15, -0xe0(%rcx,%rdx)
mulsd 0x2e219(%rip), %xmm14   # 0x6ccc8
mulsd %xmm14, %xmm14
movsd %xmm14, -0xd0(%rcx,%rdx)
movsd %xmm13, -0xc8(%rcx,%rdx)
movsd %xmm6, -0xc0(%rcx,%rdx)
movsd %xmm4, -0xb8(%rcx,%rdx)
movsd %xmm5, -0xb0(%rcx,%rdx)
movsd %xmm2, -0xa8(%rcx,%rdx)
movsd %xmm1, -0xa0(%rcx,%rdx)
movsd %xmm3, -0x98(%rcx,%rdx)
movsd %xmm0, -0x90(%rcx,%rdx)
movsd %xmm12, -0x88(%rcx,%rdx)
movsd %xmm7, -0x80(%rcx,%rdx)
movsd %xmm8, -0x78(%rcx,%rdx)
movsd %xmm9, -0x70(%rcx,%rdx)
movsd %xmm10, -0x68(%rcx,%rdx)
xorps %xmm0, %xmm0
cvtsi2sdl -0x98(%rbp), %xmm0
movsd %xmm11, -0x60(%rcx,%rdx)
xorps %xmm1, %xmm1
cvtsi2sdl -0x90(%rbp), %xmm1
movsd -0x48(%rbp), %xmm2
movsd %xmm2, -0x58(%rcx,%rdx)
xorps %xmm2, %xmm2
cvtsi2sdl -0x8c(%rbp), %xmm2
mulsd 0x2e189(%rip), %xmm1    # 0x6ccf0
mulsd 0x2e179(%rip), %xmm2    # 0x6cce8
xorl %eax, %eax
movq %rax, -0x50(%rcx,%rdx)
movsd %xmm2, -0x48(%rcx,%rdx)
movsd %xmm1, -0x40(%rcx,%rdx)
xorps %xmm1, %xmm1
cvtsi2sdl -0x80(%rbp), %xmm1
mulsd 0x2e166(%rip), %xmm0    # 0x6ccf8
mulsd 0x2e166(%rip), %xmm1    # 0x6cd00
movsd %xmm0, -0x38(%rcx,%rdx)
movsd %xmm1, -0x30(%rcx,%rdx)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x18(%rcx,%rdx)
movupd %xmm0, -0x28(%rcx,%rdx)
movq %rax, -0x8(%rcx,%rdx)
movl %r13d, 0x9bdd4(%rbx)
movl $0x2, %r12d
jmp 0x3ebf4
leaq 0x30a94(%rip), %rsi     # 0x6f665
movl $0x2, %edi
jmp 0x3ebe7
leaq 0x30b0c(%rip), %rsi     # 0x6f6eb
movl $0x2, %edi
movl %r15d, %edx
xorl %eax, %eax
callq 0x4d55d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq