// File: /workspace/github_cpp_makefile_star2_O2/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 0x4348f
addl $-0x7, %edx
cvtsi2sd %edx, %xmm0
movsd 0x1d525(%rip), %xmm1    # 0x60978
mulsd %xmm0, %xmm1
addsd 0x1d521(%rip), %xmm1    # 0x60980
movsd 0x1e939(%rip), %xmm2    # 0x61da0
movapd %xmm2, %xmm3
mulsd 0x1d515(%rip), %xmm0    # 0x60988
divsd %xmm1, %xmm3
movsd %xmm3, -0x38(%rbp)
addsd 0x1d50c(%rip), %xmm0    # 0x60990
divsd %xmm0, %xmm2
movsd %xmm2, -0x30(%rbp)
jmp 0x4349d
xorpd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd %xmm0, -0x38(%rbp)
movq 0x30(%rbp), %rcx
andl $0x0, (%r14)
andl $0x0, (%r13)
testq %r12, %r12
je 0x434b7
movl $0xfff80000, (%r12)     # imm = 0xFFF80000
movq 0x38(%rbp), %rax
testq %rcx, %rcx
je 0x434c6
movl $0xffffe000, (%rcx)     # imm = 0xFFFFE000
testq %rax, %rax
je 0x434d1
movl $0xfff80000, (%rax)     # imm = 0xFFF80000
movsd 0x38(%rbx), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x434e6
jnp 0x435df
movapd %xmm1, %xmm0
divsd 0x211e6(%rip), %xmm0    # 0x646d8
movsd %xmm1, -0x50(%rbp)
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, (%r14)
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
mulsd 0x211c5(%rip), %xmm0    # 0x646d8
movsd -0x50(%rbp), %xmm1
subsd %xmm0, %xmm1
divsd 0x1e8ec(%rip), %xmm1    # 0x61e10
addsd 0x1e74c(%rip), %xmm1    # 0x61c78
movapd %xmm1, %xmm0
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, (%r13)
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm3
cvtsi2sdl (%r14), %xmm0
mulsd 0x21186(%rip), %xmm0    # 0x646d8
mulsd 0x1e8b6(%rip), %xmm3    # 0x61e10
addsd %xmm0, %xmm3
movsd 0x20(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x4356f
jnp 0x435cc
cmpb $0x0, 0x18(%rbx)
je 0x435cc
movsd -0x38(%rbp), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x435cc
movapd %xmm3, %xmm1
divsd -0x38(%rbp), %xmm1
movapd %xmm3, -0x50(%rbp)
callq 0x43290
movapd -0x50(%rbp), %xmm3
testq %r12, %r12
je 0x435cc
movsd -0x38(%rbp), %xmm1
mulsd %xmm0, %xmm1
divsd 0x21132(%rip), %xmm1    # 0x646e0
addsd 0x1e6c2(%rip), %xmm1    # 0x61c78
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 0x435e3
xorpd %xmm3, %xmm3
movq 0x10(%rbp), %r13
ucomisd %xmm0, %xmm1
jne 0x435f3
jnp 0x436ce
movsd 0x40(%rbx), %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jne 0x43604
jnp 0x43667
cmpb $0x0, 0x18(%rbx)
je 0x43667
cmpb $0x0, 0x19(%rbx)
je 0x43667
testq %rcx, %rcx
je 0x43667
subsd %xmm3, %xmm0
movapd 0x1c30f(%rip), %xmm1    # 0x5f930
andpd %xmm0, %xmm1
movsd 0x225fb(%rip), %xmm2    # 0x65c28
ucomisd %xmm1, %xmm2
jb 0x43667
divsd 0x1e7d5(%rip), %xmm0    # 0x61e10
addsd 0x1e635(%rip), %xmm0    # 0x61c78
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 0x43674
jnp 0x436ce
cmpb $0x0, 0x18(%rbx)
je 0x436ce
cmpb $0x0, 0x19(%rbx)
je 0x436ce
xorpd %xmm1, %xmm1
movsd -0x30(%rbp), %xmm2
ucomisd %xmm1, %xmm2
jbe 0x436ce
divsd -0x30(%rbp), %xmm3
movapd %xmm3, %xmm1
movq %rax, %r14
callq 0x43290
testq %r14, %r14
je 0x436ce
movsd -0x30(%rbp), %xmm1
mulsd %xmm0, %xmm1
divsd 0x2102a(%rip), %xmm1    # 0x646e0
addsd 0x1e5ba(%rip), %xmm1    # 0x61c78
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
imulq $0x30, %rax, %rax
leaq (%rax,%r15), %rsi
addq $0x9d378, %rsi          # imm = 0x9D378
movzbl 0x15(%rbx), %edx
callq 0x432b7
movl %eax, %r12d
movq (%rbx), %rdi
movsd 0x8(%rbx), %xmm0
movzbl 0x10(%rbx), %eax
imulq $0x30, %rax, %rax
leaq (%rax,%r15), %rsi
addq $0x9d388, %rsi          # imm = 0x9D388
movzbl 0x16(%rbx), %edx
callq 0x432b7
movl %eax, %r15d
testq %r13, %r13
je 0x43731
movl %r12d, %edi
callq 0x432ef
movl %eax, (%r13)
movq 0x20(%rbp), %r12
testq %r14, %r14
je 0x43745
movl %r15d, %edi
callq 0x432ef
movl %eax, (%r14)
movq 0x48(%rbp), %rax
testq %r12, %r12
je 0x43756
movzbl 0x12(%rbx), %ecx
movl %ecx, (%r12)
testq %rax, %rax
movq -0x58(%rbp), %rdx
je 0x43765
movzbl 0x13(%rbx), %ecx
movl %ecx, (%rax)
movq 0x28(%rbp), %rax
testq %rdx, %rdx
je 0x43779
xorl %ecx, %ecx
cmpb $0x2, 0x18(%rbx)
sete %cl
movl %ecx, (%rdx)
testq %rax, %rax
je 0x43789
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