// File: /workspace/github_cpp_makefile_star2_O1/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 0x3f293
movq %rdi, %rbx
leaq 0x9f0c4(%rdi), %r15
movq %r15, %rdi
movl $0x24, %esi
movl $0x6, %edx
callq 0x4e341
movl %eax, %r13d
movq %r15, %rdi
movl $0x2a, %esi
movl $0xc, %edx
callq 0x4e341
movl %eax, -0x40(%rbp)
movq %r15, %rdi
movl $0x36, %esi
movl $0xa, %edx
callq 0x4e341
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
movl $0x40, %esi
movl $0x8, %edx
callq 0x4e341
movl %eax, -0x94(%rbp)
movq %r15, %rdi
movl $0x48, %esi
movl $0xe, %edx
callq 0x4e390
movl %eax, -0x7c(%rbp)
movq %r15, %rdi
movl $0x56, %esi
movl $0xe, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x2bc2a(%rip), %xmm0    # 0x6a8b8
movsd %xmm0, -0x38(%rbp)
movq %r15, %rdi
movl $0x64, %esi
movl $0x6, %edx
callq 0x4e390
movl %eax, -0x98(%rbp)
movq %r15, %rdi
movl $0x6a, %esi
movl $0x15, %edx
callq 0x4e390
movl %eax, -0x90(%rbp)
movq %r15, %rdi
movl $0x7f, %esi
movl $0x1f, %edx
callq 0x4e390
movl %eax, -0x8c(%rbp)
movq %r15, %rdi
movl $0x9e, %esi
movl $0x10, %edx
callq 0x4e390
movl %eax, -0x78(%rbp)
movq %r15, %rdi
movl $0xae, %esi
movl $0x10, %edx
callq 0x4e390
movl %eax, -0x70(%rbp)
movq %r15, %rdi
movl $0xbe, %esi
movl $0x20, %edx
callq 0x4e390
movl %eax, -0x68(%rbp)
movq %r15, %rdi
movl $0xde, %esi
movl $0x10, %edx
callq 0x4e390
movl %eax, -0x74(%rbp)
movq %r15, %rdi
movl $0xee, %esi
movl $0x20, %edx
callq 0x4e341
movl %eax, -0x88(%rbp)
movq %r15, %rdi
movl $0x10e, %esi            # imm = 0x10E
movl $0x10, %edx
callq 0x4e390
movl %eax, -0x6c(%rbp)
movq %r15, %rdi
movl $0x11e, %esi            # imm = 0x11E
movl $0x20, %edx
callq 0x4e341
movl %eax, -0x84(%rbp)
movq %r15, %rdi
movl $0x13e, %esi            # imm = 0x13E
movl $0xe, %edx
callq 0x4e341
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x2bb20(%rip), %xmm0    # 0x6a8b8
movsd %xmm0, -0x48(%rbp)
movq %r15, %rdi
movl $0x14c, %esi            # imm = 0x14C
movl $0x10, %edx
callq 0x4e390
movl %eax, -0x60(%rbp)
movq %r15, %rdi
movl $0x15c, %esi            # imm = 0x15C
movl $0x20, %edx
callq 0x4e390
movl %eax, -0x58(%rbp)
movq %r15, %rdi
movl $0x17c, %esi            # imm = 0x17C
movl $0x10, %edx
callq 0x4e390
movl %eax, -0x5c(%rbp)
movq %r15, %rdi
movl $0x18c, %esi            # imm = 0x18C
movl $0x20, %edx
callq 0x4e390
movl %eax, -0x54(%rbp)
movq %r15, %rdi
movl $0x1ac, %esi            # imm = 0x1AC
movl $0x10, %edx
callq 0x4e390
movl %eax, -0x64(%rbp)
movq %r15, %rdi
movl $0x1bc, %esi            # imm = 0x1BC
movl $0x20, %edx
callq 0x4e390
movl %eax, -0x50(%rbp)
movq %r15, %rdi
movl $0x1dc, %esi            # imm = 0x1DC
movl $0x18, %edx
callq 0x4e390
movl %eax, -0x4c(%rbp)
movq %r15, %rdi
movl $0x1f4, %esi            # imm = 0x1F4
movl $0xa, %edx
callq 0x4e390
movl %eax, -0x80(%rbp)
movq %r15, %rdi
movl $0x1fe, %esi            # imm = 0x1FE
movl $0x2, %edx
callq 0x4e341
movl %eax, %r14d
movq %r15, %rdi
movl $0x200, %esi            # imm = 0x200
movl $0x1, %edx
callq 0x4e341
movq %rax, -0xa0(%rbp)
movq %r15, %rdi
movl -0x40(%rbp), %r12d
movl $0x201, %esi            # imm = 0x201
movl $0x7, %edx
callq 0x4e341
leaq 0x307f6(%rip), %rsi     # 0x6f686
movl $0x4, %edi
movl %r13d, %edx
movl -0x2c(%rbp), %ecx
movl %ecx, %r15d
movsd -0x48(%rbp), %xmm0
movb $0x1, %al
callq 0x4ded0
cmpl $0x0, 0xc(%rbx)
je 0x3eef5
leaq 0x9b9d0(%rbx), %rdi
callq 0x8290
leaq (%rbx,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
movq -0xa0(%rbp), %rax
movl %eax, (%rsp)
leaq 0x307d8(%rip), %rsi     # 0x6f6b0
movl %r13d, %edx
movl %r15d, %ecx
movl %r12d, %r8d
movsd -0x48(%rbp), %xmm0
movsd -0x38(%rbp), %xmm1
movl %r14d, %r9d
movb $0x2, %al
callq 0x8120
movq %r14, %r15
movl $0x8, %edi
movl %r13d, %esi
callq 0x4dbc5
testl %eax, %eax
je 0x3f2a1
movl %eax, %r14d
movq %r15, -0xb8(%rbp)
movq %rbx, %r13
leaq 0x9fd48(%rbx), %r12
leaq 0x2d882(%rip), %rsi     # 0x6c7aa
movq %r12, %rdi
callq 0x8160
xorl %r15d, %r15d
testq %rax, %rax
jne 0x3f2bd
movl -0x40(%rbp), %ebx
addl $0x400, %ebx            # imm = 0x400
movl %ebx, %edi
movsd -0x48(%rbp), %xmm0
callq 0x4fbc6
movq %rax, -0xb0(%rbp)
movsd %xmm0, -0x40(%rbp)
movl %ebx, %edi
movsd -0x38(%rbp), %xmm0
callq 0x4fbc6
movq %rax, -0xa8(%rbp)
movsd %xmm0, -0x38(%rbp)
movupd 0x10(%r13), %xmm0
movapd %xmm0, -0xd0(%rbp)
leaq 0x2d73d(%rip), %rsi     # 0x6c6c7
movq %r12, %rdi
callq 0x8160
movslq %r14d, %rcx
testq %rax, %rax
movl -0x2c(%rbp), %edi
jne 0x3efb9
movq 0x80(%r13), %rax
leaq (%rcx,%rcx,8), %rdx
shlq $0x5, %rdx
cmpl -0x11c(%rax,%rdx), %edi
je 0x3f2bd
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 0x2dcb0(%rip), %xmm12   # 0x6ccb8
mulsd %xmm12, %xmm2
mulsd %xmm12, %xmm4
mulsd %xmm12, %xmm6
mulsd %xmm12, %xmm5
movsd 0x2dcab(%rip), %xmm12   # 0x6ccd0
mulsd %xmm12, %xmm0
mulsd %xmm12, %xmm1
mulsd %xmm12, %xmm3
movsd 0x2dc9b(%rip), %xmm12   # 0x6ccd8
mulsd %xmm12, %xmm8
mulsd %xmm12, %xmm9
mulsd %xmm12, %xmm10
mulsd %xmm12, %xmm11
movsd 0x2dc86(%rip), %xmm13   # 0x6cce0
mulsd %xmm13, %xmm7
xorps %xmm12, %xmm12
cvtsi2sdl -0x64(%rbp), %xmm12
mulsd %xmm13, %xmm12
movsd 0x2cd31(%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 -0xb8(%rbp), %rax
shll $0x4, %eax
movq -0xa0(%rbp), %rdx
leal (%rax,%rdx,8), %esi
leaq (%rcx,%rcx,8), %rax
shlq $0x5, %rax
movq 0x80(%r13), %rdx
movl %ecx, -0x120(%rdx,%rax)
movl %edi, -0x11c(%rdx,%rax)
movl $0x0, -0x118(%rdx,%rax)
movl -0x94(%rbp), %edi
movl %edi, -0x114(%rdx,%rax)
movl %esi, -0x110(%rdx,%rax)
movl %ebx, -0x10c(%rdx,%rax)
movq $0x102, -0x108(%rdx,%rax) # imm = 0x102
movq -0xb0(%rbp), %rsi
movq %rsi, -0x100(%rdx,%rax)
movl -0x88(%rbp), %esi
movsd -0x40(%rbp), %xmm13
movsd %xmm13, -0xf8(%rdx,%rax)
xorps %xmm13, %xmm13
cvtsi2sd %rsi, %xmm13
movq -0xa8(%rbp), %rsi
movq %rsi, -0xf0(%rdx,%rax)
movl -0x84(%rbp), %esi
cvtsi2sd %rsi, %xmm14
movsd -0x38(%rbp), %xmm15
movsd %xmm15, -0xe8(%rdx,%rax)
mulsd 0x2db62(%rip), %xmm13   # 0x6ccc0
movaps -0xd0(%rbp), %xmm15
movups %xmm15, -0xe0(%rdx,%rax)
mulsd 0x2db50(%rip), %xmm14   # 0x6ccc8
mulsd %xmm14, %xmm14
movsd %xmm14, -0xd0(%rdx,%rax)
movsd %xmm13, -0xc8(%rdx,%rax)
movsd %xmm6, -0xc0(%rdx,%rax)
movsd %xmm4, -0xb8(%rdx,%rax)
movsd %xmm5, -0xb0(%rdx,%rax)
movsd %xmm2, -0xa8(%rdx,%rax)
movsd %xmm1, -0xa0(%rdx,%rax)
movsd %xmm3, -0x98(%rdx,%rax)
movsd %xmm0, -0x90(%rdx,%rax)
movsd %xmm12, -0x88(%rdx,%rax)
movsd %xmm7, -0x80(%rdx,%rax)
movsd %xmm8, -0x78(%rdx,%rax)
movsd %xmm9, -0x70(%rdx,%rax)
movsd %xmm10, -0x68(%rdx,%rax)
xorps %xmm0, %xmm0
cvtsi2sdl -0x98(%rbp), %xmm0
movsd %xmm11, -0x60(%rdx,%rax)
xorps %xmm1, %xmm1
cvtsi2sdl -0x90(%rbp), %xmm1
movsd -0x48(%rbp), %xmm2
movsd %xmm2, -0x58(%rdx,%rax)
xorps %xmm2, %xmm2
cvtsi2sdl -0x8c(%rbp), %xmm2
mulsd 0x2dac0(%rip), %xmm1    # 0x6ccf0
mulsd 0x2dab0(%rip), %xmm2    # 0x6cce8
xorl %esi, %esi
movq %rsi, -0x50(%rdx,%rax)
movsd %xmm2, -0x48(%rdx,%rax)
movsd %xmm1, -0x40(%rdx,%rax)
xorps %xmm1, %xmm1
cvtsi2sdl -0x80(%rbp), %xmm1
mulsd 0x2da9d(%rip), %xmm0    # 0x6ccf8
mulsd 0x2da9d(%rip), %xmm1    # 0x6cd00
movsd %xmm0, -0x38(%rdx,%rax)
movsd %xmm1, -0x30(%rdx,%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, -0x18(%rdx,%rax)
movupd %xmm0, -0x28(%rdx,%rax)
movq %rsi, -0x8(%rdx,%rax)
movl %ecx, 0x9bdd4(%r13)
movl $0x2, %r15d
jmp 0x3f2bd
leaq 0x303cb(%rip), %rsi     # 0x6f665
movl $0x2, %edi
jmp 0x3f2b0
leaq 0x30443(%rip), %rsi     # 0x6f6eb
movl $0x2, %edi
movl %r13d, %edx
xorl %eax, %eax
callq 0x4ded0
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq