// File: /workspace/github_cpp_makefile_star2_O2/spatialfruitsalad[P]volume2position/./edm.hpp
// Function: void edm::create_edm<unsigned char>(tomogram3d<unsigned char>&, tomogram3d<float>&)
static void create_edm(tomogram3d<VALUE>& matrix_in, tomogram3d<float>& edm)
    {

        std::cout << "calculating edm ... " << std::flush;

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

        edm.initialise(sx,sy,sz,-1);

        for (int z = 0; z < sz; z++)
            for (int y = 0; y < sy; y++)
                for (int x = 0; x < sx; x++)
                    edm.set(x,y,z,float(matrix_in.get(x,y,z))*INF);


        float *f = new float[std::max(sx,sz)]; //fixme sy, not quadratic case

        for (int z = 0; z < sz; z++)
        {
            for (int y = 0; y < sy; y++)
            {
                for (int x = 0; x < sx; x++)
                {
                    f[x] = edm.get(x, y, z);
                }
                float *d = dt(f, sx);
                for (int x = 0; x < sx; x++)
                {
                    edm.set (x, y, z, d[x]);
                }
                delete [] d;
            }
        }

        for (int y = 0; y < sy; y++)
        {
            for (int x = 0; x < sx; x++)
            {
                for (int z = 0; z < sz; z++)
                {
                    f[z] = edm.get( x, y, z);
                }
                float *d = dt(f, sz);
                for (int z = 0; z < sz; z++)
                {
                    edm.set (x, y, z, d[z]);
                }
                delete [] d;
            }

        }

        for (int x = 0; x < sx; x++)
        {
            for (int z = 0; z < sz; z++)
            {
                for (int y = 0; y < sy; y++)
                {
                    f[y] = edm.get( x, y, z);
                }
                float *d = dt(f, sy);
                for (int y = 0; y < sy; y++)
                {
                    edm.set (x, y, z, d[y]);
                }
                delete [] d;
            }

        }
        delete []f;
        std::cout << " done" << std::endl;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r12
movq 0xcd05(%rip), %rdi      # 0x17fc8
leaq 0x65cd(%rip), %rsi      # 0x11897
callq 0x3260
movq %rax, %rdi
callq 0x31b0
movq 0x18(%r12), %r14
movq 0x20(%r12), %r13
movq 0x28(%r12), %r15
movslq %r14d, %rsi
movq %rsi, 0x8(%rsp)
movslq %r13d, %rdx
movq %rdx, 0x18(%rsp)
movslq %r15d, %rcx
movq %rcx, 0x10(%rsp)
movss 0x5e46(%rip), %xmm0     # 0x1114c
movq %rbx, %rdi
callq 0xd11e
xorl %ebp, %ebp
cmpl $0x0, 0x8(%rsp)
movl $0x0, %eax
movq %r14, 0x20(%rsp)
cmovgl %r14d, %eax
cmpl $0x0, 0x18(%rsp)
movl $0x0, %ecx
movq %r13, 0x30(%rsp)
cmovgl %r13d, %ecx
movq %rcx, 0x18(%rsp)
movq %rax, %r13
cmpl $0x0, 0x10(%rsp)
movl $0x0, %eax
movq %r15, 0x28(%rsp)
cmovgl %r15d, %eax
movq %rax, 0x10(%rsp)
cmpq 0x10(%rsp), %rbp
je 0xb3b3
xorl %r14d, %r14d
cmpq 0x18(%rsp), %r14
je 0xb3ae
xorl %r15d, %r15d
cmpq %r15, %r13
je 0xb3a9
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
callq 0xad44
movzbl %al, %eax
cvtsi2sd %eax, %xmm0
mulsd 0x5cd9(%rip), %xmm0     # 0x11068
cvtsd2ss %xmm0, %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
callq 0xb806
incq %r15
jmp 0xb36a
incq %r14
jmp 0xb360
incq %rbp
jmp 0xb356
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpl %eax, %ecx
cmovgl %ecx, %eax
cltq
leaq (,%rax,4), %rcx
testl %eax, %eax
pushq $-0x1
popq %rdi
cmovnsq %rcx, %rdi
callq 0x3030
movq %rax, %r12
xorl %ebp, %ebp
movq %r13, 0x8(%rsp)
cmpq 0x10(%rsp), %rbp
je 0xb472
xorl %r14d, %r14d
cmpq 0x18(%rsp), %r14
je 0xb46a
xorl %r15d, %r15d
cmpq %r15, %r13
je 0xb41d
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
callq 0xb5c2
movss %xmm0, (%r12,%r15,4)
incq %r15
jmp 0xb3fc
movq %r12, %rdi
movq 0x20(%rsp), %rsi
callq 0xd20a
movq %rax, %r15
xorl %r13d, %r13d
cmpq %r13, 0x8(%rsp)
je 0xb453
movss (%r15,%r13,4), %xmm0
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %rbp, %rcx
callq 0xb806
incq %r13
jmp 0xb430
testq %r15, %r15
je 0xb460
movq %r15, %rdi
callq 0x32f0
incq %r14
movq 0x8(%rsp), %r13
jmp 0xb3f2
incq %rbp
jmp 0xb3e4
xorl %r13d, %r13d
cmpq 0x18(%rsp), %r13
je 0xb4fb
xorl %r14d, %r14d
cmpq 0x8(%rsp), %r14
je 0xb4f3
xorl %r15d, %r15d
cmpq %r15, 0x10(%rsp)
je 0xb4ac
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xb5c2
movss %xmm0, (%r12,%r15,4)
incq %r15
jmp 0xb489
movq %r12, %rdi
movq 0x28(%rsp), %rsi
callq 0xd20a
movq %rax, %r15
xorl %ebp, %ebp
cmpq %rbp, 0x10(%rsp)
je 0xb4e1
movss (%r15,%rbp,4), %xmm0
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0xb806
incq %rbp
jmp 0xb4be
testq %r15, %r15
je 0xb4ee
movq %r15, %rdi
callq 0x32f0
incq %r14
jmp 0xb47f
incq %r13
jmp 0xb475
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
cmpq %rax, %r15
je 0xb591
xorl %r14d, %r14d
cmpq 0x10(%rsp), %r14
je 0xb589
xorl %r13d, %r13d
cmpq %r13, 0x18(%rsp)
je 0xb53c
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0xb5c2
movss %xmm0, (%r12,%r13,4)
incq %r13
jmp 0xb519
movq %r12, %rdi
movq 0x30(%rsp), %rsi
callq 0xd20a
movq %rax, %r13
xorl %ebp, %ebp
cmpq %rbp, 0x18(%rsp)
je 0xb572
movss (%r13,%rbp,4), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0xb806
incq %rbp
jmp 0xb54e
testq %r13, %r13
je 0xb57f
movq %r13, %rdi
callq 0x32f0
incq %r14
movq 0x8(%rsp), %rax
jmp 0xb50f
incq %r15
jmp 0xb503
movq %r12, %rdi
callq 0x32f0
movq 0xca28(%rip), %rdi      # 0x17fc8
leaq 0x62db(%rip), %rsi      # 0x11882
callq 0x3260
movq %rax, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3110