// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::gen_obs_glo(bamboo::rtcm_t*, bamboo::obsd_t const*, int, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*)
static void gen_obs_glo(rtcm_t *rtcm, const obsd_t *data, int fcn, int *code1,
                        int *pr1, int *ppr1, int *lock1, int *amb, int *cnr1,
                        int *code2, int *pr21, int *ppr2, int *lock2, int *cnr2)
{
    double lam1=0.0,lam2=0.0,pr1c=0.0,ppr;
    int lt1,lt2;
    
    if (fcn>=0) {
        lam1=CLIGHT/(FREQ1_GLO+DFRQ1_GLO*(fcn-7));
        lam2=CLIGHT/(FREQ2_GLO+DFRQ2_GLO*(fcn-7));
    }
    *pr1=*amb=0;
    if (ppr1) *ppr1=0xFFF80000; /* invalid values */
    if (pr21) *pr21=0xFFFFE000;
    if (ppr2) *ppr2=0xFFF80000;
    
    /* L1 peudorange */
    if (data->P[0]!=0.0) {
        *amb=(int)floor(data->P[0]/PRUNIT_GLO);
        *pr1=ROUND((data->P[0]-*amb*PRUNIT_GLO)/0.02);
        pr1c=*pr1*0.02+*amb*PRUNIT_GLO;
    }
    /* L1 phaserange - L1 pseudorange */
    if (data->P[0]!=0.0&&data->L[0]!=0.0&&data->code[0]&&lam1>0.0) {
        ppr=cp_pr(data->L[0],pr1c/lam1);
        if (ppr1) *ppr1=ROUND(ppr*lam1/0.0005);
    }
    /* L2 -L1 pseudorange */
    if (data->P[0]!=0.0&&data->P[1]!=0.0&&data->code[0]&&data->code[1]&&
        fabs(data->P[1]-pr1c)<=163.82) {
        if (pr21) *pr21=ROUND((data->P[1]-pr1c)/0.02);
    }
    /* L2 phaserange - L1 pseudorange */
    if (data->P[0]!=0.0&&data->L[1]!=0.0&&data->code[0]&&data->code[1]&&
        lam2>0.0) {
        ppr=cp_pr(data->L[1],pr1c/lam2);
        if (ppr2) *ppr2=ROUND(ppr*lam2/0.0005);
    }
    lt1=locktime(data->time,rtcm->lltime[data->sat-1]  ,data->LLI[0]);
    lt2=locktime(data->time,rtcm->lltime[data->sat-1]+1,data->LLI[1]);
    
    if (lock1) *lock1=to_lock(lt1);
    if (lock2) *lock2=to_lock(lt2);
    if (cnr1 ) *cnr1=data->SNR[0];
    if (cnr2 ) *cnr2=data->SNR[1];
    if (code1) *code1=to_code1_glo(data->code[0]);
    if (code2) *code2=to_code2_glo(data->code[1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r12
movq %r8, %r13
movq %rcx, -0x58(%rbp)
movq %rsi, %rbx
movq %rdi, %r15
movq 0x18(%rbp), %r14
testl %edx, %edx
js 0x4bc99
addl $-0x7, %edx
cvtsi2sd %edx, %xmm0
movsd 0x1ed2b(%rip), %xmm1    # 0x6a988
mulsd %xmm0, %xmm1
addsd 0x1ed27(%rip), %xmm1    # 0x6a990
movsd 0x2012f(%rip), %xmm2    # 0x6bda0
movapd %xmm2, %xmm3
mulsd 0x1ed1b(%rip), %xmm0    # 0x6a998
divsd %xmm1, %xmm3
movsd %xmm3, -0x30(%rbp)
addsd 0x1ed12(%rip), %xmm0    # 0x6a9a0
divsd %xmm0, %xmm2
movsd %xmm2, -0x38(%rbp)
jmp 0x4bca7
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd %xmm0, -0x30(%rbp)
movq 0x30(%rbp), %rcx
xorl %eax, %eax
movl %eax, (%r14)
movl %eax, (%r13)
testq %r12, %r12
je 0x4bcc1
movl $0xfff80000, (%r12)     # imm = 0xFFF80000
movq 0x38(%rbp), %rax
testq %rcx, %rcx
je 0x4bcd0
movl $0xffffe000, (%rcx)     # imm = 0xFFFFE000
testq %rax, %rax
je 0x4bcdb
movl $0xfff80000, (%rax)     # imm = 0xFFF80000
movsd 0x38(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
xorpd %xmm3, %xmm3
jne 0x4bcf4
jnp 0x4bd79
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
divsd 0x2313a(%rip), %xmm0    # 0x6ee40
callq 0x8ad0
cvttsd2si %xmm0, %eax
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm1
movl %eax, (%r14)
mulsd 0x2311e(%rip), %xmm1    # 0x6ee40
movsd -0x50(%rbp), %xmm0
subsd %xmm1, %xmm0
divsd 0x200ed(%rip), %xmm0    # 0x6be20
addsd 0x1ff3d(%rip), %xmm0    # 0x6bc78
callq 0x8ad0
xorpd %xmm1, %xmm1
movq 0x30(%rbp), %rcx
cvttsd2si %xmm0, %eax
movl %eax, (%r13)
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm3
xorps %xmm0, %xmm0
cvtsi2sdl (%r14), %xmm0
mulsd 0x230d8(%rip), %xmm0    # 0x6ee40
mulsd 0x200b0(%rip), %xmm3    # 0x6be20
addsd %xmm0, %xmm3
movsd -0x50(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4bd85
jnp 0x4be18
movsd 0x20(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4bd96
jnp 0x4be18
cmpb $0x0, 0x18(%rbx)
je 0x4be18
movsd -0x30(%rbp), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x4be18
movapd %xmm3, %xmm1
divsd -0x30(%rbp), %xmm1
subsd %xmm1, %xmm0
addsd 0x2305c(%rip), %xmm0    # 0x6ee18
movsd 0x23064(%rip), %xmm1    # 0x6ee28
movq %rcx, %r14
movapd %xmm3, -0x50(%rbp)
callq 0x8860
movapd -0x50(%rbp), %xmm3
movq %r14, %rcx
testq %r12, %r12
je 0x4be18
addsd 0x2302a(%rip), %xmm0    # 0x6ee10
movsd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
divsd 0x23011(%rip), %xmm1    # 0x6ee08
addsd 0x1fe79(%rip), %xmm1    # 0x6bc78
movapd %xmm1, %xmm0
callq 0x8ad0
movapd -0x50(%rbp), %xmm3
movq %r14, %rcx
cvttsd2si %xmm0, %eax
movl %eax, (%r12)
movq 0x10(%rbp), %r13
movsd 0x38(%rbx), %xmm4
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm4
jne 0x4be31
jnp 0x4bf2b
movsd 0x40(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4be3e
jnp 0x4bea0
cmpb $0x0, 0x18(%rbx)
je 0x4bea0
cmpb $0x0, 0x19(%rbx)
je 0x4bea0
testq %rcx, %rcx
je 0x4bea0
subsd %xmm3, %xmm0
movapd 0x1dad5(%rip), %xmm1    # 0x69930
andpd %xmm0, %xmm1
movsd 0x24321(%rip), %xmm2    # 0x70188
ucomisd %xmm1, %xmm2
jb 0x4bea0
divsd 0x1ffab(%rip), %xmm0    # 0x6be20
addsd 0x1fdfb(%rip), %xmm0    # 0x6bc78
movq %rcx, %r14
movapd %xmm3, -0x50(%rbp)
movsd %xmm4, -0x30(%rbp)
callq 0x8ad0
movsd -0x30(%rbp), %xmm4
movapd -0x50(%rbp), %xmm3
cvttsd2si %xmm0, %eax
movl %eax, (%r14)
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm4
jne 0x4beac
jnp 0x4bf2b
movsd 0x28(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4beb9
jnp 0x4bf2b
cmpb $0x0, 0x18(%rbx)
je 0x4bf2b
cmpb $0x0, 0x19(%rbx)
je 0x4bf2b
movsd -0x38(%rbp), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x4bf2b
divsd -0x38(%rbp), %xmm3
subsd %xmm3, %xmm0
addsd 0x22f37(%rip), %xmm0    # 0x6ee18
movsd 0x22f3f(%rip), %xmm1    # 0x6ee28
callq 0x8860
movq 0x38(%rbp), %rax
testq %rax, %rax
je 0x4bf2b
addsd 0x22f11(%rip), %xmm0    # 0x6ee10
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
divsd 0x22ef8(%rip), %xmm1    # 0x6ee08
addsd 0x1fd60(%rip), %xmm1    # 0x6bc78
movapd %xmm1, %xmm0
movq %rax, %r14
callq 0x8ad0
cvttsd2si %xmm0, %eax
movl %eax, (%r14)
movq 0x40(%rbp), %r14
movq (%rbx), %rdi
movsd 0x8(%rbx), %xmm0
movzbl 0x10(%rbx), %eax
leaq (%rax,%rax,2), %rax
shll $0x4, %eax
leaq (%rax,%r15), %rsi
addq $0x9d378, %rsi          # imm = 0x9D378
movzbl 0x15(%rbx), %edx
callq 0x4bac1
movl %eax, %r12d
movq (%rbx), %rdi
movsd 0x8(%rbx), %xmm0
movzbl 0x10(%rbx), %eax
leaq (%rax,%rax,2), %rax
shll $0x4, %eax
leaq (%rax,%r15), %rsi
addq $0x9d388, %rsi          # imm = 0x9D388
movzbl 0x16(%rbx), %edx
callq 0x4bac1
movl %eax, %r15d
testq %r13, %r13
je 0x4bf94
movl %r12d, %edi
callq 0x4baee
movl %eax, (%r13)
movq 0x20(%rbp), %r12
testq %r14, %r14
je 0x4bfa8
movl %r15d, %edi
callq 0x4baee
movl %eax, (%r14)
movq 0x48(%rbp), %rax
testq %r12, %r12
je 0x4bfb9
movzbl 0x12(%rbx), %ecx
movl %ecx, (%r12)
testq %rax, %rax
movq -0x58(%rbp), %rdx
je 0x4bfc8
movzbl 0x13(%rbx), %ecx
movl %ecx, (%rax)
movq 0x28(%rbp), %rax
testq %rdx, %rdx
je 0x4bfdc
xorl %ecx, %ecx
cmpb $0x2, 0x18(%rbx)
sete %cl
movl %ecx, (%rdx)
testq %rax, %rax
je 0x4bfec
xorl %ecx, %ecx
cmpb $0x13, 0x19(%rbx)
sete %cl
movl %ecx, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq