// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::encode_type1006(bamboo::rtcm_t*, int)
static int encode_type1006(rtcm_t *rtcm, int sync)
{
    double *p=rtcm->sta.pos;
    int i=24,hgt=0;
    
    trace(3,"encode_type1006: sync=%d\n",sync);
    
    if (0.0<=rtcm->sta.hgt&&rtcm->sta.hgt<=6.5535) {
        hgt=ROUND(rtcm->sta.hgt/0.0001);
    }
    else {
        trace(2,"antenna height error: h=%.4f\n",rtcm->sta.hgt);
    }
    setbitu(rtcm->buff,i,12,1006       ); i+=12; /* message no */
    setbitu(rtcm->buff,i,12,rtcm->staid); i+=12; /* ref station id */
    setbitu(rtcm->buff,i, 6,0          ); i+= 6; /* itrf realization year */
    setbitu(rtcm->buff,i, 1,1          ); i+= 1; /* gps indicator */
    setbitu(rtcm->buff,i, 1,1          ); i+= 1; /* glonass indicator */
    setbitu(rtcm->buff,i, 1,0          ); i+= 1; /* galileo indicator */
    setbitu(rtcm->buff,i, 1,0          ); i+= 1; /* ref station indicator */
    set38bits(rtcm->buff,i,p[0]/0.0001 ); i+=38; /* antenna ref point ecef-x */
    setbitu(rtcm->buff,i, 1,1          ); i+= 1; /* oscillator indicator */
    setbitu(rtcm->buff,i, 1,0          ); i+= 1; /* reserved */
    set38bits(rtcm->buff,i,p[1]/0.0001 ); i+=38; /* antenna ref point ecef-y */
    setbitu(rtcm->buff,i, 2,0          ); i+= 2; /* quarter cycle indicator */
    set38bits(rtcm->buff,i,p[2]/0.0001 ); i+=38; /* antenna ref point ecef-z */
    setbitu(rtcm->buff,i,16,hgt        ); i+=16; /* antenna height */
    rtcm->nbit=i;
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %edx
movq %rdi, %rbx
leaq 0x2b87d(%rip), %rsi     # 0x7036e
xorl %r14d, %r14d
movl $0x3, %edi
xorl %eax, %eax
callq 0x4d55d
movsd 0x6f138(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x44b3c
movsd 0x2b616(%rip), %xmm1    # 0x70130
ucomisd %xmm0, %xmm1
jb 0x44b3c
divsd 0x25df8(%rip), %xmm0    # 0x6a920
addsd 0x27148(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %r14d
jmp 0x44b4f
leaq 0x2b845(%rip), %rsi     # 0x70388
movl $0x2, %edi
movb $0x1, %al
callq 0x4d55d
leaq 0x9f0c4(%rbx), %r15
movq %r15, %rdi
movl $0x18, %esi
movl $0xc, %edx
movl $0x3ee, %ecx            # imm = 0x3EE
callq 0x4da98
movl (%rbx), %ecx
movq %r15, %rdi
movl $0x24, %esi
movl $0xc, %edx
callq 0x4da98
movq %r15, %rdi
movl $0x30, %esi
movl $0x6, %edx
xorl %ecx, %ecx
callq 0x4da98
movq %r15, %rdi
movl $0x36, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x4da98
movq %r15, %rdi
movl $0x37, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x4da98
movq %r15, %rdi
movl $0x38, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x4da98
movq %r15, %rdi
movl $0x39, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x4da98
movsd 0x6f108(%rbx), %xmm0
divsd 0x25d25(%rip), %xmm0    # 0x6a920
movq %r15, %rdi
movl $0x3a, %esi
callq 0x4b1c8
movq %r15, %rdi
movl $0x60, %esi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x4da98
movq %r15, %rdi
movl $0x61, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x4da98
movsd 0x6f110(%rbx), %xmm0
divsd 0x25cdd(%rip), %xmm0    # 0x6a920
movq %r15, %rdi
movl $0x62, %esi
callq 0x4b1c8
movq %r15, %rdi
movl $0x88, %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x4da98
movsd 0x6f118(%rbx), %xmm0
divsd 0x25cac(%rip), %xmm0    # 0x6a920
movq %r15, %rdi
movl $0x8a, %esi
callq 0x4b1c8
movq %r15, %rdi
movl $0xb0, %esi
movl $0x10, %edx
movl %r14d, %ecx
callq 0x4da98
movl $0xc0, 0x9f0bc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq