#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*/ sqlite3;

/* Variables and functions */
int SQLITE_OK;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ sqlite3_close(int /*<<< orphan*/ *);
char *sqlite3_errmsg(int /*<<< orphan*/ *);
int sqlite3_exec(int /*<<< orphan*/ *, char *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/, char **);
int /*<<< orphan*/ sqlite3_free(char *);
int sqlite3_open(char *, int /*<<< orphan*/ **);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int create_db() {
  char *sql = NULL;
  sqlite3 *db = NULL;
  int rc = NULL;
  char *zErrMsg = 0;
  rc = sqlite3_open("DataBase_facificator.db", &db);
  if (rc) {
    fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
  } else {
    fprintf(stderr, "Opened database successfully\n");
  }
  sql = "CREATE TABLE FACIFICATOR ("
        "ID             INTEGER PRIMARY KEY AUTOINCREMENT,"
        "NAME           TEXT    NOT NULL,"
        "PICTURE        TEXT    NOT NULL"
        ");";
  rc = sqlite3_exec(db, sql, NULL, 0, &zErrMsg);
  if (rc != SQLITE_OK) {
    fprintf(stderr, "SQL error: %s\n", zErrMsg);
    sqlite3_free(zErrMsg);
  } else {
    fprintf(stdout, "Table created successfully\n\n");
  }
  sqlite3_close(db);
  return 0;
}


x86 assembly (clang, -O0):
<create_db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe72(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <sqlite3_open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11d2 <create_db+0x72>
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <sqlite3_errmsg@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rdx
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    11e9 <create_db+0x89>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xe5f(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
lea    -0x20(%rbp),%r8
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2dd0(%rip),%rcx
cmp    (%rcx),%eax
je     1249 <create_db+0xe9>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xea8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1080 <sqlite3_free@plt>
jmp    1260 <create_db+0x100>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <sqlite3_close@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_db>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe80(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <sqlite3_open@plt>
mov    0x2e47(%rip),%r14
mov    (%r14),%ebx
test   %eax,%eax
je     11b7 <create_db+0x57>
mov    0x8(%rsp),%rdi
call   1050 <sqlite3_errmsg@plt>
lea    0xe6f(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11c7 <create_db+0x67>
lea    0xe73(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x8(%rsp),%rdi
lea    0xe7c(%rip),%rsi
lea    0x10(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <sqlite3_exec@plt>
mov    0x2e00(%rip),%rcx
cmp    (%rcx),%eax
jne    1205 <create_db+0xa5>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
lea    0xeef(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1225 <create_db+0xc5>
mov    (%r14),%edi
mov    0x10(%rsp),%rdx
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x10(%rsp),%rdi
call   1080 <sqlite3_free@plt>
mov    0x8(%rsp),%rdi
call   1070 <sqlite3_close@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [24 x i8] c"DataBase_facificator.db\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"Can't open database: %s\0A\00"
@.str.2 = [30 x i8] c"Opened database successfully\0A\00"
@.str.3 = [141 x i8] c"CREATE TABLE FACIFICATOR (ID INTEGER PRIMARY KEY AUTOINCREMENT,NAME TEXT NOT NULL,PICTURE TEXT NOT NULL);\00"
@SQLITE_OK = global i32 0
@.str.4 = [15 x i8] c"SQL error: %s\0A\00"
@stdout = global i32 0
@.str.5 = [29 x i8] c"Table created successfully\0A\0A\00"
define i32 @create_db() {
%1 = alloca i8*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8*
store i8* null, i8** %1
store i32* null, i32** %2
store i32 0, i32* %3
store i8* null, i8** %4
%5 = call i32 @sqlite3_open(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32** %2)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = load i32*, i32** %2
%11 = call i8* @sqlite3_errmsg(i32* %10)
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %16
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %13, %8
store i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.3, i64 0, i64 0), i8** %1
%17 = load i32*, i32** %2
%18 = load i8*, i8** %1
%19 = call i32 @sqlite3_exec(i32* %17, i8* %18, i32* null, i32 0, i8** %4)
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = load i32, i32* @SQLITE_OK
%22 = icmp ne i32 %20, %21
br i1 %22, label %23, label %29
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %4
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %4
%28 = call i32 @sqlite3_free(i8* %27)
br label %32
29: ; preds = %16
%30 = load i32, i32* @stdout
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
br label %32
32: ; preds = %29, %23
%33 = load i32*, i32** %2
%34 = call i32 @sqlite3_close(i32* %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"DataBase_facificator.db\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"Can't open database: %s\0A\00"
@.str.2 = [30 x i8] c"Opened database successfully\0A\00"
@.str.3 = [141 x i8] c"CREATE TABLE FACIFICATOR (ID INTEGER PRIMARY KEY AUTOINCREMENT,NAME TEXT NOT NULL,PICTURE TEXT NOT NULL);\00"
@SQLITE_OK = global i32 0
@.str.4 = [15 x i8] c"SQL error: %s\0A\00"
@stdout = global i32 0
@.str.5 = [29 x i8] c"Table created successfully\0A\0A\00"
define i32 @create_db() {
%1 = alloca i32*
%2 = alloca i8*
%3 = bitcast i32** %1 to i8*
store i32* null, i32** %1
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = call i32 @sqlite3_open(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32** %1)
%6 = icmp eq i32 %5, 0
%7 = load i32, i32* @stderr
br i1 %6, label %12, label %8
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = call i8* @sqlite3_errmsg(i32* %9)
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %14
12: ; preds = %0
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = load i32*, i32** %1
%16 = call i32 @sqlite3_exec(i32* %15, i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.3, i64 0, i64 0), i32* null, i32 0, i8** %2)
%17 = load i32, i32* @SQLITE_OK
%18 = icmp eq i32 %16, %17
br i1 %18, label %25, label %19
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %2
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** %2
%24 = call i32 @sqlite3_free(i8* %23)
br label %28
25: ; preds = %14
%26 = load i32, i32* @stdout
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
br label %28
28: ; preds = %25, %19
%29 = load i32*, i32** %1
%30 = call i32 @sqlite3_close(i32* %29)
ret i32 0
}