// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtcm3.cpp
// Function: bamboo::decode_type1042(bamboo::rtcm_t*)
static int decode_type1042(rtcm_t *rtcm)
{
    eph_t eph={0};
    double toc,sqrtA;
    char *msg;
    int i=24+12,prn,sat,week,sys=SYS_CMP;
    
    if (i+499<=rtcm->len*8) {
        prn       =getbitu(rtcm->buff,i, 6);              i+= 6;
        week      =getbitu(rtcm->buff,i,13);              i+=13;
        eph.sva   =getbitu(rtcm->buff,i, 4);              i+= 4;
        eph.idot  =getbits(rtcm->buff,i,14)*P2_43*SC2RAD; i+=14;
        eph.iode  =getbitu(rtcm->buff,i, 5);              i+= 5; /* AODE */
        toc       =getbitu(rtcm->buff,i,17)*8.0;          i+=17;
        eph.f2    =getbits(rtcm->buff,i,11)*P2_66;        i+=11;
        eph.f1    =getbits(rtcm->buff,i,22)*P2_50;        i+=22;
        eph.f0    =getbits(rtcm->buff,i,24)*P2_33;        i+=24;
        eph.iodc  =getbitu(rtcm->buff,i, 5);              i+= 5; /* AODC */
        eph.crs   =getbits(rtcm->buff,i,18)*P2_6;         i+=18;
        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,18)*P2_31;        i+=18;
        eph.e     =getbitu(rtcm->buff,i,32)*P2_33;        i+=32;
        eph.cus   =getbits(rtcm->buff,i,18)*P2_31;        i+=18;
        sqrtA     =getbitu(rtcm->buff,i,32)*P2_19;        i+=32;
        eph.toes  =getbitu(rtcm->buff,i,17)*8.0;          i+=17;
        eph.cic   =getbits(rtcm->buff,i,18)*P2_31;        i+=18;
        eph.OMG0  =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.cis   =getbits(rtcm->buff,i,18)*P2_31;        i+=18;
        eph.i0    =getbits(rtcm->buff,i,32)*P2_31*SC2RAD; i+=32;
        eph.crc   =getbits(rtcm->buff,i,18)*P2_6;         i+=18;
        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)*1E-10;        i+=10;
        eph.tgd[1]=getbits(rtcm->buff,i,10)*1E-10;        i+=10;
        eph.svh   =getbitu(rtcm->buff,i, 1);              i+= 1;
    }
    else {
        trace(2,"rtcm3 1042 length error: len=%d\n",rtcm->len);
        return -1;
    }
    trace(4,"decode_type1042: 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 iodc=%3d week=%d toe=%6.0f toc=%6.0f svh=%02X",
                prn,eph.iode,eph.iodc,week,eph.toes,toc,eph.svh);
    }
    if (!(sat=satno(sys,prn))) {
        trace(2,"rtcm3 1042 satellite number error: prn=%d\n",prn);
        return -1;
    }
    eph.sat=sat;
    eph.week=adjbdtweek(week);
    eph.toe=bdt2gpst(bdt2time(eph.week,eph.toes)); /* bdt -> gpst */
    eph.toc=bdt2gpst(bdt2time(eph.week,toc));      /* bdt -> gpst */
    eph.ttr=rtcm->time;
    eph.A=sqrtA*sqrtA;
    if (!strstr(rtcm->opt,"-EPHALL")) {
        if (timediff(eph.toe,rtcm->nav.eph[sat-1].toe)==0.0&&
            eph.iode==rtcm->nav.eph[sat-1].iode&&
            eph.iodc==rtcm->nav.eph[sat-1].iodc) 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 $0xd8, %rsp
xorpd %xmm0, %xmm0
movapd %xmm0, -0xd0(%rbp)
movapd %xmm0, -0xf0(%rbp)
movapd %xmm0, -0xe0(%rbp)
movl 0x9f0c0(%rdi), %edx
cmpl $0x43, %edx
jl 0x389f2
movq %rdi, %rbx
leaq 0x9f0c4(%rdi), %r14
pushq $0x24
popq %rsi
pushq $0x6
popq %rdx
movq %r14, %rdi
callq 0x459f7
movl %eax, %r13d
pushq $0x2a
popq %rsi
pushq $0xd
popq %rdx
movq %r14, %rdi
callq 0x459f7
movl %eax, -0x38(%rbp)
pushq $0x37
popq %rsi
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x459f7
movl %eax, -0xac(%rbp)
pushq $0x3b
popq %rsi
pushq $0xe
popq %rdx
movq %r14, %rdi
callq 0x45a39
movl %eax, -0x60(%rbp)
pushq $0x49
popq %rsi
pushq $0x5
popq %r15
movq %r14, %rdi
movl %r15d, %edx
callq 0x459f7
movl %eax, -0x30(%rbp)
pushq $0x4e
popq %rsi
pushq $0x11
popq %rdx
movq %r14, %rdi
callq 0x459f7
movl %eax, %eax
cvtsi2sd %rax, %xmm0
mulsd 0x28633(%rip), %xmm0    # 0x60a30
movsd %xmm0, -0x40(%rbp)
pushq $0x5f
popq %rsi
pushq $0xb
popq %rdx
movq %r14, %rdi
callq 0x45a39
movl %eax, -0xa8(%rbp)
pushq $0x6a
popq %rsi
pushq $0x16
popq %rdx
movq %r14, %rdi
callq 0x45a39
movl %eax, -0xa4(%rbp)
pushq $0x18
popq %rdx
movq %r14, %rdi
movl $0x80, %esi
callq 0x45a39
movl %eax, -0x58(%rbp)
movq %r14, %rdi
movl $0x98, %esi
movl %r15d, %edx
callq 0x459f7
movl %eax, -0x2c(%rbp)
pushq $0x12
popq %r15
movq %r14, %rdi
movl $0x9d, %esi
movl %r15d, %edx
callq 0x45a39
movl %eax, -0x9c(%rbp)
pushq $0x10
popq %rdx
movq %r14, %rdi
movl $0xaf, %esi
callq 0x45a39
movl %eax, -0x84(%rbp)
pushq $0x20
popq %r12
movq %r14, %rdi
movl $0xbf, %esi
movl %r12d, %edx
callq 0x45a39
movl %eax, -0x7c(%rbp)
movq %r14, %rdi
movl $0xdf, %esi
movl %r15d, %edx
callq 0x45a39
movl %eax, -0x50(%rbp)
movq %r14, %rdi
movl $0xf1, %esi
movl %r12d, %edx
callq 0x459f7
movl %eax, -0x8c(%rbp)
movq %r14, %rdi
movl $0x111, %esi            # imm = 0x111
movl %r15d, %edx
callq 0x45a39
movl %eax, -0x80(%rbp)
movq %r14, %rdi
movl $0x123, %esi            # imm = 0x123
movl %r12d, %edx
callq 0x459f7
movl %eax, -0xa0(%rbp)
movq %r14, %rdi
movl $0x143, %esi            # imm = 0x143
pushq $0x11
popq %rdx
callq 0x459f7
movl %eax, %eax
cvtsi2sd %rax, %xmm0
mulsd 0x28528(%rip), %xmm0    # 0x60a30
movsd %xmm0, -0x48(%rbp)
movq %r14, %rdi
movl $0x154, %esi            # imm = 0x154
movl %r15d, %edx
callq 0x45a39
movl %eax, -0x74(%rbp)
movq %r14, %rdi
movl $0x166, %esi            # imm = 0x166
movl %r12d, %edx
callq 0x45a39
movl %eax, -0x70(%rbp)
movq %r14, %rdi
movl $0x186, %esi            # imm = 0x186
movl %r15d, %edx
callq 0x45a39
movl %eax, -0x90(%rbp)
movq %r14, %rdi
movl $0x198, %esi            # imm = 0x198
movl %r12d, %edx
callq 0x45a39
movl %eax, -0x6c(%rbp)
movq %r14, %rdi
movl $0x1b8, %esi            # imm = 0x1B8
movl %r15d, %edx
callq 0x45a39
movl %eax, -0x88(%rbp)
movq %r14, %rdi
movl $0x1ca, %esi            # imm = 0x1CA
movl %r12d, %edx
callq 0x45a39
movl %eax, -0x68(%rbp)
movq %r14, %rdi
movl $0x1ea, %esi            # imm = 0x1EA
pushq $0x18
popq %rdx
callq 0x45a39
movl %eax, -0x64(%rbp)
pushq $0xa
popq %r15
movq %r14, %rdi
movl $0x202, %esi            # imm = 0x202
movl %r15d, %edx
callq 0x45a39
movl %eax, -0x98(%rbp)
movq %r14, %rdi
movl $0x20c, %esi            # imm = 0x20C
movl %r15d, %edx
movl -0x30(%rbp), %r15d
callq 0x45a39
movl %eax, -0x94(%rbp)
pushq $0x1
popq %r12
movq %r14, %rdi
movl $0x216, %esi            # imm = 0x216
movl %r12d, %edx
callq 0x459f7
movl %eax, %r14d
leaq 0x2d200(%rip), %rsi     # 0x657ea
pushq $0x4
popq %rdi
movl %r13d, %edx
movl %r15d, %ecx
movsd -0x48(%rbp), %xmm0
movb $0x1, %al
callq 0x455bc
cmpl $0x0, 0xc(%rbx)
je 0x38646
leaq 0x9b9d0(%rbx), %rdi
callq 0x8290
leaq (%rbx,%rax), %rdi
addq $0x9b9d0, %rdi          # imm = 0x9B9D0
movl %r14d, (%rsp)
leaq 0x2cbb7(%rip), %rsi     # 0x651de
movl %r13d, %edx
movl %r15d, %ecx
movl -0x2c(%rbp), %r8d
movl -0x38(%rbp), %r9d
movsd -0x48(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
movb $0x2, %al
callq 0x8110
movl %r14d, -0x78(%rbp)
movl -0x38(%rbp), %r14d
pushq $0x20
popq %rdi
movl %r13d, %esi
callq 0x452fd
testl %eax, %eax
je 0x389fe
movl %eax, %r15d
callq 0x47349
movq %rax, %rdi
callq 0x477da
movq %rax, %rdi
callq 0x47871
leaq -0xbc(%rbp), %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x47289
movl (%r13), %eax
cmpl $0x2, %eax
cmovgel %eax, %r12d
subl %r14d, %r12d
addl $0x200, %r12d           # imm = 0x200
movl $0x400, %ecx            # imm = 0x400
movl %r12d, %eax
cltd
idivl %ecx
movl %eax, %r13d
shll $0xa, %r13d
addl %r14d, %r13d
movl %r13d, %edi
movsd -0x48(%rbp), %xmm0
callq 0x47222
movq %rax, %rdi
callq 0x478a9
movq %rax, %r14
movsd %xmm0, -0x38(%rbp)
movl %r13d, %edi
movsd -0x40(%rbp), %xmm0
callq 0x47222
movq %rax, %rdi
callq 0x478a9
movq %rax, -0xb8(%rbp)
movsd %xmm0, -0x40(%rbp)
movupd 0x10(%rbx), %xmm0
movapd %xmm0, -0xd0(%rbp)
leaq 0x9fd48(%rbx), %rdi
leaq 0x29fb9(%rip), %rsi     # 0x626c7
callq 0x8170
testq %rax, %rax
je 0x38a27
cvtsi2sdl -0x60(%rbp), %xmm8
cvtsi2sdl -0x84(%rbp), %xmm2
cvtsi2sdl -0x7c(%rbp), %xmm3
cvtsi2sdl -0x70(%rbp), %xmm5
cvtsi2sdl -0x6c(%rbp), %xmm7
cvtsi2sdl -0x68(%rbp), %xmm6
cvtsi2sdl -0x64(%rbp), %xmm4
cvtsi2sdl -0x58(%rbp), %xmm1
cvtsi2sdl -0x50(%rbp), %xmm9
movl -0x8c(%rbp), %eax
cvtsi2sd %rax, %xmm11
cvtsi2sdl -0x80(%rbp), %xmm12
cvtsi2sdl -0x74(%rbp), %xmm10
movsd 0x2a563(%rip), %xmm0    # 0x62cd0
mulsd %xmm0, %xmm8
mulsd %xmm0, %xmm2
mulsd %xmm0, %xmm4
movsd 0x2a53e(%rip), %xmm0    # 0x62cc0
mulsd %xmm0, %xmm1
movsd %xmm1, -0x60(%rbp)
mulsd %xmm0, %xmm11
movsd 0x2a520(%rip), %xmm0    # 0x62cb8
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm5
mulsd %xmm0, %xmm7
mulsd %xmm0, %xmm6
mulsd %xmm0, %xmm9
movsd %xmm9, -0x58(%rbp)
mulsd %xmm0, %xmm12
movsd %xmm12, -0x50(%rbp)
mulsd %xmm0, %xmm10
cvtsi2sdl -0x90(%rbp), %xmm12
mulsd %xmm0, %xmm12
cvtsi2sdl -0x9c(%rbp), %xmm13
movsd 0x2a53e(%rip), %xmm0    # 0x62d20
mulsd %xmm0, %xmm13
cvtsi2sdl -0x88(%rbp), %xmm14
mulsd %xmm0, %xmm14
movslq %r15d, %rax
imulq $0x120, %rax, %rax      # imm = 0x120
movq 0x80(%rbx), %rcx
movl %r15d, -0x120(%rcx,%rax)
movl -0x30(%rbp), %edx
movl %edx, -0x11c(%rcx,%rax)
movl -0x2c(%rbp), %edx
movl %edx, -0x118(%rcx,%rax)
movl -0xac(%rbp), %edx
movl %edx, -0x114(%rcx,%rax)
movl -0x78(%rbp), %edx
movl %edx, -0x110(%rcx,%rax)
movl %r13d, -0x10c(%rcx,%rax)
movsd 0x2955f(%rip), %xmm0    # 0x61da8
mulsd %xmm0, %xmm8
mulsd %xmm0, %xmm2
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm5
andq $0x0, -0x108(%rcx,%rax)
mulsd %xmm0, %xmm7
mulsd %xmm0, %xmm6
cvtsi2sdl -0x98(%rbp), %xmm15
mulsd %xmm0, %xmm4
cvtsi2sdl -0x94(%rbp), %xmm0
movsd 0x2be80(%rip), %xmm1    # 0x64708
mulsd %xmm1, %xmm15
mulsd %xmm1, %xmm0
movq %r14, -0x100(%rcx,%rax)
movsd -0x38(%rbp), %xmm1
movsd %xmm1, -0xf8(%rcx,%rax)
movq -0xb8(%rbp), %rdx
movq %rdx, -0xf0(%rcx,%rax)
movl -0xa0(%rbp), %edx
cvtsi2sd %rdx, %xmm1
movsd -0x40(%rbp), %xmm9
movsd %xmm9, -0xe8(%rcx,%rax)
mulsd 0x2a3ef(%rip), %xmm1    # 0x62cc8
movaps -0xd0(%rbp), %xmm9
movups %xmm9, -0xe0(%rcx,%rax)
mulsd %xmm1, %xmm1
movsd %xmm1, -0xd0(%rcx,%rax)
movsd %xmm11, -0xc8(%rcx,%rax)
movsd %xmm7, -0xc0(%rcx,%rax)
movsd %xmm5, -0xb8(%rcx,%rax)
movsd %xmm6, -0xb0(%rcx,%rax)
movsd %xmm3, -0xa8(%rcx,%rax)
movsd %xmm2, -0xa0(%rcx,%rax)
movsd %xmm4, -0x98(%rcx,%rax)
movsd %xmm8, -0x90(%rcx,%rax)
movsd %xmm14, -0x88(%rcx,%rax)
movsd %xmm13, -0x80(%rcx,%rax)
movsd -0x58(%rbp), %xmm1
movsd %xmm1, -0x78(%rcx,%rax)
movsd -0x50(%rbp), %xmm1
movsd %xmm1, -0x70(%rcx,%rax)
movsd %xmm10, -0x68(%rcx,%rax)
movsd %xmm12, -0x60(%rcx,%rax)
movsd -0x48(%rbp), %xmm1
movsd %xmm1, -0x58(%rcx,%rax)
cvtsi2sdl -0xa8(%rbp), %xmm1
andq $0x0, -0x50(%rcx,%rax)
movsd -0x60(%rbp), %xmm2
movsd %xmm2, -0x48(%rcx,%rax)
cvtsi2sdl -0xa4(%rbp), %xmm2
mulsd 0x2a36e(%rip), %xmm2    # 0x62d18
movsd %xmm2, -0x40(%rcx,%rax)
mulsd 0x2bd48(%rip), %xmm1    # 0x64700
movsd %xmm1, -0x38(%rcx,%rax)
movsd %xmm15, -0x30(%rcx,%rax)
movsd %xmm0, -0x28(%rcx,%rax)
movapd -0xf0(%rbp), %xmm0
movapd -0xe0(%rbp), %xmm1
movupd %xmm1, -0x10(%rcx,%rax)
movupd %xmm0, -0x20(%rcx,%rax)
movl %r15d, 0x9bdd4(%rbx)
pushq $0x2
jmp 0x38a14
leaq 0x2cdd0(%rip), %rsi     # 0x657c9
pushq $0x2
popq %rdi
jmp 0x38a0b
leaq 0x2ce0f(%rip), %rsi     # 0x65814
pushq $0x2
popq %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0x455bc
pushq $-0x1
popq %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x80(%rbx), %rax
leal -0x1(%r15), %ecx
movslq %ecx, %rcx
imulq $0x120, %rcx, %r12      # imm = 0x120
movq 0x20(%rax,%r12), %rsi
movsd 0x28(%rax,%r12), %xmm1
movq %r14, %rdi
movsd -0x38(%rbp), %xmm0
callq 0x47322
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x3871c
jp 0x3871c
movq 0x80(%rbx), %rcx
movl -0x30(%rbp), %eax
cmpl 0x4(%rcx,%r12), %eax
jne 0x3871c
addq %r12, %rcx
xorl %eax, %eax
movl -0x2c(%rbp), %edx
cmpl 0x8(%rcx), %edx
jne 0x3871c
jmp 0x38a15