// File: /workspace/github_cpp_makefile_star2_O3/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 0x4b306
addl $-0x7, %edx
cvtsi2sd %edx, %xmm0
movsd 0x1f6be(%rip), %xmm1    # 0x6a988
mulsd %xmm0, %xmm1
addsd 0x1f6ba(%rip), %xmm1    # 0x6a990
movsd 0x20ac2(%rip), %xmm2    # 0x6bda0
movapd %xmm2, %xmm3
mulsd 0x1f6ae(%rip), %xmm0    # 0x6a998
divsd %xmm1, %xmm3
movsd %xmm3, -0x38(%rbp)
addsd 0x1f6a5(%rip), %xmm0    # 0x6a9a0
divsd %xmm0, %xmm2
movsd %xmm2, -0x30(%rbp)
jmp 0x4b314
xorpd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd %xmm0, -0x38(%rbp)
movq 0x30(%rbp), %rcx
xorl %eax, %eax
movl %eax, (%r14)
movl %eax, (%r13)
testq %r12, %r12
je 0x4b32e
movl $0xfff80000, (%r12)     # imm = 0xFFF80000
movq 0x38(%rbp), %rax
testq %rcx, %rcx
je 0x4b33d
movl $0xffffe000, (%rcx)     # imm = 0xFFFFE000
testq %rax, %rax
je 0x4b348
movl $0xfff80000, (%rax)     # imm = 0xFFF80000
movsd 0x38(%rbx), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x4b35d
jnp 0x4b475
movapd %xmm1, %xmm0
divsd 0x23ad7(%rip), %xmm0    # 0x6ee40
movsd %xmm1, -0x50(%rbp)
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, (%r14)
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
mulsd 0x23ab6(%rip), %xmm0    # 0x6ee40
movsd -0x50(%rbp), %xmm1
subsd %xmm0, %xmm1
divsd 0x20a85(%rip), %xmm1    # 0x6be20
addsd 0x208d5(%rip), %xmm1    # 0x6bc78
movapd %xmm1, %xmm0
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, (%r13)
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm3
xorps %xmm0, %xmm0
cvtsi2sdl (%r14), %xmm0
mulsd 0x23a74(%rip), %xmm0    # 0x6ee40
mulsd 0x20a4c(%rip), %xmm3    # 0x6be20
addsd %xmm0, %xmm3
movsd 0x20(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4b3e9
jnp 0x4b462
cmpb $0x0, 0x18(%rbx)
je 0x4b462
movsd -0x38(%rbp), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x4b462
movapd %xmm3, %xmm1
divsd -0x38(%rbp), %xmm1
subsd %xmm1, %xmm0
addsd 0x23a09(%rip), %xmm0    # 0x6ee18
movsd 0x23a11(%rip), %xmm1    # 0x6ee28
movapd %xmm3, -0x50(%rbp)
callq 0x8850
movapd -0x50(%rbp), %xmm3
testq %r12, %r12
je 0x4b462
addsd 0x239dd(%rip), %xmm0    # 0x6ee10
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
divsd 0x239c4(%rip), %xmm1    # 0x6ee08
addsd 0x2082c(%rip), %xmm1    # 0x6bc78
movapd %xmm1, %xmm0
callq 0x8ac0
movapd -0x50(%rbp), %xmm3
cvttsd2si %xmm0, %eax
movl %eax, (%r12)
movsd 0x38(%rbx), %xmm1
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rcx
xorpd %xmm0, %xmm0
jmp 0x4b479
xorpd %xmm3, %xmm3
movq 0x10(%rbp), %r13
ucomisd %xmm0, %xmm1
jne 0x4b489
jnp 0x4b57c
movsd 0x40(%rbx), %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jne 0x4b49a
jnp 0x4b4fd
cmpb $0x0, 0x18(%rbx)
je 0x4b4fd
cmpb $0x0, 0x19(%rbx)
je 0x4b4fd
testq %rcx, %rcx
je 0x4b4fd
subsd %xmm3, %xmm0
movapd 0x1e479(%rip), %xmm1    # 0x69930
andpd %xmm0, %xmm1
movsd 0x24cc5(%rip), %xmm2    # 0x70188
ucomisd %xmm1, %xmm2
jb 0x4b4fd
divsd 0x2094f(%rip), %xmm0    # 0x6be20
addsd 0x2079f(%rip), %xmm0    # 0x6bc78
movq %rax, %r14
movq %rcx, %r12
movapd %xmm3, -0x50(%rbp)
callq 0x8ac0
xorpd %xmm4, %xmm4
movapd -0x50(%rbp), %xmm3
cvttsd2si %xmm0, %eax
movl %eax, (%r12)
movq %r14, %rax
movsd 0x28(%rbx), %xmm0
ucomisd %xmm4, %xmm0
jne 0x4b50a
jnp 0x4b57c
cmpb $0x0, 0x18(%rbx)
je 0x4b57c
cmpb $0x0, 0x19(%rbx)
je 0x4b57c
xorpd %xmm1, %xmm1
movsd -0x30(%rbp), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x4b57c
divsd -0x30(%rbp), %xmm3
subsd %xmm3, %xmm0
addsd 0x238e2(%rip), %xmm0    # 0x6ee18
movsd 0x238ea(%rip), %xmm1    # 0x6ee28
movq %rax, %r14
callq 0x8850
testq %r14, %r14
je 0x4b57c
addsd 0x238bd(%rip), %xmm0    # 0x6ee10
movsd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
divsd 0x238a4(%rip), %xmm1    # 0x6ee08
addsd 0x2070c(%rip), %xmm1    # 0x6bc78
movapd %xmm1, %xmm0
callq 0x8ac0
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 0x4b123
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 0x4b123
movl %eax, %r15d
testq %r13, %r13
je 0x4b5e5
movl %r12d, %edi
callq 0x4b15b
movl %eax, (%r13)
movq 0x20(%rbp), %r12
testq %r14, %r14
je 0x4b5f9
movl %r15d, %edi
callq 0x4b15b
movl %eax, (%r14)
movq 0x48(%rbp), %rax
testq %r12, %r12
je 0x4b60a
movzbl 0x12(%rbx), %ecx
movl %ecx, (%r12)
testq %rax, %rax
movq -0x58(%rbp), %rdx
je 0x4b619
movzbl 0x13(%rbx), %ecx
movl %ecx, (%rax)
movq 0x28(%rbp), %rax
testq %rdx, %rdx
je 0x4b62d
xorl %ecx, %ecx
cmpb $0x2, 0x18(%rbx)
sete %cl
movl %ecx, (%rdx)
testq %rax, %rax
je 0x4b63d
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