// File: /workspace/github_cpp_makefile_star2_O3/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, %r12d
movq %r8, -0x60(%rbp)
movq %rcx, -0x90(%rbp)
movq %rdx, -0x38(%rbp)
movq %rsi, %rbx
movq %rdi, -0x78(%rbp)
movl 0x10(%rbp), %r13d
movl %r9d, %edi
movl $0x1, %esi
callq 0x4dd75
movq %rax, %r15
testl %r12d, %r12d
jle 0x4e831
leal 0x1(%r12), %eax
movl %r12d, %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 0x4e80d
jnp 0x4e825
movslq %edx, %rdi
movsd (%rbx,%rdi,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4e825
movslq %r14d, %rdi
incl %r14d
movl %esi, (%r15,%rdi,4)
incq %rsi
addl %eax, %edx
cmpq %rsi, %rcx
jne 0x4e7ff
jmp 0x4e834
xorl %r14d, %r14d
movl %r14d, %edi
movl $0x1, %esi
callq 0x4dc73
movq %rax, -0x80(%rbp)
movl %r14d, %edi
movl $0x1, %esi
callq 0x4dc73
movq %rax, -0x98(%rbp)
movl %r14d, %edi
movl %r14d, %esi
callq 0x4dc73
movq %rax, -0x50(%rbp)
movl %r14d, %edi
movl %r14d, %esi
callq 0x4dc73
movq %rax, -0x70(%rbp)
movl %r14d, %edi
movl %r13d, %esi
callq 0x4dc73
movl %r13d, %ecx
movl %r14d, %r13d
movl %r14d, %edx
movslq %r12d, %r14
testl %edx, %edx
movq %rax, -0x58(%rbp)
movl %edx, -0x2c(%rbp)
jle 0x4e941
movl %ecx, %ecx
movq %rcx, -0x40(%rbp)
leaq (,%r13,8), %rcx
leaq (,%r14,8), %rdx
xorl %esi, %esi
movq %rax, %rdi
movq -0x50(%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 %r12d, %eax
addl %r9d, %eax
cltq
movsd (%rbx,%rax,8), %xmm0
movsd %xmm0, (%r10)
incq %r11
addq %rcx, %r10
cmpq %r11, %r13
jne 0x4e8d9
cmpl $0x0, 0x10(%rbp)
jle 0x4e925
movq -0x38(%rbp), %rax
leaq (%rax,%r9,8), %r9
movq -0x40(%rbp), %r10
movq %rdi, %r11
movsd (%r9), %xmm0
movsd %xmm0, (%r11)
addq %rcx, %r11
addq %rdx, %r9
decq %r10
jne 0x4e910
incq %rsi
addq $0x8, %r8
addq $0x8, %rdi
cmpq %r13, %rsi
jne 0x4e8bc
movq %r13, -0x88(%rbp)
movl -0x2c(%rbp), %edx
jmp 0x4e94b
movslq %edx, %rax
movq %rax, -0x88(%rbp)
movl %edx, %r12d
movl %edx, %edi
movl 0x10(%rbp), %esi
callq 0x4dc73
movq %rax, -0x40(%rbp)
movl 0x10(%rbp), %edi
movl %edi, %esi
callq 0x4dc73
movq %rax, -0x38(%rbp)
movl %r12d, %edi
movl 0x10(%rbp), %esi
callq 0x4dc73
movq %rax, -0x48(%rbp)
movl %r12d, %edi
callq 0x4de09
movq %rax, -0x68(%rbp)
movslq 0x10(%rbp), %rdx
imulq %rdx, %rdx
shlq $0x3, %rdx
movq -0x38(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x84f0
movq -0x88(%rbp), %rdx
shlq $0x3, %rdx
movq -0x98(%rbp), %r12
movq %r12, %rdi
movq -0x80(%rbp), %rsi
callq 0x84f0
movq -0x40(%rbp), %rax
movq %rax, (%rsp)
leaq 0x2669c(%rip), %rdi     # 0x75067
movsd 0x1af4d(%rip), %xmm0    # 0x69920
xorpd %xmm1, %xmm1
movl -0x2c(%rbp), %ecx
movl %ecx, %esi
movl 0x10(%rbp), %edx
movq -0x50(%rbp), %r8
movq -0x58(%rbp), %r9
callq 0x4dfb0
movq -0x38(%rbp), %rax
movq %rax, (%rsp)
leaq 0x1e265(%rip), %rdi     # 0x6cc60
movl 0x10(%rbp), %edx
movl %edx, %esi
movl -0x2c(%rbp), %ecx
movsd 0x1af15(%rip), %xmm0    # 0x69920
movq -0x58(%rbp), %r8
movq -0x40(%rbp), %r9
movaps %xmm0, %xmm1
callq 0x4dfb0
movq -0x38(%rbp), %rdi
movl 0x10(%rbp), %esi
callq 0x4e1a3
movl %eax, -0x60(%rbp)
testl %eax, %eax
jne 0x4eaf4
movq -0x48(%rbp), %rax
movq %rax, (%rsp)
leaq 0x26626(%rip), %rdi     # 0x75067
movsd 0x1aed7(%rip), %xmm0    # 0x69920
xorps %xmm1, %xmm1
movl -0x2c(%rbp), %esi
movl 0x10(%rbp), %ecx
movl %ecx, %edx
movq -0x40(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x4dfb0
movq %r12, (%rsp)
leaq 0x265fb(%rip), %rdi     # 0x75067
movl -0x2c(%rbp), %esi
movl $0x1, %edx
movl 0x10(%rbp), %ecx
movsd 0x1aea1(%rip), %xmm0    # 0x69920
movq -0x48(%rbp), %r8
movq -0x90(%rbp), %r9
movaps %xmm0, %xmm1
callq 0x4dfb0
movq -0x68(%rbp), %rax
movq %rax, (%rsp)
leaq 0x29fd2(%rip), %rdi     # 0x78a73
movsd 0x1bf07(%rip), %xmm0    # 0x6a9b0
movl -0x2c(%rbp), %edx
movl %edx, %esi
movl 0x10(%rbp), %ecx
movq -0x48(%rbp), %r8
movq -0x58(%rbp), %r9
movsd 0x1ae5f(%rip), %xmm1    # 0x69920
callq 0x4dfb0
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
xorps %xmm1, %xmm1
leaq 0x2658f(%rip), %rdi     # 0x75067
movl -0x2c(%rbp), %ecx
movl %ecx, %esi
movl %ecx, %edx
movsd 0x1ae39(%rip), %xmm0    # 0x69920
movq -0x68(%rbp), %r8
movq -0x50(%rbp), %r9
callq 0x4dfb0
movq -0x40(%rbp), %rdi
callq 0x87a0
movq -0x38(%rbp), %rdi
callq 0x87a0
movq -0x48(%rbp), %rdi
callq 0x87a0
movq -0x68(%rbp), %rdi
callq 0x87a0
cmpl $0x0, -0x2c(%rbp)
movq -0x78(%rbp), %r10
jle 0x4eb72
leaq (,%r13,8), %rax
xorl %ecx, %ecx
movq -0x70(%rbp), %rdx
movsd (%r12,%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, %r13
jne 0x4eb46
incq %rcx
addq $0x8, %rdx
cmpq %r13, %rcx
jne 0x4eb30
movq %r15, %rdi
callq 0x87a0
movq -0x80(%rbp), %rdi
callq 0x87a0
movq %r12, %rdi
callq 0x87a0
movq -0x50(%rbp), %rdi
callq 0x87a0
movq -0x70(%rbp), %rdi
callq 0x87a0
movq -0x58(%rbp), %rdi
callq 0x87a0
movl -0x60(%rbp), %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq