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

/* Variables and functions */
int /*<<< orphan*/ createGeneAdjMatrix(int ***, int);
int /*<<< orphan*/ destroyGeneAdjMatrix(int **, int);
int /*<<< orphan*/ encodeAdjGenomes(int **, struct genome_struct *, int, int);
int /*<<< orphan*/ fillGeneAdjMatrix(int **, struct genome_struct *, int, int);
void encodeGenomes(struct genome_struct *mygenomes, int num_genomes,
                   int num_genes) {
  int **adj;
  createGeneAdjMatrix(&adj, num_genes);
  fillGeneAdjMatrix(adj, mygenomes, num_genomes, num_genes);
  encodeAdjGenomes(adj, mygenomes, num_genomes, num_genes);
  destroyGeneAdjMatrix(adj, num_genes);
  return;
}


x86 assembly (clang, -O0):
<encodeGenomes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    -0x18(%rbp),%rdi
call   1040 <createGeneAdjMatrix@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1060 <fillGeneAdjMatrix@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <encodeAdjGenomes@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1050 <destroyGeneAdjMatrix@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encodeGenomes>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0x8(%rsp),%rdi
mov    %edx,%esi
call   1040 <createGeneAdjMatrix@plt>
mov    0x8(%rsp),%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1060 <fillGeneAdjMatrix@plt>
mov    0x8(%rsp),%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1030 <encodeAdjGenomes@plt>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
call   1050 <destroyGeneAdjMatrix@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.genome_struct = type { i32 }
define void @encodeGenomes(%struct.genome_struct* %0, i32 %1, i32 %2) {
%4 = alloca %struct.genome_struct*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32**
store %struct.genome_struct* %0, %struct.genome_struct** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = call i32 @createGeneAdjMatrix(i32*** %7, i32 %8)
%10 = load i32**, i32*** %7
%11 = load %struct.genome_struct*, %struct.genome_struct** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @fillGeneAdjMatrix(i32** %10, %struct.genome_struct* %11, i32 %12, i32 %13)
%15 = load i32**, i32*** %7
%16 = load %struct.genome_struct*, %struct.genome_struct** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = call i32 @encodeAdjGenomes(i32** %15, %struct.genome_struct* %16, i32 %17, i32 %18)
%20 = load i32**, i32*** %7
%21 = load i32, i32* %6
%22 = call i32 @destroyGeneAdjMatrix(i32** %20, i32 %21)
ret void
}

LLVM IR (-O2):
%struct.genome_struct = type { i32 }
define void @encodeGenomes(%struct.genome_struct* %0, i32 %1, i32 %2) {
%4 = alloca i32**
%5 = bitcast i32*** %4 to i8*
%6 = call i32 @createGeneAdjMatrix(i32*** %4, i32 %2)
%7 = load i32**, i32*** %4
%8 = call i32 @fillGeneAdjMatrix(i32** %7, %struct.genome_struct* %0, i32 %1, i32 %2)
%9 = load i32**, i32*** %4
%10 = call i32 @encodeAdjGenomes(i32** %9, %struct.genome_struct* %0, i32 %1, i32 %2)
%11 = load i32**, i32*** %4
%12 = call i32 @destroyGeneAdjMatrix(i32** %11, i32 %2)
ret void
}