#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 exp(double);
int integerrng(int, int);
double log(int);
double uniformrng();
void CO_select_forward_3(double *prob, int *n1, int *n2, double *fx,
                         int N_population, double temp) {
  int i;
  int j;
  double pr_max;
  double pr_sum;
  double pr_cum;
  double un;
  pr_max = (-fx[2] - fx[1]);
  for (i = 2; i <= N_population; i++)
    for (j = 1; j <= i - 1; j++)
      if ((-fx[i] - fx[j]) > pr_max)
        pr_max = (-fx[i] - fx[j]);
  pr_sum = 0.0;
  for (i = 2; i <= N_population; i++)
    for (j = 1; j <= i - 1; j++)
      pr_sum += exp((-fx[i] - fx[j]) / temp - pr_max / temp);
  if (pr_sum > 0.0) {
    un = uniformrng();
    pr_cum = 0.0;
    for (i = 2; i <= N_population; i++)
      for (j = 1; j <= i - 1; j++) {
        pr_cum += exp((-fx[i] - fx[j]) / temp - pr_max / temp) / pr_sum;
        if (pr_cum >= un)
          goto labels_found;
      }
  labels_found:
    *n1 = i;
    *n2 = j;
  } else {
    *n1 = integerrng(1, N_population);
    *n2 = (int)integerrng(1, N_population - 1);
  }
  if (pr_sum != 0)
    *prob = exp((-fx[*n1] - fx[*n2]) / temp - pr_max / temp) / pr_sum;
  else
    *prob = log(2.0) - log(N_population) - log(N_population - 1.0);
}


