// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::encode_msm6(bamboo::rtcm_t*, int, int)
static int encode_msm6(rtcm_t *rtcm, int sys, int sync)
{
    double rrng[64],rrate[64],psrng[64],phrng[64],lock[64];
    float cnr[64];
    unsigned char half[64];
    int i,nsat,ncell;
    
    trace(3,"encode_msm6: sys=%d sync=%d\n",sys,sync);
    
    /* encode msm header */
    if (!(i=encode_msm_head(6,rtcm,sys,sync,&nsat,&ncell,rrng,rrate,NULL,psrng,
                            phrng,NULL,lock,half,cnr))) {
        return 0;
    }
    /* encode msm satellite data */
    i=encode_msm_int_rrng(rtcm,i,rrng ,nsat ); /* rough range integer ms */
    i=encode_msm_mod_rrng(rtcm,i,rrng ,nsat ); /* rough range modulo 1 ms */
    
    /* encode msm signal data */
    i=encode_msm_psrng_ex(rtcm,i,psrng,ncell); /* fine pseudorange ext */
    i=encode_msm_phrng_ex(rtcm,i,phrng,ncell); /* fine phase-range ext */
    i=encode_msm_lock_ex (rtcm,i,lock ,ncell); /* lock-time indicator ext */
    i=encode_msm_half_amb(rtcm,i,half ,ncell); /* half-cycle-amb indicator */
    i=encode_msm_cnr_ex  (rtcm,i,cnr  ,ncell); /* signal cnr ext */
    rtcm->nbit=i;
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xbb8, %rsp            # imm = 0xBB8
movq %rdi, -0x38(%rbp)
movl %esi, -0x3c(%rbp)
movl %edx, -0x40(%rbp)
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
movl $0x3, %edi
leaq 0x3bf3d(%rip), %rsi     # 0xc2a4d
movb $0x0, %al
callq 0x8b980
movq -0x38(%rbp), %rsi
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
leaq -0x240(%rbp), %r12
leaq -0x440(%rbp), %r15
leaq -0x640(%rbp), %r14
leaq -0x840(%rbp), %rbx
leaq -0xa40(%rbp), %r11
leaq -0xb80(%rbp), %r10
leaq -0xb40(%rbp), %rax
movl $0x6, %edi
leaq -0xb88(%rbp), %r8
leaq -0xb8c(%rbp), %r9
xorl %r13d, %r13d
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x88ab0
movl %eax, -0xb84(%rbp)
cmpl $0x0, %eax
jne 0x86bb8
movl $0x0, -0x2c(%rbp)
jmp 0x86cbd
movq -0x38(%rbp), %rdi
movl -0xb84(%rbp), %esi
leaq -0x240(%rbp), %rdx
movl -0xb88(%rbp), %ecx
callq 0x8a5e0
movl %eax, -0xb84(%rbp)
movq -0x38(%rbp), %rdi
movl -0xb84(%rbp), %esi
leaq -0x240(%rbp), %rdx
movl -0xb88(%rbp), %ecx
callq 0x891f0
movl %eax, -0xb84(%rbp)
movq -0x38(%rbp), %rdi
movl -0xb84(%rbp), %esi
leaq -0x640(%rbp), %rdx
movl -0xb8c(%rbp), %ecx
callq 0x8aa90
movl %eax, -0xb84(%rbp)
movq -0x38(%rbp), %rdi
movl -0xb84(%rbp), %esi
leaq -0x840(%rbp), %rdx
movl -0xb8c(%rbp), %ecx
callq 0x8abd0
movl %eax, -0xb84(%rbp)
movq -0x38(%rbp), %rdi
movl -0xb84(%rbp), %esi
leaq -0xa40(%rbp), %rdx
movl -0xb8c(%rbp), %ecx
callq 0x8ad10
movl %eax, -0xb84(%rbp)
movq -0x38(%rbp), %rdi
movl -0xb84(%rbp), %esi
leaq -0xb80(%rbp), %rdx
movl -0xb8c(%rbp), %ecx
callq 0x8a3d0
movl %eax, -0xb84(%rbp)
movq -0x38(%rbp), %rdi
movl -0xb84(%rbp), %esi
leaq -0xb40(%rbp), %rdx
movl -0xb8c(%rbp), %ecx
callq 0x8ad90
movl %eax, -0xb84(%rbp)
movl -0xb84(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x9f0bc(%rax)
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0xbb8, %rsp            # imm = 0xBB8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)