#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 isMatched(int, char *, char *, int, int);
int isPossible(int, int, char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
void rec(int n, int filled, char *str, char *guess, int wpeg, int bpeg) {
  char i;
  if (n == filled) {
    if (isMatched(n, str, guess, wpeg, bpeg) == 1)
      printf("%s \n", str);
  } else {
    for (i = 'a'; i <= 'f'; i++) {
      if (isPossible(n, filled, str, guess, wpeg + bpeg) == 1) {
        str[filled] = i;
        rec(n, filled + 1, str, guess, wpeg, bpeg);
      }
    }
  }
}


x86 assembly (clang, -O0):
<rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    119f <rec+0x5f>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <isMatched@plt>
cmp    $0x1,%eax
jne    119a <rec+0x5a>
mov    -0x10(%rbp),%rsi
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
jmp    1217 <rec+0xd7>
movb   $0x61,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x66,%eax
jg     1212 <rec+0xd2>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
add    -0x20(%rbp),%r8d
call   1050 <isPossible@plt>
cmp    $0x1,%eax
jne    1200 <rec+0xc0>
mov    -0x21(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
call   1060 <rec@plt>
jmp    1205 <rec+0xc5>
mov    -0x21(%rbp),%al
add    $0x1,%al
mov    %al,-0x21(%rbp)
jmp    11a3 <rec+0x63>
jmp    1217 <rec+0xd7>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rec>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%r15d
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %edi,%ebp
cmp    %esi,%edi
jne    1196 <rec+0x56>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15d,%ecx
mov    %r9d,%r8d
call   1030 <isMatched@plt>
cmp    $0x1,%eax
jne    1319 <rec+0x1d9>
lea    0xe80(%rip),%rdi
mov    %rbx,%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
mov    %esi,%r13d
mov    %r9,0x10(%rsp)
lea    (%r9,%r15,1),%r14d
movslq %esi,%rax
mov    %rax,0x8(%rsp)
lea    0x1(%r13),%eax
mov    %eax,0x4(%rsp)
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14d,%r8d
call   1050 <isPossible@plt>
cmp    $0x1,%eax
jne    11e9 <rec+0xa9>
mov    0x8(%rsp),%rax
movb   $0x61,(%rbx,%rax,1)
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    0x10(%rsp),%r9
call   1060 <rec@plt>
mov    %ebp,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14d,%r8d
call   1050 <isPossible@plt>
cmp    $0x1,%eax
jne    1223 <rec+0xe3>
mov    0x8(%rsp),%rax
movb   $0x62,(%rbx,%rax,1)
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    0x10(%rsp),%r9
call   1060 <rec@plt>
mov    %ebp,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14d,%r8d
call   1050 <isPossible@plt>
cmp    $0x1,%eax
jne    125d <rec+0x11d>
mov    0x8(%rsp),%rax
movb   $0x63,(%rbx,%rax,1)
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    0x10(%rsp),%r9
call   1060 <rec@plt>
mov    %ebp,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14d,%r8d
call   1050 <isPossible@plt>
cmp    $0x1,%eax
jne    1297 <rec+0x157>
mov    0x8(%rsp),%rax
movb   $0x64,(%rbx,%rax,1)
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    0x10(%rsp),%r9
call   1060 <rec@plt>
mov    %ebp,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14d,%r8d
call   1050 <isPossible@plt>
cmp    $0x1,%eax
jne    12d1 <rec+0x191>
mov    0x8(%rsp),%rax
movb   $0x65,(%rbx,%rax,1)
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    0x10(%rsp),%r9
call   1060 <rec@plt>
mov    %ebp,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r14d,%r8d
call   1050 <isPossible@plt>
cmp    $0x1,%eax
jne    1319 <rec+0x1d9>
mov    0x8(%rsp),%rax
movb   $0x66,(%rbx,%rax,1)
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    0x10(%rsp),%r9
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <rec@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s \0A\00"
define void @rec(i32 %0, i32 %1, i8* %2, i8* %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
store i32 %0, i32* %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %29
17: ; preds = %6
%18 = load i32, i32* %7
%19 = load i8*, i8** %9
%20 = load i8*, i8** %10
%21 = load i32, i32* %11
%22 = load i32, i32* %12
%23 = call i32 @isMatched(i32 %18, i8* %19, i8* %20, i32 %21, i32 %22)
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %17
%26 = load i8*, i8** %9
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %25, %17
br label %62
29: ; preds = %6
store i8 97, i8* %13
br label %30
30: ; preds = %58, %29
%31 = load i8, i8* %13
%32 = sext i8 %31 to i32
%33 = icmp sle i32 %32, 102
br i1 %33, label %34, label %61
34: ; preds = %30
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = load i8*, i8** %9
%38 = load i8*, i8** %10
%39 = load i32, i32* %11
%40 = load i32, i32* %12
%41 = add nsw i32 %39, %40
%42 = call i32 @isPossible(i32 %35, i32 %36, i8* %37, i8* %38, i32 %41)
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %57
44: ; preds = %34
%45 = load i8, i8* %13
%46 = load i8*, i8** %9
%47 = load i32, i32* %8
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8 %45, i8* %49
%50 = load i32, i32* %7
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
%53 = load i8*, i8** %9
%54 = load i8*, i8** %10
%55 = load i32, i32* %11
%56 = load i32, i32* %12
br label %57
57: ; preds = %44, %34
br label %58
58: ; preds = %57
%59 = load i8, i8* %13
%60 = add i8 %59, 1
store i8 %60, i8* %13
br label %30
61: ; preds = %30
br label %62
62: ; preds = %61, %28
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s \0A\00"
define void @rec(i32 %0, i32 %1, i8* %2, i8* %3, i32 %4, i32 %5) {
%7 = icmp eq i32 %0, %1
br i1 %7, label %15, label %8
8: ; preds = %6
%9 = add nsw i32 %5, %4
%10 = sext i32 %1 to i64
%11 = getelementptr inbounds i8, i8* %2, i64 %10
%12 = add nsw i32 %1, 1
%13 = tail call i32 @isPossible(i32 %0, i32 %1, i8* %2, i8* %3, i32 %9)
%14 = icmp eq i32 %13, 1
br i1 %14, label %20, label %21
15: ; preds = %6
%16 = tail call i32 @isMatched(i32 %0, i8* %2, i8* %3, i32 %4, i32 %5)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %41
18: ; preds = %15
%19 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %41
20: ; preds = %8
store i8 97, i8* %11
tail call void @rec(i32 %0, i32 %12, i8* %2, i8* %3, i32 %4, i32 %5)
br label %21
21: ; preds = %8, %20
%22 = tail call i32 @isPossible(i32 %0, i32 %1, i8* %2, i8* %3, i32 %9)
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %25
24: ; preds = %21
store i8 98, i8* %11
tail call void @rec(i32 %0, i32 %12, i8* %2, i8* %3, i32 %4, i32 %5)
br label %25
25: ; preds = %24, %21
%26 = tail call i32 @isPossible(i32 %0, i32 %1, i8* %2, i8* %3, i32 %9)
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %29
28: ; preds = %25
store i8 99, i8* %11
tail call void @rec(i32 %0, i32 %12, i8* %2, i8* %3, i32 %4, i32 %5)
br label %29
29: ; preds = %28, %25
%30 = tail call i32 @isPossible(i32 %0, i32 %1, i8* %2, i8* %3, i32 %9)
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %33
32: ; preds = %29
store i8 100, i8* %11
tail call void @rec(i32 %0, i32 %12, i8* %2, i8* %3, i32 %4, i32 %5)
br label %33
33: ; preds = %32, %29
%34 = tail call i32 @isPossible(i32 %0, i32 %1, i8* %2, i8* %3, i32 %9)
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %37
36: ; preds = %33
store i8 101, i8* %11
tail call void @rec(i32 %0, i32 %12, i8* %2, i8* %3, i32 %4, i32 %5)
br label %37
37: ; preds = %36, %33
%38 = tail call i32 @isPossible(i32 %0, i32 %1, i8* %2, i8* %3, i32 %9)
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %41
40: ; preds = %37
store i8 102, i8* %11
tail call void @rec(i32 %0, i32 %12, i8* %2, i8* %3, i32 %4, i32 %5)
br label %41
41: ; preds = %37, %40, %15, %18
ret void
}