#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 */
struct parameters {
  int dummy;
};
struct dataSet {
  int dummy;
};
struct chromosome {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addNodeFunction(struct parameters *, char *);
int /*<<< orphan*/ copyChromosome(struct chromosome *, struct chromosome *);
int /*<<< orphan*/ freeChromosome(struct chromosome *);
int /*<<< orphan*/ freeDataSet(struct dataSet *);
int /*<<< orphan*/ freeParameters(struct parameters *);
double getChromosomeFitness(struct chromosome *);
struct chromosome *initialiseChromosome(struct parameters *);
struct dataSet *initialiseDataSetFromFile(char *);
struct parameters *initialiseParameters(int, int, int, int);
int /*<<< orphan*/ mutateChromosome(struct parameters *, struct chromosome *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setChromosomeFitness(struct parameters *,
                                        struct chromosome *, struct dataSet *);
int /*<<< orphan*/ setMutationRate(struct parameters *, double);
int /*<<< orphan*/ setMutationType(struct parameters *, char *);
int main(void) {
  int i, gen;
  struct parameters *params = NULL;
  struct chromosome *population[5];
  struct chromosome *fittestChromosome = NULL;
  struct dataSet *trainingData = NULL;
  double targetFitness = 0;
  int maxGens = 10000;
  params = initialiseParameters(3, 30, 1, 2);
  addNodeFunction(params, "or,nor,and,nand");
  setMutationType(params, "probabilistic");
  setMutationRate(params, 0.08);
  trainingData = initialiseDataSetFromFile("./dataSets/parity3bit.data");
  for (i = 0; i < 5; i++) {
    population[i] = initialiseChromosome(params);
  }
  fittestChromosome = initialiseChromosome(params);
  for (gen = 0; gen < maxGens; gen++) {
    for (i = 0; i < 5; i++) {
      setChromosomeFitness(params, population[i], trainingData);
    }
    copyChromosome(fittestChromosome, population[5 - 1]);
    for (i = 0; i < 5 - 1; i++) {
      if (getChromosomeFitness(population[i]) <
          getChromosomeFitness(fittestChromosome)) {
        copyChromosome(fittestChromosome, population[i]);
      }
    }
    if (getChromosomeFitness(fittestChromosome) <= targetFitness) {
      break;
    }
    copyChromosome(population[0], fittestChromosome);
    for (i = 1; i < 5; i++) {
      copyChromosome(population[i], fittestChromosome);
      mutateChromosome(params, population[i]);
    }
  }
  printf("gen\tfitness\n");
  printf("%d\t%f\n", gen, getChromosomeFitness(fittestChromosome));
  for (i = 0; i < 5; i++) {
    freeChromosome(population[i]);
  }
  freeChromosome(fittestChromosome);
  freeDataSet(trainingData);
  freeParameters(params);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x2710,-0x5c(%rbp)
mov    $0x3,%edi
mov    $0x1e,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   10c0 <initialiseParameters@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1080 <addNodeFunction@plt>
mov    -0x18(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1030 <setMutationType@plt>
mov    -0x18(%rbp),%rdi
movsd  0xda1(%rip),%xmm0
call   1090 <setMutationRate@plt>
lea    0xdbb(%rip),%rdi
call   1040 <initialiseDataSetFromFile@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    12a8 <main+0xc8>
mov    -0x18(%rbp),%rdi
call   10b0 <initialiseChromosome@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
mov    %rcx,-0x40(%rbp,%rax,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    127b <main+0x9b>
mov    -0x18(%rbp),%rdi
call   10b0 <initialiseChromosome@plt>
mov    %rax,-0x48(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jge    13ee <main+0x20e>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    12fd <main+0x11d>
mov    -0x18(%rbp),%rdi
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
mov    -0x50(%rbp),%rdx
call   1070 <setChromosomeFitness@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    12cf <main+0xef>
mov    -0x48(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10a0 <copyChromosome@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    136b <main+0x18b>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
call   10f0 <getChromosomeFitness@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x48(%rbp),%rdi
call   10f0 <getChromosomeFitness@plt>
movsd  -0x68(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1358 <main+0x178>
mov    -0x48(%rbp),%rdi
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
call   10a0 <copyChromosome@plt>
jmp    135d <main+0x17d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1311 <main+0x131>
mov    -0x48(%rbp),%rdi
call   10f0 <getChromosomeFitness@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     138b <main+0x1ab>
jmp    13ee <main+0x20e>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   10a0 <copyChromosome@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    13db <main+0x1fb>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
mov    -0x48(%rbp),%rsi
call   10a0 <copyChromosome@plt>
mov    -0x18(%rbp),%rdi
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
call   1050 <mutateChromosome@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    139f <main+0x1bf>
jmp    13e0 <main+0x200>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12bc <main+0xdc>
lea    0xc4c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x48(%rbp),%rdi
call   10f0 <getChromosomeFitness@plt>
mov    -0x6c(%rbp),%esi
lea    0xc39(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1449 <main+0x269>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
call   1100 <freeChromosome@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1423 <main+0x243>
mov    -0x48(%rbp),%rdi
call   1100 <freeChromosome@plt>
mov    -0x50(%rbp),%rdi
call   10e0 <freeDataSet@plt>
mov    -0x18(%rbp),%rdi
call   10d0 <freeParameters@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    $0x3,%edi
mov    $0x1e,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   10d0 <initialiseParameters@plt>
mov    %rax,%r13
lea    0xdef(%rip),%rsi
mov    %rax,%rdi
call   1090 <addNodeFunction@plt>
lea    0xdf0(%rip),%rsi
mov    %r13,%rdi
call   1030 <setMutationType@plt>
movsd  0xdc0(%rip),%xmm0
mov    %r13,%rdi
call   10a0 <setMutationRate@plt>
lea    0xddf(%rip),%rdi
call   1050 <initialiseDataSetFromFile@plt>
mov    %rax,0x28(%rsp)
mov    %r13,%rdi
call   10c0 <initialiseChromosome@plt>
mov    %rax,0x18(%rsp)
mov    %r13,%rdi
call   10c0 <initialiseChromosome@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   10c0 <initialiseChromosome@plt>
mov    %rax,%r14
mov    %r13,%rdi
call   10c0 <initialiseChromosome@plt>
mov    %rax,%r12
mov    %r13,%rdi
call   10c0 <initialiseChromosome@plt>
mov    %rax,0x20(%rsp)
mov    %r13,%rdi
call   10c0 <initialiseChromosome@plt>
mov    %rax,%rbx
xor    %eax,%eax
mov    %rbp,0x50(%rsp)
mov    %r14,0x48(%rsp)
mov    %r13,0x40(%rsp)
mov    %r12,0x38(%rsp)
mov    %rbx,0x30(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %eax,0x14(%rsp)
mov    %r13,%rdi
mov    0x18(%rsp),%r15
mov    %r15,%rsi
mov    %r14,%rbx
mov    %r12,%r14
mov    0x28(%rsp),%r12
mov    %r12,%rdx
call   1080 <setChromosomeFitness@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1080 <setChromosomeFitness@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1080 <setChromosomeFitness@plt>
mov    %r13,%rdi
mov    %r14,%rsi
mov    0x20(%rsp),%rbx
mov    %r12,%rdx
call   1080 <setChromosomeFitness@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1080 <setChromosomeFitness@plt>
mov    0x30(%rsp),%rdi
mov    %rbx,%rsi
call   10b0 <copyChromosome@plt>
mov    %r15,%rdi
mov    0x30(%rsp),%rbx
call   1100 <getChromosomeFitness@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1100 <getChromosomeFitness@plt>
ucomisd 0x8(%rsp),%xmm0
jbe    135c <main+0x16c>
mov    %rbx,%rdi
mov    0x18(%rsp),%rsi
call   10b0 <copyChromosome@plt>
mov    0x50(%rsp),%rbp
mov    %rbp,%rdi
call   1100 <getChromosomeFitness@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1100 <getChromosomeFitness@plt>
ucomisd 0x8(%rsp),%xmm0
jbe    138a <main+0x19a>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10b0 <copyChromosome@plt>
mov    0x48(%rsp),%r15
mov    %r15,%rdi
call   1100 <getChromosomeFitness@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1100 <getChromosomeFitness@plt>
ucomisd 0x8(%rsp),%xmm0
mov    0x40(%rsp),%r13
mov    0x38(%rsp),%r12
jbe    13c2 <main+0x1d2>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <copyChromosome@plt>
mov    %r12,%rdi
call   1100 <getChromosomeFitness@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1100 <getChromosomeFitness@plt>
ucomisd 0x8(%rsp),%xmm0
jbe    13eb <main+0x1fb>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10b0 <copyChromosome@plt>
mov    %rbx,%rdi
call   1100 <getChromosomeFitness@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    1491 <main+0x2a1>
mov    0x18(%rsp),%rdi
mov    %rbx,%rsi
call   10b0 <copyChromosome@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10b0 <copyChromosome@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1060 <mutateChromosome@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10b0 <copyChromosome@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1060 <mutateChromosome@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10b0 <copyChromosome@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1060 <mutateChromosome@plt>
mov    %r15,%r14
mov    %rbp,%r15
mov    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10b0 <copyChromosome@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r15,%rbp
call   1060 <mutateChromosome@plt>
mov    0x14(%rsp),%eax
add    $0x1,%eax
cmp    $0x2710,%eax
jne    12c0 <main+0xd0>
mov    %r14,%r15
mov    $0x2710,%r14d
jmp    1496 <main+0x2a6>
mov    0x14(%rsp),%r14d
lea    0xbb3(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1100 <getChromosomeFitness@plt>
lea    0xb98(%rip),%rdi
mov    %r14d,%esi
mov    $0x1,%al
call   1070 <printf@plt>
mov    0x18(%rsp),%rdi
call   1110 <freeChromosome@plt>
mov    %rbp,%rdi
call   1110 <freeChromosome@plt>
mov    %r15,%rdi
call   1110 <freeChromosome@plt>
mov    %r12,%rdi
call   1110 <freeChromosome@plt>
mov    0x20(%rsp),%rdi
call   1110 <freeChromosome@plt>
mov    %rbx,%rdi
call   1110 <freeChromosome@plt>
mov    0x28(%rsp),%rdi
call   10f0 <freeDataSet@plt>
mov    %r13,%rdi
call   10e0 <freeParameters@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.parameters = type { i32 }
%struct.chromosome = type { i32 }
%struct.dataSet = type { i32 }
@.str = [16 x i8] c"or,nor,and,nand\00"
@.str.1 = [14 x i8] c"probabilistic\00"
@.str.2 = [27 x i8] c"./dataSets/parity3bit.data\00"
@.str.3 = [13 x i8] c"gen\09fitness\0A\00"
@.str.4 = [7 x i8] c"%d\09%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.parameters*
%5 = alloca [5 x %struct.chromosome*]
%6 = alloca %struct.chromosome*
%7 = alloca %struct.dataSet*
%8 = alloca double
%9 = alloca i32
store i32 0, i32* %1
store %struct.parameters* null, %struct.parameters** %4
store %struct.chromosome* null, %struct.chromosome** %6
store %struct.dataSet* null, %struct.dataSet** %7
store double 0.000000e+00, double* %8
store i32 10000, i32* %9
%10 = call %struct.parameters* @initialiseParameters(i32 3, i32 30, i32 1, i32 2)
store %struct.parameters* %10, %struct.parameters** %4
%11 = load %struct.parameters*, %struct.parameters** %4
%12 = call i32 @addNodeFunction(%struct.parameters* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%13 = load %struct.parameters*, %struct.parameters** %4
%14 = call i32 @setMutationType(%struct.parameters* %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%15 = load %struct.parameters*, %struct.parameters** %4
%16 = call i32 @setMutationRate(%struct.parameters* %15, double 8.000000e-02)
%17 = call %struct.dataSet* @initialiseDataSetFromFile(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store %struct.dataSet* %17, %struct.dataSet** %7
store i32 0, i32* %2
br label %18
18: ; preds = %27, %0
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 5
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = load %struct.parameters*, %struct.parameters** %4
%23 = call %struct.chromosome* @initialiseChromosome(%struct.parameters* %22)
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 %25
store %struct.chromosome* %23, %struct.chromosome** %26
br label %27
27: ; preds = %21
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %18
30: ; preds = %18
%31 = load %struct.parameters*, %struct.parameters** %4
%32 = call %struct.chromosome* @initialiseChromosome(%struct.parameters* %31)
store %struct.chromosome* %32, %struct.chromosome** %6
store i32 0, i32* %3
br label %33
33: ; preds = %111, %30
%34 = load i32, i32* %3
%35 = load i32, i32* %9
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %114
37: ; preds = %33
store i32 0, i32* %2
br label %38
38: ; preds = %49, %37
%39 = load i32, i32* %2
%40 = icmp slt i32 %39, 5
br i1 %40, label %41, label %52
41: ; preds = %38
%42 = load %struct.parameters*, %struct.parameters** %4
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 %44
%46 = load %struct.chromosome*, %struct.chromosome** %45
%47 = load %struct.dataSet*, %struct.dataSet** %7
%48 = call i32 @setChromosomeFitness(%struct.parameters* %42, %struct.chromosome* %46, %struct.dataSet* %47)
br label %49
49: ; preds = %41
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 1
store i32 %51, i32* %2
br label %38
52: ; preds = %38
%53 = load %struct.chromosome*, %struct.chromosome** %6
%54 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 4
%55 = load %struct.chromosome*, %struct.chromosome** %54
%56 = call i32 @copyChromosome(%struct.chromosome* %53, %struct.chromosome* %55)
store i32 0, i32* %2
br label %57
57: ; preds = %77, %52
%58 = load i32, i32* %2
%59 = icmp slt i32 %58, 4
br i1 %59, label %60, label %80
60: ; preds = %57
%61 = load i32, i32* %2
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 %62
%64 = load %struct.chromosome*, %struct.chromosome** %63
%65 = call double @getChromosomeFitness(%struct.chromosome* %64)
%66 = load %struct.chromosome*, %struct.chromosome** %6
%67 = call double @getChromosomeFitness(%struct.chromosome* %66)
%68 = fcmp olt double %65, %67
br i1 %68, label %69, label %76
69: ; preds = %60
%70 = load %struct.chromosome*, %struct.chromosome** %6
%71 = load i32, i32* %2
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 %72
%74 = load %struct.chromosome*, %struct.chromosome** %73
%75 = call i32 @copyChromosome(%struct.chromosome* %70, %struct.chromosome* %74)
br label %76
76: ; preds = %69, %60
br label %77
77: ; preds = %76
%78 = load i32, i32* %2
%79 = add nsw i32 %78, 1
store i32 %79, i32* %2
br label %57
80: ; preds = %57
%81 = load %struct.chromosome*, %struct.chromosome** %6
%82 = call double @getChromosomeFitness(%struct.chromosome* %81)
%83 = load double, double* %8
%84 = fcmp ole double %82, %83
br i1 %84, label %85, label %86
85: ; preds = %80
br label %114
86: ; preds = %80
%87 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 0
%88 = load %struct.chromosome*, %struct.chromosome** %87
%89 = load %struct.chromosome*, %struct.chromosome** %6
%90 = call i32 @copyChromosome(%struct.chromosome* %88, %struct.chromosome* %89)
store i32 1, i32* %2
br label %91
91: ; preds = %107, %86
%92 = load i32, i32* %2
%93 = icmp slt i32 %92, 5
br i1 %93, label %94, label %110
94: ; preds = %91
%95 = load i32, i32* %2
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 %96
%98 = load %struct.chromosome*, %struct.chromosome** %97
%99 = load %struct.chromosome*, %struct.chromosome** %6
%100 = call i32 @copyChromosome(%struct.chromosome* %98, %struct.chromosome* %99)
%101 = load %struct.parameters*, %struct.parameters** %4
%102 = load i32, i32* %2
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 %103
%105 = load %struct.chromosome*, %struct.chromosome** %104
%106 = call i32 @mutateChromosome(%struct.parameters* %101, %struct.chromosome* %105)
br label %107
107: ; preds = %94
%108 = load i32, i32* %2
%109 = add nsw i32 %108, 1
store i32 %109, i32* %2
br label %91
110: ; preds = %91
br label %111
111: ; preds = %110
%112 = load i32, i32* %3
%113 = add nsw i32 %112, 1
store i32 %113, i32* %3
br label %33
114: ; preds = %85, %33
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%116 = load i32, i32* %3
%117 = load %struct.chromosome*, %struct.chromosome** %6
%118 = call double @getChromosomeFitness(%struct.chromosome* %117)
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %116, double %118)
store i32 0, i32* %2
br label %120
120: ; preds = %129, %114
%121 = load i32, i32* %2
%122 = icmp slt i32 %121, 5
br i1 %122, label %123, label %132
123: ; preds = %120
%124 = load i32, i32* %2
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [5 x %struct.chromosome*], [5 x %struct.chromosome*]* %5, i64 0, i64 %125
%127 = load %struct.chromosome*, %struct.chromosome** %126
%128 = call i32 @freeChromosome(%struct.chromosome* %127)
br label %129
129: ; preds = %123
%130 = load i32, i32* %2
%131 = add nsw i32 %130, 1
store i32 %131, i32* %2
br label %120
132: ; preds = %120
%133 = load %struct.chromosome*, %struct.chromosome** %6
%134 = call i32 @freeChromosome(%struct.chromosome* %133)
%135 = load %struct.dataSet*, %struct.dataSet** %7
%136 = call i32 @freeDataSet(%struct.dataSet* %135)
%137 = load %struct.parameters*, %struct.parameters** %4
%138 = call i32 @freeParameters(%struct.parameters* %137)
ret i32 0
}

LLVM IR (-O2):
%struct.parameters = type { i32 }
%struct.chromosome = type { i32 }
%struct.dataSet = type { i32 }
@.str = [16 x i8] c"or,nor,and,nand\00"
@.str.1 = [14 x i8] c"probabilistic\00"
@.str.2 = [27 x i8] c"./dataSets/parity3bit.data\00"
@.str.4 = [7 x i8] c"%d\09%f\0A\00"
@str = [12 x i8] c"gen\09fitness\00"
define i32 @main() {
%1 = tail call %struct.parameters* @initialiseParameters(i32 3, i32 30, i32 1, i32 2)
%2 = tail call i32 @addNodeFunction(%struct.parameters* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @setMutationType(%struct.parameters* %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @setMutationRate(%struct.parameters* %1, double 8.000000e-02)
%5 = tail call %struct.dataSet* @initialiseDataSetFromFile(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call %struct.chromosome* @initialiseChromosome(%struct.parameters* %1)
%7 = tail call %struct.chromosome* @initialiseChromosome(%struct.parameters* %1)
%8 = tail call %struct.chromosome* @initialiseChromosome(%struct.parameters* %1)
%9 = tail call %struct.chromosome* @initialiseChromosome(%struct.parameters* %1)
%10 = tail call %struct.chromosome* @initialiseChromosome(%struct.parameters* %1)
%11 = tail call %struct.chromosome* @initialiseChromosome(%struct.parameters* %1)
br label %12
12: ; preds = %0, %46
%13 = phi i32 [ 0, %0 ], [ %56, %46 ]
%14 = tail call i32 @setChromosomeFitness(%struct.parameters* %1, %struct.chromosome* %6, %struct.dataSet* %5)
%15 = tail call i32 @setChromosomeFitness(%struct.parameters* %1, %struct.chromosome* %7, %struct.dataSet* %5)
%16 = tail call i32 @setChromosomeFitness(%struct.parameters* %1, %struct.chromosome* %8, %struct.dataSet* %5)
%17 = tail call i32 @setChromosomeFitness(%struct.parameters* %1, %struct.chromosome* %9, %struct.dataSet* %5)
%18 = tail call i32 @setChromosomeFitness(%struct.parameters* %1, %struct.chromosome* %10, %struct.dataSet* %5)
%19 = tail call i32 @copyChromosome(%struct.chromosome* %11, %struct.chromosome* %10)
%20 = tail call double @getChromosomeFitness(%struct.chromosome* %6)
%21 = tail call double @getChromosomeFitness(%struct.chromosome* %11)
%22 = fcmp olt double %20, %21
br i1 %22, label %23, label %25
23: ; preds = %12
%24 = tail call i32 @copyChromosome(%struct.chromosome* %11, %struct.chromosome* %6)
br label %25
25: ; preds = %12, %23
%26 = tail call double @getChromosomeFitness(%struct.chromosome* %7)
%27 = tail call double @getChromosomeFitness(%struct.chromosome* %11)
%28 = fcmp olt double %26, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = tail call i32 @copyChromosome(%struct.chromosome* %11, %struct.chromosome* %7)
br label %31
31: ; preds = %29, %25
%32 = tail call double @getChromosomeFitness(%struct.chromosome* %8)
%33 = tail call double @getChromosomeFitness(%struct.chromosome* %11)
%34 = fcmp olt double %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = tail call i32 @copyChromosome(%struct.chromosome* %11, %struct.chromosome* %8)
br label %37
37: ; preds = %35, %31
%38 = tail call double @getChromosomeFitness(%struct.chromosome* %9)
%39 = tail call double @getChromosomeFitness(%struct.chromosome* %11)
%40 = fcmp olt double %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = tail call i32 @copyChromosome(%struct.chromosome* %11, %struct.chromosome* %9)
br label %43
43: ; preds = %41, %37
%44 = tail call double @getChromosomeFitness(%struct.chromosome* %11)
%45 = fcmp ugt double %44, 0.000000e+00
br i1 %45, label %46, label %58
46: ; preds = %43
%47 = tail call i32 @copyChromosome(%struct.chromosome* %6, %struct.chromosome* %11)
%48 = tail call i32 @copyChromosome(%struct.chromosome* %7, %struct.chromosome* %11)
%49 = tail call i32 @mutateChromosome(%struct.parameters* %1, %struct.chromosome* %7)
%50 = tail call i32 @copyChromosome(%struct.chromosome* %8, %struct.chromosome* %11)
%51 = tail call i32 @mutateChromosome(%struct.parameters* %1, %struct.chromosome* %8)
%52 = tail call i32 @copyChromosome(%struct.chromosome* %9, %struct.chromosome* %11)
%53 = tail call i32 @mutateChromosome(%struct.parameters* %1, %struct.chromosome* %9)
%54 = tail call i32 @copyChromosome(%struct.chromosome* %10, %struct.chromosome* %11)
%55 = tail call i32 @mutateChromosome(%struct.parameters* %1, %struct.chromosome* %10)
%56 = add nuw nsw i32 %13, 1
%57 = icmp eq i32 %56, 10000
br i1 %57, label %58, label %12
58: ; preds = %43, %46
%59 = phi i32 [ %13, %43 ], [ 10000, %46 ]
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%61 = tail call double @getChromosomeFitness(%struct.chromosome* %11)
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %59, double %61)
%63 = tail call i32 @freeChromosome(%struct.chromosome* %6)
%64 = tail call i32 @freeChromosome(%struct.chromosome* %7)
%65 = tail call i32 @freeChromosome(%struct.chromosome* %8)
%66 = tail call i32 @freeChromosome(%struct.chromosome* %9)
%67 = tail call i32 @freeChromosome(%struct.chromosome* %10)
%68 = tail call i32 @freeChromosome(%struct.chromosome* %11)
%69 = tail call i32 @freeDataSet(%struct.dataSet* %5)
%70 = tail call i32 @freeParameters(%struct.parameters* %1)
ret i32 0
}