// File: DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::encode_msm7(bamboo::rtcm_t*, int, int)
static int encode_msm7(rtcm_t *rtcm, int sys, int sync)
{
    double rrng[64],rrate[64],psrng[64],phrng[64],rate[64],lock[64];
    float cnr[64];
    unsigned char info[64],half[64];
    int i,nsat,ncell;
    
    trace(3,"encode_msm7: sys=%d sync=%d\n",sys,sync);
    
    /* encode msm header */
    if (!(i=encode_msm_head(7,rtcm,sys,sync,&nsat,&ncell,rrng,rrate,info,psrng,
                            phrng,rate,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_info    (rtcm,i,info ,nsat ); /* extended satellite info */
    i=encode_msm_mod_rrng(rtcm,i,rrng ,nsat ); /* rough range modulo 1 ms */
    i=encode_msm_rrate   (rtcm,i,rrate,nsat ); /* rough phase-range-rate */
    
    /* 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 */
    i=encode_msm_rate    (rtcm,i,rate ,ncell); /* fine phase-range-rate */
    rtcm->nbit=i;
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xdf8, %rsp            # imm = 0xDF8
movq %rdi, -0x38(%rbp)
movl %esi, -0x3c(%rbp)
movl %edx, -0x40(%rbp)
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
movl $0x3, %edi
leaq 0x3bdbc(%rip), %rsi     # 0xc2acc
movb $0x0, %al
callq 0x8b980
movq -0x38(%rbp), %rsi
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
leaq -0x240(%rbp), %rax
leaq -0x440(%rbp), %r13
leaq -0xd80(%rbp), %r12
leaq -0x640(%rbp), %r15
leaq -0x840(%rbp), %r14
leaq -0xa40(%rbp), %rbx
leaq -0xc40(%rbp), %r11
leaq -0xdc0(%rbp), %r10
leaq -0xd40(%rbp), %rdi
movq %rdi, -0xdd8(%rbp)
movl $0x7, %edi
leaq -0xdc8(%rbp), %r8
leaq -0xdcc(%rbp), %r9
movq %rax, (%rsp)
movq -0xdd8(%rbp), %rax
movq %r13, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
callq 0x88ab0
movl %eax, -0xdc4(%rbp)
cmpl $0x0, %eax
jne 0x86dc9
movl $0x0, -0x2c(%rbp)
jmp 0x86f34
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0x240(%rbp), %rdx
movl -0xdc8(%rbp), %ecx
callq 0x8a5e0
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0xd80(%rbp), %rdx
movl -0xdc8(%rbp), %ecx
callq 0x8a7d0
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0x240(%rbp), %rdx
movl -0xdc8(%rbp), %ecx
callq 0x891f0
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0x440(%rbp), %rdx
movl -0xdc8(%rbp), %ecx
callq 0x8a840
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0x640(%rbp), %rdx
movl -0xdcc(%rbp), %ecx
callq 0x8aa90
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0x840(%rbp), %rdx
movl -0xdcc(%rbp), %ecx
callq 0x8abd0
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0xc40(%rbp), %rdx
movl -0xdcc(%rbp), %ecx
callq 0x8ad10
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0xdc0(%rbp), %rdx
movl -0xdcc(%rbp), %ecx
callq 0x8a3d0
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0xd40(%rbp), %rdx
movl -0xdcc(%rbp), %ecx
callq 0x8ad90
movl %eax, -0xdc4(%rbp)
movq -0x38(%rbp), %rdi
movl -0xdc4(%rbp), %esi
leaq -0xa40(%rbp), %rdx
movl -0xdcc(%rbp), %ecx
callq 0x8a950
movl %eax, -0xdc4(%rbp)
movl -0xdc4(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x9f0bc(%rax)
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addq $0xdf8, %rsp            # imm = 0xDF8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)