#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*/ freeChromosome(struct chromosome *);
int /*<<< orphan*/ freeDataSet(struct dataSet *);
int /*<<< orphan*/ freeParameters(struct parameters *);
struct dataSet *initialiseDataSetFromFile(char *);
struct parameters *initialiseParameters(int, int, int, int);
int /*<<< orphan*/ printChromosome(struct chromosome *, int /*<<< orphan*/);
int /*<<< orphan*/ printParameters(struct parameters *);
struct chromosome *runCGP(struct parameters *, struct dataSet *, int);
int /*<<< orphan*/ setRecurrentConnectionProbability(struct parameters *,
                                                     double);
int /*<<< orphan*/ setUpdateFrequency(struct parameters *, int);
int main(void) {
  struct parameters *params = NULL;
  struct dataSet *trainingData = NULL;
  struct chromosome *chromo = NULL;
  int numInputs = 1;
  int numNodes = 15;
  int numOutputs = 1;
  int nodeArity = 2;
  int numGens = 100000;
  int updateFrequency = 500;
  double recurrentConnectionProbability = 0.10;
  params = initialiseParameters(numInputs, numNodes, numOutputs, nodeArity);
  addNodeFunction(params, "add,sub,mul,div");
  setUpdateFrequency(params, updateFrequency);
  setRecurrentConnectionProbability(params, recurrentConnectionProbability);
  printParameters(params);
  trainingData = initialiseDataSetFromFile("./dataSets/fibonacci.data");
  chromo = runCGP(params, trainingData, numGens);
  printChromosome(chromo, 0);
  freeDataSet(trainingData);
  freeChromosome(chromo);
  freeParameters(params);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0xf,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
movl   $0x2,-0x30(%rbp)
movl   $0x186a0,-0x34(%rbp)
movl   $0x1f4,-0x38(%rbp)
movsd  0xdf7(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
call   1090 <initialiseParameters@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xdda(%rip),%rsi
call   1070 <addNodeFunction@plt>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1060 <setUpdateFrequency@plt>
mov    -0x10(%rbp),%rdi
movsd  -0x40(%rbp),%xmm0
call   1040 <setRecurrentConnectionProbability@plt>
mov    -0x10(%rbp),%rdi
call   1080 <printParameters@plt>
lea    0xdbb(%rip),%rdi
call   1050 <initialiseDataSetFromFile@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1030 <runCGP@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   10c0 <printChromosome@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <freeDataSet@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <freeChromosome@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <freeParameters@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x1,%edi
mov    $0xf,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1090 <initialiseParameters@plt>
mov    %rax,%rbx
lea    0xe30(%rip),%rsi
mov    %rax,%rdi
call   1070 <addNodeFunction@plt>
mov    %rbx,%rdi
mov    $0x1f4,%esi
call   1060 <setUpdateFrequency@plt>
movsd  0xe0b(%rip),%xmm0
mov    %rbx,%rdi
call   1040 <setRecurrentConnectionProbability@plt>
mov    %rbx,%rdi
call   1080 <printParameters@plt>
lea    0xe0c(%rip),%rdi
call   1050 <initialiseDataSetFromFile@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x186a0,%edx
call   1030 <runCGP@plt>
mov    %rax,%r15
mov    %rax,%rdi
xor    %esi,%esi
call   10c0 <printChromosome@plt>
mov    %r14,%rdi
call   10b0 <freeDataSet@plt>
mov    %r15,%rdi
call   10d0 <freeChromosome@plt>
mov    %rbx,%rdi
call   10a0 <freeParameters@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.parameters = type { i32 }
%struct.dataSet = type { i32 }
%struct.chromosome = type { i32 }
@.str = [16 x i8] c"add,sub,mul,div\00"
@.str.1 = [26 x i8] c"./dataSets/fibonacci.data\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.parameters*
%3 = alloca %struct.dataSet*
%4 = alloca %struct.chromosome*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
store i32 0, i32* %1
store %struct.parameters* null, %struct.parameters** %2
store %struct.dataSet* null, %struct.dataSet** %3
store %struct.chromosome* null, %struct.chromosome** %4
store i32 1, i32* %5
store i32 15, i32* %6
store i32 1, i32* %7
store i32 2, i32* %8
store i32 100000, i32* %9
store i32 500, i32* %10
store double 1.000000e-01, double* %11
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call %struct.parameters* @initialiseParameters(i32 %12, i32 %13, i32 %14, i32 %15)
store %struct.parameters* %16, %struct.parameters** %2
%17 = load %struct.parameters*, %struct.parameters** %2
%18 = call i32 @addNodeFunction(%struct.parameters* %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%19 = load %struct.parameters*, %struct.parameters** %2
%20 = load i32, i32* %10
%21 = call i32 @setUpdateFrequency(%struct.parameters* %19, i32 %20)
%22 = load %struct.parameters*, %struct.parameters** %2
%23 = load double, double* %11
%24 = call i32 @setRecurrentConnectionProbability(%struct.parameters* %22, double %23)
%25 = load %struct.parameters*, %struct.parameters** %2
%26 = call i32 @printParameters(%struct.parameters* %25)
%27 = call %struct.dataSet* @initialiseDataSetFromFile(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store %struct.dataSet* %27, %struct.dataSet** %3
%28 = load %struct.parameters*, %struct.parameters** %2
%29 = load %struct.dataSet*, %struct.dataSet** %3
%30 = load i32, i32* %9
%31 = call %struct.chromosome* @runCGP(%struct.parameters* %28, %struct.dataSet* %29, i32 %30)
store %struct.chromosome* %31, %struct.chromosome** %4
%32 = load %struct.chromosome*, %struct.chromosome** %4
%33 = call i32 @printChromosome(%struct.chromosome* %32, i32 0)
%34 = load %struct.dataSet*, %struct.dataSet** %3
%35 = call i32 @freeDataSet(%struct.dataSet* %34)
%36 = load %struct.chromosome*, %struct.chromosome** %4
%37 = call i32 @freeChromosome(%struct.chromosome* %36)
%38 = load %struct.parameters*, %struct.parameters** %2
%39 = call i32 @freeParameters(%struct.parameters* %38)
ret i32 0
}

LLVM IR (-O2):
%struct.parameters = type { i32 }
%struct.dataSet = type { i32 }
%struct.chromosome = type { i32 }
@.str = [16 x i8] c"add,sub,mul,div\00"
@.str.1 = [26 x i8] c"./dataSets/fibonacci.data\00"
define i32 @main() {
%1 = tail call %struct.parameters* @initialiseParameters(i32 1, i32 15, 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 @setUpdateFrequency(%struct.parameters* %1, i32 500)
%4 = tail call i32 @setRecurrentConnectionProbability(%struct.parameters* %1, double 1.000000e-01)
%5 = tail call i32 @printParameters(%struct.parameters* %1)
%6 = tail call %struct.dataSet* @initialiseDataSetFromFile(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call %struct.chromosome* @runCGP(%struct.parameters* %1, %struct.dataSet* %6, i32 100000)
%8 = tail call i32 @printChromosome(%struct.chromosome* %7, i32 0)
%9 = tail call i32 @freeDataSet(%struct.dataSet* %6)
%10 = tail call i32 @freeChromosome(%struct.chromosome* %7)
%11 = tail call i32 @freeParameters(%struct.parameters* %1)
ret i32 0
}