#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 */
int /*<<< orphan*/ evolve1D(double *, double *, double *, int, int, double,
                            double, int, int);
int /*<<< orphan*/ expandNewpop1D(double *, double *, double *, int, int, int,
                                  int, int);
int /*<<< orphan*/ initExpansion1D(double *, int, int, int, int);
scalar_t__ rand_normal(double, double);
void expand1D(double *Pops, double *OutsidePop, double *Propagule, double *AF,
              int npop, int nSNP, double m1, double minf, int Ne, int Loss,
              int gen, int timeStart, int timeEnd, int popStart, int popEnd,
              int nSteps, int lengthSteps, int ke, int admixture) {
  int npopColonized = (int)(gen - timeStart - 1) / lengthSteps + 1;
  int p, l;
  if ((gen == timeStart) && (!admixture))
    initExpansion1D(Pops, nSNP, npop, popStart, popEnd);
  if (admixture && (gen == timeStart))
    for (l = 0; l < nSNP; l++)
      Propagule[l] = Pops[popStart * nSNP + l];
  if (gen > timeStart) {
    for (p = popStart - 1; p < popStart - 1 + npopColonized; p++) {
      for (l = 0; l < nSNP; l++) {
        double af = Pops[p * nSNP + l];
        if ((af > 0) && (af < 1))
          af = (double)rand_normal(af, af * (1 - af) / (2 * Ne));
        if (af > 1)
          af = 1;
        if (af < 0)
          af = 0;
        Pops[p * nSNP + l] = af;
      }
    }
    if (((gen - timeStart) % lengthSteps == 0) &&
        (npopColonized < (popEnd - popStart + 1)))
      expandNewpop1D(Pops, AF, Propagule, popStart + npopColonized - 1, nSNP,
                     Ne, ke, admixture);
  }
  if (popStart > 1)
    evolve1D(Pops, OutsidePop, AF, popStart - 1, nSNP, m1, minf, Ne, Loss);
  if (popEnd < npop)
    evolve1D(Pops + nSNP * popEnd, OutsidePop, AF, npop - popEnd, nSNP, m1,
             minf, Ne, Loss);
}


x86 assembly (clang, -O0):
<expand1D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x60(%rbp),%eax
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
mov    0x20(%rbp),%eax
sub    0x28(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  0x50(%rbp)
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    0x20(%rbp),%eax
cmp    0x28(%rbp),%eax
jne    11ca <expand1D+0x8a>
cmpl   $0x0,0x60(%rbp)
jne    11ca <expand1D+0x8a>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    0x38(%rbp),%ecx
mov    0x40(%rbp),%r8d
call   1050 <initExpansion1D@plt>
cmpl   $0x0,0x60(%rbp)
je     1229 <expand1D+0xe9>
mov    0x20(%rbp),%eax
cmp    0x28(%rbp),%eax
jne    1229 <expand1D+0xe9>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1224 <expand1D+0xe4>
mov    -0x8(%rbp),%rax
mov    0x38(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e7 <expand1D+0xa7>
jmp    1229 <expand1D+0xe9>
mov    0x20(%rbp),%eax
cmp    0x28(%rbp),%eax
jle    13b0 <expand1D+0x270>
mov    0x38(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    0x38(%rbp),%ecx
sub    $0x1,%ecx
add    -0x3c(%rbp),%ecx
cmp    %ecx,%eax
jge    1353 <expand1D+0x213>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1340 <expand1D+0x200>
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12dd <expand1D+0x19d>
movsd  0xd66(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    12dd <expand1D+0x19d>
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  0xd49(%rip),%xmm2
subsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm1
mov    0x10(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
call   1060 <rand_normal@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xd16(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1301 <expand1D+0x1c1>
movsd  0xd04(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    1317 <expand1D+0x1d7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1259 <expand1D+0x119>
jmp    1345 <expand1D+0x205>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    123e <expand1D+0xfe>
mov    0x20(%rbp),%eax
sub    0x28(%rbp),%eax
cltd
idivl  0x50(%rbp)
cmp    $0x0,%edx
jne    13ab <expand1D+0x26b>
mov    -0x3c(%rbp),%eax
mov    0x40(%rbp),%ecx
sub    0x38(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    13ab <expand1D+0x26b>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x38(%rbp),%ecx
add    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x28(%rbp),%r8d
mov    0x10(%rbp),%r9d
mov    0x58(%rbp),%r10d
mov    0x60(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <expandNewpop1D@plt>
jmp    13b0 <expand1D+0x270>
cmpl   $0x1,0x38(%rbp)
jle    13e9 <expand1D+0x2a9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    0x38(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x28(%rbp),%r8d
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <evolve1D@plt>
mov    0x40(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1434 <expand1D+0x2f4>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%eax
imul   0x40(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
sub    0x40(%rbp),%ecx
mov    -0x28(%rbp),%r8d
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <evolve1D@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand1D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm1,0x40(%rsp)
movsd  %xmm0,0x38(%rsp)
mov    %r9d,0x10(%rsp)
mov    %r8d,%r15d
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,0x30(%rsp)
mov    %rdi,%r13
mov    0xa8(%rsp),%r9d
mov    0xa0(%rsp),%r10d
mov    %r10d,%eax
sub    %r9d,%eax
add    $0xffffffff,%eax
cltd
idivl  0xd0(%rsp)
mov    %rax,0x28(%rsp)
mov    %r10d,%eax
mov    0xe0(%rsp),%ebx
sub    %r9d,%eax
mov    %eax,0x1c(%rsp)
jne    11d9 <expand1D+0x99>
test   %ebx,%ebx
jne    11d9 <expand1D+0x99>
mov    %r13,%rdi
mov    0x10(%rsp),%esi
mov    %r15d,%edx
mov    0xb8(%rsp),%ecx
mov    0xc0(%rsp),%r8d
mov    %r10d,%ebp
call   1050 <initExpansion1D@plt>
mov    %ebp,%r10d
mov    0xa8(%rsp),%r9d
cmp    %r9d,%r10d
jne    13d9 <expand1D+0x299>
test   %ebx,%ebx
je     13d9 <expand1D+0x299>
cmpl   $0x0,0x10(%rsp)
jle    13d9 <expand1D+0x299>
mov    0xb8(%rsp),%eax
mov    0x10(%rsp),%edx
imul   %edx,%eax
movslq %eax,%rcx
mov    %edx,%eax
cmp    $0x4,%edx
jb     123d <expand1D+0xfd>
lea    (%rcx,%rax,1),%rdx
lea    0x0(,%rdx,8),%rdx
add    %r13,%rdx
cmp    %r14,%rdx
jbe    12e0 <expand1D+0x1a0>
lea    (%r14,%rax,8),%rdx
lea    0x0(,%rcx,8),%rsi
add    %r13,%rsi
cmp    %rdx,%rsi
jae    12e0 <expand1D+0x1a0>
xor    %edx,%edx
mov    %rdx,%rsi
not    %rsi
add    %rax,%rsi
mov    %rax,%rdi
and    $0x3,%rdi
je     1278 <expand1D+0x138>
mov    %r13,%rbx
lea    0x0(,%rcx,8),%rbp
add    %r13,%rbp
nop
movsd  0x0(%rbp,%rdx,8),%xmm0
movsd  %xmm0,(%r14,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rdi
jne    1260 <expand1D+0x120>
jmp    127b <expand1D+0x13b>
mov    %r13,%rbx
cmp    $0x3,%rsi
mov    %rbx,%r13
jb     13d9 <expand1D+0x299>
lea    0x18(,%rcx,8),%rcx
add    %r13,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  -0x18(%rcx,%rdx,8),%xmm0
movsd  %xmm0,(%r14,%rdx,8)
movsd  -0x10(%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x8(%r14,%rdx,8)
movsd  -0x8(%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x10(%r14,%rdx,8)
movsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x18(%r14,%rdx,8)
add    $0x4,%rdx
cmp    %rdx,%rax
jne    12a0 <expand1D+0x160>
jmp    13d9 <expand1D+0x299>
mov    %eax,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rbp
mov    %rbp,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%esi
and    $0x3,%esi
cmp    $0xc,%rbp
jae    1306 <expand1D+0x1c6>
xor    %ebp,%ebp
jmp    1384 <expand1D+0x244>
and    $0xfffffffffffffffc,%rdi
lea    0x70(,%rcx,8),%rbx
add    %r13,%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movups -0x70(%rbx,%rbp,8),%xmm0
movups -0x60(%rbx,%rbp,8),%xmm1
movups %xmm0,(%r14,%rbp,8)
movups %xmm1,0x10(%r14,%rbp,8)
movups -0x50(%rbx,%rbp,8),%xmm0
movups -0x40(%rbx,%rbp,8),%xmm1
movups %xmm0,0x20(%r14,%rbp,8)
movups %xmm1,0x30(%r14,%rbp,8)
movups -0x30(%rbx,%rbp,8),%xmm0
movups -0x20(%rbx,%rbp,8),%xmm1
movups %xmm0,0x40(%r14,%rbp,8)
movups %xmm1,0x50(%r14,%rbp,8)
movupd -0x10(%rbx,%rbp,8),%xmm0
movupd (%rbx,%rbp,8),%xmm1
movupd %xmm0,0x60(%r14,%rbp,8)
movupd %xmm1,0x70(%r14,%rbp,8)
add    $0x10,%rbp
add    $0xfffffffffffffffc,%rdi
jne    1320 <expand1D+0x1e0>
test   %rsi,%rsi
je     13d0 <expand1D+0x290>
lea    (%r14,%rbp,8),%rdi
add    $0x10,%rdi
add    %rcx,%rbp
lea    0x10(,%rbp,8),%rbp
add    %r13,%rbp
shl    $0x5,%rsi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movupd -0x10(%rbp,%rbx,1),%xmm0
movupd 0x0(%rbp,%rbx,1),%xmm1
movupd %xmm0,-0x10(%rdi,%rbx,1)
movupd %xmm1,(%rdi,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%rsi
jne    13b0 <expand1D+0x270>
cmp    %rax,%rdx
jne    123f <expand1D+0xff>
mov    0x90(%rsp),%ebp
cmp    %r9d,%r10d
mov    0xb8(%rsp),%ebx
jle    147d <expand1D+0x33d>
mov    %r13,0x20(%rsp)
mov    %r12,0x48(%rsp)
mov    %r15d,0x18(%rsp)
mov    0x28(%rsp),%rax
add    %ebx,%eax
mov    %eax,0x14(%rsp)
cmp    %ebx,%eax
jge    150b <expand1D+0x3cb>
mov    0x1c(%rsp),%eax
cltd
idivl  0xd0(%rsp)
test   %edx,%edx
mov    0x18(%rsp),%r15d
mov    0x48(%rsp),%r12
mov    0x20(%rsp),%r13
mov    0xb8(%rsp),%ebx
mov    0x90(%rsp),%ebp
jne    147d <expand1D+0x33d>
mov    0xc0(%rsp),%eax
sub    %ebx,%eax
cmp    %eax,0x28(%rsp)
jge    147d <expand1D+0x33d>
mov    0xd8(%rsp),%eax
mov    0xe0(%rsp),%ecx
mov    %ecx,0x8(%rsp)
mov    %eax,(%rsp)
mov    %r13,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    0x14(%rsp),%ecx
mov    0x10(%rsp),%r8d
mov    %ebp,%r9d
call   1040 <expandNewpop1D@plt>
mov    0x98(%rsp),%r14d
cmp    $0x2,%ebx
jl     14b7 <expand1D+0x377>
add    $0xffffffff,%ebx
mov    %r14d,(%rsp)
mov    %r13,%rdi
mov    0x30(%rsp),%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
mov    0x10(%rsp),%r8d
movsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
mov    %ebp,%r9d
call   1030 <evolve1D@plt>
mov    0xc0(%rsp),%eax
sub    %eax,%r15d
jle    14fc <expand1D+0x3bc>
mov    0x10(%rsp),%r8d
imul   %r8d,%eax
cltq
lea    0x0(,%rax,8),%rdi
add    %r13,%rdi
mov    %r14d,(%rsp)
mov    0x30(%rsp),%rsi
mov    %r12,%rdx
mov    %r15d,%ecx
movsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
mov    %ebp,%r9d
call   1030 <evolve1D@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xb8(%rsp),%eax
add    $0xffffffff,%eax
mov    0x90(%rsp),%ecx
add    %ecx,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,0x50(%rsp)
movslq %eax,%r12
mov    0x10(%rsp),%eax
movslq %eax,%rbp
mov    %eax,%r15d
mov    %rbp,%rax
imul   %r12,%rax
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,8),%rbx
shl    $0x3,%rbp
xorpd  %xmm2,%xmm2
movsd  0xaa8(%rip),%xmm3
jmp    1572 <expand1D+0x432>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
add    %rbp,%rbx
cmp    %r12d,0x14(%rsp)
je     1412 <expand1D+0x2d2>
cmpl   $0x0,0x10(%rsp)
jle    1560 <expand1D+0x420>
xor    %r13d,%r13d
jmp    159f <expand1D+0x45f>
xchg   %ax,%ax
movapd %xmm3,%xmm1
minsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
maxsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%r13,8)
add    $0x1,%r13
cmp    %r13,%r15
je     1560 <expand1D+0x420>
movsd  (%rbx,%r13,8),%xmm0
ucomisd %xmm2,%xmm0
jbe    1580 <expand1D+0x440>
ucomisd %xmm0,%xmm3
jbe    1580 <expand1D+0x440>
movapd %xmm3,%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
divsd  0x50(%rsp),%xmm1
call   1060 <rand_normal@plt>
movsd  0xa30(%rip),%xmm3
xorpd  %xmm2,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
jmp    1580 <expand1D+0x440>

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

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