#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 */

/* Variables and functions */
int /*<<< orphan*/ evolution(int, int, int *, int *, int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ init_random_generator();
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (4 != argc) {
    fprintf(stderr, "cmd line arguments:\n");
    fprintf(stderr, "  int mwidthension of matrices,\n");
    fprintf(stderr, "  int size of population,\n");
    fprintf(stderr, "  int number of annealing steps.\n");
    fprintf(stderr, "example: ./matrix 5 100 100\n");
    exit(-1);
  }
  int mwidth;
  sscanf(argv[1], "%d", &mwidth);
  int pop;
  sscanf(argv[2], "%d", &pop);
  int ann;
  sscanf(argv[3], "%d", &ann);
  int mcount = 2;
  int lhs[] = {0, 0, 1, 1, -1};
  int rhs[] = {1, 1, 1, 0, 0, 0, -1};
  init_random_generator();
  evolution(pop, ann, lhs, rhs, mcount, mwidth);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%eax
cmp    -0x4(%rbp),%eax
je     11e0 <main+0x90>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe95(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea1(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe89(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe71(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <sscanf@plt>
movl   $0x2,-0x20(%rbp)
mov    0xe6a(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe67(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe65(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xe6b(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe68(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe65(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe63(%rip),%eax
mov    %eax,-0x48(%rbp)
mov    $0x0,%al
call   1030 <init_random_generator@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
lea    -0x40(%rbp),%rdx
lea    -0x60(%rbp),%rcx
mov    -0x20(%rbp),%r8d
mov    -0x14(%rbp),%r9d
call   1040 <evolution@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
cmp    $0x4,%edi
jne    11fe <main+0xae>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xf22(%rip),%r14
lea    0xc(%rsp),%rdx
mov    %r14,%rsi
call   1060 <sscanf@plt>
mov    0x10(%rbx),%rdi
lea    0x8(%rsp),%rdx
mov    %r14,%rsi
call   1060 <sscanf@plt>
mov    0x18(%rbx),%rdi
lea    0x4(%rsp),%rdx
mov    %r14,%rsi
call   1060 <sscanf@plt>
mov    0xf0d(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xef2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xf12(%rip),%xmm0
movups %xmm0,0x3c(%rsp)
movaps 0xefa(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
xor    %eax,%eax
call   1030 <init_random_generator@plt>
mov    0x8(%rsp),%edi
mov    0x4(%rsp),%esi
mov    0xc(%rsp),%r9d
lea    0x10(%rsp),%rdx
lea    0x30(%rsp),%rcx
mov    $0x2,%r8d
call   1040 <evolution@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2ddb(%rip),%rbx
mov    (%rbx),%edi
lea    0xdf2(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdf9(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe0c(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe19(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe2d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"cmd line arguments:\0A\00"
@.str.1 = [33 x i8] c" int mwidthension of matrices,\0A\00"
@.str.2 = [27 x i8] c" int size of population,\0A\00"
@.str.3 = [34 x i8] c" int number of annealing steps.\0A\00"
@.str.4 = [29 x i8] c"example: ./matrix 5 100 100\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@__const.main.lhs = [5 x i32] [i32 0, i32 0, i32 1, i32 1, i32 -1]
@__const.main.rhs = [7 x i32] [i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 -1]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [5 x i32]
%10 = alloca [7 x i32]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%11 = load i32, i32* %3
%12 = icmp ne i32 4, %11
br i1 %12, label %13, label %25
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @exit(i32 -1)
unreachable
25: ; preds = %2
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %5)
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @sscanf(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %6)
%34 = load i8**, i8*** %4
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @sscanf(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %7)
store i32 2, i32* %8
%38 = bitcast [5 x i32]* %9 to i8*
%39 = bitcast [7 x i32]* %10 to i8*
%40 = call i32 (...) @init_random_generator()
%41 = load i32, i32* %6
%42 = load i32, i32* %7
%43 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 0
%44 = getelementptr inbounds [7 x i32], [7 x i32]* %10, i64 0, i64 0
%45 = load i32, i32* %8
%46 = load i32, i32* %5
%47 = call i32 @evolution(i32 %41, i32 %42, i32* %43, i32* %44, i32 %45, i32 %46)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"cmd line arguments:\0A\00"
@.str.1 = [33 x i8] c" int mwidthension of matrices,\0A\00"
@.str.2 = [27 x i8] c" int size of population,\0A\00"
@.str.3 = [34 x i8] c" int number of annealing steps.\0A\00"
@.str.4 = [29 x i8] c"example: ./matrix 5 100 100\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@__const.main.lhs = [5 x i32] [i32 0, i32 0, i32 1, i32 1, i32 -1]
@__const.main.rhs = [7 x i32] [i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 -1]
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [5 x i32]
%7 = alloca [7 x i32]
%8 = icmp eq i32 %0, 4
br i1 %8, label %21, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%20 = tail call i32 @exit(i32 -1)
unreachable
21: ; preds = %2
%22 = bitcast i32* %3 to i8*
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%26 = bitcast i32* %4 to i8*
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%30 = bitcast i32* %5 to i8*
%31 = getelementptr inbounds i8*, i8** %1, i64 3
%32 = load i8*, i8** %31
%33 = call i32 @sscanf(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %5)
%34 = bitcast [5 x i32]* %6 to i8*
%35 = bitcast [7 x i32]* %7 to i8*
%36 = call i32 (...) @init_random_generator()
%37 = load i32, i32* %4
%38 = load i32, i32* %5
%39 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%40 = getelementptr inbounds [7 x i32], [7 x i32]* %7, i64 0, i64 0
%41 = load i32, i32* %3
%42 = call i32 @evolution(i32 %37, i32 %38, i32* %39, i32* %40, i32 2, i32 %41)
ret i32 0
}