// File: /workspace/github_cpp_makefile_star2_O3/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
xorl %eax, %eax
movl %eax, (%r15)
movl %eax, (%r14)
testq %r8, %r8
je 0x4addd
movl $0xfff80000, (%r13)     # imm = 0xFFF80000
movq 0x30(%rbp), %rax
testq %rcx, %rcx
je 0x4adec
movl $0xffffe000, (%rcx)     # imm = 0xFFFFE000
testq %rax, %rax
je 0x4adf7
movl $0xfff80000, (%rax)     # imm = 0xFFF80000
movsd 0x38(%rbx), %xmm2
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm2
jne 0x4ae0c
jnp 0x4af3a
xorpd %xmm1, %xmm1
cmpb $0x0, 0x18(%rbx)
xorpd %xmm3, %xmm3
je 0x4aea4
movapd %xmm2, %xmm0
divsd 0x23fd6(%rip), %xmm0    # 0x6ee00
movsd %xmm2, -0x40(%rbp)
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, (%r15)
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
mulsd 0x23fb5(%rip), %xmm0    # 0x6ee00
movsd -0x40(%rbp), %xmm1
subsd %xmm0, %xmm1
divsd 0x20fc4(%rip), %xmm1    # 0x6be20
addsd 0x20e14(%rip), %xmm1    # 0x6bc78
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
xorps %xmm0, %xmm0
cvtsi2sdl (%r15), %xmm0
mulsd 0x23f68(%rip), %xmm0    # 0x6ee00
mulsd 0x20f80(%rip), %xmm3    # 0x6be20
addsd %xmm0, %xmm3
movsd 0x20(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4aeb1
jnp 0x4af2f
cmpb $0x0, 0x18(%rbx)
je 0x4af2f
movapd %xmm3, %xmm1
divsd 0x252b5(%rip), %xmm1    # 0x70178
addsd %xmm1, %xmm0
addsd 0x23f49(%rip), %xmm0    # 0x6ee18
movsd 0x23f51(%rip), %xmm1    # 0x6ee28
movq %rax, %r14
movq %rcx, %r15
movapd %xmm3, -0x40(%rbp)
callq 0x8850
movapd -0x40(%rbp), %xmm3
movq %r15, %rcx
movq %r14, %rax
testq %r13, %r13
je 0x4af2f
addsd 0x23f11(%rip), %xmm0    # 0x6ee10
mulsd 0x25279(%rip), %xmm0    # 0x70180
divsd 0x23ef9(%rip), %xmm0    # 0x6ee08
addsd 0x20d61(%rip), %xmm0    # 0x6bc78
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 0x4af3e
xorpd %xmm3, %xmm3
ucomisd %xmm0, %xmm2
movq %r12, %r13
jne 0x4af4d
jnp 0x4b02e
movsd 0x40(%rbx), %xmm0
xorpd %xmm4, %xmm4
ucomisd %xmm4, %xmm0
jne 0x4af5e
jnp 0x4afc0
cmpb $0x0, 0x18(%rbx)
je 0x4afc0
cmpb $0x0, 0x19(%rbx)
je 0x4afc0
testq %rcx, %rcx
je 0x4afc0
subsd %xmm3, %xmm0
movapd 0x1e9b5(%rip), %xmm1    # 0x69930
andpd %xmm0, %xmm1
movsd 0x25201(%rip), %xmm2    # 0x70188
ucomisd %xmm1, %xmm2
jb 0x4afc0
divsd 0x20e8b(%rip), %xmm0    # 0x6be20
addsd 0x20cdb(%rip), %xmm0    # 0x6bc78
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 0x4afcd
jnp 0x4b02e
cmpb $0x0, 0x18(%rbx)
je 0x4b02e
cmpb $0x0, 0x19(%rbx)
je 0x4b02e
divsd 0x251af(%rip), %xmm3    # 0x70190
addsd %xmm3, %xmm0
addsd 0x23e2b(%rip), %xmm0    # 0x6ee18
movsd 0x23e33(%rip), %xmm1    # 0x6ee28
movq %rax, %r14
callq 0x8850
testq %r14, %r14
je 0x4b02e
addsd 0x23e06(%rip), %xmm0    # 0x6ee10
mulsd 0x25186(%rip), %xmm0    # 0x70198
divsd 0x23dee(%rip), %xmm0    # 0x6ee08
addsd 0x20c56(%rip), %xmm0    # 0x6bc78
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, (%r14)
movq 0x38(%rbp), %r15
movq (%rbx), %rdi
movsd 0x8(%rbx), %xmm0
movzbl 0x10(%rbx), %eax
leaq (%rax,%rax,2), %rax
shll $0x4, %eax
movq -0x48(%rbp), %r12
leaq (%rax,%r12), %rsi
addq $0x9d378, %rsi          # imm = 0x9D378
movzbl 0x15(%rbx), %edx
callq 0x4b123
movl %eax, %r14d
movq (%rbx), %rdi
movsd 0x8(%rbx), %xmm0
movzbl 0x10(%rbx), %eax
leaq (%rax,%rax,2), %rax
shll $0x4, %eax
leaq (%rax,%r12), %rsi
addq $0x9d388, %rsi          # imm = 0x9D388
movzbl 0x16(%rbx), %edx
callq 0x4b123
movl %eax, %r12d
testq %r13, %r13
je 0x4b09b
movl %r14d, %edi
callq 0x4b15b
movl %eax, (%r13)
movq 0x18(%rbp), %r14
testq %r15, %r15
je 0x4b0af
movl %r12d, %edi
callq 0x4b15b
movl %eax, (%r15)
movq 0x40(%rbp), %rax
testq %r14, %r14
je 0x4b0bf
movzbl 0x12(%rbx), %ecx
movl %ecx, (%r14)
testq %rax, %rax
movq -0x50(%rbp), %rsi
je 0x4b0ce
movzbl 0x13(%rbx), %ecx
movl %ecx, (%rax)
movq 0x20(%rbp), %rax
testq %rsi, %rsi
je 0x4b0f3
movb 0x18(%rbx), %cl
addb $-0x2, %cl
xorl %edx, %edx
cmpb $0x4, %cl
ja 0x4b0f1
movzbl %cl, %ecx
leaq 0x25006(%rip), %rdx     # 0x700f4
movl (%rdx,%rcx,4), %edx
movl %edx, (%rsi)
testq %rax, %rax
je 0x4b114
movb 0x19(%rbx), %cl
addb $-0xf, %cl
xorl %edx, %edx
cmpb $0x8, %cl
ja 0x4b112
movzbl %cl, %ecx
leaq 0x24ff9(%rip), %rdx     # 0x70108
movl (%rdx,%rcx,4), %edx
movl %edx, (%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq