#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*/ printf(char *, ...);
int unlink(char *);
void delete_existing_file(char File[256]) {
  int code = unlink(File);
  if (code == 0) {
    printf("Deleted old %s successfully.\n", File);
  } else if (code == 1) {
    printf("There was an error deleting file %s.\n", File);
    printf("Please delete the file manually.\n");
  }
}


x86 assembly (clang, -O0):
<delete_existing_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1159 <delete_existing_file+0x39>
mov    -0x8(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1188 <delete_existing_file+0x68>
cmpl   $0x1,-0xc(%rbp)
jne    1183 <delete_existing_file+0x63>
mov    -0x8(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1188 <delete_existing_file+0x68>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_existing_file>:
push   %rbx
mov    %rdi,%rbx
call   1030 <unlink@plt>
cmp    $0x1,%eax
je     1154 <delete_existing_file+0x24>
test   %eax,%eax
jne    1172 <delete_existing_file+0x42>
lea    0xeb7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1050 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed8(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Deleted old %s successfully.\0A\00"
@.str.1 = [38 x i8] c"There was an error deleting file %s.\0A\00"
@.str.2 = [34 x i8] c"Please delete the file manually.\0A\00"
define void @delete_existing_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @unlink(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %19
11: ; preds = %1
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i8*, i8** %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %14, %11
br label %19
19: ; preds = %18, %8
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Deleted old %s successfully.\0A\00"
@.str.1 = [38 x i8] c"There was an error deleting file %s.\0A\00"
@str = [33 x i8] c"Please delete the file manually.\00"
define void @delete_existing_file(i8* %0) {
%2 = tail call i32 @unlink(i8* %0)
switch i32 %2, label %8 [
i32 0, label %3
i32 1, label %5
]
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %8
5: ; preds = %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %1, %5, %3
ret void
}