// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r13d
movq %rdi, %rbx
movl %esi, %ebp
leaq (,%rbp,4), %r15
testl %esi, %esi
movq $-0x1, %r12
cmovsq %r12, %r15
movq %r15, %rdi
callq 0x3030
movq %rax, %r14
movq %r15, %rdi
callq 0x3030
movq %rax, %r15
leal 0x1(%r13), %edi
shlq $0x2, %rdi
cmpl $-0x1, %r13d
cmovlq %r12, %rdi
callq 0x3030
movq %rax, %r12
movl $0x0, (%r15)
movsd 0x543f(%rip), %xmm0     # 0x17110
movsd %xmm0, (%rax)
cmpl $0x2, %r13d
jl 0x11da3
movl $0x1, %eax
xorl %esi, %esi
xorl %ecx, %ecx
movl %eax, %edx
imull %eax, %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
addss (%rbx,%rax,4), %xmm0
movslq %ecx, %rdx
movslq %esi, %rsi
movl %eax, %edi
subl %esi, %edi
movl %esi, %r8d
imull %esi, %r8d
xorps %xmm2, %xmm2
cvtsi2ss %r8d, %xmm2
addss (%rbx,%rsi,4), %xmm2
movaps %xmm0, %xmm1
subss %xmm2, %xmm1
addl %edi, %edi
xorps %xmm2, %xmm2
cvtsi2ss %edi, %xmm2
divss %xmm2, %xmm1
movss (%r12,%rdx,4), %xmm2
ucomiss %xmm1, %xmm2
jb 0x11d75
movslq -0x4(%r15,%rdx,4), %rcx
movl %ecx, %esi
imull %ecx, %esi
xorps %xmm2, %xmm2
cvtsi2ss %esi, %xmm2
movl %eax, %esi
addss (%rbx,%rcx,4), %xmm2
subl %ecx, %esi
movaps %xmm0, %xmm1
subss %xmm2, %xmm1
addl %esi, %esi
xorps %xmm2, %xmm2
cvtsi2ss %esi, %xmm2
divss %xmm2, %xmm1
movss -0x4(%r12,%rdx,4), %xmm2
decq %rdx
ucomiss %xmm1, %xmm2
jae 0x11d36
movl %edx, %ecx
movslq %ecx, %rsi
incl %ecx
movl %eax, 0x4(%r15,%rsi,4)
movss %xmm1, 0x4(%r12,%rsi,4)
movl $0x60ad78ec, 0x8(%r12,%rdx,4) # imm = 0x60AD78EC
movl %eax, %esi
movq %rax, %rdx
incq %rdx
movq %rdx, %rax
cmpq %rbp, %rdx
jne 0x11ce8
testl %r13d, %r13d
jle 0x11e16
xorl %eax, %eax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorl %esi, %esi
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movslq %esi, %r8
shlq $0x20, %rsi
movq %rsi, %rdi
addq %rcx, %rdi
decq %r8
movq %r8, %rsi
addq %rdx, %rdi
ucomiss 0x8(%r12,%rsi,4), %xmm0
leaq 0x1(%rsi), %rsi
ja 0x11dda
sarq $0x1e, %rdi
movslq (%r15,%rdi), %rdi
movl %eax, %r8d
subl %edi, %r8d
imull %r8d, %r8d
xorps %xmm0, %xmm0
cvtsi2ss %r8d, %xmm0
addss (%rbx,%rdi,4), %xmm0
movss %xmm0, (%r14,%rax,4)
incq %rax
cmpq %rbp, %rax
jne 0x11dc0
movq %r15, %rdi
callq 0x3340
movq %r12, %rdi
callq 0x3340
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq