#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 */
scalar_t__ RAND_MAX;
double ed(double *, int, int, int);
int getpid();
double neighbours_stress(double *, double *, int, int, double);
int rand();
int /*<<< orphan*/ srand(scalar_t__);
scalar_t__ time(int /*<<< orphan*/ *);
size_t trmIndex(int, int);
double CStochasticProximityEmbedding(double *s, double *d_coords, double rco,
                                     int nelem, int dim, double maxlam,
                                     double minlam, int ncycle, int nstep,
                                     int stressfreq) {
  int a = 0, b = 0, idxa = 0, idxb = 0, idxak = 0, idxbk = 0;
  double dab = 0.0, rab = 0.0;
  double lam = maxlam;
  double t = 0.0;
  double finalstress = 0.0;
  srand(time(NULL) + getpid() * getpid());
  for (int i = 0; i < nelem * dim; i++) {
    d_coords[i] = (double)rand() / (double)RAND_MAX;
  }
  for (int i = 0; i < ncycle; i++) {
    for (int j = 0; j < nstep; j++) {
      a = rand() % nelem;
      while (1) {
        b = rand() % nelem;
        if (b != a)
          break;
      }
      dab = ed(d_coords, a, b, dim);
      rab = s[trmIndex(a, b)];
      if (rab <= rco || (rab > rco && dab < rab)) {
        idxa = a * dim;
        idxb = b * dim;
        t = lam * 0.5 * (rab - dab) / (dab + 1e-8);
        for (int k = 0; k < dim; k++) {
          idxak = idxa + k;
          idxbk = idxb + k;
          d_coords[idxak] =
              d_coords[idxak] + t * (d_coords[idxak] - d_coords[idxbk]);
          d_coords[idxbk] =
              d_coords[idxbk] + t * (d_coords[idxbk] - d_coords[idxak]);
        }
      }
    }
    lam = lam - (maxlam - minlam) / (double)(ncycle - 1);
  }
  finalstress = neighbours_stress(s, d_coords, dim, nelem, rco);
  return (finalstress);
}


