#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ writeScenario(int /*<<< orphan*/ *, char *);
void genDictionnary(FILE *f, char *(*dictionnary)[1024], int *index,
                    char *number[10], int n) {
  if (n > 0) {
    number[10 - n] = "?u";
    genDictionnary(f, dictionnary, index, number, n - 1);
    number[10 - n] = "?d";
    genDictionnary(f, dictionnary, index, number, n - 1);
  } else {
    char *prev = "";
    int nbOccurences = 0;
    bool ok = true;
    int i = 0;
    while (i < 10 && ok) {
      if (number[i] == prev || prev == "") {
        nbOccurences++;
      } else {
        nbOccurences = 0;
      }
      if (nbOccurences > 2) {
        ok = false;
      }
      prev = number[i];
      i++;
    }
    if (ok) {
      for (int i = 0; i < 10; i++) {
        writeScenario(f, number[i]);
      }
      writeScenario(f, "\n");
    }
    (*index)++;
  }
}


x86 assembly (clang, -O0):
<genDictionnary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    11b9 <genDictionnary+0x99>
mov    -0x20(%rbp),%rax
mov    $0xa,%ecx
sub    -0x24(%rbp),%ecx
movslq %ecx,%rcx
lea    0xea4(%rip),%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
sub    $0x1,%r8d
call   1040 <genDictionnary@plt>
mov    -0x20(%rbp),%rax
mov    $0xa,%ecx
sub    -0x24(%rbp),%ecx
movslq %ecx,%rcx
lea    0xe70(%rip),%rdx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
sub    $0x1,%r8d
call   1040 <genDictionnary@plt>
jmp    12c6 <genDictionnary+0x1a6>
lea    0xe47(%rip),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x3c(%rbp)
mov    %al,-0x41(%rbp)
jge    11f2 <genDictionnary+0xd2>
cmpl   $0x0,-0x38(%rbp)
setne  %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    1202 <genDictionnary+0xe2>
jmp    126d <genDictionnary+0x14d>
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x30(%rbp),%rax
je     1229 <genDictionnary+0x109>
lea    0xde8(%rip),%rax
cmp    %rax,-0x30(%rbp)
jne    1237 <genDictionnary+0x117>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    123e <genDictionnary+0x11e>
movl   $0x0,-0x34(%rbp)
cmpl   $0x2,-0x34(%rbp)
jle    124f <genDictionnary+0x12f>
movl   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11d9 <genDictionnary+0xb9>
cmpl   $0x0,-0x38(%rbp)
je     12bb <genDictionnary+0x19b>
movl   $0x0,-0x40(%rbp)
cmpl   $0xa,-0x40(%rbp)
jge    12ab <genDictionnary+0x18b>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <writeScenario@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    127e <genDictionnary+0x15e>
mov    -0x8(%rbp),%rdi
lea    0xd50(%rip),%rsi
call   1030 <writeScenario@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genDictionnary>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r12
mov    %rdi,%r15
test   %r8d,%r8d
jle    1196 <genDictionnary+0x76>
mov    %rsi,%r13
mov    %r8d,%ebp
mov    $0xa,%eax
sub    %rbp,%rax
lea    (%r12,%rax,8),%r14
mov    %r12,(%rsp)
nopl   0x0(%rax)
lea    0xea9(%rip),%rax
mov    %rax,(%r14)
lea    -0x1(%rbp),%rbx
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r12,%rcx
mov    %ebx,%r8d
mov    %r15,%r12
mov    %rdx,%r15
call   1040 <genDictionnary@plt>
mov    %r15,%rdx
mov    %r12,%r15
mov    (%rsp),%r12
lea    0xe7d(%rip),%rax
mov    %rax,(%r14)
add    $0x8,%r14
cmp    $0x1,%rbp
mov    %rbx,%rbp
ja     1150 <genDictionnary+0x30>
lea    0xe6a(%rip),%rax
xor    %ecx,%ecx
xor    %ebp,%ebp
mov    %rax,%rsi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rsi,%rdi
mov    (%r12,%rcx,8),%rsi
mov    %ebp,%ebx
add    $0x1,%ebx
cmp    %rdi,%rsi
mov    $0x0,%ebp
cmove  %ebx,%ebp
cmp    %rax,%rdi
cmove  %ebx,%ebp
cmp    $0x2,%ebp
jg     11df <genDictionnary+0xbf>
lea    0x1(%rcx),%rdi
cmp    $0x9,%rcx
mov    %rdi,%rcx
jb     11b0 <genDictionnary+0x90>
cmp    $0x2,%ebp
jg     127e <genDictionnary+0x15e>
mov    (%r12),%rsi
mov    %r15,%rdi
mov    %rdx,%rbx
call   1030 <writeScenario@plt>
mov    0x8(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    0x10(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    0x18(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    0x20(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    0x28(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    0x30(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    0x38(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    0x40(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    0x48(%r12),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
lea    0xd93(%rip),%rsi
mov    %r15,%rdi
call   1030 <writeScenario@plt>
mov    %rbx,%rdx
addl   $0x1,(%rdx)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"?u\00"
@.str.1 = [3 x i8] c"?d\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"\0A\00"
define void @genDictionnary(i32* %0, [1024 x i8*]* %1, i32* %2, i8** %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %16
7: ; preds = %5
%8 = zext i32 %4 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ %8, %7 ], [ %13, %9 ]
%11 = sub nsw i64 10, %10
%12 = getelementptr inbounds i8*, i8** %3, i64 %11
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %12
%13 = add nsw i64 %10, -1
%14 = trunc i64 %13 to i32
tail call void @genDictionnary(i32* %0, [1024 x i8*]* %1, i32* %2, i8** %3, i32 %14)
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %12
%15 = icmp ugt i64 %10, 1
br i1 %15, label %9, label %16
16: ; preds = %9, %5
br label %17
17: ; preds = %16, %17
%18 = phi i64 [ %29, %17 ], [ 0, %16 ]
%19 = phi i32 [ %27, %17 ], [ 0, %16 ]
%20 = phi i8* [ %22, %17 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %16 ]
%21 = getelementptr inbounds i8*, i8** %3, i64 %18
%22 = load i8*, i8** %21
%23 = icmp eq i8* %22, %20
%24 = icmp eq i8* %20, getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%25 = or i1 %24, %23
%26 = add nsw i32 %19, 1
%27 = select i1 %25, i32 %26, i32 0
%28 = icmp slt i32 %27, 3
%29 = add nuw nsw i64 %18, 1
%30 = icmp ult i64 %18, 9
%31 = and i1 %28, %30
br i1 %31, label %17, label %32
32: ; preds = %17
br i1 %28, label %33, label %64
33: ; preds = %32
%34 = load i8*, i8** %3
%35 = tail call i32 @writeScenario(i32* %0, i8* %34)
%36 = getelementptr inbounds i8*, i8** %3, i64 1
%37 = load i8*, i8** %36
%38 = tail call i32 @writeScenario(i32* %0, i8* %37)
%39 = getelementptr inbounds i8*, i8** %3, i64 2
%40 = load i8*, i8** %39
%41 = tail call i32 @writeScenario(i32* %0, i8* %40)
%42 = getelementptr inbounds i8*, i8** %3, i64 3
%43 = load i8*, i8** %42
%44 = tail call i32 @writeScenario(i32* %0, i8* %43)
%45 = getelementptr inbounds i8*, i8** %3, i64 4
%46 = load i8*, i8** %45
%47 = tail call i32 @writeScenario(i32* %0, i8* %46)
%48 = getelementptr inbounds i8*, i8** %3, i64 5
%49 = load i8*, i8** %48
%50 = tail call i32 @writeScenario(i32* %0, i8* %49)
%51 = getelementptr inbounds i8*, i8** %3, i64 6
%52 = load i8*, i8** %51
%53 = tail call i32 @writeScenario(i32* %0, i8* %52)
%54 = getelementptr inbounds i8*, i8** %3, i64 7
%55 = load i8*, i8** %54
%56 = tail call i32 @writeScenario(i32* %0, i8* %55)
%57 = getelementptr inbounds i8*, i8** %3, i64 8
%58 = load i8*, i8** %57
%59 = tail call i32 @writeScenario(i32* %0, i8* %58)
%60 = getelementptr inbounds i8*, i8** %3, i64 9
%61 = load i8*, i8** %60
%62 = tail call i32 @writeScenario(i32* %0, i8* %61)
%63 = tail call i32 @writeScenario(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %64
64: ; preds = %33, %32
%65 = load i32, i32* %2
%66 = add nsw i32 %65, 1
store i32 %66, i32* %2
ret void
}