#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 *, ...);
int /*<<< orphan*/ puts(char *);
void fill_genotype_model(char *alleles, char *model, int k, int n,
                         int curr_model_index, int curr_allele_index,
                         int verbose) {
  if (verbose) {
    printf("STATUS-------------------\n");
    printf("PLOIDY & NO. ALLELES:\t%d, %d\n", k, n);
    printf("CURRENT MODEL POSITION:\t\t%d\n", curr_model_index);
    printf("CURRENT ALLELE POSITION:\t%d\n", curr_allele_index);
  }
  model[curr_model_index] = alleles[curr_allele_index];
  int i;
  int j;
  for (i = curr_allele_index; i < n; i++) {
    if (curr_model_index < k - 1) {
      fill_genotype_model(alleles, model, k, n, ++curr_model_index, i, verbose);
      if (curr_model_index == k - 1) {
        return;
      }
    } else {
      printf("GENOTYPE MODEL:\t");
      puts(model);
      if (k == 1 || i == n - 1) {
        return;
      }
    }
    curr_model_index--;
    if (verbose)
      printf("\t~~~\n");
  }
  return;
}


x86 assembly (clang, -O0):
<fill_genotype_model>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
cmpl   $0x0,0x10(%rbp)
je     119f <fill_genotype_model+0x6f>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    128c <fill_genotype_model+0x15c>
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    121c <fill_genotype_model+0xec>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
add    $0x1,%r8d
mov    %r8d,-0x1c(%rbp)
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <fill_genotype_model@plt>
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1217 <fill_genotype_model+0xe7>
jmp    1291 <fill_genotype_model+0x161>
jmp    1258 <fill_genotype_model+0x128>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <puts@plt>
cmpl   $0x1,-0x14(%rbp)
je     124e <fill_genotype_model+0x11e>
mov    -0x24(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1253 <fill_genotype_model+0x123>
jmp    1291 <fill_genotype_model+0x161>
jmp    1258 <fill_genotype_model+0x128>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,0x10(%rbp)
je     1279 <fill_genotype_model+0x149>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    127e <fill_genotype_model+0x14e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bb <fill_genotype_model+0x8b>
jmp    1291 <fill_genotype_model+0x161>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_genotype_model>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebx
mov    %r8d,%ebp
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,0x10(%rsp)
cmpl   $0x0,0x50(%rsp)
je     1199 <fill_genotype_model+0x69>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe94(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq %ebx,%rax
mov    0x10(%rsp),%rcx
mov    (%rcx,%rax,1),%al
movslq %ebp,%rcx
mov    %al,(%r12,%rcx,1)
cmp    %r14d,%ebx
jge    1247 <fill_genotype_model+0x117>
lea    -0x1(%r15),%r13d
lea    -0x1(%r14),%eax
mov    %eax,0xc(%rsp)
jmp    11db <fill_genotype_model+0xab>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffff,%ebp
add    $0x1,%ebx
cmp    %ebx,%r14d
je     1247 <fill_genotype_model+0x117>
cmp    %r13d,%ebp
jge    1210 <fill_genotype_model+0xe0>
add    $0x1,%ebp
mov    0x50(%rsp),%eax
mov    %eax,(%rsp)
mov    0x10(%rsp),%rdi
mov    %r12,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    %ebx,%r9d
call   1050 <fill_genotype_model@plt>
cmp    %r13d,%ebp
jne    1232 <fill_genotype_model+0x102>
jmp    1247 <fill_genotype_model+0x117>
nopw   0x0(%rax,%rax,1)
lea    0xe41(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
cmp    $0x1,%r15d
je     1247 <fill_genotype_model+0x117>
cmp    %ebx,0xc(%rsp)
je     1247 <fill_genotype_model+0x117>
cmpl   $0x0,0x50(%rsp)
je     11d0 <fill_genotype_model+0xa0>
lea    0xe29(%rip),%rdi
call   1030 <puts@plt>
jmp    11d0 <fill_genotype_model+0xa0>
add    $0x18,%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 = [30 x i8] c"PLOIDY & NO. ALLELES:\09%d, %d\0A\00"
@.str.2 = [29 x i8] c"CURRENT MODEL POSITION:\09\09%d\0A\00"
@.str.3 = [29 x i8] c"CURRENT ALLELE POSITION:\09%d\0A\00"
@.str.4 = [17 x i8] c"GENOTYPE MODEL:\09\00"
@.str.5 = [6 x i8] c"\09~~~\0A\00"
define void @fill_genotype_model(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%17 = load i32, i32* %14
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %7
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* %10
%22 = load i32, i32* %11
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i32, i32* %12
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %13
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %19, %7
%29 = load i8*, i8** %8
%30 = load i32, i32* %13
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = load i8*, i8** %9
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
store i8 %33, i8* %37
%38 = load i32, i32* %13
store i32 %38, i32* %15
br label %39
39: ; preds = %84, %28
%40 = load i32, i32* %15
%41 = load i32, i32* %11
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %87
43: ; preds = %39
%44 = load i32, i32* %12
%45 = load i32, i32* %10
%46 = sub nsw i32 %45, 1
%47 = icmp slt i32 %44, %46
br i1 %47, label %48, label %63
48: ; preds = %43
%49 = load i8*, i8** %8
%50 = load i8*, i8** %9
%51 = load i32, i32* %10
%52 = load i32, i32* %11
%53 = load i32, i32* %12
%54 = add nsw i32 %53, 1
store i32 %54, i32* %12
%55 = load i32, i32* %15
%56 = load i32, i32* %14
%57 = load i32, i32* %12
%58 = load i32, i32* %10
%59 = sub nsw i32 %58, 1
%60 = icmp eq i32 %57, %59
br i1 %60, label %61, label %62
61: ; preds = %48
br label %88
62: ; preds = %48
br label %76
63: ; preds = %43
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%65 = load i8*, i8** %9
%66 = call i32 @puts(i8* %65)
%67 = load i32, i32* %10
%68 = icmp eq i32 %67, 1
br i1 %68, label %74, label %69
69: ; preds = %63
%70 = load i32, i32* %15
%71 = load i32, i32* %11
%72 = sub nsw i32 %71, 1
%73 = icmp eq i32 %70, %72
br i1 %73, label %74, label %75
74: ; preds = %69, %63
br label %88
75: ; preds = %69
br label %76
76: ; preds = %75, %62
%77 = load i32, i32* %12
%78 = add nsw i32 %77, -1
store i32 %78, i32* %12
%79 = load i32, i32* %14
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %76
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %83
83: ; preds = %81, %76
br label %84
84: ; preds = %83
%85 = load i32, i32* %15
%86 = add nsw i32 %85, 1
store i32 %86, i32* %15
br label %39
87: ; preds = %39
br label %88
88: ; preds = %87, %74, %61
ret void
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"PLOIDY & NO. ALLELES:\09%d, %d\0A\00"
@.str.2 = [29 x i8] c"CURRENT MODEL POSITION:\09\09%d\0A\00"
@.str.3 = [29 x i8] c"CURRENT ALLELE POSITION:\09%d\0A\00"
@.str.4 = [17 x i8] c"GENOTYPE MODEL:\09\00"
@str = [5 x i8] c"\09~~~\00"
@str.6 = [26 x i8] c"STATUS-------------------\00"
define void @fill_genotype_model(i8* nocapture %0, i8* nocapture %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = icmp eq i32 %6, 0
br i1 %8, label %14, label %9
9: ; preds = %7
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.6, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %5)
br label %14
14: ; preds = %9, %7
%15 = sext i32 %5 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = sext i32 %4 to i64
%19 = getelementptr inbounds i8, i8* %1, i64 %18
store i8 %17, i8* %19
%20 = icmp slt i32 %5, %3
br i1 %20, label %21, label %45
21: ; preds = %14
%22 = add nsw i32 %2, -1
%23 = icmp eq i32 %2, 1
%24 = add nsw i32 %3, -1
br label %25
25: ; preds = %21, %42
%26 = phi i32 [ %4, %21 ], [ %39, %42 ]
%27 = phi i32 [ %5, %21 ], [ %43, %42 ]
%28 = icmp slt i32 %26, %22
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = add nsw i32 %26, 1
tail call void @fill_genotype_model(i8* %0, i8* %1, i32 %2, i32 %3, i32 %30, i32 %27, i32 %6)
%31 = icmp eq i32 %30, %22
br i1 %31, label %45, label %37
32: ; preds = %25
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%34 = tail call i32 @puts(i8* dereferenceable(1) %1)
%35 = icmp eq i32 %27, %24
%36 = select i1 %23, i1 true, i1 %35
br i1 %36, label %45, label %37
37: ; preds = %32, %29
%38 = phi i32 [ %30, %29 ], [ %26, %32 ]
%39 = add nsw i32 %38, -1
br i1 %8, label %42, label %40
40: ; preds = %37
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %42
42: ; preds = %37, %40
%43 = add i32 %27, 1
%44 = icmp eq i32 %43, %3
br i1 %44, label %45, label %25
45: ; preds = %29, %32, %42, %14
ret void
}