// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %r9, %r12
movq %r8, %r13
movq %rcx, %r14
movq %rdx, -0x58(%rbp)
movq %rsi, %rbx
movq %rdi, -0x50(%rbp)
movq 0x28(%rbp), %rcx
movq 0x10(%rbp), %r15
xorl %eax, %eax
movl %eax, (%r15)
movl %eax, (%r14)
testq %r8, %r8
je 0x4b769
movl $0xfff80000, (%r13)     # imm = 0xFFF80000
movq 0x30(%rbp), %rax
testq %rcx, %rcx
je 0x4b778
movl $0xffffe000, (%rcx)     # imm = 0xFFFFE000
testq %rax, %rax
je 0x4b783
movl $0xfff80000, (%rax)     # imm = 0xFFF80000
movsd 0x38(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
xorpd %xmm3, %xmm3
jne 0x4b79c
jnp 0x4b82e
cmpb $0x0, 0x18(%rbx)
je 0x4b82e
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
divsd 0x23648(%rip), %xmm0    # 0x6ee00
callq 0x8ad0
cvttsd2si %xmm0, %eax
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm1
movl %eax, (%r15)
mulsd 0x2362c(%rip), %xmm1    # 0x6ee00
movsd -0x40(%rbp), %xmm0
subsd %xmm1, %xmm0
divsd 0x2063b(%rip), %xmm0    # 0x6be20
addsd 0x2048b(%rip), %xmm0    # 0x6bc78
callq 0x8ad0
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 0x235e3(%rip), %xmm0    # 0x6ee00
mulsd 0x205fb(%rip), %xmm3    # 0x6be20
addsd %xmm0, %xmm3
movsd -0x40(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4b83a
jnp 0x4b8c5
movsd 0x20(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4b847
jnp 0x4b8c5
cmpb $0x0, 0x18(%rbx)
je 0x4b8c5
movapd %xmm3, %xmm1
divsd 0x2491f(%rip), %xmm1    # 0x70178
addsd %xmm1, %xmm0
addsd 0x235b3(%rip), %xmm0    # 0x6ee18
movsd 0x235bb(%rip), %xmm1    # 0x6ee28
movq %rax, %r14
movq %rcx, %r15
movapd %xmm3, -0x40(%rbp)
callq 0x8860
movapd -0x40(%rbp), %xmm3
movq %r15, %rcx
movq %r14, %rax
testq %r13, %r13
je 0x4b8c5
addsd 0x2357b(%rip), %xmm0    # 0x6ee10
mulsd 0x248e3(%rip), %xmm0    # 0x70180
divsd 0x23563(%rip), %xmm0    # 0x6ee08
addsd 0x203cb(%rip), %xmm0    # 0x6bc78
callq 0x8ad0
movapd -0x40(%rbp), %xmm3
movq %r15, %rcx
cvttsd2si %xmm0, %eax
movl %eax, (%r13)
movq %r14, %rax
movsd 0x38(%rbx), %xmm4
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm4
movq %r12, %r13
jne 0x4b8dd
jnp 0x4b9cc
movsd 0x40(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4b8ea
jnp 0x4b952
cmpb $0x0, 0x18(%rbx)
je 0x4b952
cmpb $0x0, 0x19(%rbx)
je 0x4b952
testq %rcx, %rcx
je 0x4b952
subsd %xmm3, %xmm0
movapd 0x1e029(%rip), %xmm1    # 0x69930
andpd %xmm0, %xmm1
movsd 0x24875(%rip), %xmm2    # 0x70188
ucomisd %xmm1, %xmm2
jb 0x4b952
divsd 0x204ff(%rip), %xmm0    # 0x6be20
addsd 0x2034f(%rip), %xmm0    # 0x6bc78
movq %rax, %r14
movq %rcx, %r15
movapd %xmm3, -0x40(%rbp)
movsd %xmm4, -0x48(%rbp)
callq 0x8ad0
movsd -0x48(%rbp), %xmm4
movapd -0x40(%rbp), %xmm3
cvttsd2si %xmm0, %eax
movl %eax, (%r15)
movq %r14, %rax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm4
jne 0x4b95e
jnp 0x4b9cc
movsd 0x28(%rbx), %xmm0
ucomisd %xmm1, %xmm0
jne 0x4b96b
jnp 0x4b9cc
cmpb $0x0, 0x18(%rbx)
je 0x4b9cc
cmpb $0x0, 0x19(%rbx)
je 0x4b9cc
divsd 0x24811(%rip), %xmm3    # 0x70190
addsd %xmm3, %xmm0
addsd 0x2348d(%rip), %xmm0    # 0x6ee18
movsd 0x23495(%rip), %xmm1    # 0x6ee28
movq %rax, %r14
callq 0x8860
testq %r14, %r14
je 0x4b9cc
addsd 0x23468(%rip), %xmm0    # 0x6ee10
mulsd 0x247e8(%rip), %xmm0    # 0x70198
divsd 0x23450(%rip), %xmm0    # 0x6ee08
addsd 0x202b8(%rip), %xmm0    # 0x6bc78
callq 0x8ad0
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 -0x50(%rbp), %r12
leaq (%rax,%r12), %rsi
addq $0x9d378, %rsi          # imm = 0x9D378
movzbl 0x15(%rbx), %edx
callq 0x4bac1
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 0x4bac1
movl %eax, %r12d
testq %r13, %r13
je 0x4ba39
movl %r14d, %edi
callq 0x4baee
movl %eax, (%r13)
movq 0x18(%rbp), %r14
testq %r15, %r15
je 0x4ba4d
movl %r12d, %edi
callq 0x4baee
movl %eax, (%r15)
movq 0x40(%rbp), %rax
testq %r14, %r14
je 0x4ba5d
movzbl 0x12(%rbx), %ecx
movl %ecx, (%r14)
testq %rax, %rax
movq -0x58(%rbp), %rsi
je 0x4ba6c
movzbl 0x13(%rbx), %ecx
movl %ecx, (%rax)
movq 0x20(%rbp), %rax
testq %rsi, %rsi
je 0x4ba91
movb 0x18(%rbx), %cl
addb $-0x2, %cl
xorl %edx, %edx
cmpb $0x4, %cl
ja 0x4ba8f
movzbl %cl, %ecx
leaq 0x24668(%rip), %rdx     # 0x700f4
movl (%rdx,%rcx,4), %edx
movl %edx, (%rsi)
testq %rax, %rax
je 0x4bab2
movb 0x19(%rbx), %cl
addb $-0xf, %cl
xorl %edx, %edx
cmpb $0x8, %cl
ja 0x4bab0
movzbl %cl, %ecx
leaq 0x2465b(%rip), %rdx     # 0x70108
movl (%rdx,%rcx,4), %edx
movl %edx, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq