#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 chromosome {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addNodeFunction(struct parameters *, char *);
int /*<<< orphan*/ freeChromosome(struct chromosome *);
int /*<<< orphan*/ freeParameters(struct parameters *);
struct chromosome *initialiseChromosome(struct parameters *);
struct parameters *initialiseParameters(int, int, int, int);
int /*<<< orphan*/ printChromosome(struct chromosome *, int /*<<< orphan*/);
int /*<<< orphan*/ saveChromosomeDot(struct chromosome *, int /*<<< orphan*/,
                                     char *);
int /*<<< orphan*/ saveChromosomeLatex(struct chromosome *, int /*<<< orphan*/,
                                       char *);
int main(void) {
  struct parameters *params = NULL;
  struct chromosome *chromo = NULL;
  int numInputs = 1;
  int numNodes = 8;
  int numOutputs = 1;
  int nodeArity = 2;
  params = initialiseParameters(numInputs, numNodes, numOutputs, nodeArity);
  addNodeFunction(params, "add,sub,mul,div,sin");
  chromo = initialiseChromosome(params);
  printChromosome(chromo, 0);
  saveChromosomeDot(chromo, 0, "chromo.dot");
  saveChromosomeLatex(chromo, 0, "chromo.tex");
  freeChromosome(chromo);
  freeParameters(params);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x8,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
call   1060 <initialiseParameters@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1040 <addNodeFunction@plt>
mov    -0x10(%rbp),%rdi
call   1050 <initialiseChromosome@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1090 <printChromosome@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
lea    0xe0f(%rip),%rdx
call   1030 <saveChromosomeDot@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
lea    0xe08(%rip),%rdx
call   1080 <saveChromosomeLatex@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <freeChromosome@plt>
mov    -0x10(%rbp),%rdi
call   1070 <freeParameters@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%edi
mov    $0x8,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
call   1060 <initialiseParameters@plt>
mov    %rax,%r14
lea    0xe59(%rip),%rsi
mov    %rax,%rdi
call   1040 <addNodeFunction@plt>
mov    %r14,%rdi
call   1050 <initialiseChromosome@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
call   1090 <printChromosome@plt>
lea    0xe49(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <saveChromosomeDot@plt>
lea    0xe43(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <saveChromosomeLatex@plt>
mov    %rbx,%rdi
call   10a0 <freeChromosome@plt>
mov    %r14,%rdi
call   1070 <freeParameters@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.parameters = type { i32 }
%struct.chromosome = type { i32 }
@.str = [20 x i8] c"add,sub,mul,div,sin\00"
@.str.1 = [11 x i8] c"chromo.dot\00"
@.str.2 = [11 x i8] c"chromo.tex\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.parameters*
%3 = alloca %struct.chromosome*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store %struct.parameters* null, %struct.parameters** %2
store %struct.chromosome* null, %struct.chromosome** %3
store i32 1, i32* %4
store i32 8, i32* %5
store i32 1, i32* %6
store i32 2, i32* %7
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = call %struct.parameters* @initialiseParameters(i32 %8, i32 %9, i32 %10, i32 %11)
store %struct.parameters* %12, %struct.parameters** %2
%13 = load %struct.parameters*, %struct.parameters** %2
%14 = call i32 @addNodeFunction(%struct.parameters* %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%15 = load %struct.parameters*, %struct.parameters** %2
%16 = call %struct.chromosome* @initialiseChromosome(%struct.parameters* %15)
store %struct.chromosome* %16, %struct.chromosome** %3
%17 = load %struct.chromosome*, %struct.chromosome** %3
%18 = call i32 @printChromosome(%struct.chromosome* %17, i32 0)
%19 = load %struct.chromosome*, %struct.chromosome** %3
%20 = call i32 @saveChromosomeDot(%struct.chromosome* %19, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%21 = load %struct.chromosome*, %struct.chromosome** %3
%22 = call i32 @saveChromosomeLatex(%struct.chromosome* %21, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%23 = load %struct.chromosome*, %struct.chromosome** %3
%24 = call i32 @freeChromosome(%struct.chromosome* %23)
%25 = load %struct.parameters*, %struct.parameters** %2
%26 = call i32 @freeParameters(%struct.parameters* %25)
ret i32 0
}

LLVM IR (-O2):
%struct.parameters = type { i32 }
%struct.chromosome = type { i32 }
@.str = [20 x i8] c"add,sub,mul,div,sin\00"
@.str.1 = [11 x i8] c"chromo.dot\00"
@.str.2 = [11 x i8] c"chromo.tex\00"
define i32 @main() {
%1 = tail call %struct.parameters* @initialiseParameters(i32 1, i32 8, i32 1, i32 2)
%2 = tail call i32 @addNodeFunction(%struct.parameters* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call %struct.chromosome* @initialiseChromosome(%struct.parameters* %1)
%4 = tail call i32 @printChromosome(%struct.chromosome* %3, i32 0)
%5 = tail call i32 @saveChromosomeDot(%struct.chromosome* %3, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @saveChromosomeLatex(%struct.chromosome* %3, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @freeChromosome(%struct.chromosome* %3)
%8 = tail call i32 @freeParameters(%struct.parameters* %1)
ret i32 0
}