// File: /workspace/github_cpp_makefile_star2_O1/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 $0x78, %rsp
movl %r9d, %r13d
movq %r8, -0x58(%rbp)
movq %rcx, -0x90(%rbp)
movq %rdx, -0x30(%rbp)
movq %rsi, %rbx
movq %rdi, -0x78(%rbp)
movl 0x10(%rbp), %r12d
movl %r9d, %edi
movl $0x1, %esi
callq 0x4e6e4
movq %rax, %r15
testl %r13d, %r13d
jle 0x4f1c5
leal 0x1(%r13), %eax
movl %r13d, %ecx
xorl %edx, %edx
xorpd %xmm0, %xmm0
xorl %esi, %esi
xorl %r14d, %r14d
movq -0x78(%rbp), %r8
movsd (%r8,%rsi,8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x4f1a1
jnp 0x4f1b9
movslq %edx, %rdi
movsd (%rbx,%rdi,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4f1b9
movslq %r14d, %rdi
incl %r14d
movl %esi, (%r15,%rdi,4)
incq %rsi
addl %eax, %edx
cmpq %rsi, %rcx
jne 0x4f193
jmp 0x4f1c8
xorl %r14d, %r14d
movl %r14d, %edi
movl $0x1, %esi
callq 0x4e5e2
movq %rax, -0x80(%rbp)
movl %r14d, %edi
movl $0x1, %esi
callq 0x4e5e2
movq %rax, -0x70(%rbp)
movl %r14d, %edi
movl %r14d, %esi
callq 0x4e5e2
movq %rax, -0x48(%rbp)
movl %r14d, %edi
movl %r14d, %esi
callq 0x4e5e2
movq %rax, -0x68(%rbp)
movl %r14d, %edi
movl %r12d, %esi
callq 0x4e5e2
movq %rax, -0x38(%rbp)
movl %r14d, %r12d
movl %r14d, %eax
movslq %r13d, %r14
movl %eax, -0x84(%rbp)
testl %eax, %eax
jle 0x4f2c1
leaq (,%r12,8), %rcx
leaq (,%r14,8), %rdx
xorl %esi, %esi
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %r8
movslq (%r15,%rsi,4), %r9
movq -0x78(%rbp), %rax
movsd (%rax,%r9,8), %xmm0
movq -0x80(%rbp), %rax
movsd %xmm0, (%rax,%rsi,8)
movq %r8, %r10
xorl %r11d, %r11d
movl (%r15,%r11,4), %eax
imull %r13d, %eax
addl %r9d, %eax
cltq
movsd (%rbx,%rax,8), %xmm0
movsd %xmm0, (%r10)
incq %r11
addq %rcx, %r10
cmpq %r11, %r12
jne 0x4f265
cmpl $0x0, 0x10(%rbp)
jle 0x4f2b1
movq -0x30(%rbp), %rax
leaq (%rax,%r9,8), %r9
movl 0x10(%rbp), %r10d
movq %rdi, %r11
movsd (%r9), %xmm0
movsd %xmm0, (%r11)
addq %rcx, %r11
addq %rdx, %r9
decq %r10
jne 0x4f29c
incq %rsi
addq $0x8, %r8
addq $0x8, %rdi
cmpq %r12, %rsi
jne 0x4f248
movl -0x84(%rbp), %r13d
movl %r13d, %edi
movl 0x10(%rbp), %esi
callq 0x4e5e2
movq %rax, -0x50(%rbp)
movl 0x10(%rbp), %edi
movl %edi, %esi
callq 0x4e5e2
movq %rax, -0x30(%rbp)
movl %r13d, %edi
movl 0x10(%rbp), %esi
callq 0x4e5e2
movq %rax, -0x40(%rbp)
movl %r13d, %edi
callq 0x4e778
movq %rax, -0x60(%rbp)
movslq 0x10(%rbp), %rdx
imulq %rdx, %rdx
shlq $0x3, %rdx
movq -0x30(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x84f0
movslq %r13d, %rdx
shlq $0x3, %rdx
movq -0x70(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x84f0
movq -0x50(%rbp), %rax
movq %rax, (%rsp)
leaq 0x25d4b(%rip), %rdi     # 0x75087
movsd 0x1a5dc(%rip), %xmm0    # 0x69920
xorpd %xmm1, %xmm1
movl %r13d, %esi
movl 0x10(%rbp), %edx
movl %r13d, %ecx
movq -0x48(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x4e91f
movq -0x30(%rbp), %rax
movq %rax, (%rsp)
leaq 0x1d8f3(%rip), %rdi     # 0x6cc60
movl 0x10(%rbp), %edx
movl %edx, %esi
movl %r13d, %ecx
movsd 0x1a5a3(%rip), %xmm0    # 0x69920
movq -0x38(%rbp), %r8
movq -0x50(%rbp), %r9
movaps %xmm0, %xmm1
callq 0x4e91f
movq -0x30(%rbp), %rdi
movl 0x10(%rbp), %esi
callq 0x4eb12
movl %eax, -0x58(%rbp)
testl %eax, %eax
jne 0x4f46d
movq -0x40(%rbp), %rax
movq %rax, (%rsp)
leaq 0x25cd4(%rip), %rdi     # 0x75087
movsd 0x1a565(%rip), %xmm0    # 0x69920
xorps %xmm1, %xmm1
movl %r13d, %esi
movl 0x10(%rbp), %ecx
movl %ecx, %edx
movq -0x50(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0x4e91f
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
leaq 0x25ca5(%rip), %rdi     # 0x75087
movl %r13d, %esi
movl $0x1, %edx
movl 0x10(%rbp), %ecx
movsd 0x1a52b(%rip), %xmm0    # 0x69920
movq -0x40(%rbp), %r8
movq -0x90(%rbp), %r9
movaps %xmm0, %xmm1
callq 0x4e91f
movq -0x60(%rbp), %rax
movq %rax, (%rsp)
leaq 0x29684(%rip), %rdi     # 0x78a9b
movsd 0x1b591(%rip), %xmm0    # 0x6a9b0
movl %r13d, %esi
movl %r13d, %edx
movl 0x10(%rbp), %ecx
movq -0x40(%rbp), %r8
movq -0x38(%rbp), %r9
movsd 0x1a4e8(%rip), %xmm1    # 0x69920
callq 0x4e91f
movq -0x68(%rbp), %rax
movq %rax, (%rsp)
xorps %xmm1, %xmm1
leaq 0x25c38(%rip), %rdi     # 0x75087
movl %r13d, %esi
movl %r13d, %edx
movl %r13d, %ecx
movsd 0x1a4c0(%rip), %xmm0    # 0x69920
movq -0x60(%rbp), %r8
movq -0x48(%rbp), %r9
callq 0x4e91f
movq -0x50(%rbp), %rdi
callq 0x87b0
movq -0x30(%rbp), %rdi
callq 0x87b0
movq -0x40(%rbp), %rdi
callq 0x87b0
movq -0x60(%rbp), %rdi
callq 0x87b0
testl %r13d, %r13d
movq -0x78(%rbp), %r10
movq -0x70(%rbp), %r13
jle 0x4f4ef
leaq (,%r12,8), %rax
xorl %ecx, %ecx
movq -0x68(%rbp), %rdx
movsd (%r13,%rcx,8), %xmm0
movslq (%r15,%rcx,4), %rsi
movsd %xmm0, (%r10,%rsi,8)
movq %rdx, %rdi
xorl %r8d, %r8d
movsd (%rdi), %xmm0
movslq (%r15,%r8,4), %r9
imulq %r14, %r9
addq %rsi, %r9
movsd %xmm0, (%rbx,%r9,8)
incq %r8
addq %rax, %rdi
cmpq %r8, %r12
jne 0x4f4c3
incq %rcx
addq $0x8, %rdx
cmpq %r12, %rcx
jne 0x4f4ac
movq %r15, %rdi
callq 0x87b0
movq -0x80(%rbp), %rdi
callq 0x87b0
movq %r13, %rdi
callq 0x87b0
movq -0x48(%rbp), %rdi
callq 0x87b0
movq -0x68(%rbp), %rdi
callq 0x87b0
movq -0x38(%rbp), %rdi
callq 0x87b0
movl -0x58(%rbp), %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq