// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtcm3e.cpp
// Function: bamboo::gen_obs_gps(bamboo::rtcm_t*, bamboo::obsd_t const*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*)
static void gen_obs_gps(rtcm_t *rtcm, const obsd_t *data, int *code1, int *pr1,
                        int *ppr1, int *lock1, int *amb, int *cnr1, int *code2,
                        int *pr21, int *ppr2, int *lock2, int *cnr2)
{
    double lam1,lam2,pr1c=0.0,ppr;
    int lt1,lt2;
    
    lam1=CLIGHT/FREQ1;
    lam2=CLIGHT/FREQ2;
    *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&&data->code[0]) {
        *amb=(int)floor(data->P[0]/PRUNIT_GPS);
        *pr1=ROUND((data->P[0]-*amb*PRUNIT_GPS)/0.02);
        pr1c=*pr1*0.02+*amb*PRUNIT_GPS;
    }
    /* L1 phaserange - L1 pseudorange */
    if (data->P[0]!=0.0&&data->L[0]!=0.0&&data->code[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]) {
        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_gps(data->code[0]);
    if (code2) *code2=to_code2_gps(data->code[1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r12
movq %r8, %r13
movq %rcx, %r14
movq %rdx, -0x50(%rbp)
movq %rsi, %rbx
movq %rdi, -0x48(%rbp)
movq 0x28(%rbp), %rcx
movq 0x10(%rbp), %r15
andl $0x0, (%r15)
andl $0x0, (%r14)
testq %r8, %r8
je 0x42f87
movl $0xfff80000, (%r13)     # imm = 0xFFF80000
movq 0x30(%rbp), %rax
testq %rcx, %rcx
je 0x42f96
movl $0xffffe000, (%rcx)     # imm = 0xFFFFE000
testq %rax, %rax
je 0x42fa1
movl $0xfff80000, (%rax)     # imm = 0xFFF80000
movsd 0x38(%rbx), %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jne 0x42fb6
jnp 0x430c5
xorpd %xmm1, %xmm1
cmpb $0x0, 0x18(%rbx)
xorpd %xmm3, %xmm3
je 0x4304b
movapd %xmm2, %xmm0
divsd 0x21724(%rip), %xmm0    # 0x646f8
movsd %xmm2, -0x40(%rbp)
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, (%r15)
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
mulsd 0x21703(%rip), %xmm0    # 0x646f8
movsd -0x40(%rbp), %xmm1
subsd %xmm0, %xmm1
divsd 0x1ee0a(%rip), %xmm1    # 0x61e10
addsd 0x1ec6a(%rip), %xmm1    # 0x61c78
movapd %xmm1, %xmm0
callq 0x8ac0
xorpd %xmm1, %xmm1
movq 0x28(%rbp), %rcx
cvttsd2si %xmm0, %eax
movl %eax, (%r14)
movq 0x30(%rbp), %rax
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm3
cvtsi2sdl (%r15), %xmm0
mulsd 0x216b9(%rip), %xmm0    # 0x646f8
mulsd 0x1edc9(%rip), %xmm3    # 0x61e10
addsd %xmm0, %xmm3
movsd 0x20(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jne 0x43058
jnp 0x430ba
cmpb $0x0, 0x18(%rbx)
je 0x430ba
movapd %xmm3, %xmm1
divsd 0x22bb6(%rip), %xmm1    # 0x65c20
movq %rax, %r14
movq %rcx, %r15
movapd %xmm3, -0x40(%rbp)
callq 0x43290
movapd -0x40(%rbp), %xmm3
movq %r15, %rcx
movq %r14, %rax
testq %r13, %r13
je 0x430ba
mulsd 0x22b8e(%rip), %xmm0    # 0x65c20
divsd 0x21646(%rip), %xmm0    # 0x646e0
addsd 0x1ebd6(%rip), %xmm0    # 0x61c78
callq 0x8ac0
movapd -0x40(%rbp), %xmm3
movq %r15, %rcx
cvttsd2si %xmm0, %eax
movl %eax, (%r13)
movq %r14, %rax
movsd 0x38(%rbx), %xmm2
xorpd %xmm0, %xmm0
jmp 0x430c9
xorpd %xmm3, %xmm3
ucomisd %xmm0, %xmm2
movq %r12, %r13
jne 0x430d8
jnp 0x431a1
movsd 0x40(%rbx), %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jne 0x430e9
jnp 0x4314b
cmpb $0x0, 0x18(%rbx)
je 0x4314b
cmpb $0x0, 0x19(%rbx)
je 0x4314b
testq %rcx, %rcx
je 0x4314b
subsd %xmm3, %xmm0
movapd 0x1c82a(%rip), %xmm1    # 0x5f930
andpd %xmm0, %xmm1
movsd 0x22b16(%rip), %xmm2    # 0x65c28
ucomisd %xmm1, %xmm2
jb 0x4314b
divsd 0x1ecf0(%rip), %xmm0    # 0x61e10
addsd 0x1eb50(%rip), %xmm0    # 0x61c78
movq %rax, %r14
movq %rcx, %r15
movapd %xmm3, -0x40(%rbp)
callq 0x8ac0
xorpd %xmm4, %xmm4
movapd -0x40(%rbp), %xmm3
cvttsd2si %xmm0, %eax
movl %eax, (%r15)
movq %r14, %rax
movsd 0x28(%rbx), %xmm0
ucomisd %xmm4, %xmm0
jne 0x43158
jnp 0x431a1
cmpb $0x0, 0x18(%rbx)
je 0x431a1
cmpb $0x0, 0x19(%rbx)
je 0x431a1
divsd 0x22ac4(%rip), %xmm3    # 0x65c30
movapd %xmm3, %xmm1
movq %rax, %r14
callq 0x43290
testq %r14, %r14
je 0x431a1
mulsd 0x22aab(%rip), %xmm0    # 0x65c30
divsd 0x21553(%rip), %xmm0    # 0x646e0
addsd 0x1eae3(%rip), %xmm0    # 0x61c78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, (%r14)
movq 0x38(%rbp), %r15
movq (%rbx), %rdi
movsd 0x8(%rbx), %xmm0
movzbl 0x10(%rbx), %eax
imulq $0x30, %rax, %rax
movq -0x48(%rbp), %r12
leaq (%rax,%r12), %rsi
addq $0x9d378, %rsi          # imm = 0x9D378
movzbl 0x15(%rbx), %edx
callq 0x432b7
movl %eax, %r14d
movq (%rbx), %rdi
movsd 0x8(%rbx), %xmm0
movzbl 0x10(%rbx), %eax
imulq $0x30, %rax, %rax
leaq (%rax,%r12), %rsi
addq $0x9d388, %rsi          # imm = 0x9D388
movzbl 0x16(%rbx), %edx
callq 0x432b7
movl %eax, %r12d
testq %r13, %r13
je 0x43208
movl %r14d, %edi
callq 0x432ef
movl %eax, (%r13)
movq 0x18(%rbp), %r14
testq %r15, %r15
je 0x4321c
movl %r12d, %edi
callq 0x432ef
movl %eax, (%r15)
movq 0x40(%rbp), %rax
testq %r14, %r14
je 0x4322c
movzbl 0x12(%rbx), %ecx
movl %ecx, (%r14)
testq %rax, %rax
movq -0x50(%rbp), %rsi
je 0x4323b
movzbl 0x13(%rbx), %ecx
movl %ecx, (%rax)
movq 0x20(%rbp), %rax
testq %rsi, %rsi
je 0x43260
movb 0x18(%rbx), %cl
addb $-0x2, %cl
xorl %edx, %edx
cmpb $0x4, %cl
ja 0x4325e
movzbl %cl, %ecx
leaq 0x22fd9(%rip), %rdx     # 0x66234
movl (%rdx,%rcx,4), %edx
movl %edx, (%rsi)
testq %rax, %rax
je 0x43281
movb 0x19(%rbx), %cl
addb $-0xf, %cl
xorl %edx, %edx
cmpb $0x8, %cl
ja 0x4327f
movzbl %cl, %ecx
leaq 0x22fcc(%rip), %rdx     # 0x66248
movl (%rdx,%rcx,4), %edx
movl %edx, (%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq