// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
movq %rdi, %rbx
movq 0xe0b3(%rip), %r15      # 0x1cfc8
leaq 0x89b6(%rip), %rsi      # 0x178d2
movl $0x14, %edx
movq %r15, %rdi
callq 0x32f0
movq %r15, %rdi
callq 0x31e0
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %r12
movq 0x28(%rbx), %rcx
movq %rax, 0x8(%rsp)
movslq %eax, %rsi
movslq %r12d, %rdx
movq %rcx, 0x18(%rsp)
movslq %ecx, %r15
movss 0x81f4(%rip), %xmm0     # 0x1714c
movq %r14, %rdi
movq %r15, %rcx
callq 0x11b04
testl %r15d, %r15d
movq %r12, 0x28(%rsp)
jle 0xf001
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq 0x18(%rsp), %rax
andq %r15, %rax
movq %rax, 0x20(%rsp)
movq %r12, %rax
andq %r15, %rax
movq %rax, 0x10(%rsp)
andq 0x8(%rsp), %r15
xorl %r13d, %r13d
testl %r12d, %r12d
jle 0xeff2
xorl %ebp, %ebp
cmpl $0x0, 0x8(%rsp)
jle 0xefe8
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xe968
movzbl %al, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x809d(%rip), %xmm0     # 0x17068
cvtsd2ss %xmm0, %xmm0
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0xf6ac
incq %r12
cmpq %r12, %r15
jne 0xefa8
incq %rbp
cmpq 0x10(%rsp), %rbp
jne 0xef9e
incq %r13
cmpq 0x20(%rsp), %r13
movq 0x28(%rsp), %r12
jne 0xef97
movq 0x8(%rsp), %r15
movq 0x18(%rsp), %rbx
cmpl %ebx, %r15d
movl %ebx, %eax
cmovgl %r15d, %eax
cltq
leaq (,%rax,4), %rcx
testl %eax, %eax
movq $-0x1, %rdi
cmovnsq %rcx, %rdi
callq 0x3030
movq %rax, 0x10(%rsp)
testl %ebx, %ebx
jle 0xf116
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movq 0x18(%rsp), %rax
andq %rbp, %rax
movq %rax, 0x30(%rsp)
movq %r12, %rax
andq %rbp, %rax
movq %rax, 0x20(%rsp)
andq %r15, %rbp
xorl %ebx, %ebx
testl %r12d, %r12d
jle 0xf103
xorl %r13d, %r13d
testl %r15d, %r15d
jle 0xf0d8
xorl %r12d, %r12d
movq 0x10(%rsp), %r15
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0xf342
movss %xmm0, (%r15,%r12,4)
incq %r12
cmpq %r12, %rbp
jne 0xf078
movq %r15, %rdi
movq 0x8(%rsp), %r15
movl %r15d, %esi
callq 0x11c6c
movq %rax, %r12
testl %r15d, %r15d
jle 0xf0e8
xorl %r15d, %r15d
movss (%r12,%r15,4), %xmm0
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0xf6ac
incq %r15
cmpq %r15, %rbp
jne 0xf0b2
movq 0x8(%rsp), %r15
jmp 0xf0ed
movq 0x10(%rsp), %rdi
movl %r15d, %esi
callq 0x11c6c
movq %rax, %r12
testq %r12, %r12
je 0xf0f5
movq %r12, %rdi
callq 0x3340
incq %r13
cmpq 0x20(%rsp), %r13
jne 0xf06b
incq %rbx
cmpq 0x30(%rsp), %rbx
movq 0x28(%rsp), %r12
jne 0xf05f
testl %r12d, %r12d
jle 0xf1fd
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movq 0x28(%rsp), %rax
andq %rbp, %rax
movq %rax, 0x30(%rsp)
movq %r15, %rax
andq %rbp, %rax
movq %rax, 0x20(%rsp)
andq 0x18(%rsp), %rbp
xorl %ebx, %ebx
testl %r15d, %r15d
jle 0xf1ef
xorl %r13d, %r13d
movq 0x18(%rsp), %rsi
testl %esi, %esi
jle 0xf1c0
xorl %r12d, %r12d
movq 0x10(%rsp), %r15
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0xf342
movss %xmm0, (%r15,%r12,4)
incq %r12
cmpq %r12, %rbp
jne 0xf160
movq %r15, %rdi
movq 0x18(%rsp), %r15
movl %r15d, %esi
callq 0x11c6c
movq %rax, %r12
testl %r15d, %r15d
jle 0xf1cf
xorl %r15d, %r15d
movss (%r12,%r15,4), %xmm0
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0xf6ac
incq %r15
cmpq %r15, %rbp
jne 0xf19a
movq 0x8(%rsp), %r15
jmp 0xf1d9
movq 0x10(%rsp), %rdi
callq 0x11c6c
movq %rax, %r12
jmp 0xf1d4
movq 0x8(%rsp), %r15
testq %r12, %r12
je 0xf1e1
movq %r12, %rdi
callq 0x3340
incq %r13
cmpq 0x20(%rsp), %r13
jne 0xf14f
incq %rbx
cmpq 0x30(%rsp), %rbx
jne 0xf143
testl %r15d, %r15d
movq 0x28(%rsp), %rsi
jle 0xf2e7
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, %r15
movq 0x18(%rsp), %rcx
andq %rax, %rcx
movq %rcx, 0x20(%rsp)
movq %rsi, %rbp
andq %rax, %rbp
xorl %ebx, %ebx
movq %r15, 0x8(%rsp)
cmpl $0x0, 0x18(%rsp)
jle 0xf2db
xorl %r13d, %r13d
testl %esi, %esi
jle 0xf2a7
xorl %r12d, %r12d
movq 0x10(%rsp), %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0xf342
movss %xmm0, (%r15,%r12,4)
incq %r12
cmpq %r12, %rbp
jne 0xf247
movq %r15, %rdi
movq 0x28(%rsp), %r15
movl %r15d, %esi
callq 0x11c6c
movq %rax, %r12
testl %r15d, %r15d
jle 0xf2b6
xorl %r15d, %r15d
movss (%r12,%r15,4), %xmm0
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0xf6ac
incq %r15
cmpq %r15, %rbp
jne 0xf281
movq 0x8(%rsp), %r15
jmp 0xf2c0
movq 0x10(%rsp), %rdi
callq 0x11c6c
movq %rax, %r12
jmp 0xf2bb
movq 0x8(%rsp), %r15
testq %r12, %r12
je 0xf2c8
movq %r12, %rdi
callq 0x3340
incq %r13
cmpq 0x20(%rsp), %r13
movq 0x28(%rsp), %rsi
jne 0xf23b
incq %rbx
cmpq %r15, %rbx
jne 0xf22d
movq 0x10(%rsp), %rdi
callq 0x3340
leaq 0x85c5(%rip), %rsi      # 0x178bd
movl $0x5, %edx
movq 0xdcc4(%rip), %rbx      # 0x1cfc8
movq %rbx, %rdi
callq 0x32f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31e0
nop