// File: spatialfruitsalad[P]volume2position/./tomogram.hpp
// Function: tomogram3d<int>::cleanBorder(double)
void cleanBorder(double outside = 0.005)
    {
        unsigned nx = get_sx();
        unsigned ny = get_sy();
        unsigned nz = get_sz();
        
        std::set<VALUE> markList; // all particle labels contained in here will be set to 0
        double zExcludeFraction = 0.05;
        unsigned zTop = zExcludeFraction * nz;
        unsigned zBot = nz - zTop;
    
        for (unsigned long k = 0; k != nz; ++k)
        for (unsigned long j = 0; j != ny; ++j)
        for (unsigned long i = 0; i != nx; ++i)
        {
            // exclude all particles that touch the boundary
            
            auto v = get(i,j,k);
            
            if( v != 0)
            {
                // TOP && bottom
                if(k < zTop || k > zBot)
                {
                    markList.insert(v);
                }
                double r = sqrt( (i-nx/2)*(i-nx/2) + (j- ny/2)*(j-ny/2));
                // radial
                if (r > 0.5*nx*(1.0 - outside))
                {
                    markList.insert(v);
                }
            }
        }
        std::cout << "CleanUp: removing " << markList.size() << " clusters" << std::endl;
// remove all clusters that touch the boundary
        for (unsigned int k = 0; k != nz; ++k)
        for (unsigned int j = 0; j != ny; ++j)
        for (unsigned int i = 0; i != nx; ++i)
        {
            auto v = get(i,j,k);
            if( markList.count(v) == 1)
            {
                set(i,j,k,0);
            }
        }
    }

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x120(%rsp)
movsd %xmm0, 0x118(%rsp)
movq 0x120(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x23dd0
movq 0x58(%rsp), %rdi
movl %eax, 0x114(%rsp)
callq 0x23de0
movq 0x58(%rsp), %rdi
movl %eax, 0x110(%rsp)
callq 0x23df0
movl %eax, 0x10c(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x23e00
movabsq $0x3fa999999999999a, %rax # imm = 0x3FA999999999999A
movq %rax, 0xd0(%rsp)
movsd 0xd0(%rsp), %xmm0
movl 0x10c(%rsp), %eax
cvtsi2sd %rax, %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, 0xcc(%rsp)
movl 0x10c(%rsp), %eax
subl 0xcc(%rsp), %eax
movl %eax, 0xc8(%rsp)
movq $0x0, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movl 0x10c(%rsp), %ecx
cmpq %rcx, %rax
je 0xe46a
movq $0x0, 0xb8(%rsp)
movq 0xb8(%rsp), %rax
movl 0x110(%rsp), %ecx
cmpq %rcx, %rax
je 0xe44f
movq $0x0, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
movl 0x114(%rsp), %ecx
cmpq %rcx, %rax
je 0xe434
movq 0x58(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq 0xc0(%rsp), %rcx
callq 0xefc0
movl %eax, 0x54(%rsp)
jmp 0xe2a0
movl 0x54(%rsp), %eax
movl %eax, 0xac(%rsp)
cmpl $0x0, 0xac(%rsp)
je 0xe419
movq 0xc0(%rsp), %rax
movl 0xcc(%rsp), %ecx
cmpq %rcx, %rax
jb 0xe2e1
movq 0xc0(%rsp), %rax
movl 0xc8(%rsp), %ecx
cmpq %rcx, %rax
jbe 0xe341
leaq 0xd8(%rsp), %rdi
leaq 0xac(%rsp), %rsi
callq 0x23e10
movb %dl, 0x47(%rsp)
movq %rax, 0x48(%rsp)
jmp 0xe301
movb 0x47(%rsp), %al
movq 0x48(%rsp), %rcx
movq %rcx, 0x88(%rsp)
movb %al, 0x90(%rsp)
jmp 0xe341
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xa0(%rsp)
movl %eax, 0x9c(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x23ee0
jmp 0xe5d7
movq 0xb0(%rsp), %rax
movl 0x114(%rsp), %ecx
shrl %ecx
subq %rcx, %rax
imulq %rax, %rax
movq 0xb8(%rsp), %rcx
movl 0x110(%rsp), %edx
shrl %edx
subq %rdx, %rcx
imulq %rcx, %rcx
addq %rcx, %rax
movq %rax, %xmm0
movaps 0x19d40(%rip), %xmm1    # 0x280c0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x19d44(%rip), %xmm1    # 0x280d0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
callq 0x3250
movsd %xmm0, 0x80(%rsp)
movsd 0x80(%rsp), %xmm0
movl 0x114(%rsp), %eax
cvtsi2sd %rax, %xmm2
movsd 0x19c82(%rip), %xmm1    # 0x28048
mulsd %xmm2, %xmm1
movsd 0x19c6e(%rip), %xmm2    # 0x28040
subsd 0x118(%rsp), %xmm2
mulsd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xe417
leaq 0xd8(%rsp), %rdi
leaq 0xac(%rsp), %rsi
callq 0x23e10
movb %dl, 0x37(%rsp)
movq %rax, 0x38(%rsp)
jmp 0xe405
movb 0x37(%rsp), %al
movq 0x38(%rsp), %rcx
movq %rcx, 0x70(%rsp)
movb %al, 0x78(%rsp)
jmp 0xe419
jmp 0xe41b
movq 0xb0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb0(%rsp)
jmp 0xe260
jmp 0xe436
movq 0xb8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xb8(%rsp)
jmp 0xe23c
jmp 0xe451
movq 0xc0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xc0(%rsp)
jmp 0xe218
movq 0x25b4f(%rip), %rdi     # 0x33fc0
leaq 0x1a88c(%rip), %rsi     # 0x28d04
callq 0x3290
movq %rax, 0x28(%rsp)
jmp 0xe484
leaq 0xd8(%rsp), %rdi
callq 0x23e70
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x3090
movq %rax, 0x20(%rsp)
jmp 0xe4a5
movq 0x20(%rsp), %rdi
leaq 0x1a866(%rip), %rsi     # 0x28d17
callq 0x3290
movq %rax, 0x18(%rsp)
jmp 0xe4bd
movq 0x18(%rsp), %rdi
movq 0x25ad7(%rip), %rsi     # 0x33fa0
callq 0x32c0
jmp 0xe4d0
movl $0x0, 0x6c(%rsp)
movl 0x6c(%rsp), %eax
cmpl 0x10c(%rsp), %eax
je 0xe5c2
movl $0x0, 0x68(%rsp)
movl 0x68(%rsp), %eax
cmpl 0x110(%rsp), %eax
je 0xe5b0
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
cmpl 0x114(%rsp), %eax
je 0xe59e
movq 0x58(%rsp), %rdi
movl 0x64(%rsp), %eax
movl %eax, %esi
movl 0x68(%rsp), %eax
movl %eax, %edx
movl 0x6c(%rsp), %eax
movl %eax, %ecx
callq 0xefc0
movl %eax, 0x14(%rsp)
jmp 0xe53d
movl 0x14(%rsp), %eax
movl %eax, 0x60(%rsp)
leaq 0xd8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x23e80
movq %rax, 0x8(%rsp)
jmp 0xe55e
movq 0x8(%rsp), %rax
cmpq $0x1, %rax
jne 0xe58c
movq 0x58(%rsp), %rdi
movl 0x64(%rsp), %eax
movl %eax, %esi
movl 0x68(%rsp), %eax
movl %eax, %edx
movl 0x6c(%rsp), %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x12980
jmp 0xe58a
jmp 0xe58c
jmp 0xe58e
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0xe50a
jmp 0xe5a0
movl 0x68(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x68(%rsp)
jmp 0xe4f1
jmp 0xe5b2
movl 0x6c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x6c(%rsp)
jmp 0xe4d8
leaq 0xd8(%rsp), %rdi
callq 0x23ee0
addq $0x128, %rsp            # imm = 0x128
retq
movq 0xa0(%rsp), %rdi
callq 0x34a0
nopw %cs:(%rax,%rax)
nop