double *make_distance_mapd(double *data, unsigned int width,
                           unsigned int height, double *vmax) {
  short *xdist = (short *)malloc(width * height * sizeof(short));
  short *ydist = (short *)malloc(width * height * sizeof(short));
  double *gx = (double *)calloc(width * height, sizeof(double));
  double *gy = (double *)calloc(width * height, sizeof(double));
  double *outside = (double *)calloc(width * height, sizeof(double));
  double *inside = (double *)calloc(width * height, sizeof(double));
  unsigned int i;
  computegradient(data, width, height, gx, gy);
  edtaa3(data, gx, gy, width, height, xdist, ydist, outside);
  for (i = 0; i < width * height; ++i)
    if (outside[i] < 0.0)
      outside[i] = 0.0;
  memset(gx, 0, sizeof(double) * width * height);
  memset(gy, 0, sizeof(double) * width * height);
  for (i = 0; i < width * height; ++i)
    data[i] = 1 - data[i];
  computegradient(data, width, height, gx, gy);
  edtaa3(data, gx, gy, width, height, xdist, ydist, inside);
  for (i = 0; i < width * height; ++i)
    if (inside[i] < 0)
      inside[i] = 0.0;
  *vmax = 0.;
  for (i = 0; i < width * height; ++i) {
    outside[i] -= inside[i];
    if (*vmax < fabs(outside[i]))
      *vmax = fabs(outside[i]);
  }
  for (i = 0; i < width * height; ++i) {
    double v = outside[i];
    if (v < -*vmax)
      outside[i] = -*vmax;
    else if (v > +*vmax)
      outside[i] = +*vmax;
    data[i] = (outside[i] + *vmax) / (2. * *vmax);
  }
  free(xdist);
  free(ydist);
  free(gx);
  free(gy);
  free(outside);
  free(inside);
  return data;
}