x86 assembly (clang, -O0):
<CStochasticProximityEmbedding>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
mov    %r9d,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %rax,-0x98(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x8c(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x98(%rbp),%rdi
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
imul   %ecx,%eax
cltq
add    %rax,%rdi
call   1060 <srand@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
imul   -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    1286 <CStochasticProximityEmbedding+0x116>
mov    $0x0,%al
call   1090 <rand@plt>
cvtsi2sd %eax,%xmm0
mov    0x2d86(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    123e <CStochasticProximityEmbedding+0xce>
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    14bb <CStochasticProximityEmbedding+0x34b>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1487 <CStochasticProximityEmbedding+0x317>
mov    $0x0,%al
call   1090 <rand@plt>
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x3c(%rbp)
mov    $0x0,%al
call   1090 <rand@plt>
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
je     12df <CStochasticProximityEmbedding+0x16f>
jmp    12e4 <CStochasticProximityEmbedding+0x174>
jmp    12c0 <CStochasticProximityEmbedding+0x150>
mov    -0x10(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1070 <ed@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x40(%rbp),%esi
call   1050 <trmIndex@plt>
mov    %rax,%rcx
mov    -0xa0(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jae    135d <CStochasticProximityEmbedding+0x1ed>
movsd  -0x60(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    146e <CStochasticProximityEmbedding+0x2fe>
movsd  -0x58(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    146e <CStochasticProximityEmbedding+0x2fe>
mov    -0x3c(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0x48(%rbp)
movsd  0xc8f(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
subsd  -0x58(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc6c(%rip),%xmm1
addsd  -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1469 <CStochasticProximityEmbedding+0x2f9>
mov    -0x44(%rbp),%eax
add    -0x88(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%eax
add    -0x88(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x70(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x50(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x70(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    13ac <CStochasticProximityEmbedding+0x23c>
jmp    146e <CStochasticProximityEmbedding+0x2fe>
jmp    1473 <CStochasticProximityEmbedding+0x303>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    12a3 <CStochasticProximityEmbedding+0x133>
movsd  -0x68(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    128d <CStochasticProximityEmbedding+0x11d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%ecx
movsd  -0x18(%rbp),%xmm0
call   1030 <neighbours_stress@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CStochasticProximityEmbedding>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9d,0x14(%rsp)
mov    %r8,0x20(%rsp)
movsd  %xmm2,0x30(%rsp)
movsd  %xmm1,0x18(%rsp)
mov    %ecx,%ebx
mov    %edx,%ebp
movsd  %xmm0,0x28(%rsp)
mov    %rsi,%r14
mov    %rdi,0x40(%rsp)
xor    %edi,%edi
call   1080 <time@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   1040 <getpid@plt>
imul   %r13d,%eax
mov    %r14,%r12
movslq %eax,%rdi
add    %r15,%rdi
call   1060 <srand@plt>
mov    %ebx,0x4(%rsp)
imul   %ebp,%ebx
test   %ebx,%ebx
jle    1219 <CStochasticProximityEmbedding+0xa9>
mov    %ebx,%r15d
mov    0x2dfd(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
xor    %eax,%eax
call   1090 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11f0 <CStochasticProximityEmbedding+0x80>
mov    %r12,0x8(%rsp)
cmpl   $0x0,0x20(%rsp)
mov    0x14(%rsp),%ebx
jle    1541 <CStochasticProximityEmbedding+0x3d1>
movsd  0x18(%rsp),%xmm1
subsd  0x30(%rsp),%xmm1
mov    0x20(%rsp),%rax
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x48(%rsp)
mov    0x4(%rsp),%r14d
mov    0x8(%rsp),%rax
lea    (%rax,%r14,8),%rcx
mov    %rcx,0x78(%rsp)
mov    %r14d,%ecx
and    $0xfffffffe,%ecx
mov    %rcx,0x70(%rsp)
add    $0xfffffffffffffffe,%rcx
mov    %rcx,0x68(%rsp)
mov    %rcx,%rdx
shr    %rdx
add    $0x1,%rdx
mov    %rdx,%rcx
mov    %rdx,0x60(%rsp)
and    $0xfffffffffffffffe,%rdx
mov    %rdx,0x58(%rsp)
add    $0x10,%rax
mov    %rax,0x50(%rsp)
xor    %eax,%eax
jmp    12d3 <CStochasticProximityEmbedding+0x163>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  0x18(%rsp),%xmm0
subsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    0x3c(%rsp),%eax
add    $0x1,%eax
cmp    0x20(%rsp),%eax
je     1541 <CStochasticProximityEmbedding+0x3d1>
mov    %eax,0x3c(%rsp)
test   %ebx,%ebx
jle    12b0 <CStochasticProximityEmbedding+0x140>
movsd  0x18(%rsp),%xmm0
mulsd  0xd17(%rip),%xmm0
movsd  %xmm0,0x80(%rsp)
xor    %r12d,%r12d
jmp    1309 <CStochasticProximityEmbedding+0x199>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    %ebx,%r12d
je     12b0 <CStochasticProximityEmbedding+0x140>
xor    %eax,%eax
call   1090 <rand@plt>
cltd
idiv   %ebp
mov    %edx,%r15d
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <rand@plt>
cltd
idiv   %ebp
cmp    %r15d,%edx
je     1320 <CStochasticProximityEmbedding+0x1b0>
mov    %edx,%r13d
mov    0x8(%rsp),%rdi
mov    %r15d,%esi
mov    0x4(%rsp),%ecx
call   1070 <ed@plt>
movsd  %xmm0,0x30(%rsp)
mov    %r15d,%edi
mov    %r13d,%esi
call   1050 <trmIndex@plt>
movsd  0x30(%rsp),%xmm2
mov    0x40(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  0x28(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    137e <CStochasticProximityEmbedding+0x20e>
ucomisd 0x28(%rsp),%xmm0
jbe    1300 <CStochasticProximityEmbedding+0x190>
ucomisd %xmm2,%xmm0
jbe    1300 <CStochasticProximityEmbedding+0x190>
movapd %xmm2,%xmm1
addsd  0xc7e(%rip),%xmm1
cmpl   $0x0,0x4(%rsp)
jle    1300 <CStochasticProximityEmbedding+0x190>
subsd  %xmm2,%xmm0
mulsd  0x80(%rsp),%xmm0
divsd  %xmm1,%xmm0
mov    0x4(%rsp),%edx
imul   %edx,%r13d
imul   %edx,%r15d
movslq %r15d,%rax
movslq %r13d,%rcx
cmp    $0x1,%edx
je     13e1 <CStochasticProximityEmbedding+0x271>
mov    0x8(%rsp),%r8
lea    (%r8,%rax,8),%rdx
mov    0x78(%rsp),%rdi
lea    (%rdi,%rcx,8),%rsi
cmp    %rsi,%rdx
jae    1433 <CStochasticProximityEmbedding+0x2c3>
lea    (%rdi,%rax,8),%rdx
lea    (%r8,%rcx,8),%rsi
cmp    %rdx,%rsi
jae    1433 <CStochasticProximityEmbedding+0x2c3>
xor    %edx,%edx
mov    0x8(%rsp),%rsi
lea    (%rsi,%rcx,8),%rcx
lea    (%rsi,%rax,8),%rax
movsd  (%rax,%rdx,8),%xmm1
movapd %xmm1,%xmm2
subsd  (%rcx,%rdx,8),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rax,%rdx,8)
movsd  (%rcx,%rdx,8),%xmm1
movapd %xmm1,%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,(%rcx,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%r14
jne    13f0 <CStochasticProximityEmbedding+0x280>
jmp    1300 <CStochasticProximityEmbedding+0x190>
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
cmpq   $0x0,0x68(%rsp)
je     1536 <CStochasticProximityEmbedding+0x3c6>
mov    0x50(%rsp),%rdx
lea    (%rdx,%rax,8),%rsi
lea    (%rdx,%rcx,8),%rdi
mov    0x58(%rsp),%rbx
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movupd -0x10(%rsi,%rdx,8),%xmm2
movupd -0x10(%rdi,%rdx,8),%xmm3
movapd %xmm2,%xmm4
subpd  %xmm3,%xmm4
mulpd  %xmm1,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm4,-0x10(%rsi,%rdx,8)
movapd %xmm3,%xmm2
subpd  %xmm4,%xmm2
mulpd  %xmm1,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm2,-0x10(%rdi,%rdx,8)
movupd (%rsi,%rdx,8),%xmm2
movupd (%rdi,%rdx,8),%xmm3
movapd %xmm2,%xmm4
subpd  %xmm3,%xmm4
mulpd  %xmm1,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm4,(%rsi,%rdx,8)
movapd %xmm3,%xmm2
subpd  %xmm4,%xmm2
mulpd  %xmm1,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm2,(%rdi,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rbx
jne    1460 <CStochasticProximityEmbedding+0x2f0>
testb  $0x1,0x60(%rsp)
je     151c <CStochasticProximityEmbedding+0x3ac>
lea    (%rdx,%rax,1),%rsi
add    %rcx,%rdx
movupd (%r8,%rsi,8),%xmm2
movupd (%r8,%rdx,8),%xmm3
movapd %xmm2,%xmm4
subpd  %xmm3,%xmm4
mulpd  %xmm1,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm4,(%r8,%rsi,8)
movapd %xmm3,%xmm2
subpd  %xmm4,%xmm2
mulpd  %xmm1,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm2,(%r8,%rdx,8)
mov    0x70(%rsp),%rsi
mov    %rsi,%rdx
cmp    %r14,%rsi
mov    0x14(%rsp),%ebx
je     1300 <CStochasticProximityEmbedding+0x190>
jmp    13e3 <CStochasticProximityEmbedding+0x273>
xor    %edx,%edx
testb  $0x1,0x60(%rsp)
jne    14dd <CStochasticProximityEmbedding+0x36d>
jmp    151c <CStochasticProximityEmbedding+0x3ac>
mov    0x40(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    0x4(%rsp),%edx
mov    %ebp,%ecx
movsd  0x28(%rsp),%xmm0
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <neighbours_stress@plt>

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

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @CStochasticProximityEmbedding(double* %0, double* %1, double %2, i32 %3, i32 %4, double %5, double %6, i32 %7, i32 %8, i32 %9) {
%11 = tail call i64 @time(i32* null)
%12 = tail call i32 (...) @getpid()
%13 = tail call i32 (...) @getpid()
%14 = mul nsw i32 %13, %12
%15 = sext i32 %14 to i64
%16 = add nsw i64 %11, %15
%17 = tail call i32 @srand(i64 %16)
%18 = mul i32 %4, %3
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %10
%21 = zext i32 %18 to i64
br label %45
22: ; preds = %45, %10
%23 = icmp sgt i32 %7, 0
br i1 %23, label %24, label %60
24: ; preds = %22
%25 = icmp sgt i32 %8, 0
%26 = icmp sgt i32 %4, 0
%27 = fsub double %5, %6
%28 = add nsw i32 %7, -1
%29 = sitofp i32 %28 to double
%30 = fdiv double %27, %29
%31 = zext i32 %4 to i64
%32 = getelementptr double, double* %1, i64 %31
%33 = getelementptr double, double* %1, i64 %31
%34 = and i64 %31, 4294967294
%35 = add nsw i64 %34, -2
%36 = lshr exact i64 %35, 1
%37 = add nuw i64 %36, 1
%38 = icmp eq i32 %4, 1
%39 = and i64 %31, 4294967294
%40 = and i64 %37, 1
%41 = icmp eq i64 %35, 0
%42 = and i64 %37, -2
%43 = icmp eq i64 %40, 0
%44 = icmp eq i64 %39, %31
br label %55
45: ; preds = %20, %45
%46 = phi i64 [ 0, %20 ], [ %53, %45 ]
%47 = tail call i32 (...) @rand()
%48 = sitofp i32 %47 to double
%49 = load i64, i64* @RAND_MAX
%50 = sitofp i64 %49 to double
%51 = fdiv double %48, %50
%52 = getelementptr inbounds double, double* %1, i64 %46
store double %51, double* %52
%53 = add nuw nsw i64 %46, 1
%54 = icmp eq i64 %53, %21
br i1 %54, label %22, label %45
55: ; preds = %24, %62
%56 = phi i32 [ 0, %24 ], [ %64, %62 ]
%57 = phi double [ %5, %24 ], [ %63, %62 ]
br i1 %25, label %58, label %62
58: ; preds = %55
%59 = fmul double %57, 5.000000e-01
br label %66
60: ; preds = %62, %22
%61 = tail call double @neighbours_stress(double* %0, double* %1, i32 %4, i32 %3, double %2)
ret double %61
62: ; preds = %175, %55
%63 = fsub double %57, %30
%64 = add nuw nsw i32 %56, 1
%65 = icmp eq i32 %64, %7
br i1 %65, label %60, label %55
66: ; preds = %58, %175
%67 = phi i32 [ 0, %58 ], [ %176, %175 ]
%68 = tail call i32 (...) @rand()
%69 = srem i32 %68, %3
br label %70
70: ; preds = %70, %66
%71 = tail call i32 (...) @rand()
%72 = srem i32 %71, %3
%73 = icmp eq i32 %72, %69
br i1 %73, label %70, label %74
74: ; preds = %70
%75 = tail call double @ed(double* %1, i32 %69, i32 %72, i32 %4)
%76 = tail call i64 @trmIndex(i32 %69, i32 %72)
%77 = getelementptr inbounds double, double* %0, i64 %76
%78 = load double, double* %77
%79 = fcmp ugt double %78, %2
br i1 %79, label %80, label %84
80: ; preds = %74
%81 = fcmp ogt double %78, %2
%82 = fcmp olt double %75, %78
%83 = select i1 %81, i1 %82, i1 false
br i1 %83, label %84, label %175
84: ; preds = %80, %74
%85 = fsub double %78, %75
%86 = fmul double %59, %85
%87 = fadd double %75, 1.000000e-08
%88 = fdiv double %86, %87
br i1 %26, label %89, label %175
89: ; preds = %84
%90 = mul nsw i32 %72, %4
%91 = mul nsw i32 %69, %4
%92 = sext i32 %91 to i64
%93 = sext i32 %90 to i64
br i1 %38, label %158, label %94
94: ; preds = %89
%95 = getelementptr double, double* %1, i64 %92
%96 = getelementptr double, double* %32, i64 %92
%97 = getelementptr double, double* %1, i64 %93
%98 = getelementptr double, double* %33, i64 %93
%99 = icmp ult double* %95, %98
%100 = icmp ult double* %97, %96
%101 = and i1 %99, %100
br i1 %101, label %158, label %102
102: ; preds = %94
%103 = insertelement <2 x double> poison, double %88, i64 0
%104 = shufflevector <2 x double> %103, <2 x double> poison, <2 x i32> zeroinitializer
br i1 %41, label %140, label %105
105: ; preds = %102, %105
%106 = phi i64 [ %137, %105 ], [ 0, %102 ]
%107 = phi i64 [ %138, %105 ], [ 0, %102 ]
%108 = add nsw i64 %106, %92
%109 = add nsw i64 %106, %93
%110 = getelementptr inbounds double, double* %1, i64 %108
%111 = bitcast double* %110 to <2 x double>*
%112 = load <2 x double>, <2 x double>* %111
%113 = getelementptr inbounds double, double* %1, i64 %109
%114 = bitcast double* %113 to <2 x double>*
%115 = load <2 x double>, <2 x double>* %114
%116 = fsub <2 x double> %112, %115
%117 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %104, <2 x double> %116, <2 x double> %112)
%118 = bitcast double* %110 to <2 x double>*
store <2 x double> %117, <2 x double>* %118
%119 = fsub <2 x double> %115, %117
%120 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %104, <2 x double> %119, <2 x double> %115)
%121 = bitcast double* %113 to <2 x double>*
store <2 x double> %120, <2 x double>* %121
%122 = or i64 %106, 2
%123 = add nsw i64 %122, %92
%124 = add nsw i64 %122, %93
%125 = getelementptr inbounds double, double* %1, i64 %123
%126 = bitcast double* %125 to <2 x double>*
%127 = load <2 x double>, <2 x double>* %126
%128 = getelementptr inbounds double, double* %1, i64 %124
%129 = bitcast double* %128 to <2 x double>*
%130 = load <2 x double>, <2 x double>* %129
%131 = fsub <2 x double> %127, %130
%132 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %104, <2 x double> %131, <2 x double> %127)
%133 = bitcast double* %125 to <2 x double>*
store <2 x double> %132, <2 x double>* %133
%134 = fsub <2 x double> %130, %132
%135 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %104, <2 x double> %134, <2 x double> %130)
%136 = bitcast double* %128 to <2 x double>*
store <2 x double> %135, <2 x double>* %136
%137 = add nuw i64 %106, 4
%138 = add nuw i64 %107, 2
%139 = icmp eq i64 %138, %42
br i1 %139, label %140, label %105
140: ; preds = %105, %102
%141 = phi i64 [ 0, %102 ], [ %137, %105 ]
br i1 %43, label %157, label %142
142: ; preds = %140
%143 = add nsw i64 %141, %92
%144 = add nsw i64 %141, %93
%145 = getelementptr inbounds double, double* %1, i64 %143
%146 = bitcast double* %145 to <2 x double>*
%147 = load <2 x double>, <2 x double>* %146
%148 = getelementptr inbounds double, double* %1, i64 %144
%149 = bitcast double* %148 to <2 x double>*
%150 = load <2 x double>, <2 x double>* %149
%151 = fsub <2 x double> %147, %150
%152 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %104, <2 x double> %151, <2 x double> %147)
%153 = bitcast double* %145 to <2 x double>*
store <2 x double> %152, <2 x double>* %153
%154 = fsub <2 x double> %150, %152
%155 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %104, <2 x double> %154, <2 x double> %150)
%156 = bitcast double* %148 to <2 x double>*
store <2 x double> %155, <2 x double>* %156
br label %157
157: ; preds = %140, %142
br i1 %44, label %175, label %158
158: ; preds = %94, %89, %157
%159 = phi i64 [ 0, %94 ], [ 0, %89 ], [ %39, %157 ]
br label %160
160: ; preds = %158, %160
%161 = phi i64 [ %173, %160 ], [ %159, %158 ]
%162 = add nsw i64 %161, %92
%163 = add nsw i64 %161, %93
%164 = getelementptr inbounds double, double* %1, i64 %162
%165 = load double, double* %164
%166 = getelementptr inbounds double, double* %1, i64 %163
%167 = load double, double* %166
%168 = fsub double %165, %167
%169 = tail call double @llvm.fmuladd.f64(double %88, double %168, double %165)
store double %169, double* %164
%170 = load double, double* %166
%171 = fsub double %170, %169
%172 = tail call double @llvm.fmuladd.f64(double %88, double %171, double %170)
store double %172, double* %166
%173 = add nuw nsw i64 %161, 1
%174 = icmp eq i64 %173, %31
br i1 %174, label %175, label %160
175: ; preds = %160, %157, %84, %80
%176 = add nuw nsw i32 %67, 1
%177 = icmp eq i32 %176, %8
br i1 %177, label %62, label %66
}