// File: /workspace/github_cpp_makefile_star2_O1/DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::csmooth(bamboo::obs_t*, int)
extern void csmooth(obs_t *obs, int ns)
{
    double Ps[2][MAXRTKSAT][NFREQ]={{{0}}},Lp[2][MAXRTKSAT][NFREQ]={{{0}}},dcp;
    int i,j,s,r,n[2][MAXRTKSAT][NFREQ]={{{0}}};
    obsd_t *p;
    
    trace(3,"csmooth: nobs=%d,ns=%d\n",obs->n,ns);
    
    for (i=0;i<obs->n;i++) {
        p=&obs->data[i]; s=p->sat; r=p->rcv;
        for (j=0;j<NFREQ;j++) {
            if (s<=0||MAXRTKSAT<s||r<=0||2<r) continue;
            if (p->P[j]==0.0||p->L[j]==0.0) continue;
            if (p->LLI[j]) n[r-1][s-1][j]=0;
            if (n[r-1][s-1][j]==0) Ps[r-1][s-1][j]=p->P[j];
            else {
                dcp=lam_carr[j]*(p->L[j]-Lp[r-1][s-1][j]);
                Ps[r-1][s-1][j]=p->P[j]/ns+(Ps[r-1][s-1][j]+dcp)*(ns-1)/ns;
            }
            if (++n[r-1][s-1][j]<ns) p->P[j]=0.0; else p->P[j]=Ps[r-1][s-1][j];
            Lp[r-1][s-1][j]=p->L[j];
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48b0, %rsp           # imm = 0x48B0
movl %esi, %ebx
movq %rdi, %r14
leaq -0x48d0(%rbp), %rdi
movl $0x1d10, %edx           # imm = 0x1D10
xorl %esi, %esi
callq 0x8390
leaq -0x2bc0(%rbp), %rdi
movl $0x1d10, %edx           # imm = 0x1D10
xorl %esi, %esi
callq 0x8390
leaq -0xeb0(%rbp), %rdi
movl $0xe88, %edx            # imm = 0xE88
xorl %esi, %esi
callq 0x8390
movslq (%r14), %rax
testq %rax, %rax
jle 0x564ed
cvtsi2sd %ebx, %xmm0
movq 0x8(%r14), %rcx
leal -0x1(%rbx), %edx
cvtsi2sd %edx, %xmm1
xorl %edx, %edx
leaq 0x1a858(%rip), %rsi     # 0x70c10
xorpd %xmm2, %xmm2
movq %rcx, %rdi
leaq (%rdx,%rdx,2), %r8
shlq $0x5, %r8
movzbl 0x10(%rcx,%r8), %r9d
movb 0x11(%rcx,%r8), %r8b
movzbl %r8b, %r10d
leal 0x64(%r9), %r8d
cmpb $0x65, %r8b
setb %r11b
leal -0x3(%r10), %r8d
cmpb $-0x2, %r8b
setb %r8b
orb %r11b, %r8b
decl %r10d
decl %r9d
imulq $0x744, %r10, %r11      # imm = 0x744
leaq (%r9,%r9,2), %r14
leaq (%r11,%r14,4), %r9
addq %rbp, %r9
addq $-0xeb0, %r9            # imm = 0xF150
imulq $0xe88, %r10, %r10      # imm = 0xE88
leaq (%r10,%r14,8), %r11
leaq (%r11,%rbp), %r10
addq $-0x2bc0, %r10          # imm = 0xD440
addq %rbp, %r11
addq $-0x48d0, %r11          # imm = 0xB730
movq %rsi, %r14
xorl %r15d, %r15d
testb %r8b, %r8b
jne 0x564cc
movsd 0x38(%rdi,%r15,8), %xmm4
ucomisd %xmm2, %xmm4
jne 0x5644e
jnp 0x564cc
movsd 0x20(%rdi,%r15,8), %xmm3
ucomisd %xmm2, %xmm3
jne 0x5645d
jnp 0x564cc
cmpb $0x0, 0x15(%rdi,%r15)
je 0x5646d
movl $0x0, (%r9,%r15,4)
movl (%r9,%r15,4), %r12d
testl %r12d, %r12d
je 0x564a3
movapd %xmm3, %xmm5
subsd (%r10,%r15,8), %xmm5
mulsd (%r14), %xmm5
divsd %xmm0, %xmm4
addsd (%r11,%r15,8), %xmm5
mulsd %xmm1, %xmm5
divsd %xmm0, %xmm5
addsd %xmm4, %xmm5
movsd %xmm5, (%r11,%r15,8)
jmp 0x564a9
movsd %xmm4, (%r11,%r15,8)
incl %r12d
movl %r12d, (%r9,%r15,4)
xorpd %xmm4, %xmm4
cmpl %ebx, %r12d
jl 0x564bf
movsd (%r11,%r15,8), %xmm4
movsd %xmm4, 0x38(%rdi,%r15,8)
movsd %xmm3, (%r10,%r15,8)
incq %r15
addq $0x8, %r14
cmpq $0x3, %r15
jne 0x56436
incq %rdx
addq $0x60, %rdi
cmpq %rax, %rdx
jne 0x563bf
addq $0x48b0, %rsp           # imm = 0x48B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq