#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*/ db_delete_entry_by_id(int, int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ steel_tracker_file_exists();
void delete_entry(int id) {
  if (!steel_tracker_file_exists())
    return;
  bool success = false;
  if (!db_delete_entry_by_id(id, &success)) {
    fprintf(stderr, "Entry deletion failed.\n");
  } else {
    if (!success)
      fprintf(stderr, "No entry found with id %d.\n", id);
  }
}


x86 assembly (clang, -O0):
<delete_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <steel_tracker_file_exists@plt>
cmp    $0x0,%eax
jne    1150 <delete_entry+0x20>
jmp    11b1 <delete_entry+0x81>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1040 <db_delete_entry_by_id@plt>
cmp    $0x0,%eax
jne    1188 <delete_entry+0x58>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11b1 <delete_entry+0x81>
cmpl   $0x0,-0x8(%rbp)
jne    11ac <delete_entry+0x7c>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe73(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11b1 <delete_entry+0x81>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_entry>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <steel_tracker_file_exists@plt>
test   %eax,%eax
je     1193 <delete_entry+0x63>
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %ebx,%edi
call   1040 <db_delete_entry_by_id@plt>
test   %eax,%eax
je     117c <delete_entry+0x4c>
cmpl   $0x0,0xc(%rsp)
jne    1193 <delete_entry+0x63>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1193 <delete_entry+0x63>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Entry deletion failed.\0A\00"
@.str.1 = [28 x i8] c"No entry found with id %d.\0A\00"
define void @delete_entry(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @steel_tracker_file_exists()
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
br label %22
7: ; preds = %1
store i32 0, i32* %3
%8 = load i32, i32* %2
%9 = call i32 @db_delete_entry_by_id(i32 %8, i32* %3)
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %22
14: ; preds = %7
%15 = load i32, i32* %3
%16 = icmp ne i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = load i32, i32* %2
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %14
br label %22
22: ; preds = %6, %21, %11
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Entry deletion failed.\0A\00"
@.str.1 = [28 x i8] c"No entry found with id %d.\0A\00"
define void @delete_entry(i32 %0) {
%2 = alloca i32
%3 = tail call i32 (...) @steel_tracker_file_exists()
%4 = icmp eq i32 %3, 0
br i1 %4, label %19, label %5
5: ; preds = %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = call i32 @db_delete_entry_by_id(i32 %0, i32* %2)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %18
12: ; preds = %5
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %18
18: ; preds = %12, %15, %9
br label %19
19: ; preds = %1, %18
ret void
}