x86 assembly (clang, -O0):
<make_distance_mapd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edi
shl    $0x1,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edi
shl    $0x1,%rdi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    $0x0,%al
call   1030 <computegradient@plt>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    -0x28(%rbp),%r10
mov    -0x40(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1060 <edtaa3@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jae    12a2 <make_distance_mapd+0x142>
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    128f <make_distance_mapd+0x12f>
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1294 <make_distance_mapd+0x134>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1259 <make_distance_mapd+0xf9>
mov    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    %eax,%edx
shl    $0x3,%rdx
mov    -0x10(%rbp),%eax
imul   %rax,%rdx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x38(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    %eax,%edx
shl    $0x3,%rdx
mov    -0x10(%rbp),%eax
imul   %rax,%rdx
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jae    131f <make_distance_mapd+0x1bf>
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  0xd08(%rip),%xmm0
subsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12df <make_distance_mapd+0x17f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    $0x0,%al
call   1030 <computegradient@plt>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    -0x28(%rbp),%r10
mov    -0x48(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1060 <edtaa3@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jae    13b7 <make_distance_mapd+0x257>
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    13a4 <make_distance_mapd+0x244>
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    13a9 <make_distance_mapd+0x249>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    136e <make_distance_mapd+0x20e>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jae    1457 <make_distance_mapd+0x2f7>
mov    -0x48(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xbf9(%rip),%xmm2
pand   %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1444 <make_distance_mapd+0x2e4>
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xbd8(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1449 <make_distance_mapd+0x2e9>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13c9 <make_distance_mapd+0x269>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jae    154d <make_distance_mapd+0x3ed>
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    14df <make_distance_mapd+0x37f>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
jmp    150b <make_distance_mapd+0x3ab>
movsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1506 <make_distance_mapd+0x3a6>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
jmp    150b <make_distance_mapd+0x3ab>
mov    -0x40(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0xad5(%rip),%xmm1
mulsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    145e <make_distance_mapd+0x2fe>
mov    -0x20(%rbp),%rdi
call   1040 <free@plt>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    -0x38(%rbp),%rdi
call   1040 <free@plt>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x48(%rbp),%rdi
call   1040 <free@plt>
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_distance_mapd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,0x30(%rsp)
mov    %edx,0xc(%rsp)
mov    %esi,0x8(%rsp)
mov    %rdi,%r12
mov    %edx,%r13d
imul   %esi,%r13d
mov    %r13,%rbp
add    %r13,%rbp
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %rbp,%rdi
call   1080 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    $0x8,%esi
mov    %r13,%rdi
call   1070 <calloc@plt>
mov    %rax,%r14
mov    $0x8,%esi
mov    %r13,%rdi
call   1070 <calloc@plt>
mov    %rax,%rbx
mov    $0x8,%esi
mov    %r13,%rdi
call   1070 <calloc@plt>
mov    %rax,%r15
mov    $0x8,%esi
mov    %r13,%rdi
call   1070 <calloc@plt>
mov    %rax,0x20(%rsp)
mov    %r12,%rdi
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%ebp
mov    %ebp,%edx
mov    %r14,0x10(%rsp)
mov    %r14,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1030 <computegradient@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%r14
mov    %rbx,%rdx
mov    0x8(%rsp),%ebx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    0x28(%rsp),%r9
xor    %eax,%eax
push   %r15
push   0x20(%rsp)
call   1060 <edtaa3@plt>
add    $0x10,%rsp
mov    %ebx,%eax
mov    %ebp,%ebp
mov    0x10(%rsp),%rdi
test   %r13d,%r13d
mov    %r14,0x40(%rsp)
mov    %r13,0x38(%rsp)
je     12c1 <make_distance_mapd+0x161>
cmp    $0x1,%r13d
jne    12ea <make_distance_mapd+0x18a>
xor    %ecx,%ecx
mov    0x10(%rsp),%r14
mov    0x20(%rsp),%rbx
test   $0x1,%r13b
je     1279 <make_distance_mapd+0x119>
xorpd  %xmm0,%xmm0
ucomisd (%r15,%rcx,8),%xmm0
jbe    1279 <make_distance_mapd+0x119>
movq   $0x0,(%r15,%rcx,8)
imul   %rax,%rbp
shl    $0x3,%rbp
mov    %r14,%rdi
mov    %r14,%r13
xor    %esi,%esi
mov    %rbp,%rdx
call   1050 <memset@plt>
mov    0x40(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1050 <memset@plt>
mov    0x38(%rsp),%rdi
test   %rdi,%rdi
je     1341 <make_distance_mapd+0x1e1>
cmp    $0x4,%edi
jae    1388 <make_distance_mapd+0x228>
xor    %eax,%eax
jmp    1458 <make_distance_mapd+0x2f8>
imul   %rax,%rbp
shl    $0x3,%rbp
xor    %esi,%esi
mov    %rbp,%rdx
call   1050 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1050 <memset@plt>
mov    0x20(%rsp),%rbx
jmp    1479 <make_distance_mapd+0x319>
mov    %r13d,%edx
and    $0xfffffffe,%edx
xor    %ecx,%ecx
xorpd  %xmm0,%xmm0
mov    0x10(%rsp),%r14
mov    0x20(%rsp),%rbx
jmp    131d <make_distance_mapd+0x1bd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x2,%rcx
cmp    %rcx,%rdx
je     125f <make_distance_mapd+0xff>
ucomisd (%r15,%rcx,8),%xmm0
jbe    132d <make_distance_mapd+0x1cd>
movq   $0x0,(%r15,%rcx,8)
ucomisd 0x8(%r15,%rcx,8),%xmm0
jbe    1310 <make_distance_mapd+0x1b0>
movq   $0x0,0x8(%r15,%rcx,8)
jmp    1310 <make_distance_mapd+0x1b0>
mov    %r12,%rdi
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%ebp
mov    %ebp,%edx
mov    %r13,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1030 <computegradient@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
mov    0x8(%rsp),%ecx
mov    %ebp,%r8d
mov    0x28(%rsp),%rbp
mov    %rbp,%r9
xor    %eax,%eax
push   %rbx
push   0x20(%rsp)
call   1060 <edtaa3@plt>
add    $0x10,%rsp
jmp    151b <make_distance_mapd+0x3bb>
mov    %edi,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     16af <make_distance_mapd+0x54f>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
movapd 0xc4a(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
movupd (%r12,%rcx,8),%xmm1
movupd 0x10(%r12,%rcx,8),%xmm2
movupd 0x20(%r12,%rcx,8),%xmm3
movupd 0x30(%r12,%rcx,8),%xmm4
movapd %xmm0,%xmm5
subpd  %xmm1,%xmm5
movapd %xmm0,%xmm1
subpd  %xmm2,%xmm1
movupd %xmm5,(%r12,%rcx,8)
movupd %xmm1,0x10(%r12,%rcx,8)
movapd %xmm0,%xmm1
subpd  %xmm3,%xmm1
movapd %xmm0,%xmm2
subpd  %xmm4,%xmm2
movupd %xmm1,0x20(%r12,%rcx,8)
movupd %xmm2,0x30(%r12,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%rsi
jne    13c0 <make_distance_mapd+0x260>
test   $0x1,%dl
je     1453 <make_distance_mapd+0x2f3>
movupd (%r12,%rcx,8),%xmm0
movupd 0x10(%r12,%rcx,8),%xmm1
movapd 0xbc6(%rip),%xmm2
movapd %xmm2,%xmm3
subpd  %xmm0,%xmm3
subpd  %xmm1,%xmm2
movupd %xmm3,(%r12,%rcx,8)
movupd %xmm2,0x10(%r12,%rcx,8)
cmp    %rdi,%rax
je     1479 <make_distance_mapd+0x319>
movsd  0xbd0(%rip),%xmm0
movapd %xmm0,%xmm1
subsd  (%r12,%rax,8),%xmm1
movsd  %xmm1,(%r12,%rax,8)
add    $0x1,%rax
cmp    %rax,%rdi
jne    1460 <make_distance_mapd+0x300>
mov    %r12,%rdi
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%r13d
mov    %r13d,%edx
mov    0x10(%rsp),%r14
mov    %r14,%rcx
mov    0x40(%rsp),%rbp
mov    %rbp,%r8
xor    %eax,%eax
call   1030 <computegradient@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbp,%r14
mov    %rbp,%rdx
mov    0x8(%rsp),%ecx
mov    %r13d,%r8d
mov    0x28(%rsp),%rbp
mov    %rbp,%r9
xor    %eax,%eax
push   %rbx
push   0x20(%rsp)
call   1060 <edtaa3@plt>
mov    0x48(%rsp),%rdi
add    $0x10,%rsp
test   %rdi,%rdi
je     151b <make_distance_mapd+0x3bb>
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
mov    0x30(%rsp),%rsi
je     152c <make_distance_mapd+0x3cc>
mov    %edi,%edx
and    $0xfffffffe,%edx
xor    %ecx,%ecx
xorpd  %xmm0,%xmm0
jmp    14f9 <make_distance_mapd+0x399>
nop
add    $0x2,%rcx
cmp    %rcx,%rdx
je     152e <make_distance_mapd+0x3ce>
ucomisd (%rbx,%rcx,8),%xmm0
jbe    1508 <make_distance_mapd+0x3a8>
movq   $0x0,(%rbx,%rcx,8)
ucomisd 0x8(%rbx,%rcx,8),%xmm0
jbe    14f0 <make_distance_mapd+0x390>
movq   $0x0,0x8(%rbx,%rcx,8)
jmp    14f0 <make_distance_mapd+0x390>
mov    0x30(%rsp),%rax
movq   $0x0,(%rax)
jmp    1669 <make_distance_mapd+0x509>
xor    %ecx,%ecx
test   $0x1,%dil
je     1547 <make_distance_mapd+0x3e7>
xorpd  %xmm0,%xmm0
ucomisd (%rbx,%rcx,8),%xmm0
jbe    1547 <make_distance_mapd+0x3e7>
movq   $0x0,(%rbx,%rcx,8)
movq   $0x0,(%rsi)
test   %rdi,%rdi
je     1669 <make_distance_mapd+0x509>
test   %rax,%rax
je     15d4 <make_distance_mapd+0x474>
mov    %edi,%edx
and    $0xfffffffe,%edx
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
movapd 0xaa1(%rip),%xmm1
jmp    1589 <make_distance_mapd+0x429>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x2,%rcx
cmp    %rcx,%rdx
je     15da <make_distance_mapd+0x47a>
movsd  (%r15,%rcx,8),%xmm2
subsd  (%rbx,%rcx,8),%xmm2
movsd  %xmm2,(%r15,%rcx,8)
andpd  %xmm1,%xmm2
ucomisd %xmm0,%xmm2
jbe    15ac <make_distance_mapd+0x44c>
movsd  %xmm2,(%rsi)
movapd %xmm2,%xmm0
movsd  0x8(%r15,%rcx,8),%xmm2
subsd  0x8(%rbx,%rcx,8),%xmm2
movsd  %xmm2,0x8(%r15,%rcx,8)
andpd  %xmm1,%xmm2
ucomisd %xmm0,%xmm2
jbe    1580 <make_distance_mapd+0x420>
movsd  %xmm2,(%rsi)
movapd %xmm2,%xmm0
jmp    1580 <make_distance_mapd+0x420>
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
test   $0x1,%dil
je     1607 <make_distance_mapd+0x4a7>
movsd  (%r15,%rcx,8),%xmm1
subsd  (%rbx,%rcx,8),%xmm1
movsd  %xmm1,(%r15,%rcx,8)
andpd  0xa17(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1607 <make_distance_mapd+0x4a7>
movsd  %xmm1,(%rsi)
movapd %xmm1,%xmm0
test   %rdi,%rdi
je     1669 <make_distance_mapd+0x509>
xor    %ecx,%ecx
movapd 0xa0a(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
movsd  (%r15,%rcx,8),%xmm2
movapd %xmm0,%xmm3
xorpd  %xmm1,%xmm3
ucomisd %xmm2,%xmm3
ja     163e <make_distance_mapd+0x4de>
ucomisd %xmm0,%xmm2
movapd %xmm0,%xmm3
jbe    1648 <make_distance_mapd+0x4e8>
movsd  %xmm3,(%r15,%rcx,8)
movapd %xmm3,%xmm2
addsd  %xmm0,%xmm2
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm2
movsd  %xmm2,(%r12,%rcx,8)
cmp    %rcx,%rax
je     1669 <make_distance_mapd+0x509>
movsd  (%rsi),%xmm0
add    $0x1,%rcx
jmp    1620 <make_distance_mapd+0x4c0>
mov    %rbp,%rdi
call   1040 <free@plt>
mov    0x18(%rsp),%rdi
call   1040 <free@plt>
mov    0x10(%rsp),%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1040 <free@plt>
mov    %r15,%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    %r12,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ecx,%ecx
test   $0x1,%dl
jne    1425 <make_distance_mapd+0x2c5>
jmp    1453 <make_distance_mapd+0x2f3>

LLVM IR (-O0):
define double* @make_distance_mapd(double* %0, i32 %1, i32 %2, double* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca i16*
%10 = alloca i16*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
%16 = alloca double
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double* %3, double** %8
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = mul i32 %17, %18
%20 = zext i32 %19 to i64
%21 = mul i64 %20, 2
%22 = call i8* @malloc(i64 %21)
%23 = bitcast i8* %22 to i16*
store i16* %23, i16** %9
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = mul i32 %24, %25
%27 = zext i32 %26 to i64
%28 = mul i64 %27, 2
%29 = call i8* @malloc(i64 %28)
%30 = bitcast i8* %29 to i16*
store i16* %30, i16** %10
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = mul i32 %31, %32
%34 = zext i32 %33 to i64
%35 = call i8* @calloc(i64 %34, i64 8)
%36 = bitcast i8* %35 to double*
store double* %36, double** %11
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = mul i32 %37, %38
%40 = zext i32 %39 to i64
%41 = call i8* @calloc(i64 %40, i64 8)
%42 = bitcast i8* %41 to double*
store double* %42, double** %12
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = mul i32 %43, %44
%46 = zext i32 %45 to i64
%47 = call i8* @calloc(i64 %46, i64 8)
%48 = bitcast i8* %47 to double*
store double* %48, double** %13
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = mul i32 %49, %50
%52 = zext i32 %51 to i64
%53 = call i8* @calloc(i64 %52, i64 8)
%54 = bitcast i8* %53 to double*
store double* %54, double** %14
%55 = load double*, double** %5
%56 = load i32, i32* %6
%57 = load i32, i32* %7
%58 = load double*, double** %11
%59 = load double*, double** %12
%60 = call i32 (double*, i32, i32, double*, double*, ...) bitcast (i32 (...)* @computegradient to i32 (double*, i32, i32, double*, double*, ...)*)(double* %55, i32 %56, i32 %57, double* %58, double* %59)
%61 = load double*, double** %5
%62 = load double*, double** %11
%63 = load double*, double** %12
%64 = load i32, i32* %6
%65 = load i32, i32* %7
%66 = load i16*, i16** %9
%67 = load i16*, i16** %10
%68 = load double*, double** %13
%69 = call i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...) bitcast (i32 (...)* @edtaa3 to i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...)*)(double* %61, double* %62, double* %63, i32 %64, i32 %65, i16* %66, i16* %67, double* %68)
store i32 0, i32* %15
br label %70
70: ; preds = %89, %4
%71 = load i32, i32* %15
%72 = load i32, i32* %6
%73 = load i32, i32* %7
%74 = mul i32 %72, %73
%75 = icmp ult i32 %71, %74
br i1 %75, label %76, label %92
76: ; preds = %70
%77 = load double*, double** %13
%78 = load i32, i32* %15
%79 = zext i32 %78 to i64
%80 = getelementptr inbounds double, double* %77, i64 %79
%81 = load double, double* %80
%82 = fcmp olt double %81, 0.000000e+00
br i1 %82, label %83, label %88
83: ; preds = %76
%84 = load double*, double** %13
%85 = load i32, i32* %15
%86 = zext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
store double 0.000000e+00, double* %87
br label %88
88: ; preds = %83, %76
br label %89
89: ; preds = %88
%90 = load i32, i32* %15
%91 = add i32 %90, 1
store i32 %91, i32* %15
br label %70
92: ; preds = %70
%93 = load double*, double** %11
%94 = bitcast double* %93 to i8*
%95 = load i32, i32* %6
%96 = zext i32 %95 to i64
%97 = mul i64 8, %96
%98 = load i32, i32* %7
%99 = zext i32 %98 to i64
%100 = mul i64 %97, %99
%101 = load double*, double** %12
%102 = bitcast double* %101 to i8*
%103 = load i32, i32* %6
%104 = zext i32 %103 to i64
%105 = mul i64 8, %104
%106 = load i32, i32* %7
%107 = zext i32 %106 to i64
%108 = mul i64 %105, %107
store i32 0, i32* %15
br label %109
109: ; preds = %126, %92
%110 = load i32, i32* %15
%111 = load i32, i32* %6
%112 = load i32, i32* %7
%113 = mul i32 %111, %112
%114 = icmp ult i32 %110, %113
br i1 %114, label %115, label %129
115: ; preds = %109
%116 = load double*, double** %5
%117 = load i32, i32* %15
%118 = zext i32 %117 to i64
%119 = getelementptr inbounds double, double* %116, i64 %118
%120 = load double, double* %119
%121 = fsub double 1.000000e+00, %120
%122 = load double*, double** %5
%123 = load i32, i32* %15
%124 = zext i32 %123 to i64
%125 = getelementptr inbounds double, double* %122, i64 %124
store double %121, double* %125
br label %126
126: ; preds = %115
%127 = load i32, i32* %15
%128 = add i32 %127, 1
store i32 %128, i32* %15
br label %109
129: ; preds = %109
%130 = load double*, double** %5
%131 = load i32, i32* %6
%132 = load i32, i32* %7
%133 = load double*, double** %11
%134 = load double*, double** %12
%135 = call i32 (double*, i32, i32, double*, double*, ...) bitcast (i32 (...)* @computegradient to i32 (double*, i32, i32, double*, double*, ...)*)(double* %130, i32 %131, i32 %132, double* %133, double* %134)
%136 = load double*, double** %5
%137 = load double*, double** %11
%138 = load double*, double** %12
%139 = load i32, i32* %6
%140 = load i32, i32* %7
%141 = load i16*, i16** %9
%142 = load i16*, i16** %10
%143 = load double*, double** %14
%144 = call i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...) bitcast (i32 (...)* @edtaa3 to i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...)*)(double* %136, double* %137, double* %138, i32 %139, i32 %140, i16* %141, i16* %142, double* %143)
store i32 0, i32* %15
br label %145
145: ; preds = %164, %129
%146 = load i32, i32* %15
%147 = load i32, i32* %6
%148 = load i32, i32* %7
%149 = mul i32 %147, %148
%150 = icmp ult i32 %146, %149
br i1 %150, label %151, label %167
151: ; preds = %145
%152 = load double*, double** %14
%153 = load i32, i32* %15
%154 = zext i32 %153 to i64
%155 = getelementptr inbounds double, double* %152, i64 %154
%156 = load double, double* %155
%157 = fcmp olt double %156, 0.000000e+00
br i1 %157, label %158, label %163
158: ; preds = %151
%159 = load double*, double** %14
%160 = load i32, i32* %15
%161 = zext i32 %160 to i64
%162 = getelementptr inbounds double, double* %159, i64 %161
store double 0.000000e+00, double* %162
br label %163
163: ; preds = %158, %151
br label %164
164: ; preds = %163
%165 = load i32, i32* %15
%166 = add i32 %165, 1
store i32 %166, i32* %15
br label %145
167: ; preds = %145
%168 = load double*, double** %8
store double 0.000000e+00, double* %168
store i32 0, i32* %15
br label %169
169: ; preds = %205, %167
%170 = load i32, i32* %15
%171 = load i32, i32* %6
%172 = load i32, i32* %7
%173 = mul i32 %171, %172
%174 = icmp ult i32 %170, %173
br i1 %174, label %175, label %208
175: ; preds = %169
%176 = load double*, double** %14
%177 = load i32, i32* %15
%178 = zext i32 %177 to i64
%179 = getelementptr inbounds double, double* %176, i64 %178
%180 = load double, double* %179
%181 = load double*, double** %13
%182 = load i32, i32* %15
%183 = zext i32 %182 to i64
%184 = getelementptr inbounds double, double* %181, i64 %183
%185 = load double, double* %184
%186 = fsub double %185, %180
store double %186, double* %184
%187 = load double*, double** %8
%188 = load double, double* %187
%189 = load double*, double** %13
%190 = load i32, i32* %15
%191 = zext i32 %190 to i64
%192 = getelementptr inbounds double, double* %189, i64 %191
%193 = load double, double* %192
%194 = call double @llvm.fabs.f64(double %193)
%195 = fcmp olt double %188, %194
br i1 %195, label %196, label %204
196: ; preds = %175
%197 = load double*, double** %13
%198 = load i32, i32* %15
%199 = zext i32 %198 to i64
%200 = getelementptr inbounds double, double* %197, i64 %199
%201 = load double, double* %200
%202 = call double @llvm.fabs.f64(double %201)
%203 = load double*, double** %8
store double %202, double* %203
br label %204
204: ; preds = %196, %175
br label %205
205: ; preds = %204
%206 = load i32, i32* %15
%207 = add i32 %206, 1
store i32 %207, i32* %15
br label %169
208: ; preds = %169
store i32 0, i32* %15
br label %209
209: ; preds = %264, %208
%210 = load i32, i32* %15
%211 = load i32, i32* %6
%212 = load i32, i32* %7
%213 = mul i32 %211, %212
%214 = icmp ult i32 %210, %213
br i1 %214, label %215, label %267
215: ; preds = %209
%216 = load double*, double** %13
%217 = load i32, i32* %15
%218 = zext i32 %217 to i64
%219 = getelementptr inbounds double, double* %216, i64 %218
%220 = load double, double* %219
store double %220, double* %16
%221 = load double, double* %16
%222 = load double*, double** %8
%223 = load double, double* %222
%224 = fneg double %223
%225 = fcmp olt double %221, %224
br i1 %225, label %226, label %234
226: ; preds = %215
%227 = load double*, double** %8
%228 = load double, double* %227
%229 = fneg double %228
%230 = load double*, double** %13
%231 = load i32, i32* %15
%232 = zext i32 %231 to i64
%233 = getelementptr inbounds double, double* %230, i64 %232
store double %229, double* %233
br label %247
234: ; preds = %215
%235 = load double, double* %16
%236 = load double*, double** %8
%237 = load double, double* %236
%238 = fcmp ogt double %235, %237
br i1 %238, label %239, label %246
239: ; preds = %234
%240 = load double*, double** %8
%241 = load double, double* %240
%242 = load double*, double** %13
%243 = load i32, i32* %15
%244 = zext i32 %243 to i64
%245 = getelementptr inbounds double, double* %242, i64 %244
store double %241, double* %245
br label %246
246: ; preds = %239, %234
br label %247
247: ; preds = %246, %226
%248 = load double*, double** %13
%249 = load i32, i32* %15
%250 = zext i32 %249 to i64
%251 = getelementptr inbounds double, double* %248, i64 %250
%252 = load double, double* %251
%253 = load double*, double** %8
%254 = load double, double* %253
%255 = fadd double %252, %254
%256 = load double*, double** %8
%257 = load double, double* %256
%258 = fmul double 2.000000e+00, %257
%259 = fdiv double %255, %258
%260 = load double*, double** %5
%261 = load i32, i32* %15
%262 = zext i32 %261 to i64
%263 = getelementptr inbounds double, double* %260, i64 %262
store double %259, double* %263
br label %264
264: ; preds = %247
%265 = load i32, i32* %15
%266 = add i32 %265, 1
store i32 %266, i32* %15
br label %209
267: ; preds = %209
%268 = load i16*, i16** %9
%269 = bitcast i16* %268 to i8*
%270 = load i16*, i16** %10
%271 = bitcast i16* %270 to i8*
%272 = load double*, double** %11
%273 = bitcast double* %272 to i8*
%274 = load double*, double** %12
%275 = bitcast double* %274 to i8*
%276 = load double*, double** %13
%277 = bitcast double* %276 to i8*
%278 = load double*, double** %14
%279 = bitcast double* %278 to i8*
%280 = load double*, double** %5
ret double* %280
}

LLVM IR (-O2):
define double* @make_distance_mapd(double* returned %0, i32 %1, i32 %2, double* nocapture %3) {
%5 = mul i32 %2, %1
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 1
%8 = tail call i8* @malloc(i64 %7)
%9 = bitcast i8* %8 to i16*
%10 = tail call i8* @malloc(i64 %7)
%11 = bitcast i8* %10 to i16*
%12 = tail call i8* @calloc(i64 %6, i64 8)
%13 = bitcast i8* %12 to double*
%14 = tail call i8* @calloc(i64 %6, i64 8)
%15 = bitcast i8* %14 to double*
%16 = tail call i8* @calloc(i64 %6, i64 8)
%17 = bitcast i8* %16 to double*
%18 = tail call i8* @calloc(i64 %6, i64 8)
%19 = bitcast i8* %18 to double*
%20 = tail call i32 (double*, i32, i32, double*, double*, ...) bitcast (i32 (...)* @computegradient to i32 (double*, i32, i32, double*, double*, ...)*)(double* %0, i32 %1, i32 %2, double* %13, double* %15)
%21 = tail call i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...) bitcast (i32 (...)* @edtaa3 to i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...)*)(double* %0, double* %13, double* %15, i32 %1, i32 %2, i16* %9, i16* %11, double* %17)
%22 = icmp eq i32 %5, 0
br i1 %22, label %28, label %23
23: ; preds = %4
%24 = and i64 %6, 1
%25 = icmp eq i32 %5, 1
br i1 %25, label %50, label %26
26: ; preds = %23
%27 = and i64 %6, 4294967294
br label %33
28: ; preds = %4
%29 = zext i32 %1 to i64
%30 = shl nuw nsw i64 %29, 3
%31 = zext i32 %2 to i64
%32 = mul i64 %30, %31
tail call void @llvm.memset.p0i8.i64(i8* align 8 %12, i8 0, i64 %32, i1 false)
tail call void @llvm.memset.p0i8.i64(i8* align 8 %14, i8 0, i64 %32, i1 false)
br label %126
33: ; preds = %46, %26
%34 = phi i64 [ 0, %26 ], [ %47, %46 ]
%35 = phi i64 [ 0, %26 ], [ %48, %46 ]
%36 = getelementptr inbounds double, double* %17, i64 %34
%37 = load double, double* %36
%38 = fcmp olt double %37, 0.000000e+00
br i1 %38, label %39, label %40
39: ; preds = %33
store double 0.000000e+00, double* %36
br label %40
40: ; preds = %33, %39
%41 = or i64 %34, 1
%42 = getelementptr inbounds double, double* %17, i64 %41
%43 = load double, double* %42
%44 = fcmp olt double %43, 0.000000e+00
br i1 %44, label %45, label %46
45: ; preds = %40
store double 0.000000e+00, double* %42
br label %46
46: ; preds = %45, %40
%47 = add nuw nsw i64 %34, 2
%48 = add i64 %35, 2
%49 = icmp eq i64 %48, %27
br i1 %49, label %50, label %33
50: ; preds = %46, %23
%51 = phi i64 [ 0, %23 ], [ %47, %46 ]
%52 = icmp eq i64 %24, 0
br i1 %52, label %58, label %53
53: ; preds = %50
%54 = getelementptr inbounds double, double* %17, i64 %51
%55 = load double, double* %54
%56 = fcmp olt double %55, 0.000000e+00
br i1 %56, label %57, label %58
57: ; preds = %53
store double 0.000000e+00, double* %54
br label %58
58: ; preds = %53, %57, %50
%59 = zext i32 %1 to i64
%60 = shl nuw nsw i64 %59, 3
%61 = zext i32 %2 to i64
%62 = mul i64 %60, %61
tail call void @llvm.memset.p0i8.i64(i8* align 8 %12, i8 0, i64 %62, i1 false)
tail call void @llvm.memset.p0i8.i64(i8* align 8 %14, i8 0, i64 %62, i1 false)
br i1 %22, label %135, label %63
63: ; preds = %58
%64 = icmp ult i32 %5, 4
br i1 %64, label %117, label %65
65: ; preds = %63
%66 = and i64 %6, 4294967292
%67 = add nsw i64 %66, -4
%68 = lshr exact i64 %67, 2
%69 = add nuw nsw i64 %68, 1
%70 = and i64 %69, 1
%71 = icmp eq i64 %67, 0
br i1 %71, label %101, label %72
72: ; preds = %65
%73 = and i64 %69, 9223372036854775806
br label %74
74: ; preds = %74, %72
%75 = phi i64 [ 0, %72 ], [ %98, %74 ]
%76 = phi i64 [ 0, %72 ], [ %99, %74 ]
%77 = getelementptr inbounds double, double* %0, i64 %75
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = getelementptr inbounds double, double* %77, i64 2
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %79
%84 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %82
%85 = bitcast double* %77 to <2 x double>*
store <2 x double> %83, <2 x double>* %85
%86 = bitcast double* %80 to <2 x double>*
store <2 x double> %84, <2 x double>* %86
%87 = or i64 %75, 4
%88 = getelementptr inbounds double, double* %0, i64 %87
%89 = bitcast double* %88 to <2 x double>*
%90 = load <2 x double>, <2 x double>* %89
%91 = getelementptr inbounds double, double* %88, i64 2
%92 = bitcast double* %91 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %90
%95 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %93
%96 = bitcast double* %88 to <2 x double>*
store <2 x double> %94, <2 x double>* %96
%97 = bitcast double* %91 to <2 x double>*
store <2 x double> %95, <2 x double>* %97
%98 = add nuw i64 %75, 8
%99 = add i64 %76, 2
%100 = icmp eq i64 %99, %73
br i1 %100, label %101, label %74
101: ; preds = %74, %65
%102 = phi i64 [ 0, %65 ], [ %98, %74 ]
%103 = icmp eq i64 %70, 0
br i1 %103, label %115, label %104
104: ; preds = %101
%105 = getelementptr inbounds double, double* %0, i64 %102
%106 = bitcast double* %105 to <2 x double>*
%107 = load <2 x double>, <2 x double>* %106
%108 = getelementptr inbounds double, double* %105, i64 2
%109 = bitcast double* %108 to <2 x double>*
%110 = load <2 x double>, <2 x double>* %109
%111 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %107
%112 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %110
%113 = bitcast double* %105 to <2 x double>*
store <2 x double> %111, <2 x double>* %113
%114 = bitcast double* %108 to <2 x double>*
store <2 x double> %112, <2 x double>* %114
br label %115
115: ; preds = %101, %104
%116 = icmp eq i64 %66, %6
br i1 %116, label %126, label %117
117: ; preds = %63, %115
%118 = phi i64 [ 0, %63 ], [ %66, %115 ]
br label %119
119: ; preds = %117, %119
%120 = phi i64 [ %124, %119 ], [ %118, %117 ]
%121 = getelementptr inbounds double, double* %0, i64 %120
%122 = load double, double* %121
%123 = fsub double 1.000000e+00, %122
store double %123, double* %121
%124 = add nuw nsw i64 %120, 1
%125 = icmp eq i64 %124, %6
br i1 %125, label %126, label %119
126: ; preds = %119, %115, %28
%127 = tail call i32 (double*, i32, i32, double*, double*, ...) bitcast (i32 (...)* @computegradient to i32 (double*, i32, i32, double*, double*, ...)*)(double* %0, i32 %1, i32 %2, double* %13, double* %15)
%128 = tail call i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...) bitcast (i32 (...)* @edtaa3 to i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...)*)(double* %0, double* %13, double* %15, i32 %1, i32 %2, i16* %9, i16* %11, double* %19)
br i1 %22, label %138, label %129
129: ; preds = %126
%130 = add nsw i64 %6, -1
%131 = and i64 %6, 1
%132 = icmp eq i64 %130, 0
br i1 %132, label %156, label %133
133: ; preds = %129
%134 = and i64 %6, 4294967294
br label %139
135: ; preds = %58
%136 = tail call i32 (double*, i32, i32, double*, double*, ...) bitcast (i32 (...)* @computegradient to i32 (double*, i32, i32, double*, double*, ...)*)(double* %0, i32 %1, i32 %2, double* %13, double* %15)
%137 = tail call i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...) bitcast (i32 (...)* @edtaa3 to i32 (double*, double*, double*, i32, i32, i16*, i16*, double*, ...)*)(double* %0, double* %13, double* %15, i32 %1, i32 %2, i16* %9, i16* %11, double* %19)
br label %138
138: ; preds = %135, %126
store double 0.000000e+00, double* %3
br label %235
139: ; preds = %152, %133
%140 = phi i64 [ 0, %133 ], [ %153, %152 ]
%141 = phi i64 [ 0, %133 ], [ %154, %152 ]
%142 = getelementptr inbounds double, double* %19, i64 %140
%143 = load double, double* %142
%144 = fcmp olt double %143, 0.000000e+00
br i1 %144, label %145, label %146
145: ; preds = %139
store double 0.000000e+00, double* %142
br label %146
146: ; preds = %139, %145
%147 = or i64 %140, 1
%148 = getelementptr inbounds double, double* %19, i64 %147
%149 = load double, double* %148
%150 = fcmp olt double %149, 0.000000e+00
br i1 %150, label %151, label %152
151: ; preds = %146
store double 0.000000e+00, double* %148
br label %152
152: ; preds = %151, %146
%153 = add nuw nsw i64 %140, 2
%154 = add i64 %141, 2
%155 = icmp eq i64 %154, %134
br i1 %155, label %156, label %139
156: ; preds = %152, %129
%157 = phi i64 [ 0, %129 ], [ %153, %152 ]
%158 = icmp eq i64 %131, 0
br i1 %158, label %164, label %159
159: ; preds = %156
%160 = getelementptr inbounds double, double* %19, i64 %157
%161 = load double, double* %160
%162 = fcmp olt double %161, 0.000000e+00
br i1 %162, label %163, label %164
163: ; preds = %159
store double 0.000000e+00, double* %160
br label %164
164: ; preds = %159, %163, %156
store double 0.000000e+00, double* %3
br i1 %22, label %235, label %165
165: ; preds = %164
%166 = and i64 %6, 1
%167 = icmp eq i64 %130, 0
br i1 %167, label %170, label %168
168: ; preds = %165
%169 = and i64 %6, 4294967294
br label %186
170: ; preds = %209, %165
%171 = phi double [ undef, %165 ], [ %210, %209 ]
%172 = phi i64 [ 0, %165 ], [ %211, %209 ]
%173 = phi double [ 0.000000e+00, %165 ], [ %210, %209 ]
%174 = icmp eq i64 %166, 0
br i1 %174, label %184, label %175
175: ; preds = %170
%176 = getelementptr inbounds double, double* %19, i64 %172
%177 = load double, double* %176
%178 = getelementptr inbounds double, double* %17, i64 %172
%179 = load double, double* %178
%180 = fsub double %179, %177
store double %180, double* %178
%181 = tail call double @llvm.fabs.f64(double %180)
%182 = fcmp olt double %173, %181
br i1 %182, label %183, label %184
183: ; preds = %175
store double %181, double* %3
br label %184
184: ; preds = %175, %183, %170
%185 = phi double [ %171, %170 ], [ %173, %175 ], [ %181, %183 ]
br i1 %22, label %235, label %214
186: ; preds = %209, %168
%187 = phi i64 [ 0, %168 ], [ %211, %209 ]
%188 = phi double [ 0.000000e+00, %168 ], [ %210, %209 ]
%189 = phi i64 [ 0, %168 ], [ %212, %209 ]
%190 = getelementptr inbounds double, double* %19, i64 %187
%191 = load double, double* %190
%192 = getelementptr inbounds double, double* %17, i64 %187
%193 = load double, double* %192
%194 = fsub double %193, %191
store double %194, double* %192
%195 = tail call double @llvm.fabs.f64(double %194)
%196 = fcmp olt double %188, %195
br i1 %196, label %197, label %198
197: ; preds = %186
store double %195, double* %3
br label %198
198: ; preds = %186, %197
%199 = phi double [ %188, %186 ], [ %195, %197 ]
%200 = or i64 %187, 1
%201 = getelementptr inbounds double, double* %19, i64 %200
%202 = load double, double* %201
%203 = getelementptr inbounds double, double* %17, i64 %200
%204 = load double, double* %203
%205 = fsub double %204, %202
store double %205, double* %203
%206 = tail call double @llvm.fabs.f64(double %205)
%207 = fcmp olt double %199, %206
br i1 %207, label %208, label %209
208: ; preds = %198
store double %206, double* %3
br label %209
209: ; preds = %208, %198
%210 = phi double [ %199, %198 ], [ %206, %208 ]
%211 = add nuw nsw i64 %187, 2
%212 = add i64 %189, 2
%213 = icmp eq i64 %212, %169
br i1 %213, label %170, label %186
214: ; preds = %184, %233
%215 = phi double [ %234, %233 ], [ %185, %184 ]
%216 = phi i64 [ %231, %233 ], [ 0, %184 ]
%217 = getelementptr inbounds double, double* %17, i64 %216
%218 = load double, double* %217
%219 = fneg double %215
%220 = fcmp olt double %218, %219
br i1 %220, label %223, label %221
221: ; preds = %214
%222 = fcmp ogt double %218, %215
br i1 %222, label %223, label %225
223: ; preds = %221, %214
%224 = phi double [ %219, %214 ], [ %215, %221 ]
store double %224, double* %217
br label %225
225: ; preds = %223, %221
%226 = phi double [ %218, %221 ], [ %224, %223 ]
%227 = fadd double %215, %226
%228 = fmul double %215, 2.000000e+00
%229 = fdiv double %227, %228
%230 = getelementptr inbounds double, double* %0, i64 %216
store double %229, double* %230
%231 = add nuw nsw i64 %216, 1
%232 = icmp eq i64 %231, %6
br i1 %232, label %235, label %233
233: ; preds = %225
%234 = load double, double* %3
br label %214
235: ; preds = %225, %164, %138, %184
tail call void @free(i8* %8)
tail call void @free(i8* %10)
tail call void @free(i8* %12)
tail call void @free(i8* %14)
tail call void @free(i8* %16)
tail call void @free(i8* %18)
ret double* %0
}