// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::encode_type1005(bamboo::rtcm_t*, int)
static int encode_type1005(rtcm_t *rtcm, int sync)
{
    double *p=rtcm->sta.pos;
    int i=24;
    
    trace(3,"encode_type1005: sync=%d\n",sync);
    
    setbitu(rtcm->buff,i,12,1005       ); 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 */
    rtcm->nbit=i;
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $0x6ef38, %rax          # imm = 0x6EF38
addq $0x1d0, %rax            # imm = 0x1D0
movq %rax, -0x18(%rbp)
movl $0x18, -0x1c(%rbp)
movl -0xc(%rbp), %edx
movl $0x3, %edi
leaq 0x43deb(%rip), %rsi     # 0xc2644
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0xc, %edx
movl $0x3ed, %ecx            # imm = 0x3ED
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0xc, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movq -0x8(%rbp), %rax
movl (%rax), %ecx
movl $0xc, %edx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0xc, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0x6, %edx
xorl %ecx, %ecx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0x1, %ecx
movl %ecx, %edx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0x1, %ecx
movl %ecx, %edx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
movsd 0x3e4ee(%rip), %xmm1    # 0xbce68
divsd %xmm1, %xmm0
callq 0x87ee0
movl -0x1c(%rbp), %eax
addl $0x26, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0x1, %ecx
movl %ecx, %edx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd 0x3e477(%rip), %xmm1    # 0xbce68
divsd %xmm1, %xmm0
callq 0x87ee0
movl -0x1c(%rbp), %eax
addl $0x26, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x8c0d0
movl -0x1c(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
addq $0x9f0c4, %rdi          # imm = 0x9F0C4
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd 0x3e423(%rip), %xmm1    # 0xbce68
divsd %xmm1, %xmm0
callq 0x87ee0
movl -0x1c(%rbp), %eax
addl $0x26, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x9f0bc(%rax)
movl $0x1, %eax
addq $0x20, %rsp
popq %rbp
retq
nop