#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int removeAllFileOfDirectory(char *);
int clearProfile(void) {
  FILE *fp = NULL;
  char destination[] = "Database/profile";
  int status = removeAllFileOfDirectory(destination);
  if (status == 0) {
    return 0;
  }
  char destination2[] = "Database/profile/empty";
  fp = fopen(destination2, "w");
  if (fp == NULL) {
    return 0;
  }
  fprintf(fp, "%s", "There is no Profile here");
  fclose(fp);
  fp = NULL;
  return 1;
}


x86 assembly (clang, -O0):
<clearProfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movq   $0x0,-0x10(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea4(%rip),%al
mov    %al,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
call   1050 <removeAllFileOfDirectory@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    1191 <clearProfile+0x51>
movl   $0x0,-0x4(%rbp)
jmp    121e <clearProfile+0xde>
mov    0xe88(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe85(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe83(%rip),%eax
mov    %eax,-0x40(%rbp)
mov    0xe7d(%rip),%ax
mov    %ax,-0x3c(%rbp)
mov    0xe75(%rip),%al
mov    %al,-0x3a(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11ef <clearProfile+0xaf>
movl   $0x0,-0x4(%rbp)
jmp    121e <clearProfile+0xde>
mov    -0x10(%rbp),%rdi
lea    0xe3f(%rip),%rsi
lea    0xe3b(%rip),%rdx
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movq   $0x0,-0x10(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearProfile>:
push   %rbx
sub    $0x40,%rsp
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
mov    %rsp,%rdi
call   1040 <removeAllFileOfDirectory@plt>
test   %eax,%eax
je     11bd <clearProfile+0x7d>
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movabs $0x7974706d652f65,%rax
mov    %rax,0x2f(%rsp)
lea    0xeb4(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1050 <fopen@plt>
test   %rax,%rax
je     11bd <clearProfile+0x7d>
mov    %rax,%rbx
lea    0xe9d(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
jmp    11bf <clearProfile+0x7f>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.clearProfile.destination = [17 x i8] c"Database/profile\00"
@__const.clearProfile.destination2 = [23 x i8] c"Database/profile/empty\00"
@.str = [2 x i8] c"w\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [25 x i8] c"There is no Profile here\00"
define i32 @clearProfile() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [17 x i8]
%4 = alloca i32
%5 = alloca [23 x i8]
store i32* null, i32** %2
%6 = bitcast [17 x i8]* %3 to i8*
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%8 = call i32 @removeAllFileOfDirectory(i8* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %0
store i32 0, i32* %1
br label %24
12: ; preds = %0
%13 = bitcast [23 x i8]* %5 to i8*
%14 = getelementptr inbounds [23 x i8], [23 x i8]* %5, i64 0, i64 0
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %2
%16 = load i32*, i32** %2
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 0, i32* %1
br label %24
19: ; preds = %12
%20 = load i32*, i32** %2
%21 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32*, i32** %2
%23 = call i32 @fclose(i32* %22)
store i32* null, i32** %2
store i32 1, i32* %1
br label %24
24: ; preds = %19, %18, %11
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@__const.clearProfile.destination = [17 x i8] c"Database/profile\00"
@__const.clearProfile.destination2 = [23 x i8] c"Database/profile/empty\00"
@.str = [2 x i8] c"w\00"
@.str.2 = [25 x i8] c"There is no Profile here\00"
define i32 @clearProfile() {
%1 = alloca [17 x i8]
%2 = alloca [23 x i8]
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%4 = call i32 @removeAllFileOfDirectory(i8* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %0
%7 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 0
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 24, i64 1, i32* %8)
%12 = call i32 @fclose(i32* %8)
br label %13
13: ; preds = %6, %10
%14 = phi i32 [ 1, %10 ], [ 0, %6 ]
br label %15
15: ; preds = %0, %13
%16 = phi i32 [ %14, %13 ], [ 0, %0 ]
ret i32 %16
}