// File: spatialfruitsalad[P]volume2position/./edm.hpp
// Function: edm::dt(float*, int)
static float *dt(float *f, int n)
    {
        float *d = new float[n];
        int *v = new int[n];
        float *z = new float[n+1];
        int k = 0;
        v[0] = 0;
        z[0] = -INF;
        z[1] = +INF;
        for (int q = 1; q <= n-1; q++)
        {
            float s  = ((f[q]+square(q))-(f[v[k]]+square(v[k])))/(2*q-2*v[k]);
            while (s <= z[k])
            {
                k--;
                s  = ((f[q]+square(q))-(f[v[k]]+square(v[k])))/(2*q-2*v[k]);
            }
            k++;
            v[k] = q;
            z[k] = s;
            z[k+1] = +INF;
        }

        k = 0;
        for (int q = 0; q <= n-1; q++)
        {
            while (z[k+1] < q)
                k++;
            d[q] = square(q-v[k]) + f[v[k]];
        }

        delete [] v;
        delete [] z;
        return d;
    }

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movl %esi, 0x5c(%rsp)
movslq 0x5c(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, 0x50(%rsp)
movslq 0x5c(%rsp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, 0x48(%rsp)
movl 0x5c(%rsp), %eax
addl $0x1, %eax
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3040
movq %rax, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movq 0x48(%rsp), %rax
movl $0x0, (%rax)
movq 0x40(%rsp), %rax
movss 0xefee(%rip), %xmm0     # 0x28110
movss %xmm0, (%rax)
movq 0x40(%rsp), %rax
movss 0xefd9(%rip), %xmm0     # 0x2810c
movss %xmm0, 0x4(%rax)
movl $0x1, 0x38(%rsp)
movl 0x38(%rsp), %eax
movl 0x5c(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x19326
movq 0x60(%rsp), %rax
movslq 0x38(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, 0x20(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x19fe0
movss 0x20(%rsp), %xmm0
cvtsi2ss %eax, %xmm1
addss %xmm1, %xmm0
movss %xmm0, 0x28(%rsp)
movq 0x60(%rsp), %rax
movq 0x48(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
movslq (%rcx,%rdx,4), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, 0x24(%rsp)
movq 0x48(%rsp), %rdi
movslq 0x3c(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x19fe0
movss 0x24(%rsp), %xmm1
movss 0x28(%rsp), %xmm0
cvtsi2ss %eax, %xmm2
addss %xmm2, %xmm1
subss %xmm1, %xmm0
movl 0x38(%rsp), %eax
shll %eax
movq 0x48(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
shll %ecx
subl %ecx, %eax
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x34(%rsp)
movss 0x34(%rsp), %xmm1
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
ucomiss %xmm1, %xmm0
jb 0x192c9
movl 0x3c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x3c(%rsp)
movq 0x60(%rsp), %rax
movslq 0x38(%rsp), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, 0x14(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x19fe0
movss 0x14(%rsp), %xmm0
cvtsi2ss %eax, %xmm1
addss %xmm1, %xmm0
movss %xmm0, 0x1c(%rsp)
movq 0x60(%rsp), %rax
movq 0x48(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
movslq (%rcx,%rdx,4), %rcx
movss (%rax,%rcx,4), %xmm0
movss %xmm0, 0x18(%rsp)
movq 0x48(%rsp), %rdi
movslq 0x3c(%rsp), %rax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x19fe0
movss 0x18(%rsp), %xmm1
movss 0x1c(%rsp), %xmm0
cvtsi2ss %eax, %xmm2
addss %xmm2, %xmm1
subss %xmm1, %xmm0
movl 0x38(%rsp), %eax
shll %eax
movq 0x48(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
shll %ecx
subl %ecx, %eax
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x34(%rsp)
jmp 0x191f7
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
movl 0x38(%rsp), %edx
movq 0x48(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movss 0x34(%rsp), %xmm0
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq 0x40(%rsp), %rax
movl 0x3c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss 0xedfb(%rip), %xmm0     # 0x2810c
movss %xmm0, (%rax,%rcx,4)
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x19140
movl $0x0, 0x3c(%rsp)
movl $0x0, 0x30(%rsp)
movl 0x30(%rsp), %eax
movl 0x5c(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x193d1
jmp 0x1934b
movq 0x40(%rsp), %rax
movl 0x3c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm1
cvtsi2ssl 0x30(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x19377
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x1934b
movl 0x30(%rsp), %eax
movq 0x48(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
subl (%rcx,%rdx,4), %eax
movl %eax, 0x2c(%rsp)
leaq 0x2c(%rsp), %rdi
callq 0x19fe0
cvtsi2ss %eax, %xmm0
movq 0x60(%rsp), %rax
movq 0x48(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
movslq (%rcx,%rdx,4), %rcx
addss (%rax,%rcx,4), %xmm0
movq 0x50(%rsp), %rax
movslq 0x30(%rsp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x19336
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x193eb
movq 0x8(%rsp), %rdi
callq 0x3330
movq 0x40(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x19403
movq (%rsp), %rdi
callq 0x3330
movq 0x50(%rsp), %rax
addq $0x68, %rsp
retq
nopl (%rax)