// File: /workspace/github_cpp_makefile_star2_O1/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, %ebp
movq %rdi, %rbx
movslq %esi, %r13
leaq (,%r13,4), %r15
testl %r13d, %r13d
movq $-0x1, %r12
cmovsq %r12, %r15
movq %r15, %rdi
callq 0x3030
movq %rax, %r14
movq %r15, %rdi
callq 0x3030
movq %rax, %r15
leaq 0x4(,%r13,4), %rdi
cmpl $-0x1, %r13d
cmovlq %r12, %rdi
callq 0x3030
movq %rax, %r12
movl $0x0, (%r15)
movsd 0x52da(%rip), %xmm0     # 0x17120
movsd %xmm0, (%rax)
movl %ebp, %eax
cmpl $0x2, %r13d
jl 0x11f18
xorl %edx, %edx
movl $0x1, %ecx
movl %ecx, %esi
imull %ecx, %esi
xorps %xmm0, %xmm0
cvtsi2ss %esi, %xmm0
addss (%rbx,%rcx,4), %xmm0
movslq %edx, %rsi
movslq (%r15,%rsi,4), %rdi
movl %ecx, %r8d
subl %edi, %r8d
movl %edi, %r9d
imull %edi, %r9d
xorps %xmm2, %xmm2
cvtsi2ss %r9d, %xmm2
addss (%rbx,%rdi,4), %xmm2
movaps %xmm0, %xmm1
subss %xmm2, %xmm1
addl %r8d, %r8d
xorps %xmm2, %xmm2
cvtsi2ss %r8d, %xmm2
divss %xmm2, %xmm1
movss (%r12,%rsi,4), %xmm2
ucomiss %xmm1, %xmm2
jb 0x11ef2
movslq %edx, %rsi
movslq -0x4(%r15,%rsi,4), %rdx
movl %edx, %edi
imull %edx, %edi
xorps %xmm2, %xmm2
cvtsi2ss %edi, %xmm2
movl %ecx, %edi
addss (%rbx,%rdx,4), %xmm2
subl %edx, %edi
movaps %xmm0, %xmm1
subss %xmm2, %xmm1
addl %edi, %edi
xorps %xmm2, %xmm2
cvtsi2ss %edi, %xmm2
divss %xmm2, %xmm1
movss -0x4(%r12,%rsi,4), %xmm2
decq %rsi
ucomiss %xmm1, %xmm2
jae 0x11eb3
movl %esi, %edx
movslq %edx, %rdi
incl %edx
movl %ecx, 0x4(%r15,%rdi,4)
movss %xmm1, 0x4(%r12,%rdi,4)
movl $0x60ad78ec, 0x8(%r12,%rsi,4) # imm = 0x60AD78EC
incq %rcx
cmpq %rax, %rcx
jne 0x11e5d
testl %ebp, %ebp
jle 0x11f8b
xorl %ecx, %ecx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
movabsq $0x100000000, %rsi      # imm = 0x100000000
xorl %edi, %edi
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movslq %edi, %r9
shlq $0x20, %rdi
movq %rdi, %r8
addq %rdx, %r8
decq %r9
movq %r9, %rdi
addq %rsi, %r8
ucomiss 0x8(%r12,%rdi,4), %xmm0
leaq 0x1(%rdi), %rdi
ja 0x11f4e
sarq $0x1e, %r8
movslq (%r15,%r8), %r8
movl %ecx, %r9d
subl %r8d, %r9d
imull %r9d, %r9d
xorps %xmm0, %xmm0
cvtsi2ss %r9d, %xmm0
addss (%rbx,%r8,4), %xmm0
movss %xmm0, (%r14,%rcx,4)
incq %rcx
cmpq %rax, %rcx
jne 0x11f34
movq %r15, %rdi
callq 0x3350
movq %r12, %rdi
callq 0x3350
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop