#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_file_exists(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
char *status_get_file_path();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
bool steel_tracker_file_exists() {
  char *dbs = NULL;
  dbs = status_get_file_path();
  if (dbs == NULL) {
    fprintf(stderr, "Error getting status file path.\n");
    return false;
  }
  if (!db_file_exists(dbs)) {
    fprintf(stdout, "No databases found.\n");
    free(dbs);
    return false;
  }
  free(dbs);
  return true;
}


x86 assembly (clang, -O0):
<steel_tracker_file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1060 <status_get_file_path@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1187 <steel_tracker_file_exists+0x47>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <steel_tracker_file_exists+0x93>
mov    -0x10(%rbp),%rdi
call   1040 <db_file_exists@plt>
cmp    $0x0,%eax
jne    11c3 <steel_tracker_file_exists+0x83>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe78(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d3 <steel_tracker_file_exists+0x93>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<steel_tracker_file_exists>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <status_get_file_path@plt>
test   %rax,%rax
je     116f <steel_tracker_file_exists+0x2f>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <db_file_exists@plt>
test   %eax,%eax
je     1186 <steel_tracker_file_exists+0x46>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x1,%ebp
jmp    11a5 <steel_tracker_file_exists+0x65>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11a5 <steel_tracker_file_exists+0x65>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
lea    0xe8b(%rip),%rsi
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Error getting status file path.\0A\00"
@stdout = global i32 0
@.str.1 = [21 x i8] c"No databases found.\0A\00"
define i32 @steel_tracker_file_exists() {
%1 = alloca i32
%2 = alloca i8*
store i8* null, i8** %2
%3 = call i8* (...) @status_get_file_path()
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %21
9: ; preds = %0
%10 = load i8*, i8** %2
%11 = call i32 @db_file_exists(i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %9
%14 = load i32, i32* @stdout
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%16 = load i8*, i8** %2
%17 = call i32 @free(i8* %16)
store i32 0, i32* %1
br label %21
18: ; preds = %9
%19 = load i8*, i8** %2
%20 = call i32 @free(i8* %19)
store i32 1, i32* %1
br label %21
21: ; preds = %18, %13, %6
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Error getting status file path.\0A\00"
@stdout = global i32 0
@.str.1 = [21 x i8] c"No databases found.\0A\00"
define i32 @steel_tracker_file_exists() {
%1 = tail call i8* (...) @status_get_file_path()
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %15
6: ; preds = %0
%7 = tail call i32 @db_file_exists(i8* %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* @stdout
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @free(i8* %1)
br label %15
13: ; preds = %6
%14 = tail call i32 @free(i8* %1)
br label %15
15: ; preds = %13, %9, %3
%16 = phi i32 [ 0, %3 ], [ 1, %13 ], [ 0, %9 ]
ret i32 %16
}