#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 Subsetsum {
  int dummy;
};
struct Population {
  int dummy;
};
struct Evolution_state {
  int dummy;
};
struct Evolution {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ apocalypse(struct Evolution *, struct Population *);
char *best_phenotype(struct Subsetsum *, struct Population *);
int /*<<< orphan*/ destroy_subsetsum(struct Subsetsum *);
int /*<<< orphan*/ free(char *);
struct Evolution_state *get_evol_state();
struct Population *live(struct Evolution *, struct Subsetsum *);
struct Evolution *load_evolution(char *);
struct Subsetsum *load_subsetsum(char *);
int /*<<< orphan*/ write_result_csv(struct Evolution_state *, char *, char *,
                                    char *);
void run(char *evolution_filename, char *subsetsum_filename,
         char *result_dirname) {
  struct Evolution *evol = load_evolution(evolution_filename);
  struct Subsetsum *subsetsum = load_subsetsum(subsetsum_filename);
  struct Population *city = live(evol, subsetsum);
  struct Evolution_state *end_state = get_evol_state();
  char *alpha = best_phenotype(subsetsum, city);
  write_result_csv(end_state, subsetsum_filename, result_dirname, alpha);
  free(alpha);
  destroy_subsetsum(subsetsum);
  apocalypse(evol, city);
}


x86 assembly (clang, -O0):
<run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <load_evolution@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <load_subsetsum@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <live@plt>
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1060 <get_evol_state@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10a0 <best_phenotype@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x40(%rbp),%rcx
call   1080 <write_result_csv@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1070 <destroy_subsetsum@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1090 <apocalypse@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
mov    %rsi,%r12
call   1040 <load_evolution@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1050 <load_subsetsum@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   10b0 <live@plt>
mov    %rax,%r13
xor    %eax,%eax
call   1060 <get_evol_state@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %r13,%rsi
call   10a0 <best_phenotype@plt>
mov    %rax,%r14
mov    %rbp,%rdi
mov    %r12,%rsi
mov    (%rsp),%rdx
mov    %rax,%rcx
call   1080 <write_result_csv@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1070 <destroy_subsetsum@plt>
mov    %r15,%rdi
mov    %r13,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <apocalypse@plt>

LLVM IR (-O0):
%struct.Evolution = type { i32 }
%struct.Subsetsum = type { i32 }
%struct.Population = type { i32 }
%struct.Evolution_state = type { i32 }
define void @run(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.Evolution*
%8 = alloca %struct.Subsetsum*
%9 = alloca %struct.Population*
%10 = alloca %struct.Evolution_state*
%11 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%12 = load i8*, i8** %4
%13 = call %struct.Evolution* @load_evolution(i8* %12)
store %struct.Evolution* %13, %struct.Evolution** %7
%14 = load i8*, i8** %5
%15 = call %struct.Subsetsum* @load_subsetsum(i8* %14)
store %struct.Subsetsum* %15, %struct.Subsetsum** %8
%16 = load %struct.Evolution*, %struct.Evolution** %7
%17 = load %struct.Subsetsum*, %struct.Subsetsum** %8
%18 = call %struct.Population* @live(%struct.Evolution* %16, %struct.Subsetsum* %17)
store %struct.Population* %18, %struct.Population** %9
%19 = call %struct.Evolution_state* (...) @get_evol_state()
store %struct.Evolution_state* %19, %struct.Evolution_state** %10
%20 = load %struct.Subsetsum*, %struct.Subsetsum** %8
%21 = load %struct.Population*, %struct.Population** %9
%22 = call i8* @best_phenotype(%struct.Subsetsum* %20, %struct.Population* %21)
store i8* %22, i8** %11
%23 = load %struct.Evolution_state*, %struct.Evolution_state** %10
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = load i8*, i8** %11
%27 = call i32 @write_result_csv(%struct.Evolution_state* %23, i8* %24, i8* %25, i8* %26)
%28 = load i8*, i8** %11
%29 = call i32 @free(i8* %28)
%30 = load %struct.Subsetsum*, %struct.Subsetsum** %8
%31 = call i32 @destroy_subsetsum(%struct.Subsetsum* %30)
%32 = load %struct.Evolution*, %struct.Evolution** %7
%33 = load %struct.Population*, %struct.Population** %9
%34 = call i32 @apocalypse(%struct.Evolution* %32, %struct.Population* %33)
ret void
}

LLVM IR (-O2):
%struct.Evolution = type { i32 }
%struct.Subsetsum = type { i32 }
%struct.Population = type { i32 }
%struct.Evolution_state = type { i32 }
define void @run(i8* %0, i8* %1, i8* %2) {
%4 = tail call %struct.Evolution* @load_evolution(i8* %0)
%5 = tail call %struct.Subsetsum* @load_subsetsum(i8* %1)
%6 = tail call %struct.Population* @live(%struct.Evolution* %4, %struct.Subsetsum* %5)
%7 = tail call %struct.Evolution_state* (...) @get_evol_state()
%8 = tail call i8* @best_phenotype(%struct.Subsetsum* %5, %struct.Population* %6)
%9 = tail call i32 @write_result_csv(%struct.Evolution_state* %7, i8* %1, i8* %2, i8* %8)
%10 = tail call i32 @free(i8* %8)
%11 = tail call i32 @destroy_subsetsum(%struct.Subsetsum* %5)
%12 = tail call i32 @apocalypse(%struct.Evolution* %4, %struct.Population* %6)
ret void
}