// File: 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:
subq $0x238, %rsp            # imm = 0x238
movq %rdi, 0x230(%rsp)
movl %esi, 0x22c(%rsp)
movss %xmm0, 0x228(%rsp)
movq 0x1da9a(%rip), %rdi     # 0x33fc0
leaq 0x1236d(%rip), %rsi     # 0x2889a
callq 0x3290
movq %rax, %rdi
movl 0x22c(%rsp), %esi
callq 0x3470
movq %rax, %rdi
leaq 0x12348(%rip), %rsi     # 0x28893
callq 0x3290
movq %rax, %rdi
movq 0x1da6e(%rip), %rsi     # 0x33fc8
callq 0x32c0
movq 0x230(%rsp), %rdi
callq 0x1a690
movl %eax, 0x224(%rsp)
movq 0x230(%rsp), %rdi
callq 0x1a6a0
movl %eax, 0x220(%rsp)
movq 0x230(%rsp), %rdi
callq 0x1a6b0
movl %eax, 0x21c(%rsp)
movl 0x22c(%rsp), %ecx
movl %ecx, %edx
decl %edx
movl %ecx, %eax
shrl $0x1f, %edx
movl %edx, %ecx
leal -0x1(%rax,%rcx), %eax
sarl %eax
movl %eax, 0x218(%rsp)
movslq 0x22c(%rsp), %rax
movq %rax, 0xd8(%rsp)
leaq 0x1ff(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
callq 0x1a6c0
movq 0xd8(%rsp), %rsi
movq 0xe0(%rsp), %rdx
leaq 0x200(%rsp), %rdi
callq 0x1a6d0
jmp 0x165fe
leaq 0x1ff(%rsp), %rdi
callq 0x1a750
xorps %xmm0, %xmm0
movss %xmm0, 0x1e8(%rsp)
movl $0x0, 0x1e4(%rsp)
movl 0x1e4(%rsp), %eax
cmpl 0x22c(%rsp), %eax
je 0x16760
movl 0x1e4(%rsp), %eax
movl 0x218(%rsp), %ecx
subl %ecx, %eax
cvtsi2ss %eax, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x11a02(%rip), %xmm1    # 0x28058
callq 0x3490
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1e0(%rsp)
movaps 0x11a81(%rip), %xmm1    # 0x280f0
movss 0x1e0(%rsp), %xmm0
pxor %xmm1, %xmm0
movss 0x228(%rsp), %xmm2
movaps %xmm2, %xmm1
addss %xmm1, %xmm1
mulss %xmm2, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x34c0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1dc(%rsp)
movss 0x1dc(%rsp), %xmm0
movss %xmm0, 0xcc(%rsp)
movslq 0x1e4(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x194b0
movq %rax, 0xd0(%rsp)
jmp 0x166db
movq 0xd0(%rsp), %rax
movss 0xcc(%rsp), %xmm0
movss %xmm0, (%rax)
movss 0x1dc(%rsp), %xmm0
addss 0x1e8(%rsp), %xmm0
movss %xmm0, 0x1e8(%rsp)
movl 0x1e4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e4(%rsp)
jmp 0x16622
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x1ff(%rsp), %rdi
callq 0x1a750
jmp 0x1725d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
jmp 0x17250
movl $0x0, 0x1d8(%rsp)
movl 0x1d8(%rsp), %eax
cmpl 0x22c(%rsp), %eax
je 0x1680a
movslq 0x1d8(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x194b0
movq %rax, 0xc0(%rsp)
jmp 0x1679e
movq 0xc0(%rsp), %rax
movss (%rax), %xmm0
movss 0x1e8(%rsp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0xb4(%rsp)
movslq 0x1d8(%rsp), %rsi
leaq 0x200(%rsp), %rdi
callq 0x194b0
movq %rax, 0xb8(%rsp)
jmp 0x167df
movq 0xb8(%rsp), %rax
movss 0xb4(%rsp), %xmm0
movss %xmm0, (%rax)
movl 0x1d8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d8(%rsp)
jmp 0x1676b
movslq 0x224(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x1bf(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x1a6c0
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
leaq 0x1c0(%rsp), %rdi
callq 0x1a6d0
jmp 0x1684e
leaq 0x1bf(%rsp), %rdi
callq 0x1a750
movl $0x0, 0x1b8(%rsp)
movl 0x1b8(%rsp), %eax
cmpl 0x21c(%rsp), %eax
je 0x16b5e
movl $0x0, 0x1b4(%rsp)
movl 0x1b4(%rsp), %eax
cmpl 0x220(%rsp), %eax
je 0x16b46
movl $0x0, 0x1b0(%rsp)
movl 0x1b0(%rsp), %eax
cmpl 0x224(%rsp), %eax
je 0x16971
movq 0x230(%rsp), %rdi
movslq 0x1b0(%rsp), %rsi
movslq 0x1b4(%rsp), %rdx
movslq 0x1b8(%rsp), %rcx
callq 0x15be0
movss %xmm0, 0x9c(%rsp)
jmp 0x168e8
movslq 0x1b0(%rsp), %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x194b0
movq %rax, 0x90(%rsp)
jmp 0x16907
movq 0x90(%rsp), %rax
movss 0x9c(%rsp), %xmm0
movss %xmm0, (%rax)
movl 0x1b0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b0(%rsp)
jmp 0x168a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x1bf(%rsp), %rdi
callq 0x1a750
jmp 0x17250
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
jmp 0x17243
movl $0x0, 0x1ac(%rsp)
movl 0x1ac(%rsp), %eax
cmpl 0x224(%rsp), %eax
je 0x16b2e
movl 0x1ac(%rsp), %eax
subl 0x218(%rsp), %eax
movl %eax, 0x1a4(%rsp)
movl $0x0, 0x1a0(%rsp)
leaq 0x1a4(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x127b0
movl (%rax), %eax
movl %eax, 0x1a8(%rsp)
movl 0x1ac(%rsp), %eax
addl 0x218(%rsp), %eax
movl %eax, 0x198(%rsp)
movl 0x224(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x194(%rsp)
leaq 0x198(%rsp), %rdi
leaq 0x194(%rsp), %rsi
callq 0x127f0
movl (%rax), %eax
movl %eax, 0x19c(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x190(%rsp)
movl 0x1a8(%rsp), %eax
movl %eax, 0x18c(%rsp)
movl 0x18c(%rsp), %eax
cmpl 0x19c(%rsp), %eax
jg 0x16ae6
movslq 0x18c(%rsp), %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x194b0
movq %rax, 0x88(%rsp)
jmp 0x16a5f
movq 0x88(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x7c(%rsp)
movl 0x18c(%rsp), %eax
movl 0x1ac(%rsp), %ecx
subl %ecx, %eax
movl 0x218(%rsp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
leaq 0x200(%rsp), %rdi
callq 0x194b0
movq %rax, 0x80(%rsp)
jmp 0x16aa4
movss 0x7c(%rsp), %xmm0
movq 0x80(%rsp), %rax
movss (%rax), %xmm2
movss 0x190(%rsp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x190(%rsp)
movl 0x18c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18c(%rsp)
jmp 0x16a2c
movq 0x230(%rsp), %rdi
movslq 0x1ac(%rsp), %rsi
movslq 0x1b4(%rsp), %rdx
movslq 0x1b8(%rsp), %rcx
movss 0x190(%rsp), %xmm0
callq 0x15f80
jmp 0x16b16
jmp 0x16b18
movl 0x1ac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ac(%rsp)
jmp 0x1697c
jmp 0x16b30
movl 0x1b4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b4(%rsp)
jmp 0x16885
jmp 0x16b48
movl 0x1b8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1b8(%rsp)
jmp 0x16866
movslq 0x220(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x16f(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x1a6c0
movq 0x68(%rsp), %rsi
movq 0x70(%rsp), %rdx
leaq 0x170(%rsp), %rdi
callq 0x1a6d0
jmp 0x16b96
leaq 0x16f(%rsp), %rdi
callq 0x1a750
movl $0x0, 0x168(%rsp)
movl 0x168(%rsp), %eax
cmpl 0x21c(%rsp), %eax
je 0x16e90
movl $0x0, 0x164(%rsp)
movl 0x164(%rsp), %eax
cmpl 0x224(%rsp), %eax
je 0x16e78
movl $0x0, 0x160(%rsp)
movl 0x160(%rsp), %eax
cmpl 0x220(%rsp), %eax
je 0x16caa
movq 0x230(%rsp), %rdi
movslq 0x164(%rsp), %rsi
movslq 0x160(%rsp), %rdx
movslq 0x168(%rsp), %rcx
callq 0x15be0
movss %xmm0, 0x64(%rsp)
jmp 0x16c2d
movslq 0x160(%rsp), %rsi
leaq 0x170(%rsp), %rdi
callq 0x194b0
movq %rax, 0x58(%rsp)
jmp 0x16c49
movq 0x58(%rsp), %rax
movss 0x64(%rsp), %xmm0
movss %xmm0, (%rax)
movl 0x160(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x160(%rsp)
jmp 0x16bec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x16f(%rsp), %rdi
callq 0x1a750
jmp 0x17243
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
jmp 0x17236
movl $0x2, 0x15c(%rsp)
movl 0x15c(%rsp), %eax
movl 0x220(%rsp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
je 0x16e60
movl 0x15c(%rsp), %eax
subl 0x218(%rsp), %eax
movl %eax, 0x154(%rsp)
movl $0x0, 0x150(%rsp)
leaq 0x154(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x127b0
movl (%rax), %eax
movl %eax, 0x158(%rsp)
movl 0x15c(%rsp), %eax
addl 0x218(%rsp), %eax
movl %eax, 0x148(%rsp)
movl 0x220(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x144(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x144(%rsp), %rsi
callq 0x127f0
movl (%rax), %eax
movl %eax, 0x14c(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x140(%rsp)
movl 0x158(%rsp), %eax
movl %eax, 0x13c(%rsp)
movl 0x13c(%rsp), %eax
cmpl 0x14c(%rsp), %eax
jg 0x16e18
movslq 0x13c(%rsp), %rsi
leaq 0x170(%rsp), %rdi
callq 0x194b0
movq %rax, 0x50(%rsp)
jmp 0x16d9a
movq 0x50(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x44(%rsp)
movl 0x13c(%rsp), %eax
movl 0x15c(%rsp), %ecx
subl %ecx, %eax
movl 0x218(%rsp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
leaq 0x200(%rsp), %rdi
callq 0x194b0
movq %rax, 0x48(%rsp)
jmp 0x16dd9
movss 0x44(%rsp), %xmm0
movq 0x48(%rsp), %rax
movss (%rax), %xmm2
movss 0x140(%rsp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x140(%rsp)
movl 0x13c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x13c(%rsp)
jmp 0x16d6a
movq 0x230(%rsp), %rdi
movslq 0x164(%rsp), %rsi
movslq 0x15c(%rsp), %rdx
movslq 0x168(%rsp), %rcx
movss 0x140(%rsp), %xmm0
callq 0x15f80
jmp 0x16e48
jmp 0x16e4a
movl 0x15c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x15c(%rsp)
jmp 0x16cb5
jmp 0x16e62
movl 0x164(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x164(%rsp)
jmp 0x16bcd
jmp 0x16e7a
movl 0x168(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x168(%rsp)
jmp 0x16bae
movslq 0x21c(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x11f(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x1a6c0
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
leaq 0x120(%rsp), %rdi
callq 0x1a6d0
jmp 0x16ec8
leaq 0x11f(%rsp), %rdi
callq 0x1a750
movl $0x0, 0x118(%rsp)
movl 0x118(%rsp), %eax
cmpl 0x224(%rsp), %eax
je 0x171cf
movl $0x0, 0x114(%rsp)
movl 0x114(%rsp), %eax
cmpl 0x220(%rsp), %eax
je 0x171b7
movl $0x0, 0x110(%rsp)
movl 0x110(%rsp), %eax
cmpl 0x21c(%rsp), %eax
je 0x16fe9
movq 0x230(%rsp), %rdi
movslq 0x118(%rsp), %rsi
movslq 0x114(%rsp), %rdx
movslq 0x110(%rsp), %rcx
callq 0x15be0
movss %xmm0, 0x2c(%rsp)
jmp 0x16f5f
movslq 0x110(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x194b0
movq %rax, 0x20(%rsp)
jmp 0x16f7b
movq 0x20(%rsp), %rax
movss 0x2c(%rsp), %xmm0
movss %xmm0, (%rax)
movl 0x110(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x110(%rsp)
jmp 0x16f1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x11f(%rsp), %rdi
callq 0x1a750
jmp 0x17236
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x1a760
jmp 0x17236
movl $0x2, 0x10c(%rsp)
movl 0x10c(%rsp), %eax
movl 0x21c(%rsp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
je 0x1719f
movl 0x10c(%rsp), %eax
subl 0x218(%rsp), %eax
movl %eax, 0x104(%rsp)
movl $0x0, 0x100(%rsp)
leaq 0x104(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x127b0
movl (%rax), %eax
movl %eax, 0x108(%rsp)
movl 0x10c(%rsp), %eax
addl 0x218(%rsp), %eax
movl %eax, 0xf8(%rsp)
movl 0x21c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0xf4(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xf4(%rsp), %rsi
callq 0x127f0
movl (%rax), %eax
movl %eax, 0xfc(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0xf0(%rsp)
movl 0x108(%rsp), %eax
movl %eax, 0xec(%rsp)
movl 0xec(%rsp), %eax
cmpl 0xfc(%rsp), %eax
jg 0x17157
movslq 0xec(%rsp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x194b0
movq %rax, 0x18(%rsp)
jmp 0x170d9
movq 0x18(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0xc(%rsp)
movl 0xec(%rsp), %eax
movl 0x10c(%rsp), %ecx
subl %ecx, %eax
movl 0x218(%rsp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
leaq 0x200(%rsp), %rdi
callq 0x194b0
movq %rax, 0x10(%rsp)
jmp 0x17118
movss 0xc(%rsp), %xmm0
movq 0x10(%rsp), %rax
movss (%rax), %xmm2
movss 0xf0(%rsp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0xf0(%rsp)
movl 0xec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xec(%rsp)
jmp 0x170a9
movq 0x230(%rsp), %rdi
movslq 0x118(%rsp), %rsi
movslq 0x114(%rsp), %rdx
movslq 0x10c(%rsp), %rcx
movss 0xf0(%rsp), %xmm0
callq 0x15f80
jmp 0x17187
jmp 0x17189
movl 0x10c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10c(%rsp)
jmp 0x16ff4
jmp 0x171a1
movl 0x114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x114(%rsp)
jmp 0x16eff
jmp 0x171b9
movl 0x118(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x118(%rsp)
jmp 0x16ee0
movq 0x1cdea(%rip), %rdi     # 0x33fc0
leaq 0x1166d(%rip), %rsi     # 0x2884a
callq 0x3290
movq %rax, (%rsp)
jmp 0x171e8
movq (%rsp), %rdi
movq 0x1cdad(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0x171fa
leaq 0x120(%rsp), %rdi
callq 0x1a760
leaq 0x170(%rsp), %rdi
callq 0x1a760
leaq 0x1c0(%rsp), %rdi
callq 0x1a760
leaq 0x200(%rsp), %rdi
callq 0x1a760
addq $0x238, %rsp            # imm = 0x238
retq
leaq 0x170(%rsp), %rdi
callq 0x1a760
leaq 0x1c0(%rsp), %rdi
callq 0x1a760
leaq 0x200(%rsp), %rdi
callq 0x1a760
movq 0x1f0(%rsp), %rdi
callq 0x34a0
nopw (%rax,%rax)