#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*/ printf(char *, ...);
void genome_addition_iteration(int *genotype, int zeroes, int inds,
                               int *zero_ind, int curr_zero, int *replacement,
                               int curr_ind, int verbose) {
  if (verbose) {
    printf("STATUS-------------------\n");
    printf("ZEROES & INDS: %d\t%d\n", zeroes, inds);
    printf("CURRENT ZERO:\t\t%d\n", curr_zero);
    printf("CURRENT REPLACEMENT:\t%d\n", curr_ind);
  }
  genotype[zero_ind[curr_zero]] = genotype[replacement[curr_ind]];
  int i;
  int j;
  for (i = curr_ind; i < inds; i++) {
    if (curr_zero < zeroes - 1) {
      genome_addition_iteration(genotype, zeroes, inds, zero_ind, ++curr_zero,
                                replacement, i, verbose);
      if (curr_zero == zeroes - 1) {
        return;
      }
    } else {
      printf("GENOTYPE:\t");
      for (j = 0; j < zeroes + inds; j++) {
        printf(" %d", genotype[j]);
      }
      printf("\n");
      if (zeroes == 1 || i == inds - 1) {
        return;
      }
    }
    curr_zero--;
    if (verbose)
      printf("\t~~~\n");
  }
  return;
}


x86 assembly (clang, -O0):
<genome_addition_iteration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
cmpl   $0x0,0x18(%rbp)
je     1192 <genome_addition_iteration+0x72>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x10(%rbp),%esi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq 0x10(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rsi
movslq (%rcx,%rsi,4),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12dc <genome_addition_iteration+0x1bc>
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1228 <genome_addition_iteration+0x108>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
add    $0x1,%r8d
mov    %r8d,-0x1c(%rbp)
mov    -0x28(%rbp),%r9
mov    -0x2c(%rbp),%r10d
mov    0x18(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <genome_addition_iteration@plt>
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1223 <genome_addition_iteration+0x103>
jmp    12e1 <genome_addition_iteration+0x1c1>
jmp    12a8 <genome_addition_iteration+0x188>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    1275 <genome_addition_iteration+0x155>
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    123d <genome_addition_iteration+0x11d>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
je     129e <genome_addition_iteration+0x17e>
mov    -0x2c(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    12a3 <genome_addition_iteration+0x183>
jmp    12e1 <genome_addition_iteration+0x1c1>
jmp    12a8 <genome_addition_iteration+0x188>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,0x18(%rbp)
je     12c9 <genome_addition_iteration+0x1a9>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ce <genome_addition_iteration+0x1ae>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11be <genome_addition_iteration+0x9e>
jmp    12e1 <genome_addition_iteration+0x1c1>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genome_addition_iteration>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x28(%rsp)
mov    %r8d,%r12d
mov    %rcx,0x20(%rsp)
mov    %edx,%ebp
mov    %esi,%r15d
mov    %rdi,%r14
mov    0x78(%rsp),%eax
mov    0x70(%rsp),%ebx
test   %eax,%eax
je     11af <genome_addition_iteration+0x6f>
lea    0xee0(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7e(%rip),%rdi
mov    %r15d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe81(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,0x10(%rsp)
movslq %ebx,%rax
mov    0x28(%rsp),%rcx
movslq (%rcx,%rax,4),%rax
mov    (%r14,%rax,4),%eax
movslq %r12d,%rcx
mov    0x20(%rsp),%rdx
movslq (%rdx,%rcx,4),%rcx
mov    %eax,(%r14,%rcx,4)
cmp    %ebp,%ebx
jge    12cb <genome_addition_iteration+0x18b>
mov    0x10(%rsp),%rax
lea    -0x1(%rax),%ecx
lea    (%rax,%rbp,1),%r13d
lea    -0x1(%rbp),%eax
mov    %eax,0x1c(%rsp)
mov    %ecx,0xc(%rsp)
mov    %rbp,0x30(%rsp)
jmp    120f <genome_addition_iteration+0xcf>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%r12d
add    $0x1,%ebx
cmp    %ebp,%ebx
je     12cb <genome_addition_iteration+0x18b>
cmp    %ecx,%r12d
jge    1250 <genome_addition_iteration+0x110>
mov    %ecx,%r15d
add    $0x1,%r12d
mov    %r14,%rdi
mov    0x10(%rsp),%rsi
mov    %ebp,%edx
mov    0x20(%rsp),%rcx
mov    %r12d,%r8d
mov    0x28(%rsp),%r9
mov    0x78(%rsp),%eax
push   %rax
push   %rbx
call   1060 <genome_addition_iteration@plt>
add    $0x10,%rsp
cmp    %r15d,%r12d
mov    %r15d,%ecx
jne    12aa <genome_addition_iteration+0x16a>
jmp    12cb <genome_addition_iteration+0x18b>
xchg   %ax,%ax
mov    %r12d,%r15d
lea    0xde8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r13d,%r13d
lea    0xde2(%rip),%rbp
jle    1287 <genome_addition_iteration+0x147>
xor    %r12d,%r12d
mov    (%r14,%r12,4),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r13
jne    1270 <genome_addition_iteration+0x130>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x1,0x10(%rsp)
mov    0x30(%rsp),%rbp
mov    0xc(%rsp),%ecx
je     12cb <genome_addition_iteration+0x18b>
mov    %r15d,%r12d
cmp    0x1c(%rsp),%ebx
je     12cb <genome_addition_iteration+0x18b>
mov    0x78(%rsp),%eax
test   %eax,%eax
je     1200 <genome_addition_iteration+0xc0>
lea    0xd94(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%ecx
jmp    1200 <genome_addition_iteration+0xc0>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"STATUS-------------------\0A\00"
@.str.1 = [22 x i8] c"ZEROES & INDS: %d\09%d\0A\00"
@.str.2 = [19 x i8] c"CURRENT ZERO:\09\09%d\0A\00"
@.str.3 = [25 x i8] c"CURRENT REPLACEMENT:\09%d\0A\00"
@.str.4 = [11 x i8] c"GENOTYPE:\09\00"
@.str.5 = [4 x i8] c" %d\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [6 x i8] c"\09~~~\0A\00"
define void @genome_addition_iteration(i32* %0, i32 %1, i32 %2, i32* %3, i32 %4, i32* %5, i32 %6, i32 %7) {
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32* %0, i32** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32* %3, i32** %12
store i32 %4, i32* %13
store i32* %5, i32** %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%19 = load i32, i32* %16
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* %10
%24 = load i32, i32* %11
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i32, i32* %13
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %15
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %21, %8
%31 = load i32*, i32** %9
%32 = load i32*, i32** %14
%33 = load i32, i32* %15
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %31, i64 %37
%39 = load i32, i32* %38
%40 = load i32*, i32** %9
%41 = load i32*, i32** %12
%42 = load i32, i32* %13
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = load i32, i32* %44
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %40, i64 %46
store i32 %39, i32* %47
%48 = load i32, i32* %15
store i32 %48, i32* %17
br label %49
49: ; preds = %111, %30
%50 = load i32, i32* %17
%51 = load i32, i32* %11
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %114
53: ; preds = %49
%54 = load i32, i32* %13
%55 = load i32, i32* %10
%56 = sub nsw i32 %55, 1
%57 = icmp slt i32 %54, %56
br i1 %57, label %58, label %74
58: ; preds = %53
%59 = load i32*, i32** %9
%60 = load i32, i32* %10
%61 = load i32, i32* %11
%62 = load i32*, i32** %12
%63 = load i32, i32* %13
%64 = add nsw i32 %63, 1
store i32 %64, i32* %13
%65 = load i32*, i32** %14
%66 = load i32, i32* %17
%67 = load i32, i32* %16
%68 = load i32, i32* %13
%69 = load i32, i32* %10
%70 = sub nsw i32 %69, 1
%71 = icmp eq i32 %68, %70
br i1 %71, label %72, label %73
72: ; preds = %58
br label %115
73: ; preds = %58
br label %103
74: ; preds = %53
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %18
br label %76
76: ; preds = %89, %74
%77 = load i32, i32* %18
%78 = load i32, i32* %10
%79 = load i32, i32* %11
%80 = add nsw i32 %78, %79
%81 = icmp slt i32 %77, %80
br i1 %81, label %82, label %92
82: ; preds = %76
%83 = load i32*, i32** %9
%84 = load i32, i32* %18
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i32, i32* %83, i64 %85
%87 = load i32, i32* %86
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %87)
br label %89
89: ; preds = %82
%90 = load i32, i32* %18
%91 = add nsw i32 %90, 1
store i32 %91, i32* %18
br label %76
92: ; preds = %76
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%94 = load i32, i32* %10
%95 = icmp eq i32 %94, 1
br i1 %95, label %101, label %96
96: ; preds = %92
%97 = load i32, i32* %17
%98 = load i32, i32* %11
%99 = sub nsw i32 %98, 1
%100 = icmp eq i32 %97, %99
br i1 %100, label %101, label %102
101: ; preds = %96, %92
br label %115
102: ; preds = %96
br label %103
103: ; preds = %102, %73
%104 = load i32, i32* %13
%105 = add nsw i32 %104, -1
store i32 %105, i32* %13
%106 = load i32, i32* %16
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %110
108: ; preds = %103
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %110
110: ; preds = %108, %103
br label %111
111: ; preds = %110
%112 = load i32, i32* %17
%113 = add nsw i32 %112, 1
store i32 %113, i32* %17
br label %49
114: ; preds = %49
br label %115
115: ; preds = %114, %101, %72
ret void
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"ZEROES & INDS: %d\09%d\0A\00"
@.str.2 = [19 x i8] c"CURRENT ZERO:\09\09%d\0A\00"
@.str.3 = [25 x i8] c"CURRENT REPLACEMENT:\09%d\0A\00"
@.str.4 = [11 x i8] c"GENOTYPE:\09\00"
@.str.5 = [4 x i8] c" %d\00"
@str = [5 x i8] c"\09~~~\00"
@str.8 = [26 x i8] c"STATUS-------------------\00"
define void @genome_addition_iteration(i32* nocapture %0, i32 %1, i32 %2, i32* nocapture %3, i32 %4, i32* nocapture %5, i32 %6, i32 %7) {
%9 = icmp eq i32 %7, 0
br i1 %9, label %15, label %10
10: ; preds = %8
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %2)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %6)
br label %15
15: ; preds = %10, %8
%16 = sext i32 %6 to i64
%17 = getelementptr inbounds i32, i32* %5, i64 %16
%18 = load i32, i32* %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %0, i64 %19
%21 = load i32, i32* %20
%22 = sext i32 %4 to i64
%23 = getelementptr inbounds i32, i32* %3, i64 %22
%24 = load i32, i32* %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %0, i64 %25
store i32 %21, i32* %26
%27 = icmp slt i32 %6, %2
br i1 %27, label %28, label %63
28: ; preds = %15
%29 = add nsw i32 %1, -1
%30 = add i32 %2, %1
%31 = icmp sgt i32 %30, 0
%32 = icmp eq i32 %1, 1
%33 = add nsw i32 %2, -1
%34 = zext i32 %30 to i64
br label %35
35: ; preds = %28, %60
%36 = phi i32 [ %6, %28 ], [ %61, %60 ]
%37 = phi i32 [ %4, %28 ], [ %57, %60 ]
%38 = icmp slt i32 %37, %29
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = add nsw i32 %37, 1
tail call void @genome_addition_iteration(i32* %0, i32 %1, i32 %2, i32* %3, i32 %40, i32* %5, i32 %36, i32 %7)
%41 = icmp eq i32 %40, %29
br i1 %41, label %63, label %55
42: ; preds = %35
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br i1 %31, label %44, label %51
44: ; preds = %42, %44
%45 = phi i64 [ %49, %44 ], [ 0, %42 ]
%46 = getelementptr inbounds i32, i32* %0, i64 %45
%47 = load i32, i32* %46
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = add nuw nsw i64 %45, 1
%50 = icmp eq i64 %49, %34
br i1 %50, label %51, label %44
51: ; preds = %44, %42
%52 = tail call i32 @putchar(i32 10)
%53 = icmp eq i32 %36, %33
%54 = select i1 %32, i1 true, i1 %53
br i1 %54, label %63, label %55
55: ; preds = %51, %39
%56 = phi i32 [ %40, %39 ], [ %37, %51 ]
%57 = add nsw i32 %56, -1
br i1 %9, label %60, label %58
58: ; preds = %55
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %60
60: ; preds = %55, %58
%61 = add i32 %36, 1
%62 = icmp eq i32 %61, %2
br i1 %62, label %63, label %35
63: ; preds = %39, %51, %60, %15
ret void
}