#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double abs(double);
double pow(double, int);
double sqrt(double);
extern void sammon(double **distance_matrix, double **initial_projection,
                   double **projection_aux, int instances, int max_iter,
                   double magic_factor, double tol) {
  int count;
  double delta_pq = 0.0;
  double c = 0.0;
  double sum_dist_rn = 0.0;
  double sum_dist_r2 = 0.0;
  double sum_inder_1 = 0.0;
  double sum_inder_2 = 0.0;
  int p, q, j;
  double x1x2, y1y2, dist_pj;
  int a, b;
  for (int i = 0; i < max_iter; i++) {
    int count;
    double delta_pq = 0.0;
    double c = 0.0;
    double sum_dist_rn = 0.0;
    double sum_dist_r2 = 0.0;
    double sum_inder_1 = 0.0;
    double sum_inder_2 = 0.0;
    int p, q, j;
    double x1x2, y1y2, dist_pj;
    int a, b;
    sum_dist_rn = 0.0;
    for (a = 0; a < instances; a++) {
      for (b = 0; b < instances; b++) {
        if (distance_matrix[a][b] < tol) {
          distance_matrix[a][b] = tol;
        }
        sum_dist_rn += distance_matrix[a][b];
      }
    }
    c = -2.0 / sum_dist_rn;
    for (p = 0; p < instances; p++) {
      for (q = 0; q < 2; q++) {
        sum_inder_1 = 0.0;
        sum_inder_2 = 0.0;
        for (j = 0; j < instances; j++) {
          if (j != p) {
            x1x2 = projection_aux[p][0] - projection_aux[j][0];
            y1y2 = projection_aux[p][1] - projection_aux[j][1];
            dist_pj = sqrt(abs(x1x2 * x1x2 + y1y2 * y1y2));
            if (dist_pj < tol) {
              dist_pj = tol;
            }
            double d = ((distance_matrix[p][j] - dist_pj) /
                        (distance_matrix[p][j] * dist_pj));
            double e = initial_projection[p][q] - initial_projection[j][q];
            sum_inder_1 += d * e;
            double f = (1 / (distance_matrix[p][j] * dist_pj));
            double g =
                ((distance_matrix[p][j] - dist_pj) -
                 ((pow((initial_projection[p][q] - initial_projection[j][q]),
                       2) /
                   dist_pj) *
                  (1 + ((distance_matrix[p][j] - dist_pj) / dist_pj))));
            sum_inder_2 += f * g;
          }
        }
        delta_pq = ((c * sum_inder_1) / abs(c * sum_inder_2));
        initial_projection[p][q] -= magic_factor * delta_pq;
      }
    }
  }
}


