#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*/ exit(int /*<<< orphan*/);
char malloc(int);
int strlen(char *);
void masquageMotCahe(char pointeurMotSecret[], char pointeurMotCache[]) {
  int longeurChaine = 0, i = 0;
  longeurChaine = strlen(pointeurMotSecret);
  *pointeurMotCache = malloc(longeurChaine * sizeof(char));
  if (pointeurMotCache == NULL) {
    exit(0);
  } else {
    for (i = 0; i < longeurChaine; i++) {
      pointeurMotCache[i] = '*';
    }
  }
}


x86 assembly (clang, -O0):
<masquageMotCahe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
cmpq   $0x0,-0x10(%rbp)
jne    1183 <masquageMotCahe+0x53>
xor    %edi,%edi
call   1050 <exit@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b0 <masquageMotCahe+0x80>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x2a,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118a <masquageMotCahe+0x5a>
jmp    11b5 <masquageMotCahe+0x85>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<masquageMotCahe>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %al,(%rbx)
test   %ebp,%ebp
jle    1159 <masquageMotCahe+0x29>
mov    %ebp,%edx
mov    %rbx,%rdi
mov    $0x2a,%esi
call   1040 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @masquageMotCahe(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 1
%12 = trunc i64 %11 to i32
%13 = call signext i8 @malloc(i32 %12)
%14 = load i8*, i8** %4
store i8 %13, i8* %14
%15 = load i8*, i8** %4
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %2
store i32 0, i32* %6
br label %20
20: ; preds = %29, %19
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i8*, i8** %4
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 42, i8* %28
br label %29
29: ; preds = %24
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %20
32: ; preds = %20
br label %33
33: ; preds = %32
ret void
}

LLVM IR (-O2):
define void @masquageMotCahe(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call signext i8 @malloc(i32 %3)
store i8 %4, i8* %1
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = zext i32 %3 to i64
br label %8
8: ; preds = %6, %2
ret void
}