// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::encode_type1042(bamboo::rtcm_t*, int)
static int encode_type1042(rtcm_t *rtcm, int sync)
{
    eph_t *eph;
    unsigned int sqrtA,e;
    int i=24,prn,week,toe,toc,i0,OMG0,omg,M0,deln,idot,OMGd,crs,crc;
    int cus,cuc,cis,cic,af0,af1,af2,tgd1,tgd2;
    
    trace(3,"encode_type1042: sync=%d\n",sync);
    
    if (satsys(rtcm->ephsat,&prn)!=SYS_CMP) return 0;
    eph=rtcm->nav.eph+rtcm->ephsat-1;
    if (eph->sat!=rtcm->ephsat) return 0;
    week =eph->week%8192;
    toe  =ROUND(eph->toes/8.0);
    toc  =ROUND(time2bdt(gpst2bdt(eph->toc),NULL)/8.0); /* gpst -> bdt */
    sqrtA=ROUND_U(sqrt(eph->A)/P2_19);
    e    =ROUND_U(eph->e/P2_33);
    i0   =ROUND(eph->i0  /P2_31/SC2RAD);
    OMG0 =ROUND(eph->OMG0/P2_31/SC2RAD);
    omg  =ROUND(eph->omg /P2_31/SC2RAD);
    M0   =ROUND(eph->M0  /P2_31/SC2RAD);
    deln =ROUND(eph->deln/P2_43/SC2RAD);
    idot =ROUND(eph->idot/P2_43/SC2RAD);
    OMGd =ROUND(eph->OMGd/P2_43/SC2RAD);
    crs  =ROUND(eph->crs/P2_6 );
    crc  =ROUND(eph->crc/P2_6 );
    cus  =ROUND(eph->cus/P2_31);
    cuc  =ROUND(eph->cuc/P2_31);
    cis  =ROUND(eph->cis/P2_31);
    cic  =ROUND(eph->cic/P2_31);
    af0  =ROUND(eph->f0 /P2_33);
    af1  =ROUND(eph->f1 /P2_50);
    af2  =ROUND(eph->f2 /P2_66);
    tgd1 =ROUND(eph->tgd[0]/1E-10);
    tgd2 =ROUND(eph->tgd[1]/1E-10);
    
    setbitu(rtcm->buff,i,12,1042     ); i+=12;
    setbitu(rtcm->buff,i, 6,prn      ); i+= 6;
    setbitu(rtcm->buff,i,13,week     ); i+=13;
    setbitu(rtcm->buff,i, 4,eph->sva ); i+= 4;
    setbits(rtcm->buff,i,14,idot     ); i+=14;
    setbitu(rtcm->buff,i, 5,eph->iode); i+= 5;
    setbitu(rtcm->buff,i,17,toc      ); i+=17;
    setbits(rtcm->buff,i,11,af2      ); i+=11;
    setbits(rtcm->buff,i,22,af1      ); i+=22;
    setbits(rtcm->buff,i,24,af0      ); i+=24;
    setbitu(rtcm->buff,i, 5,eph->iodc); i+= 5;
    setbits(rtcm->buff,i,18,crs      ); i+=18;
    setbits(rtcm->buff,i,16,deln     ); i+=16;
    setbits(rtcm->buff,i,32,M0       ); i+=32;
    setbits(rtcm->buff,i,18,cuc      ); i+=18;
    setbitu(rtcm->buff,i,32,e        ); i+=32;
    setbits(rtcm->buff,i,18,cus      ); i+=18;
    setbitu(rtcm->buff,i,32,sqrtA    ); i+=32;
    setbitu(rtcm->buff,i,17,toe      ); i+=17;
    setbits(rtcm->buff,i,18,cic      ); i+=18;
    setbits(rtcm->buff,i,32,OMG0     ); i+=32;
    setbits(rtcm->buff,i,18,cis      ); i+=18;
    setbits(rtcm->buff,i,32,i0       ); i+=32;
    setbits(rtcm->buff,i,18,crc      ); i+=18;
    setbits(rtcm->buff,i,32,omg      ); i+=32;
    setbits(rtcm->buff,i,24,OMGd     ); i+=24;
    setbits(rtcm->buff,i,10,tgd1     ); i+=10;
    setbits(rtcm->buff,i,10,tgd2     ); i+=10;
    setbitu(rtcm->buff,i, 1,eph->svh ); i+= 1;
    rtcm->nbit=i;
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %edx
movq %rdi, %rbx
leaq 0x29b0a(%rip), %rsi     # 0x70476
xorl %r14d, %r14d
movl $0x3, %edi
xorl %eax, %eax
callq 0x4d55d
movl 0x9bdd4(%rbx), %edi
leaq -0x7c(%rbp), %rsi
callq 0x4d2f2
cmpl $0x20, %eax
jne 0x46ff0
movq 0x80(%rbx), %r15
movslq 0x9bdd4(%rbx), %rcx
leaq (%rcx,%rcx,8), %rax
shlq $0x5, %rax
cmpl %ecx, -0x120(%r15,%rax)
jne 0x46ff0
addq %rax, %r15
movl -0x10c(%r15), %r12d
leal 0x1fff(%r12), %eax
testl %r12d, %r12d
cmovnsl %r12d, %eax
andl $0xffffe000, %eax       # imm = 0xFFFFE000
subl %eax, %r12d
movsd -0x58(%r15), %xmm0
mulsd 0x29772(%rip), %xmm0    # 0x70158
addsd 0x2528a(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x78(%rbp)
movq -0xf0(%r15), %rdi
movsd -0xe8(%r15), %xmm0
callq 0x4fb17
movq %rax, %rdi
xorl %esi, %esi
callq 0x4f46f
mulsd 0x29737(%rip), %xmm0    # 0x70158
addsd 0x2524f(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x68(%rbp)
movsd -0xd0(%r15), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x46a4e
sqrtsd %xmm0, %xmm0
jmp 0x46a53
callq 0x84e0
mulsd 0x2404d(%rip), %xmm0    # 0x6aaa8
movsd 0x25215(%rip), %xmm1    # 0x6bc78
addsd %xmm1, %xmm0
callq 0x8ac0
cvttsd2si %xmm0, %rax
movq %rax, -0x90(%rbp)
movsd -0xc8(%r15), %xmm0
movsd -0xa0(%r15), %xmm1
movsd %xmm1, -0x30(%rbp)
divsd 0x26229(%rip), %xmm0    # 0x6ccc0
addsd 0x251d9(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %rax
movq %rax, -0x88(%rbp)
movsd -0xc0(%r15), %xmm0
mulsd 0x23fdf(%rip), %xmm0    # 0x6aaa0
divsd 0x252df(%rip), %xmm0    # 0x6bda8
addsd 0x251a7(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x74(%rbp)
movsd -0xb8(%r15), %xmm0
mulsd 0x23fb2(%rip), %xmm0    # 0x6aaa0
divsd 0x252b2(%rip), %xmm0    # 0x6bda8
addsd 0x2517a(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x6c(%rbp)
movsd -0xb0(%r15), %xmm0
mulsd 0x23f85(%rip), %xmm0    # 0x6aaa0
divsd 0x25285(%rip), %xmm0    # 0x6bda8
addsd 0x2514d(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x70(%rbp)
movsd -0xa8(%r15), %xmm0
mulsd 0x23f58(%rip), %xmm0    # 0x6aaa0
divsd 0x25258(%rip), %xmm0    # 0x6bda8
addsd 0x25120(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x60(%rbp)
movsd -0x30(%rbp), %xmm0
divsd 0x2615f(%rip), %xmm0    # 0x6ccd0
divsd 0x2522f(%rip), %xmm0    # 0x6bda8
addsd 0x250f7(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x5c(%rbp)
movsd -0x90(%r15), %xmm0
divsd 0x26132(%rip), %xmm0    # 0x6ccd0
divsd 0x25202(%rip), %xmm0    # 0x6bda8
addsd 0x250ca(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x3c(%rbp)
movsd -0x98(%r15), %xmm0
divsd 0x26105(%rip), %xmm0    # 0x6ccd0
divsd 0x251d5(%rip), %xmm0    # 0x6bda8
addsd 0x2509d(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x30(%rbp)
movsd -0x80(%r15), %xmm0
mulsd 0x23e9b(%rip), %xmm0    # 0x6aa90
addsd 0x2507b(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x44(%rbp)
movsd 0x23e7f(%rip), %xmm0    # 0x6aa90
mulsd -0x88(%r15), %xmm0
addsd 0x25056(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x64(%rbp)
movsd -0x70(%r15), %xmm0
mulsd 0x23e64(%rip), %xmm0    # 0x6aaa0
addsd 0x25034(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x54(%rbp)
movsd -0x78(%r15), %xmm0
mulsd 0x23e42(%rip), %xmm0    # 0x6aaa0
addsd 0x25012(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x40(%rbp)
movsd -0x60(%r15), %xmm0
mulsd 0x23e20(%rip), %xmm0    # 0x6aaa0
addsd 0x24ff0(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x58(%rbp)
movsd 0x23e04(%rip), %xmm0    # 0x6aaa0
mulsd -0x68(%r15), %xmm0
addsd 0x24fce(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x48(%rbp)
movsd -0x48(%r15), %xmm0
divsd 0x25ffc(%rip), %xmm0    # 0x6ccc0
addsd 0x24fac(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x38(%rbp)
movsd -0x40(%r15), %xmm0
mulsd 0x23d9a(%rip), %xmm0    # 0x6aa80
addsd 0x24f8a(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x34(%rbp)
movsd -0x38(%r15), %xmm0
divsd 0x28148(%rip), %xmm0    # 0x6ee50
addsd 0x24f68(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %r14d
movsd -0x30(%r15), %xmm0
divsd 0x25090(%rip), %xmm0    # 0x6bdb8
addsd 0x24f48(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x50(%rbp)
movsd -0x28(%r15), %xmm0
divsd 0x2506e(%rip), %xmm0    # 0x6bdb8
addsd 0x24f26(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x4c(%rbp)
leaq 0x9f0c4(%rbx), %r13
movq %r13, %rdi
movl $0x18, %esi
movl $0xc, %edx
movl $0x412, %ecx            # imm = 0x412
callq 0x4da98
movl -0x7c(%rbp), %ecx
movq %r13, %rdi
movl $0x24, %esi
movl $0x6, %edx
callq 0x4da98
movq %r13, %rdi
movl $0x2a, %esi
movl $0xd, %edx
movl %r12d, %ecx
callq 0x4da98
movl -0x114(%r15), %ecx
movq %r13, %rdi
movl $0x37, %esi
movl $0x4, %edx
callq 0x4da98
movq %r13, %rdi
movl $0x3b, %esi
movl $0xe, %edx
movl -0x3c(%rbp), %ecx
callq 0x4db0c
movl -0x11c(%r15), %ecx
movq %r13, %rdi
movl $0x49, %esi
movl $0x5, %edx
callq 0x4da98
movq %r13, %rdi
movl $0x4e, %esi
movl $0x11, %edx
movl -0x68(%rbp), %ecx
callq 0x4da98
movq %r13, %rdi
movl $0x5f, %esi
movl $0xb, %edx
movl %r14d, %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x6a, %esi
movl $0x16, %edx
movl -0x34(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x80, %esi
movl $0x18, %edx
movl -0x38(%rbp), %ecx
callq 0x4db0c
movl -0x118(%r15), %ecx
movq %r13, %rdi
movl $0x98, %esi
movl $0x5, %edx
callq 0x4da98
movq %r13, %rdi
movl $0x9d, %esi
movl $0x12, %edx
movl -0x44(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0xaf, %esi
movl $0x10, %edx
movl -0x5c(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0xbf, %esi
movl $0x20, %edx
movl -0x60(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0xdf, %esi
movl $0x12, %edx
movl -0x40(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0xf1, %esi
movl $0x20, %edx
movq -0x88(%rbp), %rcx
callq 0x4da98
movq %r13, %rdi
movl $0x111, %esi            # imm = 0x111
movl $0x12, %edx
movl -0x54(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x123, %esi            # imm = 0x123
movl $0x20, %edx
movq -0x90(%rbp), %rcx
callq 0x4da98
movq %r13, %rdi
movl $0x143, %esi            # imm = 0x143
movl $0x11, %edx
movl -0x78(%rbp), %ecx
callq 0x4da98
movq %r13, %rdi
movl $0x154, %esi            # imm = 0x154
movl $0x12, %edx
movl -0x48(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x166, %esi            # imm = 0x166
movl $0x20, %edx
movl -0x6c(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x186, %esi            # imm = 0x186
movl $0x12, %edx
movl -0x58(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x198, %esi            # imm = 0x198
movl $0x20, %edx
movl -0x74(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x1b8, %esi            # imm = 0x1B8
movl $0x12, %edx
movl -0x64(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x1ca, %esi            # imm = 0x1CA
movl $0x20, %edx
movl -0x70(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x1ea, %esi            # imm = 0x1EA
movl $0x18, %edx
movl -0x30(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x202, %esi            # imm = 0x202
movl $0xa, %edx
movl -0x50(%rbp), %ecx
callq 0x4db0c
movq %r13, %rdi
movl $0x20c, %esi            # imm = 0x20C
movl $0xa, %edx
movl -0x4c(%rbp), %ecx
callq 0x4db0c
movl -0x110(%r15), %ecx
movl $0x1, %r14d
movq %r13, %rdi
movl $0x216, %esi            # imm = 0x216
movl $0x1, %edx
callq 0x4da98
movl $0x217, 0x9f0bc(%rbx)   # imm = 0x217
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq