// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::filter_(double const*, double const*, double const*, double const*, double const*, int, int, double*, double*)
static int filter_(const double *x, const double *P, const double *H,
                   const double *v, const double *R, int n, int m,
                   double *xp, double *Pp)
{
    double *F=mat(n,m),*Q=mat(m,m),*K=mat(n,m),*I=eye(n);
    int info;
    
    matcpy(Q,R,m,m);
    matcpy(xp,x,n,1);
    matmul("NN",n,m,n,1.0,P,H,0.0,F);       /* Q=H'*P*H+R */
    matmul("TN",m,m,n,1.0,H,F,1.0,Q);
    if (!(info=matinv(Q,m))) {
        matmul("NN",n,m,m,1.0,F,Q,0.0,K);   /* K=P*H*Q^-1 */
        matmul("NN",n,1,m,1.0,K,v,1.0,xp);  /* xp=x+K*v */
        matmul("NT",n,n,m,-1.0,K,H,1.0,I);  /* Pp=(I-K*H')*P */
        matmul("NN",n,n,n,1.0,I,P,0.0,Pp);
    }
    free(F); free(Q); free(K); free(I);
    return info;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movl -0x2c(%rbp), %edi
movl 0x10(%rbp), %esi
callq 0x8c500
movq %rax, -0x38(%rbp)
movl 0x10(%rbp), %edi
movl 0x10(%rbp), %esi
callq 0x8c500
movq %rax, -0x40(%rbp)
movl -0x2c(%rbp), %edi
movl 0x10(%rbp), %esi
callq 0x8c500
movq %rax, -0x48(%rbp)
movl -0x2c(%rbp), %edi
callq 0x8c750
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl 0x10(%rbp), %edx
movl 0x10(%rbp), %ecx
callq 0x8c9e0
movq 0x18(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl $0x1, %ecx
callq 0x8c9e0
movl -0x2c(%rbp), %esi
movl 0x10(%rbp), %edx
movl -0x2c(%rbp), %ecx
movq -0x10(%rbp), %r8
movq -0x18(%rbp), %r9
movq -0x38(%rbp), %rax
leaq 0x39f24(%rip), %rdi     # 0xc798c
movsd 0x2e3f0(%rip), %xmm0    # 0xbbe60
xorps %xmm1, %xmm1
movq %rax, (%rsp)
callq 0x8ca20
movl 0x10(%rbp), %esi
movl 0x10(%rbp), %edx
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %r8
movq -0x38(%rbp), %r9
movq -0x40(%rbp), %rax
leaq 0x31350(%rip), %rdi     # 0xbede8
movsd 0x2e3c0(%rip), %xmm1    # 0xbbe60
movaps %xmm1, %xmm0
movq %rax, (%rsp)
callq 0x8ca20
movq -0x40(%rbp), %rdi
movl 0x10(%rbp), %esi
callq 0x8cd10
movl %eax, -0x54(%rbp)
cmpl $0x0, %eax
jne 0x8db8b
movl -0x2c(%rbp), %esi
movl 0x10(%rbp), %edx
movl 0x10(%rbp), %ecx
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %r9
movq -0x48(%rbp), %rax
leaq 0x39eac(%rip), %rdi     # 0xc798c
movsd 0x2e378(%rip), %xmm0    # 0xbbe60
xorps %xmm1, %xmm1
movq %rax, (%rsp)
callq 0x8ca20
movl -0x2c(%rbp), %esi
movl 0x10(%rbp), %ecx
movq -0x48(%rbp), %r8
movq -0x20(%rbp), %r9
movq 0x18(%rbp), %rax
leaq 0x39e7f(%rip), %rdi     # 0xc798c
movl $0x1, %edx
movsd 0x2e346(%rip), %xmm1    # 0xbbe60
movaps %xmm1, %xmm0
movq %rax, (%rsp)
callq 0x8ca20
movl -0x2c(%rbp), %esi
movl -0x2c(%rbp), %edx
movl 0x10(%rbp), %ecx
movq -0x48(%rbp), %r8
movq -0x18(%rbp), %r9
movq -0x50(%rbp), %rax
leaq 0x3dca9(%rip), %rdi     # 0xcb7eb
movsd 0x3128e(%rip), %xmm0    # 0xbedd8
movsd 0x2e30e(%rip), %xmm1    # 0xbbe60
movq %rax, (%rsp)
callq 0x8ca20
movl -0x2c(%rbp), %esi
movl -0x2c(%rbp), %edx
movl -0x2c(%rbp), %ecx
movq -0x50(%rbp), %r8
movq -0x10(%rbp), %r9
movq 0x20(%rbp), %rax
leaq 0x39e15(%rip), %rdi     # 0xc798c
movsd 0x2e2e1(%rip), %xmm0    # 0xbbe60
xorps %xmm1, %xmm1
movq %rax, (%rsp)
callq 0x8ca20
movq -0x38(%rbp), %rdi
callq 0x9900
movq -0x40(%rbp), %rdi
callq 0x9900
movq -0x48(%rbp), %rdi
callq 0x9900
movq -0x50(%rbp), %rdi
callq 0x9900
movl -0x54(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)