// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::encode_type1019(bamboo::rtcm_t*, int)
static int encode_type1019(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,tgd;
    
    trace(3,"encode_type1019: sync=%d\n",sync);
    
    if (satsys(rtcm->ephsat,&prn)!=SYS_GPS) return 0;
    eph=rtcm->nav.eph+rtcm->ephsat-1;
    if (eph->sat!=rtcm->ephsat) return 0;
    week=eph->week%1024;
    toe  =ROUND(eph->toes/16.0);
    toc  =ROUND(time2gpst(eph->toc,NULL)/16.0);
    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_5 );
    crc  =ROUND(eph->crc/P2_5 );
    cus  =ROUND(eph->cus/P2_29);
    cuc  =ROUND(eph->cuc/P2_29);
    cis  =ROUND(eph->cis/P2_29);
    cic  =ROUND(eph->cic/P2_29);
    af0  =ROUND(eph->f0 /P2_31);
    af1  =ROUND(eph->f1 /P2_43);
    af2  =ROUND(eph->f2 /P2_55);
    tgd  =ROUND(eph->tgd[0]/P2_31);
    
    setbitu(rtcm->buff,i,12,1019     ); i+=12;
    setbitu(rtcm->buff,i, 6,prn      ); i+= 6;
    setbitu(rtcm->buff,i,10,week     ); i+=10;
    setbitu(rtcm->buff,i, 4,eph->sva ); i+= 4;
    setbitu(rtcm->buff,i, 2,eph->code); i+= 2;
    setbits(rtcm->buff,i,14,idot     ); i+=14;
    setbitu(rtcm->buff,i, 8,eph->iode); i+= 8;
    setbitu(rtcm->buff,i,16,toc      ); i+=16;
    setbits(rtcm->buff,i, 8,af2      ); i+= 8;
    setbits(rtcm->buff,i,16,af1      ); i+=16;
    setbits(rtcm->buff,i,22,af0      ); i+=22;
    setbitu(rtcm->buff,i,10,eph->iodc); i+=10;
    setbits(rtcm->buff,i,16,crs      ); i+=16;
    setbits(rtcm->buff,i,16,deln     ); i+=16;
    setbits(rtcm->buff,i,32,M0       ); i+=32;
    setbits(rtcm->buff,i,16,cuc      ); i+=16;
    setbitu(rtcm->buff,i,32,e        ); i+=32;
    setbits(rtcm->buff,i,16,cus      ); i+=16;
    setbitu(rtcm->buff,i,32,sqrtA    ); i+=32;
    setbitu(rtcm->buff,i,16,toe      ); i+=16;
    setbits(rtcm->buff,i,16,cic      ); i+=16;
    setbits(rtcm->buff,i,32,OMG0     ); i+=32;
    setbits(rtcm->buff,i,16,cis      ); i+=16;
    setbits(rtcm->buff,i,32,i0       ); i+=32;
    setbits(rtcm->buff,i,16,crc      ); i+=16;
    setbits(rtcm->buff,i,32,omg      ); i+=32;
    setbits(rtcm->buff,i,24,OMGd     ); i+=24;
    setbits(rtcm->buff,i, 8,tgd      ); i+= 8;
    setbitu(rtcm->buff,i, 6,eph->svh ); i+= 6;
    setbitu(rtcm->buff,i, 1,eph->flag); i+= 1;
    setbitu(rtcm->buff,i, 1,eph->fit>0.0?0:1); 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 0x2abf0(%rip), %rsi     # 0x70428
xorl %r14d, %r14d
movl $0x3, %edi
xorl %eax, %eax
callq 0x4d55d
movl 0x9bdd4(%rbx), %edi
leaq -0x78(%rbp), %rsi
callq 0x4d2f2
cmpl $0x1, %eax
jne 0x45ece
movq 0x80(%rbx), %r13
movslq 0x9bdd4(%rbx), %rcx
leaq (%rcx,%rcx,8), %rax
shlq $0x5, %rax
cmpl %ecx, -0x120(%r13,%rax)
jne 0x45ece
addq %rax, %r13
movl -0x10c(%r13), %r12d
leal 0x3ff(%r12), %eax
testl %r12d, %r12d
cmovnsl %r12d, %eax
andl $0xfffffc00, %eax       # imm = 0xFFFFFC00
subl %eax, %r12d
movsd -0x58(%r13), %xmm0
mulsd 0x295c6(%rip), %xmm0    # 0x6ee78
addsd 0x263be(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x74(%rbp)
movq -0xf0(%r13), %rdi
movsd -0xe8(%r13), %xmm0
xorl %esi, %esi
callq 0x4f2b1
mulsd 0x29593(%rip), %xmm0    # 0x6ee78
addsd 0x2638b(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x64(%rbp)
movsd -0xd0(%r13), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x45912
sqrtsd %xmm0, %xmm0
jmp 0x45917
callq 0x84e0
mulsd 0x25189(%rip), %xmm0    # 0x6aaa8
movsd 0x26351(%rip), %xmm1    # 0x6bc78
addsd %xmm1, %xmm0
callq 0x8ac0
cvttsd2si %xmm0, %rax
movq %rax, -0x88(%rbp)
movsd -0xc8(%r13), %xmm0
movsd -0xa0(%r13), %xmm1
movsd %xmm1, -0x30(%rbp)
divsd 0x27365(%rip), %xmm0    # 0x6ccc0
addsd 0x26315(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %rax
movq %rax, -0x80(%rbp)
movsd -0xc0(%r13), %xmm0
mulsd 0x2511e(%rip), %xmm0    # 0x6aaa0
divsd 0x2641e(%rip), %xmm0    # 0x6bda8
addsd 0x262e6(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x70(%rbp)
movsd -0xb8(%r13), %xmm0
mulsd 0x250f1(%rip), %xmm0    # 0x6aaa0
divsd 0x263f1(%rip), %xmm0    # 0x6bda8
addsd 0x262b9(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x68(%rbp)
movsd -0xb0(%r13), %xmm0
mulsd 0x250c4(%rip), %xmm0    # 0x6aaa0
divsd 0x263c4(%rip), %xmm0    # 0x6bda8
addsd 0x2628c(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x6c(%rbp)
movsd -0xa8(%r13), %xmm0
mulsd 0x25097(%rip), %xmm0    # 0x6aaa0
divsd 0x26397(%rip), %xmm0    # 0x6bda8
addsd 0x2625f(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x5c(%rbp)
movsd -0x30(%rbp), %xmm0
divsd 0x2729e(%rip), %xmm0    # 0x6ccd0
divsd 0x2636e(%rip), %xmm0    # 0x6bda8
addsd 0x26236(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x58(%rbp)
movsd -0x90(%r13), %xmm0
divsd 0x27271(%rip), %xmm0    # 0x6ccd0
divsd 0x26341(%rip), %xmm0    # 0x6bda8
addsd 0x26209(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x3c(%rbp)
movsd -0x98(%r13), %xmm0
divsd 0x27244(%rip), %xmm0    # 0x6ccd0
divsd 0x26314(%rip), %xmm0    # 0x6bda8
addsd 0x261dc(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x30(%rbp)
movsd -0x80(%r13), %xmm0
mulsd 0x2a682(%rip), %xmm0    # 0x70138
addsd 0x261ba(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x44(%rbp)
movsd 0x2a666(%rip), %xmm0    # 0x70138
mulsd -0x88(%r13), %xmm0
addsd 0x26195(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x60(%rbp)
movsd -0x70(%r13), %xmm0
mulsd 0x2a643(%rip), %xmm0    # 0x70140
addsd 0x26173(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x50(%rbp)
movsd -0x78(%r13), %xmm0
mulsd 0x2a621(%rip), %xmm0    # 0x70140
addsd 0x26151(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x40(%rbp)
movsd -0x60(%r13), %xmm0
mulsd 0x2a5ff(%rip), %xmm0    # 0x70140
addsd 0x2612f(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x54(%rbp)
movsd 0x2a5e3(%rip), %xmm0    # 0x70140
mulsd -0x68(%r13), %xmm0
addsd 0x2610d(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x48(%rbp)
movsd -0x48(%r13), %xmm0
mulsd 0x24f1b(%rip), %xmm0    # 0x6aaa0
addsd 0x260eb(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x38(%rbp)
movsd -0x40(%r13), %xmm0
divsd 0x27129(%rip), %xmm0    # 0x6ccd0
addsd 0x260c9(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x34(%rbp)
movsd -0x38(%r13), %xmm0
divsd 0x271b7(%rip), %xmm0    # 0x6cd80
addsd 0x260a7(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %r14d
movsd 0x24ebd(%rip), %xmm0    # 0x6aaa0
mulsd -0x30(%r13), %xmm0
addsd 0x26087(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x4c(%rbp)
leaq 0x9f0c4(%rbx), %r15
movq %r15, %rdi
movl $0x18, %esi
movl $0xc, %edx
movl $0x3fb, %ecx            # imm = 0x3FB
callq 0x4da98
movl -0x78(%rbp), %ecx
movq %r15, %rdi
movl $0x24, %esi
movl $0x6, %edx
callq 0x4da98
movq %r15, %rdi
movl $0x2a, %esi
movl $0xa, %edx
movl %r12d, %ecx
callq 0x4da98
movl -0x114(%r13), %ecx
movq %r15, %rdi
movl $0x34, %esi
movl $0x4, %edx
callq 0x4da98
movl -0x108(%r13), %ecx
movq %r15, %rdi
movl $0x38, %esi
movl $0x2, %edx
callq 0x4da98
movq %r15, %rdi
movl $0x3a, %esi
movl $0xe, %edx
movl -0x3c(%rbp), %ecx
callq 0x4db0c
movl -0x11c(%r13), %ecx
movq %r15, %rdi
movl $0x48, %esi
movl $0x8, %edx
callq 0x4da98
movq %r15, %rdi
movl $0x50, %esi
movl $0x10, %edx
movl -0x64(%rbp), %ecx
callq 0x4da98
movq %r15, %rdi
movl $0x60, %esi
movl $0x8, %edx
movl %r14d, %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x68, %esi
movl $0x10, %edx
movl -0x34(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x78, %esi
movl $0x16, %edx
movl -0x38(%rbp), %ecx
callq 0x4db0c
movl -0x118(%r13), %ecx
movq %r15, %rdi
movl $0x8e, %esi
movl $0xa, %edx
callq 0x4da98
movq %r15, %rdi
movl $0x98, %esi
movl $0x10, %edx
movl -0x44(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0xa8, %esi
movl $0x10, %edx
movl -0x58(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0xb8, %esi
movl $0x20, %edx
movl -0x5c(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0xd8, %esi
movl $0x10, %edx
movl -0x40(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0xe8, %esi
movl $0x20, %edx
movq -0x80(%rbp), %rcx
callq 0x4da98
movq %r15, %rdi
movl $0x108, %esi            # imm = 0x108
movl $0x10, %edx
movl -0x50(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x118, %esi            # imm = 0x118
movl $0x20, %edx
movq -0x88(%rbp), %rcx
callq 0x4da98
movq %r15, %rdi
movl $0x138, %esi            # imm = 0x138
movl $0x10, %edx
movl -0x74(%rbp), %ecx
callq 0x4da98
movq %r15, %rdi
movl $0x148, %esi            # imm = 0x148
movl $0x10, %edx
movl -0x48(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x158, %esi            # imm = 0x158
movl $0x20, %edx
movl -0x68(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x178, %esi            # imm = 0x178
movl $0x10, %edx
movl -0x54(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x188, %esi            # imm = 0x188
movl $0x20, %edx
movl -0x70(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x1a8, %esi            # imm = 0x1A8
movl $0x10, %edx
movl -0x60(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x1b8, %esi            # imm = 0x1B8
movl $0x20, %edx
movl -0x6c(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x1d8, %esi            # imm = 0x1D8
movl $0x18, %edx
movl -0x30(%rbp), %ecx
callq 0x4db0c
movq %r15, %rdi
movl $0x1f0, %esi            # imm = 0x1F0
movl $0x8, %edx
movl -0x4c(%rbp), %ecx
callq 0x4db0c
movl -0x110(%r13), %ecx
movq %r15, %rdi
movl $0x1f8, %esi            # imm = 0x1F8
movl $0x6, %edx
callq 0x4da98
movl -0x104(%r13), %ecx
movl $0x1, %r14d
movq %r15, %rdi
movl $0x1fe, %esi            # imm = 0x1FE
movl $0x1, %edx
callq 0x4da98
movsd -0x50(%r13), %xmm0
xorl %ecx, %ecx
ucomisd 0x24a59(%rip), %xmm0    # 0x6a908
setbe %cl
movq %r15, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
movl $0x1, %edx
callq 0x4da98
movl $0x200, 0x9f0bc(%rbx)   # imm = 0x200
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq