// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::filter(double*, double*, double const*, double const*, double const*, int, int)
extern int filter(double *x, double *P, const double *H, const double *v,
                  const double *R, int n, int m)
{
    double *x_,*xp_,*P_,*Pp_,*H_;
    int i,j,k,info,*ix;
    
    ix=imat(n,1); for (i=k=0;i<n;i++) if (x[i]!=0.0&&P[i+i*n]>0.0) ix[k++]=i;
    x_=mat(k,1); xp_=mat(k,1); P_=mat(k,k); Pp_=mat(k,k); H_=mat(k,m);
    for (i=0;i<k;i++) {
        x_[i]=x[ix[i]];
        for (j=0;j<k;j++) P_[i+j*k]=P[ix[i]+ix[j]*n];
        for (j=0;j<m;j++) H_[i+j*k]=H[ix[i]+j*n];
    }
    info=filter_(x_,P_,H_,v,R,k,m,xp_,Pp_);
    for (i=0;i<k;i++) {
        x[ix[i]]=xp_[i];
        for (j=0;j<k;j++) P[ix[i]+ix[j]*n]=Pp_[i+j*k];
    }
    free(ix); free(x_); free(xp_); free(P_); free(Pp_); free(H_);
    return info;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r9d, %r13d
movq %r8, -0x58(%rbp)
movq %rcx, -0x98(%rbp)
movq %rdx, -0x38(%rbp)
movq %rsi, %rbx
movq %rdi, -0x88(%rbp)
pushq $0x1
popq %rsi
movl %r9d, %edi
callq 0x45d3a
movq %rax, %r15
xorl %eax, %eax
testl %r13d, %r13d
movl $0x0, %ecx
cmovgl %r13d, %ecx
leal 0x1(%r13), %edx
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorl %r8d, %r8d
movslq %r8d, %r12
cmpq %rsi, %rcx
je 0x46736
movq -0x88(%rbp), %rdi
movsd (%rdi,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x46718
jnp 0x4672f
movslq %eax, %rdi
movsd (%rbx,%rdi,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4672f
leal 0x1(%r12), %r8d
movl %esi, (%r15,%r12,4)
incq %rsi
addl %edx, %eax
jmp 0x466fc
pushq $0x1
popq %r14
movl %r12d, %edi
movl %r14d, %esi
movl %r8d, -0x2c(%rbp)
callq 0x45c3a
movq %rax, -0x80(%rbp)
movl %r12d, %edi
movl %r14d, %esi
callq 0x45c3a
movq %rax, -0x78(%rbp)
movl %r12d, %edi
movl %r12d, %esi
callq 0x45c3a
movq %rax, -0x50(%rbp)
movl %r12d, %edi
movl %r12d, %esi
callq 0x45c3a
movq %rax, -0x70(%rbp)
movl %r12d, %edi
movl 0x10(%rbp), %r14d
movl %r14d, %esi
callq 0x45c3a
movl -0x2c(%rbp), %edi
movq %rax, %rsi
movslq %r13d, %rcx
xorl %eax, %eax
testl %r14d, %r14d
movl $0x0, %edx
cmovgl %r14d, %edx
movq %rdx, -0x40(%rbp)
testl %r12d, %r12d
movl $0x0, %r8d
cmovgl %edi, %r8d
movl %r12d, %r14d
shlq $0x3, %r12
movq %rcx, -0xa0(%rbp)
leaq (,%rcx,8), %rdx
movq %rsi, -0x68(%rbp)
movq -0x50(%rbp), %rcx
movq %r8, -0x90(%rbp)
cmpq %r8, %rax
je 0x46867
movslq (%r15,%rax,4), %r8
movq -0x88(%rbp), %r9
movsd (%r9,%r8,8), %xmm0
movq -0x80(%rbp), %r9
movsd %xmm0, (%r9,%rax,8)
movq %rcx, %r9
xorl %r10d, %r10d
cmpq %r10, %r14
je 0x46826
movl (%r15,%r10,4), %r11d
imull %r13d, %r11d
addl %r8d, %r11d
movslq %r11d, %r11
movsd (%rbx,%r11,8), %xmm0
movsd %xmm0, (%r9)
incq %r10
addq %r12, %r9
jmp 0x46800
movq -0x38(%rbp), %rdi
leaq (%rdi,%r8,8), %r8
movq %rsi, %r9
movq -0x40(%rbp), %r10
subq $0x1, %r10
jb 0x4684d
movsd (%r8), %xmm0
movsd %xmm0, (%r9)
addq %rdx, %r8
addq %r12, %r9
jmp 0x46835
incq %rax
addq $0x8, %rcx
addq $0x8, %rsi
movl -0x2c(%rbp), %edi
movq -0x90(%rbp), %r8
jmp 0x467d6
movl 0x10(%rbp), %esi
movl %edi, %r13d
callq 0x45c3a
movq %rax, -0x40(%rbp)
movl 0x10(%rbp), %edi
movl %edi, %esi
callq 0x45c3a
movq %rax, -0x38(%rbp)
movl %r13d, %edi
movl 0x10(%rbp), %esi
callq 0x45c3a
movq %rax, -0x48(%rbp)
movl %r13d, %edi
callq 0x45dcc
movq %rax, -0x60(%rbp)
movl 0x10(%rbp), %r13d
movslq %r13d, %rdx
imulq %rdx, %rdx
shlq $0x3, %rdx
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x84f0
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq %r12, %rdx
callq 0x84f0
movq -0x40(%rbp), %rax
movq %rax, (%rsp)
leaq 0x247a3(%rip), %rdi     # 0x6b07d
movsd 0x1903e(%rip), %xmm0    # 0x5f920
xorpd %xmm1, %xmm1
movl -0x2c(%rbp), %ecx
movl %ecx, %esi
movl %r13d, %edx
movq -0x50(%rbp), %r8
movq -0x68(%rbp), %r13
movq %r13, %r9
callq 0x45f19
movq -0x38(%rbp), %rax
movq %rax, (%rsp)
leaq 0x1c353(%rip), %rdi     # 0x62c60
movl 0x10(%rbp), %edx
movl %edx, %esi
movl -0x2c(%rbp), %ecx
movsd 0x19003(%rip), %xmm0    # 0x5f920
movq %r13, %r8
movq -0x40(%rbp), %r9
movaps %xmm0, %xmm1
callq 0x45f19
movq -0x38(%rbp), %rdi
movl 0x10(%rbp), %esi
callq 0x46100
movl %eax, -0x58(%rbp)
testl %eax, %eax
jne 0x46a0e
movq -0x48(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2472b(%rip), %rdi     # 0x6b07d
movsd 0x18fc6(%rip), %xmm0    # 0x5f920
xorps %xmm1, %xmm1
movl -0x2c(%rbp), %r13d
movl %r13d, %esi
movl 0x10(%rbp), %ecx
movl %ecx, %edx
movq -0x40(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x45f19
movq -0x78(%rbp), %rax
movq %rax, (%rsp)
pushq $0x1
popq %rdx
leaq 0x246f5(%rip), %rdi     # 0x6b07d
movl %r13d, %esi
movl 0x10(%rbp), %ecx
movsd 0x18f8a(%rip), %xmm0    # 0x5f920
movq -0x48(%rbp), %r8
movq -0x98(%rbp), %r9
movaps %xmm0, %xmm1
callq 0x45f19
movq -0x60(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2808f(%rip), %rdi     # 0x6ea47
movsd 0x19fe0(%rip), %xmm0    # 0x609a0
movl %r13d, %esi
movl %r13d, %edx
movl 0x10(%rbp), %ecx
movq -0x48(%rbp), %r8
movq -0x68(%rbp), %r9
movsd 0x18f47(%rip), %xmm1    # 0x5f920
callq 0x45f19
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
xorps %xmm1, %xmm1
leaq 0x2468d(%rip), %rdi     # 0x6b07d
movl %r13d, %esi
movl %r13d, %edx
movl %r13d, %ecx
movsd 0x18f1f(%rip), %xmm0    # 0x5f920
movq -0x60(%rbp), %r8
movq -0x50(%rbp), %r9
callq 0x45f19
movq -0x40(%rbp), %rdi
callq 0x8780
movq -0x38(%rbp), %rdi
callq 0x8780
movq -0x48(%rbp), %rdi
callq 0x8780
movq -0x60(%rbp), %rdi
callq 0x8780
xorl %eax, %eax
movq -0x70(%rbp), %rcx
movq -0x78(%rbp), %r13
movq -0xa0(%rbp), %r9
movq -0x90(%rbp), %r10
cmpq %r10, %rax
je 0x46a96
movsd (%r13,%rax,8), %xmm0
movslq (%r15,%rax,4), %rdx
movq -0x88(%rbp), %rsi
movsd %xmm0, (%rsi,%rdx,8)
movq %rcx, %rsi
xorl %edi, %edi
cmpq %rdi, %r14
je 0x46a8d
movsd (%rsi), %xmm0
movslq (%r15,%rdi,4), %r8
imulq %r9, %r8
addq %rdx, %r8
movsd %xmm0, (%rbx,%r8,8)
incq %rdi
addq %r12, %rsi
jmp 0x46a6b
incq %rax
addq $0x8, %rcx
jmp 0x46a4a
movq %r15, %rdi
callq 0x8780
movq -0x80(%rbp), %rdi
callq 0x8780
movq %r13, %rdi
callq 0x8780
movq -0x50(%rbp), %rdi
callq 0x8780
movq -0x70(%rbp), %rdi
callq 0x8780
movq -0x68(%rbp), %rdi
callq 0x8780
movl -0x58(%rbp), %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq