// File: /workspace/github_cpp_makefile_star2_O2/spatialfruitsalad[P]volume2position/./gauss_filter.hpp
// Function: void gaussFilter::gauss_filter_mask_5<float>(tomogram3d<float>&, int, float)
static void gauss_filter_mask_5 (tomogram3d<VALUE>& matrix_in, int masksize, float sigma){

    std::cout << "gauss_filter_neu: masksize " << masksize << "  ... " << std::flush;

    int sx = matrix_in.get_sx();
    int sy = matrix_in.get_sy();
    int sz = matrix_in.get_sz();

    int tol = (masksize-1)/2;

    std::vector <float> mask1D (masksize);
    float sum = 0;
    
    for (int i = 0; i != masksize; ++i){
        float distance_square = pow(float(i-tol),2);
        float val = exp(-1*distance_square/(2*sigma*sigma));
        mask1D.at(i) = val;
        sum += val;
    }

    for (int i = 0; i != masksize; ++i){
        mask1D.at(i) = mask1D.at(i)/sum;
    }

    std::vector<VALUE> row_x (sx);
    for (int k = 0; k != sz; ++k)
    for (int j = 0; j != sy; ++j){
        for (int i = 0; i != sx; ++i){
            row_x.at(i) = matrix_in.get(i,j,k);
        }
        for (int i = 0; i != sx; ++i){
            int imin = std::max (i-tol, 0);
            int imax = std::min (i+tol, int (sx-1));
            float new_val = 0;
            for (int ii = imin; ii <= imax; ++ii){
                new_val += row_x.at(ii)*mask1D.at(ii-i+tol);
            }
            matrix_in.set(i,j,k,new_val);
        }
    }

    std::vector<VALUE> row_y (sy);
    for (int k = 0; k != sz; ++k)
    for (int i = 0; i != sx; ++i){
        for (int j = 0; j != sy; ++j){
            row_y.at(j) = matrix_in.get(i,j,k);
        }
        for (int j = 2; j != sy - 2; ++j){
            int jmin = std::max (j-tol, 0);
            int jmax = std::min (j+tol, int (sy-1));
            float new_val = 0;
            for (int jj = jmin; jj <= jmax; ++jj){
                new_val += row_y.at(jj)*mask1D.at(jj-j+tol);
            }
            matrix_in.set(i,j,k,new_val);
        }
    }

    std::vector<VALUE> row_z (sz);
    for (int i = 0; i != sx; ++i)
    for (int j = 0; j != sy; ++j){
        for (int k = 0; k != sz; ++k){
            row_z.at(k) = matrix_in.get(i,j,k);
        }
        for (int k = 2; k != sz - 2; ++k){
            int kmin = std::max (k-tol, 0);
            int kmax = std::min (k+tol, int (sz-1));
            float new_val = 0;
            for (int kk = kmin; kk <= kmax; ++kk){
                new_val += row_z.at(kk)*mask1D.at(kk-k+tol);
            }
            matrix_in.set(i,j,k,new_val);
        }
    }
    std::cout << " done" << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movss %xmm0, 0xc(%rsp)
movl %esi, %ebx
movq %rdi, %r14
movq 0xc433(%rip), %rdi      # 0x17fc8
leaq 0x5d36(%rip), %rsi      # 0x118d2
callq 0x3260
movq %rax, %rdi
movl %ebx, %esi
callq 0x3410
leaq 0x5d19(%rip), %rsi      # 0x118cb
movq %rax, %rdi
callq 0x3260
movq %rax, %rdi
callq 0x31b0
movq 0x18(%r14), %rcx
movq 0x20(%r14), %rax
movq %rax, 0x50(%rsp)
movq %rcx, 0x30(%rsp)
movl %ecx, %eax
movq %rax, 0x60(%rsp)
movq %r14, 0x48(%rsp)
movq 0x28(%r14), %r13
leal -0x1(%rbx), %eax
pushq $0x2
popq %rcx
cltd
movl %ecx, 0x38(%rsp)
idivl %ecx
movl %eax, %r12d
movslq %ebx, %rbx
leaq 0x80(%rsp), %r14
leaq 0xd0(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd66e
movss 0xc(%rsp), %xmm1
movaps %xmm1, %xmm0
addss %xmm1, %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x10(%rsp)
movl %ebx, %r15d
movq %r12, 0x58(%rsp)
negl %r12d
movq %r12, 0x40(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0xbca1
movq 0x40(%rsp), %rax
addl %ebx, %eax
cvtsi2ss %eax, %xmm0
movaps %xmm0, %xmm1
xorps 0x5492(%rip), %xmm1     # 0x110f0
mulss %xmm0, %xmm1
divss 0x10(%rsp), %xmm1
cvtss2sd %xmm1, %xmm0
callq 0x3430
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd3e6
cvtsd2ss 0x20(%rsp), %xmm0
movss %xmm0, (%rax)
movss 0xc(%rsp), %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0xc(%rsp)
incq %rbx
jmp 0xbc44
xorl %ebx, %ebx
leaq 0x80(%rsp), %r14
cmpq %rbx, %r15
je 0xbce5
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd3e6
movss (%rax), %xmm0
movss %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd3e6
movss 0x20(%rsp), %xmm0
divss 0xc(%rsp), %xmm0
movss %xmm0, (%rax)
incq %rbx
jmp 0xbcab
movslq 0x60(%rsp), %rsi
leaq 0xd0(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0xd66e
movq 0x30(%rsp), %rax
decl %eax
movq %rax, 0x30(%rsp)
movl 0x50(%rsp), %r14d
movq %r13, 0x98(%rsp)
movl %r13d, %eax
movq %rax, 0x68(%rsp)
movl 0x58(%rsp), %eax
movq %rax, 0x70(%rsp)
xorl %r15d, %r15d
leaq 0xd0(%rsp), %r12
leaq 0x80(%rsp), %r13
movq %r14, 0x78(%rsp)
cmpq 0x68(%rsp), %r15
je 0xbe7d
xorl %eax, %eax
movq %r15, 0x28(%rsp)
movq %rax, 0x18(%rsp)
cmpq %r14, %rax
je 0xbe75
xorl %ebx, %ebx
movq 0x18(%rsp), %r14
cmpq %rbx, 0x60(%rsp)
je 0xbda2
movq 0x48(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0xb5c2
movss %xmm0, 0xc(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xd3e6
movss 0xc(%rsp), %xmm0
movss %xmm0, (%rax)
incq %rbx
jmp 0xbd68
movq 0x70(%rsp), %r15
xorl %r14d, %r14d
movq 0x40(%rsp), %rax
movl %eax, 0x10(%rsp)
cmpq 0x60(%rsp), %r14
je 0xbe5e
movl 0x10(%rsp), %eax
testl %eax, %eax
movl $0x0, %ebx
cmovgl %eax, %ebx
movq 0x58(%rsp), %rax
addl %r14d, %eax
movq 0x30(%rsp), %rcx
cmpl %eax, %ecx
cmovll %ecx, %eax
movslq %eax, %rbp
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
cmpq %rbp, %rbx
jg 0xbe32
movq %r12, %rdi
movq %rbx, %rsi
callq 0xd3e6
movss (%rax), %xmm0
movss %xmm0, 0x20(%rsp)
leal (%r15,%rbx), %eax
movslq %eax, %rsi
movq %r13, %rdi
callq 0xd3e6
movss 0x20(%rsp), %xmm1
mulss (%rax), %xmm1
movss 0xc(%rsp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
incq %rbx
jmp 0xbdea
movq 0x48(%rsp), %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rdx
movq 0x28(%rsp), %rcx
movss 0xc(%rsp), %xmm0
callq 0xb806
incq %r14
incl 0x10(%rsp)
decq %r15
jmp 0xbdb3
movq 0x18(%rsp), %rax
incq %rax
movq 0x78(%rsp), %r14
movq 0x28(%rsp), %r15
jmp 0xbd53
incq %r15
jmp 0xbd41
movq 0x50(%rsp), %rbx
movslq %ebx, %rsi
leaq 0xb8(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0xd66e
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movl %ebx, %ecx
addl %eax, %ecx
movq %rcx, 0x30(%rsp)
leal -0x1(%rbx), %eax
movl %eax, 0x40(%rsp)
movq 0x58(%rsp), %rax
subl %eax, 0x38(%rsp)
cltq
movq %rax, 0x50(%rsp)
addq $-0x2, %rax
movq %rax, 0x70(%rsp)
xorl %r15d, %r15d
leaq 0xb8(%rsp), %r12
leaq 0x80(%rsp), %r13
cmpq 0x68(%rsp), %r15
je 0xc013
xorl %eax, %eax
movq %r15, 0x28(%rsp)
movq %rax, 0x10(%rsp)
cmpq 0x60(%rsp), %rax
je 0xc00b
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0xbf39
movq 0x48(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0xb5c2
movss %xmm0, 0xc(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xd3e6
movss 0xc(%rsp), %xmm0
movss %xmm0, (%rax)
incq %rbx
jmp 0xbeff
movq 0x70(%rsp), %r15
pushq $0x2
popq %r14
movl 0x38(%rsp), %eax
movl %eax, 0x18(%rsp)
cmpq 0x30(%rsp), %r14
je 0xbff4
movl 0x18(%rsp), %eax
testl %eax, %eax
movl $0x0, %ebx
cmovgl %eax, %ebx
movq 0x58(%rsp), %rax
addl %r14d, %eax
movl 0x40(%rsp), %ecx
cmpl %eax, %ecx
cmovll %ecx, %eax
movslq %eax, %rbp
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
cmpq %rbp, %rbx
jg 0xbfc8
movq %r12, %rdi
movq %rbx, %rsi
callq 0xd3e6
movss (%rax), %xmm0
movss %xmm0, 0x20(%rsp)
leal (%r15,%rbx), %eax
movslq %eax, %rsi
movq %r13, %rdi
callq 0xd3e6
movss 0x20(%rsp), %xmm1
mulss (%rax), %xmm1
movss 0xc(%rsp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
incq %rbx
jmp 0xbf80
movq 0x48(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
movq 0x28(%rsp), %rcx
movss 0xc(%rsp), %xmm0
callq 0xb806
incq %r14
incl 0x18(%rsp)
decq %r15
jmp 0xbf4a
movq 0x10(%rsp), %rax
incq %rax
movq 0x78(%rsp), %r14
movq 0x28(%rsp), %r15
jmp 0xbeed
incq %r15
jmp 0xbedb
movq 0x98(%rsp), %rbx
movslq %ebx, %rsi
leaq 0xa0(%rsp), %rdi
leaq 0x3f(%rsp), %rdx
callq 0xd66e
movl %ebx, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
addl %eax, %ecx
movq %rcx, 0x30(%rsp)
leal -0x1(%rbx), %eax
movl %eax, 0x40(%rsp)
addq $-0x2, 0x50(%rsp)
xorl %r15d, %r15d
leaq 0xa0(%rsp), %r12
leaq 0x80(%rsp), %r13
cmpq 0x60(%rsp), %r15
je 0xc199
xorl %eax, %eax
movq %r15, 0x28(%rsp)
movq %rax, 0x10(%rsp)
cmpq %r14, %rax
je 0xc191
xorl %ebx, %ebx
movq 0x68(%rsp), %r14
cmpq %rbx, %r14
je 0xc0bf
movq 0x48(%rsp), %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq 0xb5c2
movss %xmm0, 0xc(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
callq 0xd3e6
movss 0xc(%rsp), %xmm0
movss %xmm0, (%rax)
incq %rbx
jmp 0xc085
movq 0x50(%rsp), %r15
pushq $0x2
popq %r14
movl 0x38(%rsp), %eax
movl %eax, 0x18(%rsp)
cmpq 0x30(%rsp), %r14
je 0xc17a
movl 0x18(%rsp), %eax
testl %eax, %eax
movl $0x0, %ebx
cmovgl %eax, %ebx
movq 0x58(%rsp), %rax
addl %r14d, %eax
movl 0x40(%rsp), %ecx
cmpl %eax, %ecx
cmovll %ecx, %eax
movslq %eax, %rbp
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
cmpq %rbp, %rbx
jg 0xc14e
movq %r12, %rdi
movq %rbx, %rsi
callq 0xd3e6
movss (%rax), %xmm0
movss %xmm0, 0x20(%rsp)
leal (%r15,%rbx), %eax
movslq %eax, %rsi
movq %r13, %rdi
callq 0xd3e6
movss 0x20(%rsp), %xmm1
mulss (%rax), %xmm1
movss 0xc(%rsp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0xc(%rsp)
incq %rbx
jmp 0xc106
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rcx
movss 0xc(%rsp), %xmm0
callq 0xb806
incq %r14
incl 0x18(%rsp)
decq %r15
jmp 0xc0d0
movq 0x10(%rsp), %rax
incq %rax
movq 0x78(%rsp), %r14
movq 0x28(%rsp), %r15
jmp 0xc070
incq %r15
jmp 0xc05e
movq 0xbe28(%rip), %rdi      # 0x17fc8
leaq 0x56db(%rip), %rsi      # 0x11882
callq 0x3260
movq %rax, %rdi
callq 0x3110
leaq 0xa0(%rsp), %rdi
callq 0xd6ec
leaq 0xb8(%rsp), %rdi
callq 0xd6ec
leaq 0xd0(%rsp), %rdi
callq 0xd6ec
leaq 0x80(%rsp), %rdi
callq 0xd6ec
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc215
jmp 0xc227
jmp 0xc239
jmp 0xc204
jmp 0xc204
movq %rax, %rbx
jmp 0xc249
jmp 0xc215
jmp 0xc215
jmp 0xc227
jmp 0xc227
jmp 0xc239
jmp 0xc239
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0xd6ec
jmp 0xc22a
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0xd6ec
jmp 0xc23c
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xd6ec
leaq 0x80(%rsp), %rdi
callq 0xd6ec
movq %rbx, %rdi
callq 0x3420