#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_remove_lockfile();
scalar_t__ db_shred(char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char getc(int /*<<< orphan*/);
int is_file_encrypted(char const *);
int /*<<< orphan*/ status_del_tracking(char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ steel_tracker_file_exists();
void remove_database(const char *path) {
  if (!steel_tracker_file_exists())
    return;
  bool encrypted = false;
  char ch;
  encrypted = is_file_encrypted(path);
  fprintf(stdout, "Are you sure? (y/N) ");
  ch = getc(stdin);
  if (ch == 'y' || ch == 'Y') {
    if (db_shred(path)) {
      status_del_tracking(path);
      if (!encrypted)
        db_remove_lockfile();
    } else {
      fprintf(stderr, "Unable to shred the database.\n");
    }
  } else {
    fprintf(stdout, "Aborted.\n");
  }
}


x86 assembly (clang, -O0):
<remove_database>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <steel_tracker_file_exists@plt>
cmp    $0x0,%eax
jne    1191 <remove_database+0x21>
jmp    1245 <remove_database+0xd5>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <is_file_encrypted@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
call   1080 <getc@plt>
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x79,%eax
je     11e4 <remove_database+0x74>
movsbl -0xd(%rbp),%eax
cmp    $0x59,%eax
jne    1230 <remove_database+0xc0>
mov    -0x8(%rbp),%rdi
call   1030 <db_shred@plt>
cmp    $0x0,%rax
je     1216 <remove_database+0xa6>
mov    -0x8(%rbp),%rdi
call   1090 <status_del_tracking@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1211 <remove_database+0xa1>
mov    $0x0,%al
call   1040 <db_remove_lockfile@plt>
jmp    122b <remove_database+0xbb>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
lea    0xdef(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1245 <remove_database+0xd5>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
lea    0xdf4(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_database>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <steel_tracker_file_exists@plt>
test   %eax,%eax
je     11d1 <remove_database+0x61>
mov    %rbx,%rdi
call   1070 <is_file_encrypted@plt>
mov    %eax,%r14d
mov    0x2e3c(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe62(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1080 <getc@plt>
and    $0xdf,%al
cmp    $0x59,%al
jne    11d6 <remove_database+0x66>
mov    %rbx,%rdi
call   1030 <db_shred@plt>
test   %rax,%rax
je     11e2 <remove_database+0x72>
mov    %rbx,%rdi
call   1090 <status_del_tracking@plt>
test   %r14d,%r14d
je     11fb <remove_database+0x8b>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x0(%rbp),%edi
lea    0xe54(%rip),%rsi
jmp    11f2 <remove_database+0x82>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
lea    0xe23(%rip),%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fprintf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <db_remove_lockfile@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [21 x i8] c"Are you sure? (y/N) \00"
@stdin = global i32 0
@stderr = global i32 0
@.str.1 = [31 x i8] c"Unable to shred the database.\0A\00"
@.str.2 = [10 x i8] c"Aborted.\0A\00"
define void @remove_database(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
store i8* %0, i8** %2
%5 = call i32 (...) @steel_tracker_file_exists()
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
br label %41
8: ; preds = %1
store i32 0, i32* %3
%9 = load i8*, i8** %2
%10 = call i32 @is_file_encrypted(i8* %9)
store i32 %10, i32* %3
%11 = load i32, i32* @stdout
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @stdin
%14 = call signext i8 @getc(i32 %13)
store i8 %14, i8* %4
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 121
br i1 %17, label %22, label %18
18: ; preds = %8
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 89
br i1 %21, label %22, label %38
22: ; preds = %18, %8
%23 = load i8*, i8** %2
%24 = call i64 @db_shred(i8* %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = load i8*, i8** %2
%28 = call i32 @status_del_tracking(i8* %27)
%29 = load i32, i32* %3
%30 = icmp ne i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %26
%32 = call i32 (...) @db_remove_lockfile()
br label %33
33: ; preds = %31, %26
br label %37
34: ; preds = %22
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %37
37: ; preds = %34, %33
br label %41
38: ; preds = %18
%39 = load i32, i32* @stdout
%40 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %7, %38, %37
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [21 x i8] c"Are you sure? (y/N) \00"
@stdin = global i32 0
@stderr = global i32 0
@.str.1 = [31 x i8] c"Unable to shred the database.\0A\00"
@.str.2 = [10 x i8] c"Aborted.\0A\00"
define void @remove_database(i8* %0) {
%2 = tail call i32 (...) @steel_tracker_file_exists()
%3 = icmp eq i32 %2, 0
br i1 %3, label %26, label %4
4: ; preds = %1
%5 = tail call i32 @is_file_encrypted(i8* %0)
%6 = load i32, i32* @stdout
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = tail call signext i8 @getc(i32 %8)
%10 = and i8 %9, -33
%11 = icmp eq i8 %10, 89
br i1 %11, label %12, label %23
12: ; preds = %4
%13 = tail call i64 @db_shred(i8* %0)
%14 = icmp eq i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %12
%16 = tail call i32 @status_del_tracking(i8* %0)
%17 = icmp eq i32 %5, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = tail call i32 (...) @db_remove_lockfile()
br label %26
20: ; preds = %12
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %26
23: ; preds = %4
%24 = load i32, i32* @stdout
%25 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %23, %15, %18, %20, %1
ret void
}