x86 assembly (clang, -O0):
<CO_select_forward_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x2,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1252 <CO_select_forward_3+0x112>
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     123f <CO_select_forward_3+0xff>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    122c <CO_select_forward_3+0xec>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1231 <CO_select_forward_3+0xf1>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11a9 <CO_select_forward_3+0x69>
jmp    1244 <CO_select_forward_3+0x104>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1196 <CO_select_forward_3+0x56>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x2,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     12f9 <CO_select_forward_3+0x1b9>
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     12e6 <CO_select_forward_3+0x1a6>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
subsd  %xmm1,%xmm0
call   1050 <exp@plt>
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1274 <CO_select_forward_3+0x134>
jmp    12eb <CO_select_forward_3+0x1ab>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1261 <CO_select_forward_3+0x121>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13f9 <CO_select_forward_3+0x2b9>
mov    $0x0,%al
call   1030 <uniformrng@plt>
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x2,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     13dd <CO_select_forward_3+0x29d>
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     13ca <CO_select_forward_3+0x28a>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
subsd  %xmm1,%xmm0
call   1050 <exp@plt>
divsd  -0x48(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
jb     13b7 <CO_select_forward_3+0x277>
jmp    13e2 <CO_select_forward_3+0x2a2>
jmp    13bc <CO_select_forward_3+0x27c>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1339 <CO_select_forward_3+0x1f9>
jmp    13cf <CO_select_forward_3+0x28f>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1326 <CO_select_forward_3+0x1e6>
jmp    13e2 <CO_select_forward_3+0x2a2>
mov    -0x34(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1426 <CO_select_forward_3+0x2e6>
mov    -0x24(%rbp),%esi
mov    $0x1,%edi
call   1040 <integerrng@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%esi
sub    $0x1,%esi
mov    $0x1,%edi
call   1040 <integerrng@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1443 <CO_select_forward_3+0x303>
jp     1443 <CO_select_forward_3+0x303>
jmp    14a4 <CO_select_forward_3+0x364>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq (%rcx),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
subsd  %xmm1,%xmm0
call   1050 <exp@plt>
divsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    14fa <CO_select_forward_3+0x3ba>
mov    $0x2,%edi
call   1060 <log@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x24(%rbp),%edi
call   1060 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xb27(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CO_select_forward_3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movapd %xmm0,%xmm3
mov    %r8d,%r15d
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %rdi,%r13
movsd  0x10(%rcx),%xmm0
movapd 0xe92(%rip),%xmm5
xorpd  %xmm0,%xmm5
subsd  0x8(%rcx),%xmm5
cmp    $0x2,%r8d
movapd %xmm3,0x30(%rsp)
jge    1197 <CO_select_forward_3+0x57>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm5,0x20(%rsp)
jmp    1436 <CO_select_forward_3+0x2f6>
mov    %r14,0x10(%rsp)
mov    %rbp,0x18(%rsp)
lea    0x1(%r15),%r14d
mov    $0x2,%eax
mov    $0x1,%ecx
xor    %edx,%edx
movapd 0xe47(%rip),%xmm4
nopl   0x0(%rax)
mov    %rdx,%rsi
add    $0x1,%rdx
xorpd  %xmm4,%xmm0
cmp    $0x3,%rsi
jae    11e0 <CO_select_forward_3+0xa0>
mov    $0x1,%esi
jmp    1235 <CO_select_forward_3+0xf5>
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rdi
and    $0xfffffffffffffffc,%rdi
xor    %esi,%esi
nopl   0x0(%rax)
movapd %xmm0,%xmm1
subsd  0x8(%rbx,%rsi,8),%xmm1
maxsd  %xmm5,%xmm1
movapd %xmm0,%xmm2
subsd  0x10(%rbx,%rsi,8),%xmm2
maxsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
subsd  0x18(%rbx,%rsi,8),%xmm1
movapd %xmm0,%xmm5
subsd  0x20(%rbx,%rsi,8),%xmm5
maxsd  %xmm2,%xmm1
maxsd  %xmm1,%xmm5
add    $0x4,%rsi
cmp    %rsi,%rdi
jne    11f0 <CO_select_forward_3+0xb0>
add    $0x1,%rsi
movapd %xmm5,%xmm1
test   $0x3,%dl
je     126a <CO_select_forward_3+0x12a>
mov    %ecx,%edi
and    $0x3,%edi
lea    (%rbx,%rsi,8),%rsi
xor    %ebp,%ebp
nopl   0x0(%rax)
movapd %xmm0,%xmm1
subsd  (%rsi,%rbp,8),%xmm1
maxsd  %xmm5,%xmm1
add    $0x1,%rbp
movapd %xmm1,%xmm5
cmp    %rbp,%rdi
jne    1250 <CO_select_forward_3+0x110>
add    $0x1,%rax
cmp    %r14,%rax
je     1285 <CO_select_forward_3+0x145>
movsd  (%rbx,%rax,8),%xmm0
add    $0x1,%rcx
movapd %xmm1,%xmm5
jmp    11c0 <CO_select_forward_3+0x80>
cmp    $0x2,%r15d
jge    129f <CO_select_forward_3+0x15f>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm1,0x20(%rsp)
jmp    142c <CO_select_forward_3+0x2ec>
mov    %r13,0x8(%rsp)
movapd %xmm1,0x50(%rsp)
movapd %xmm1,%xmm2
divsd  %xmm3,%xmm2
xorpd  %xmm1,%xmm1
mov    $0x2,%eax
mov    $0x8,%r13d
movsd  %xmm2,0x20(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %rax,%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm1,(%rsp)
movsd  (%rbx,%r12,8),%xmm0
xorpd  %xmm4,%xmm0
subsd  0x8(%rbx,%rbp,1),%xmm0
divsd  %xmm3,%xmm0
subsd  %xmm2,%xmm0
call   1050 <exp@plt>
movsd  0x20(%rsp),%xmm2
movapd 0xcf0(%rip),%xmm4
movsd  (%rsp),%xmm1
movapd 0x30(%rsp),%xmm3
addsd  %xmm0,%xmm1
add    $0x8,%rbp
cmp    %rbp,%r13
jne    12e0 <CO_select_forward_3+0x1a0>
lea    0x1(%r12),%rax
add    $0x8,%r13
cmp    %r14,%rax
jne    12d0 <CO_select_forward_3+0x190>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
mov    0x8(%rsp),%r13
movsd  %xmm1,(%rsp)
jbe    1420 <CO_select_forward_3+0x2e0>
xor    %eax,%eax
call   1030 <uniformrng@plt>
movsd  (%rsp),%xmm2
movapd 0x30(%rsp),%xmm1
movsd  %xmm0,0x40(%rsp)
mov    $0x2,%eax
cmp    $0x2,%r15d
jl     1518 <CO_select_forward_3+0x3d8>
xorpd  %xmm0,%xmm0
mov    $0x2,%eax
xor    %r13d,%r13d
movapd 0xc77(%rip),%xmm3
mov    %rax,%rbp
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,0x48(%rsp)
movsd  (%rbx,%rbp,8),%xmm0
xorpd  %xmm3,%xmm0
subsd  (%rbx,%r12,8),%xmm0
divsd  %xmm1,%xmm0
subsd  0x20(%rsp),%xmm0
call   1050 <exp@plt>
movsd  (%rsp),%xmm2
divsd  %xmm2,%xmm0
addsd  0x48(%rsp),%xmm0
ucomisd 0x40(%rsp),%xmm0
jae    150c <CO_select_forward_3+0x3cc>
lea    (%r12,%r13,1),%rax
add    $0x1,%rax
add    $0x1,%r12
cmp    $0x2,%rax
movapd 0x30(%rsp),%xmm1
movapd 0xc03(%rip),%xmm3
jne    13a0 <CO_select_forward_3+0x260>
lea    0x1(%rbp),%rax
add    $0xffffffffffffffff,%r13
cmp    %r14,%rax
jne    1389 <CO_select_forward_3+0x249>
mov    %r14d,%eax
mov    %rbp,%r12
mov    0x8(%rsp),%r13
jmp    1518 <CO_select_forward_3+0x3d8>
movapd 0x50(%rsp),%xmm0
movapd %xmm0,0x20(%rsp)
mov    0x18(%rsp),%rbp
mov    0x10(%rsp),%r14
mov    $0x1,%edi
mov    %r15d,%esi
call   1040 <integerrng@plt>
mov    %eax,0x0(%rbp)
lea    -0x1(%r15),%esi
mov    $0x1,%edi
call   1040 <integerrng@plt>
mov    %eax,%r12d
movapd 0x20(%rsp),%xmm3
movapd 0x30(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    %r12d,(%r14)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1477 <CO_select_forward_3+0x337>
jnp    14b9 <CO_select_forward_3+0x379>
movslq 0x0(%rbp),%rax
movsd  (%rbx,%rax,8),%xmm0
xorpd  0xb78(%rip),%xmm0
movslq %r12d,%rax
subsd  (%rbx,%rax,8),%xmm0
unpcklpd %xmm3,%xmm0
unpcklpd %xmm1,%xmm1
divpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm2,(%rsp)
call   1050 <exp@plt>
divsd  (%rsp),%xmm0
jmp    14f7 <CO_select_forward_3+0x3b7>
mov    $0x2,%edi
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
mov    %r15d,%edi
call   1060 <log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
add    $0xffffffff,%r15d
mov    %r15d,%edi
call   1060 <log@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movsd  %xmm0,0x0(%r13)
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%eax
mov    0x8(%rsp),%r13
movaps 0x30(%rsp),%xmm1
mov    0x18(%rsp),%rbp
mov    %eax,0x0(%rbp)
mov    0x10(%rsp),%r14
movapd 0x50(%rsp),%xmm3
jmp    1468 <CO_select_forward_3+0x328>

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

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