#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 */
scalar_t__ contains(char, char **, int);
int /*<<< orphan*/ printf(char *, char *);
char replace(char, char **, int);
void suggest(char password[], char out[], int len, int pos, char map[][2],
             int map_len) {
  if (len == pos) {
    out[len] = '\0';
    printf("%s \n", out);
    return;
  }
  out[pos] = password[pos];
  suggest(password, out, len, pos + 1, map, map_len);
  if (contains(password[pos], map, map_len)) {
    out[pos] = replace(password[pos], map, map_len);
    suggest(password, out, len, pos + 1, map, map_len);
  }
}


x86 assembly (clang, -O0):
<suggest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    118b <suggest+0x4b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rsi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
jmp    1228 <suggest+0xe8>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
call   1060 <suggest@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
movsbl %al,%edi
call   1040 <contains@plt>
cmp    $0x0,%rax
je     1228 <suggest+0xe8>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
movsbl %al,%edi
call   1050 <replace@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
call   1060 <suggest@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<suggest>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
mov    %edx,0xc(%rsp)
cmp    %ecx,%edx
je     11e8 <suggest+0xa8>
mov    %r9d,%r14d
mov    %r8,%r12
mov    %ecx,%ebx
mov    %rdi,%rbp
movslq %ecx,%r15
mov    0xc(%rsp),%eax
neg    %eax
mov    %rax,0x10(%rsp)
add    $0x1,%ebx
nopl   0x0(%rax)
movzbl 0x0(%rbp,%r15,1),%eax
mov    %al,0x0(%r13,%r15,1)
mov    %rbp,%rdi
mov    %r13,%rsi
mov    0xc(%rsp),%edx
mov    %ebx,%ecx
mov    %r12,%r8
mov    %r14d,%r9d
call   1060 <suggest@plt>
movsbl 0x0(%rbp,%r15,1),%edi
mov    %r12,%rsi
mov    %r14d,%edx
call   1040 <contains@plt>
test   %rax,%rax
je     1210 <suggest+0xd0>
movsbl 0x0(%rbp,%r15,1),%edi
mov    %r12,%rsi
mov    %r14d,%edx
call   1050 <replace@plt>
mov    %al,0x0(%r13,%r15,1)
mov    0x10(%rsp),%rax
add    %ebx,%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
add    $0x1,%r15
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1180 <suggest+0x40>
movslq 0xc(%rsp),%rax
movb   $0x0,0x0(%r13,%rax,1)
lea    0xe06(%rip),%rdi
mov    %r13,%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@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 @suggest(i8* %0, i8* %1, i32 %2, i32 %3, [2 x i8]* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca [2 x i8]*
%12 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store [2 x i8]* %4, [2 x i8]** %11
store i32 %5, i32* %12
%13 = load i32, i32* %9
%14 = load i32, i32* %10
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %6
%17 = load i8*, i8** %8
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 0, i8* %20
%21 = load i8*, i8** %8
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %71
23: ; preds = %6
%24 = load i8*, i8** %7
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = load i8*, i8** %8
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 %28, i8* %32
%33 = load i8*, i8** %7
%34 = load i8*, i8** %8
%35 = load i32, i32* %9
%36 = load i32, i32* %10
%37 = add nsw i32 %36, 1
%38 = load [2 x i8]*, [2 x i8]** %11
%39 = load i32, i32* %12
%40 = load i8*, i8** %7
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = load [2 x i8]*, [2 x i8]** %11
%46 = bitcast [2 x i8]* %45 to i8**
%47 = load i32, i32* %12
%48 = call i64 @contains(i8 signext %44, i8** %46, i32 %47)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %71
50: ; preds = %23
%51 = load i8*, i8** %7
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = load [2 x i8]*, [2 x i8]** %11
%57 = bitcast [2 x i8]* %56 to i8**
%58 = load i32, i32* %12
%59 = call signext i8 @replace(i8 signext %55, i8** %57, i32 %58)
%60 = load i8*, i8** %8
%61 = load i32, i32* %10
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
store i8 %59, i8* %63
%64 = load i8*, i8** %7
%65 = load i8*, i8** %8
%66 = load i32, i32* %9
%67 = load i32, i32* %10
%68 = add nsw i32 %67, 1
%69 = load [2 x i8]*, [2 x i8]** %11
%70 = load i32, i32* %12
br label %71
71: ; preds = %16, %50, %23
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s \0A\00"
define void @suggest(i8* %0, i8* %1, i32 %2, i32 %3, [2 x i8]* %4, i32 %5) {
%7 = icmp eq i32 %2, %3
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = bitcast [2 x i8]* %4 to i8**
%10 = sext i32 %3 to i64
br label %15
11: ; preds = %25, %6
%12 = sext i32 %2 to i64
%13 = getelementptr inbounds i8, i8* %1, i64 %12
store i8 0, i8* %13
%14 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %29
15: ; preds = %8, %25
%16 = phi i64 [ %10, %8 ], [ %20, %25 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %1, i64 %16
store i8 %18, i8* %19
%20 = add nsw i64 %16, 1
%21 = trunc i64 %20 to i32
tail call void @suggest(i8* %0, i8* %1, i32 %2, i32 %21, [2 x i8]* %4, i32 %5)
%22 = load i8, i8* %17
%23 = tail call i64 @contains(i8 signext %22, i8** %9, i32 %5)
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %15
%26 = load i8, i8* %17
%27 = tail call signext i8 @replace(i8 signext %26, i8** %9, i32 %5)
store i8 %27, i8* %19
%28 = icmp eq i32 %21, %2
br i1 %28, label %11, label %15
29: ; preds = %15, %11
ret void
}