#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 hasard(int /*<<< orphan*/, int);
void initCodeSecretMastermind(char code[4 + 1]) {
  const char baseCode[] = "rjvbBcf";
  int combinaison[4] = {-1, -1, -1, -1};
  int indexHasard;
  for (indexHasard = 0; indexHasard < 4; indexHasard++) {
    int nbHasard;
    do {
      nbHasard = hasard(0, 7 - 1);
    } while (nbHasard == combinaison[0] || nbHasard == combinaison[1] ||
             nbHasard == combinaison[2] || nbHasard == combinaison[3]);
    combinaison[indexHasard] = nbHasard;
    code[indexHasard] = baseCode[nbHasard];
  }
  code[4] = '\0';
}


x86 assembly (clang, -O0):
<initCodeSecretMastermind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xee2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedf(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    11d8 <initCodeSecretMastermind+0xc8>
jmp    1153 <initCodeSecretMastermind+0x43>
xor    %edi,%edi
mov    $0x6,%esi
call   1030 <hasard@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%ecx
mov    $0x1,%al
cmp    -0x20(%rbp),%ecx
mov    %al,-0x29(%rbp)
je     11a1 <initCodeSecretMastermind+0x91>
mov    -0x28(%rbp),%ecx
mov    $0x1,%al
cmp    -0x1c(%rbp),%ecx
mov    %al,-0x29(%rbp)
je     11a1 <initCodeSecretMastermind+0x91>
mov    -0x28(%rbp),%ecx
mov    $0x1,%al
cmp    -0x18(%rbp),%ecx
mov    %al,-0x29(%rbp)
je     11a1 <initCodeSecretMastermind+0x91>
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1153 <initCodeSecretMastermind+0x43>
mov    -0x28(%rbp),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
movslq -0x28(%rbp),%rax
mov    -0x10(%rbp,%rax,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1144 <initCodeSecretMastermind+0x34>
mov    -0x8(%rbp),%rax
movb   $0x0,0x4(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initCodeSecretMastermind>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    $0x6,%esi
call   1030 <hasard@plt>
cmp    $0xffffffff,%eax
je     1120 <initCodeSecretMastermind+0x10>
mov    %eax,%ebp
cltq
lea    0xec4(%rip),%r12
mov    (%rax,%r12,1),%al
mov    %al,(%r14)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edi,%edi
mov    $0x6,%esi
call   1030 <hasard@plt>
cmp    %ebp,%eax
je     1150 <initCodeSecretMastermind+0x40>
mov    %eax,%r15d
cmp    $0xffffffff,%eax
je     1150 <initCodeSecretMastermind+0x40>
movslq %r15d,%rax
mov    (%rax,%r12,1),%al
mov    %al,0x1(%r14)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edi,%edi
mov    $0x6,%esi
call   1030 <hasard@plt>
cmp    %ebp,%eax
je     1180 <initCodeSecretMastermind+0x70>
mov    %eax,%ebx
cmp    %r15d,%eax
je     1180 <initCodeSecretMastermind+0x70>
cmp    $0xffffffff,%ebx
je     1180 <initCodeSecretMastermind+0x70>
movslq %ebx,%rax
mov    (%rax,%r12,1),%al
mov    %al,0x2(%r14)
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    $0x6,%esi
call   1030 <hasard@plt>
cmp    %ebp,%eax
je     11b0 <initCodeSecretMastermind+0xa0>
cmp    %r15d,%eax
je     11b0 <initCodeSecretMastermind+0xa0>
cmp    %ebx,%eax
je     11b0 <initCodeSecretMastermind+0xa0>
cmp    $0xffffffff,%eax
je     11b0 <initCodeSecretMastermind+0xa0>
cltq
mov    (%rax,%r12,1),%al
mov    %al,0x3(%r14)
movb   $0x0,0x4(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.initCodeSecretMastermind.baseCode = [8 x i8] c"rjvbBcf\00"
@__const.initCodeSecretMastermind.combinaison = [4 x i32] [i32 -1, i32 -1, i32 -1, i32 -1]
define void @initCodeSecretMastermind(i8* %0) {
%2 = alloca i8*
%3 = alloca [8 x i8]
%4 = alloca [4 x i32]
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %2
%7 = bitcast [8 x i8]* %3 to i8*
%8 = bitcast [4 x i32]* %4 to i8*
store i32 0, i32* %5
br label %9
9: ; preds = %50, %1
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %53
12: ; preds = %9
br label %13
13: ; preds = %35, %12
%14 = call i32 @hasard(i32 0, i32 6)
store i32 %14, i32* %6
br label %15
15: ; preds = %13
%16 = load i32, i32* %6
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%18 = load i32, i32* %17
%19 = icmp eq i32 %16, %18
br i1 %19, label %35, label %20
20: ; preds = %15
%21 = load i32, i32* %6
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 1
%23 = load i32, i32* %22
%24 = icmp eq i32 %21, %23
br i1 %24, label %35, label %25
25: ; preds = %20
%26 = load i32, i32* %6
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 2
%28 = load i32, i32* %27
%29 = icmp eq i32 %26, %28
br i1 %29, label %35, label %30
30: ; preds = %25
%31 = load i32, i32* %6
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 3
%33 = load i32, i32* %32
%34 = icmp eq i32 %31, %33
br label %35
35: ; preds = %30, %25, %20, %15
%36 = phi i1 [ true, %25 ], [ true, %20 ], [ true, %15 ], [ %34, %30 ]
br i1 %36, label %13, label %37
37: ; preds = %35
%38 = load i32, i32* %6
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %40
store i32 %38, i32* %41
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = load i8*, i8** %2
%47 = load i32, i32* %5
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8 %45, i8* %49
br label %50
50: ; preds = %37
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %9
53: ; preds = %9
%54 = load i8*, i8** %2
%55 = getelementptr inbounds i8, i8* %54, i64 4
store i8 0, i8* %55
ret void
}

LLVM IR (-O2):
@__const.initCodeSecretMastermind.baseCode = [8 x i8] c"rjvbBcf\00"
define void @initCodeSecretMastermind(i8* nocapture writeonly %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @hasard(i32 0, i32 6)
%4 = icmp eq i32 %3, -1
br i1 %4, label %2, label %5
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.initCodeSecretMastermind.baseCode, i64 0, i64 %6
%8 = load i8, i8* %7
store i8 %8, i8* %0
br label %9
9: ; preds = %9, %5
%10 = tail call i32 @hasard(i32 0, i32 6)
%11 = icmp eq i32 %10, %3
%12 = icmp eq i32 %10, -1
%13 = or i1 %11, %12
br i1 %13, label %9, label %14
14: ; preds = %9
%15 = sext i32 %10 to i64
%16 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.initCodeSecretMastermind.baseCode, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %17, i8* %18
br label %19
19: ; preds = %19, %14
%20 = tail call i32 @hasard(i32 0, i32 6)
%21 = icmp eq i32 %20, %3
%22 = icmp eq i32 %20, %10
%23 = select i1 %21, i1 true, i1 %22
%24 = icmp eq i32 %20, -1
%25 = or i1 %23, %24
br i1 %25, label %19, label %26
26: ; preds = %19
%27 = sext i32 %20 to i64
%28 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.initCodeSecretMastermind.baseCode, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %29, i8* %30
br label %31
31: ; preds = %31, %26
%32 = tail call i32 @hasard(i32 0, i32 6)
%33 = icmp eq i32 %32, %3
%34 = icmp eq i32 %32, %10
%35 = select i1 %33, i1 true, i1 %34
%36 = icmp eq i32 %32, %20
%37 = select i1 %35, i1 true, i1 %36
%38 = icmp eq i32 %32, -1
%39 = select i1 %37, i1 true, i1 %38
br i1 %39, label %31, label %40
40: ; preds = %31
%41 = sext i32 %32 to i64
%42 = getelementptr inbounds [8 x i8], [8 x i8]* @__const.initCodeSecretMastermind.baseCode, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %43, i8* %44
%45 = getelementptr inbounds i8, i8* %0, i64 4
store i8 0, i8* %45
ret void
}