x86 assembly (clang, -O0):
<sammon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movl   $0x0,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    16e6 <sammon+0x5b6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movl   $0x0,-0xfc(%rbp)
mov    -0xfc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12c2 <sammon+0x192>
movl   $0x0,-0x100(%rbp)
mov    -0x100(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12a9 <sammon+0x179>
mov    -0x8(%rbp),%rax
movslq -0xfc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x100(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    126a <sammon+0x13a>
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xfc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x100(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0xfc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x100(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x100(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x100(%rbp)
jmp    1211 <sammon+0xe1>
jmp    12ae <sammon+0x17e>
mov    -0xfc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc(%rbp)
jmp    11f8 <sammon+0xc8>
movsd  0xd36(%rip),%xmm0
divsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movl   $0x0,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    16cd <sammon+0x59d>
movl   $0x0,-0xd8(%rbp)
cmpl   $0x2,-0xd8(%rbp)
jge    16b4 <sammon+0x584>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movl   $0x0,-0xdc(%rbp)
mov    -0xdc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1610 <sammon+0x4e0>
mov    -0xdc(%rbp),%eax
cmp    -0xd4(%rbp),%eax
je     15f7 <sammon+0x4c7>
mov    -0x18(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movslq -0xdc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
mov    -0x18(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movslq -0xdc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0xe8(%rbp),%xmm0
ff
movsd  -0xe8(%rbp),%xmm2
ff
movsd  -0xf0(%rbp),%xmm1
ff
mulsd  -0xf0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <abs@plt>
call   1050 <sqrt@plt>
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0xf8(%rbp),%xmm1
ff
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1407 <sammon+0x2d7>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
mov    -0x8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xdc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0xf8(%rbp),%xmm0
ff
mov    -0x8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xdc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  -0xf8(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
mov    -0x10(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xdc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd8(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0x108(%rbp),%xmm0
ff
movsd  -0x110(%rbp),%xmm2
ff
movsd  -0xc8(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xdc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  -0xf8(%rbp),%xmm1
ff
movsd  0xb1e(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
mov    -0x8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xdc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0xf8(%rbp),%xmm0
ff
movsd  %xmm0,-0x128(%rbp)
ff
mov    -0x10(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xdc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd8(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  -0x128(%rbp),%xmm1
ff
divsd  -0xf8(%rbp),%xmm0
ff
mov    -0x8(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xdc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
subsd  -0xf8(%rbp),%xmm3
ff
divsd  -0xf8(%rbp),%xmm3
ff
movsd  0xa64(%rip),%xmm2
addsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x118(%rbp),%xmm0
ff
movsd  -0x120(%rbp),%xmm2
ff
movsd  -0xd0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
jmp    15fc <sammon+0x4cc>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    132a <sammon+0x1fa>
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x130(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  -0xd0(%rbp),%xmm0
ff
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movsd  -0x130(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  -0xa8(%rbp),%xmm2
ff
mov    -0x10(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xd8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    12fd <sammon+0x1cd>
jmp    16b9 <sammon+0x589>
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    12e4 <sammon+0x1b4>
jmp    16d2 <sammon+0x5a2>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    1192 <sammon+0x62>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sammon>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movapd %xmm0,0x40(%rsp)
mov    %rdx,0x38(%rsp)
mov    %r8d,0x2c(%rsp)
test   %r8d,%r8d
jle    1543 <sammon+0x413>
mov    %rsi,%r12
mov    %rdi,%r13
movapd 0x40(%rsp),%xmm0
xorpd  0xe92(%rip),%xmm0
movapd %xmm0,0x40(%rsp)
mov    %ecx,%ebx
mov    %ebx,%eax
and    $0xfffffffe,%eax
mov    %rax,0x88(%rsp)
xor    %eax,%eax
movsd  %xmm1,(%rsp)
mov    %ecx,0xc(%rsp)
jmp    11a9 <sammon+0x79>
mov    0x90(%rsp),%rax
add    $0x1,%eax
cmp    0x2c(%rsp),%eax
mov    0xc(%rsp),%ecx
je     1543 <sammon+0x413>
mov    %rax,0x90(%rsp)
test   %ecx,%ecx
jle    1190 <sammon+0x60>
xorpd  %xmm0,%xmm0
xor    %eax,%eax
mov    0xc(%rsp),%esi
mov    0x88(%rsp),%rdi
jmp    11dd <sammon+0xad>
nopl   0x0(%rax)
addsd  %xmm2,%xmm0
add    $0x1,%rax
cmp    %rbx,%rax
je     1250 <sammon+0x120>
mov    0x0(%r13,%rax,8),%rcx
xor    %edx,%edx
cmp    $0x1,%esi
jne    1221 <sammon+0xf1>
test   $0x1,%bl
je     11d4 <sammon+0xa4>
movsd  (%rcx,%rdx,8),%xmm2
ucomisd %xmm2,%xmm1
jbe    11d0 <sammon+0xa0>
movsd  %xmm1,(%rcx,%rdx,8)
movapd %xmm1,%xmm2
jmp    11d0 <sammon+0xa0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
add    $0x2,%rdx
cmp    %rdx,%rdi
je     11e9 <sammon+0xb9>
movsd  (%rcx,%rdx,8),%xmm3
ucomisd %xmm3,%xmm1
jbe    1235 <sammon+0x105>
movsd  %xmm1,(%rcx,%rdx,8)
movapd %xmm1,%xmm3
movsd  0x8(%rcx,%rdx,8),%xmm2
ucomisd %xmm2,%xmm1
jbe    1210 <sammon+0xe0>
movsd  %xmm1,0x8(%rcx,%rdx,8)
movapd %xmm1,%xmm2
jmp    1210 <sammon+0xe0>
nopl   (%rax)
test   %esi,%esi
jle    1190 <sammon+0x60>
movsd  0xdc0(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%rsp)
xor    %r15d,%r15d
jmp    12c1 <sammon+0x191>
nop
movsd  0x30(%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
unpckhpd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
call   1030 <abs@plt>
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    (%r12,%r15,8),%rax
mulsd  0x40(%rsp),%xmm1
addsd  0x8(%rax),%xmm1
movsd  %xmm1,0x8(%rax)
add    $0x1,%r15
cmp    %rbx,%r15
movsd  (%rsp),%xmm1
je     1190 <sammon+0x60>
xorpd  %xmm2,%xmm2
xor    %r14d,%r14d
jmp    138d <sammon+0x25d>
nopl   (%rax)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm1
maxsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
mov    0x0(%r13,%r15,8),%rax
movsd  (%rax,%r14,8),%xmm3
movapd %xmm3,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,0x60(%rsp)
mov    (%r12,%r15,8),%rax
movsd  (%rax),%xmm0
mov    (%r12,%r14,8),%rax
subsd  (%rax),%xmm0
movapd %xmm0,0x50(%rsp)
mulsd  %xmm1,%xmm3
movapd 0xcf1(%rip),%xmm1
unpcklpd %xmm2,%xmm1
unpcklpd %xmm3,%xmm3
divpd  %xmm3,%xmm1
movapd %xmm1,0x70(%rsp)
mov    $0x2,%edi
call   1040 <pow@plt>
mov    0x0(%r13,%r15,8),%rax
movsd  (%rax,%r14,8),%xmm1
movsd  0x20(%rsp),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm2,%xmm1
addsd  0xccc(%rip),%xmm1
divsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movapd 0x60(%rsp),%xmm1
subsd  %xmm0,%xmm1
unpcklpd 0x50(%rsp),%xmm1
mulpd  0x70(%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
addpd  %xmm1,%xmm2
add    $0x1,%r14
cmp    %r14,%rbx
je     13e0 <sammon+0x2b0>
cmp    %r14,%r15
je     1384 <sammon+0x254>
movapd %xmm2,0x10(%rsp)
mov    0x38(%rsp),%rcx
mov    (%rcx,%r15,8),%rax
mov    (%rcx,%r14,8),%rcx
movsd  (%rax),%xmm0
movsd  0x8(%rax),%xmm1
subsd  (%rcx),%xmm0
subsd  0x8(%rcx),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <abs@plt>
ucomisd 0xc60(%rip),%xmm0
jb     12d0 <sammon+0x1a0>
sqrtsd %xmm0,%xmm0
jmp    12d5 <sammon+0x1a5>
nop
movsd  0x30(%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
unpckhpd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
call   1030 <abs@plt>
movapd 0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
mov    (%r12,%r15,8),%rax
mulsd  0x40(%rsp),%xmm1
addsd  (%rax),%xmm1
movsd  %xmm1,(%rax)
xorpd  %xmm2,%xmm2
xor    %ebp,%ebp
jmp    14f1 <sammon+0x3c1>
nopl   0x0(%rax,%rax,1)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm1
maxsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
mov    0x0(%r13,%r15,8),%rax
movsd  (%rax,%rbp,8),%xmm3
movapd %xmm3,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,0x60(%rsp)
mov    (%r12,%r15,8),%rax
movsd  0x8(%rax),%xmm0
mov    (%r12,%rbp,8),%rax
subsd  0x8(%rax),%xmm0
movapd %xmm0,0x50(%rsp)
mulsd  %xmm1,%xmm3
movapd 0xb90(%rip),%xmm1
unpcklpd %xmm2,%xmm1
unpcklpd %xmm3,%xmm3
divpd  %xmm3,%xmm1
movapd %xmm1,0x70(%rsp)
mov    $0x2,%edi
call   1040 <pow@plt>
mov    0x0(%r13,%r15,8),%rax
movsd  (%rax,%rbp,8),%xmm1
movsd  0x20(%rsp),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm2,%xmm1
addsd  0xb6c(%rip),%xmm1
divsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movapd 0x60(%rsp),%xmm1
subsd  %xmm0,%xmm1
unpcklpd 0x50(%rsp),%xmm1
mulpd  0x70(%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
addpd  %xmm1,%xmm2
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1270 <sammon+0x140>
cmp    %rbp,%r15
je     14e4 <sammon+0x3b4>
movapd %xmm2,0x10(%rsp)
mov    0x38(%rsp),%rcx
mov    (%rcx,%r15,8),%rax
mov    (%rcx,%rbp,8),%rcx
movsd  (%rax),%xmm0
movsd  0x8(%rax),%xmm1
subsd  (%rcx),%xmm0
subsd  0x8(%rcx),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <abs@plt>
ucomisd 0xafc(%rip),%xmm0
jb     1430 <sammon+0x300>
sqrtsd %xmm0,%xmm0
jmp    1435 <sammon+0x305>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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