#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*/ create_sqlite_account(char *);
int /*<<< orphan*/ database_directory(char *);
scalar_t__ directory_exists(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ system(char *);
int create_sqlite_database() {
  char str[1024];
  char directory[1024];
  database_directory(directory);
  if (directory_exists(directory) == 0) {
    sprintf((char *)str, "mkdir %s", directory);
    system(str);
  }
  create_sqlite_account("current");
  create_sqlite_account("savings");
  return 0;
}


x86 assembly (clang, -O0):
<create_sqlite_database>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
lea    -0x800(%rbp),%rdi
call   1060 <database_directory@plt>
lea    -0x800(%rbp),%rdi
call   1040 <directory_exists@plt>
cmp    $0x0,%rax
jne    11a3 <create_sqlite_database+0x53>
lea    -0x400(%rbp),%rdi
lea    -0x800(%rbp),%rdx
lea    0xe6e(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x400(%rbp),%rdi
call   1030 <system@plt>
lea    0xe5f(%rip),%rdi
call   1050 <create_sqlite_account@plt>
lea    0xe5b(%rip),%rdi
call   1050 <create_sqlite_account@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_sqlite_database>:
push   %rbx
sub    $0x800,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <database_directory@plt>
mov    %rbx,%rdi
call   1040 <directory_exists@plt>
test   %rax,%rax
jne    1192 <create_sqlite_database+0x42>
lea    0xe89(%rip),%rsi
lea    0x400(%rsp),%rbx
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1070 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
lea    0xe70(%rip),%rdi
call   1050 <create_sqlite_account@plt>
lea    0xe6c(%rip),%rdi
call   1050 <create_sqlite_account@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"mkdir %s\00"
@.str.1 = [8 x i8] c"current\00"
@.str.2 = [8 x i8] c"savings\00"
define i32 @create_sqlite_database() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @database_directory(i8* %3)
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = call i64 @directory_exists(i8* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%13 = call i32 @system(i8* %12)
br label %14
14: ; preds = %8, %0
%15 = call i32 @create_sqlite_account(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @create_sqlite_account(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"mkdir %s\00"
@.str.1 = [8 x i8] c"current\00"
@.str.2 = [8 x i8] c"savings\00"
define i32 @create_sqlite_database() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 @database_directory(i8* %4)
%6 = call i64 @directory_exists(i8* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4)
%10 = call i32 @system(i8* %3)
br label %11
11: ; preds = %8, %0
%12 = call i32 @create_sqlite_account(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @create_sqlite_account(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}