#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 const *, char *);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ unlink(char const *);
void _kill_program(const char *path) {
  if (!unlink(path)) {
    printf("Delete file \"%s\" successfully.\n", path);
  } else {
    FILE *fp = fopen(path, "rb");
    if (fp) {
      fclose(fp);
      printf("Delete file \"%s\" failed.\n", path);
    } else {
      printf("File \"%s\" not found.\n", path);
    }
  }
}


x86 assembly (clang, -O0):
<_kill_program>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
cmp    $0x0,%eax
jne    1173 <_kill_program+0x33>
mov    -0x8(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1050 <printf@plt>
jmp    11c5 <_kill_program+0x85>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11b0 <_kill_program+0x70>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x8(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1050 <printf@plt>
jmp    11c0 <_kill_program+0x80>
mov    -0x8(%rbp),%rsi
lea    0xe82(%rip),%rdi
call   1050 <printf@plt>
jmp    11c5 <_kill_program+0x85>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_kill_program>:
push   %rbx
mov    %rdi,%rbx
call   1030 <unlink@plt>
test   %eax,%eax
je     1172 <_kill_program+0x32>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
call   1060 <fopen@plt>
test   %rax,%rax
je     117b <_kill_program+0x3b>
mov    %rax,%rdi
call   1040 <fclose@plt>
lea    0xeb3(%rip),%rdi
jmp    1182 <_kill_program+0x42>
lea    0xe87(%rip),%rdi
jmp    1182 <_kill_program+0x42>
lea    0xebb(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Delete file \22%s\22 successfully.\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [26 x i8] c"Delete file \22%s\22 failed.\0A\00"
@.str.3 = [22 x i8] c"File \22%s\22 not found.\0A\00"
define void @_kill_program(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @unlink(i8* %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %24
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %3
%13 = load i32*, i32** %3
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i32*, i32** %3
%17 = call i32 @fclose(i32* %16)
%18 = load i8*, i8** %2
%19 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %23
20: ; preds = %10
%21 = load i8*, i8** %2
%22 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %15
br label %24
24: ; preds = %23, %7
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Delete file \22%s\22 successfully.\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [26 x i8] c"Delete file \22%s\22 failed.\0A\00"
@.str.3 = [22 x i8] c"File \22%s\22 not found.\0A\00"
define void @_kill_program(i8* %0) {
%2 = tail call i32 @unlink(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @fclose(i32* %5)
br label %9
9: ; preds = %4, %1, %7
%10 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), %4 ]
%11 = tail call i32 @printf(i8* %10, i8* %0)
ret void
}