#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_stmt;
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
scalar_t__ SQLITE_DONE;
scalar_t__ SQLITE_OK;
scalar_t__ sqlite3_bind_int(int /*<<< orphan*/ *, int, int);
scalar_t__ sqlite3_bind_text(int /*<<< orphan*/ *, int, char *, int,
                             int /*<<< orphan*/);
int /*<<< orphan*/ sqlite3_finalize(int /*<<< orphan*/ *);
scalar_t__ sqlite3_prepare(int /*<<< orphan*/ *, char *, int,
                           int /*<<< orphan*/ **, int /*<<< orphan*/);
scalar_t__ sqlite3_prepare_v2(int /*<<< orphan*/ *, char *, int,
                              int /*<<< orphan*/ **, int /*<<< orphan*/);
scalar_t__ sqlite3_step(int /*<<< orphan*/ *);
int new_db(sqlite3 *db) {
  if (!db)
    return -1;
  sqlite3_stmt *stmt;
  if (sqlite3_prepare_v2(db,
                         "CREATE TABLE Book("
                         "BookID   INTEGER PRIMARY KEY,"
                         "Title    TEXT NOT NULL,"
                         "Subtitle TEXT)",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "CREATE TABLE Owner("
                         "OwnerID     INTEGER PRIMARY KEY,"
                         "OwnerLast   TEXT NOT NULL,"
                         "OwnerFirst  TEXT NOT NULL,"
                         "OwnerMiddle TEXT,"
                         "OwnerSuffix TEXT)",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "CREATE TABLE Type("
                         "TypeID   INTEGER PRIMARY KEY,"
                         "TypeName TEXT NOT NULL)",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "CREATE TABLE Genre("
                         "GenreID   INTEGER PRIMARY KEY,"
                         "GenreName TEXT NOT NULL)",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "CREATE_TABLE Author("
                         "AuthorID     INTEGER PRIMARY KEY,"
                         "AuthorLast   TEXT NOT NULL,"
                         "AuthorFirst  TEXT NOT NULL,"
                         "AuthorMiddle TEXT,"
                         "AuthorSuffix TEXT)",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "CREATE TABLE Printing("
                         "PrintingID  INTEGER PRIMARY KEY,"
                         "BookID      INTEGER REFERENCES Book(BookID),"
                         "ISBN        TEXT,"
                         "Year        INTEGER,"
                         "TypeID      INTEGER REFERENCES Type(TypeID),"
                         "PrintingNum INTEGER)",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "CREATE TABLE BookOwner("
                         "PrintingID INTEGER REFERENCES Printing(PrintingID),"
                         "OwnerID    INTEGER REFERENCES Owner(OwnerID),"
                         "Quantity   INTEGER NOT NULL),"
                         "PRIMARY KEY(PrintingID, OwnerID))",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "CREATE TABLE BookGenre("
                         "BookID  INTEGER REFERENCES Book(BookID),"
                         "GenreID INTEGER REFERENCES Genre(GenreID),"
                         "PRIMARY KEY(BookID, GenreID))",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "CREATE TABLE BookAuthor("
                         "BookID      INTEGER REFERENCES Book(BookID),"
                         "AuthorID    INTEGER REFERENCES Author(AuthorID),"
                         "AuthorOrder INTEGER,"
                         "PRIMARY KEY(BookID, AuthorID))",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare(db,
                      "CREATE TABLE Version("
                      "SchemaVersion INTEGER NOT NULL)",
                      -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db, "INSERT INTO Version VALUES (?)", -1, &stmt, 0) !=
      SQLITE_OK)
    return -1;
  if (sqlite3_bind_int(stmt, 1, 1) != SQLITE_OK) {
    sqlite3_finalize(stmt);
    return -1;
  }
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "INSERT INTO Type (TypeID, TypeName) "
                         "VALUES (?,?)",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_bind_int(stmt, 1, 1) != SQLITE_OK) {
    sqlite3_finalize(stmt);
    return -1;
  }
  if (sqlite3_bind_text(stmt, 2, "Hardcover", -1, 0) != SQLITE_OK) {
    sqlite3_finalize(stmt);
    return -1;
  }
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  if (sqlite3_prepare_v2(db,
                         "INSERT INTO Type (TypeID, TypeName) "
                         "VALUES (?,?)",
                         -1, &stmt, 0) != SQLITE_OK)
    return -1;
  if (sqlite3_bind_int(stmt, 1, 2) != SQLITE_OK) {
    sqlite3_finalize(stmt);
    return -1;
  }
  if (sqlite3_bind_text(stmt, 2, "Softcover", -1, 0) != SQLITE_OK) {
    sqlite3_finalize(stmt);
    return -1;
  }
  if (sqlite3_step(stmt) != SQLITE_DONE) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_finalize(stmt);
  return 0;
}


x86 assembly (clang, -O0):
<new_db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1183 <new_db+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2e42(%rip),%rcx
cmp    (%rcx),%rax
je     11bb <new_db+0x5b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2e0d(%rip),%rcx
cmp    (%rcx),%rax
je     11e9 <new_db+0x89>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xe58(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2dd3(%rip),%rcx
cmp    (%rcx),%rax
je     122a <new_db+0xca>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2d9e(%rip),%rcx
cmp    (%rcx),%rax
je     1258 <new_db+0xf8>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xe73(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2d64(%rip),%rcx
cmp    (%rcx),%rax
je     1299 <new_db+0x139>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2d2f(%rip),%rcx
cmp    (%rcx),%rax
je     12c7 <new_db+0x167>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xe4b(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2cf5(%rip),%rcx
cmp    (%rcx),%rax
je     1308 <new_db+0x1a8>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2cc0(%rip),%rcx
cmp    (%rcx),%rax
je     1336 <new_db+0x1d6>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xe26(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2c86(%rip),%rcx
cmp    (%rcx),%rax
je     1377 <new_db+0x217>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2c51(%rip),%rcx
cmp    (%rcx),%rax
je     13a5 <new_db+0x245>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xe47(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2c17(%rip),%rcx
cmp    (%rcx),%rax
je     13e6 <new_db+0x286>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2be2(%rip),%rcx
cmp    (%rcx),%rax
je     1414 <new_db+0x2b4>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xea0(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2ba8(%rip),%rcx
cmp    (%rcx),%rax
je     1455 <new_db+0x2f5>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2b73(%rip),%rcx
cmp    (%rcx),%rax
je     1483 <new_db+0x323>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xee7(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2b39(%rip),%rcx
cmp    (%rcx),%rax
je     14c4 <new_db+0x364>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2b04(%rip),%rcx
cmp    (%rcx),%rax
je     14f2 <new_db+0x392>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xeff(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2aca(%rip),%rcx
cmp    (%rcx),%rax
je     1533 <new_db+0x3d3>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2a95(%rip),%rcx
cmp    (%rcx),%rax
je     1561 <new_db+0x401>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xf37(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1060 <sqlite3_prepare@plt>
mov    0x2a5b(%rip),%rcx
cmp    (%rcx),%rax
je     15a2 <new_db+0x442>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2a26(%rip),%rcx
cmp    (%rcx),%rax
je     15d0 <new_db+0x470>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xefd(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x29ec(%rip),%rcx
cmp    (%rcx),%rax
je     1611 <new_db+0x4b1>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <sqlite3_bind_int@plt>
mov    0x29c0(%rip),%rcx
cmp    (%rcx),%rax
je     1646 <new_db+0x4e6>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x2982(%rip),%rcx
cmp    (%rcx),%rax
je     1674 <new_db+0x514>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xe78(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2948(%rip),%rcx
cmp    (%rcx),%rax
je     16b5 <new_db+0x555>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <sqlite3_bind_int@plt>
mov    0x291c(%rip),%rcx
cmp    (%rcx),%rax
je     16ea <new_db+0x58a>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
lea    0xe37(%rip),%rdx
mov    $0xffffffff,%ecx
xor    %r8d,%r8d
call   1050 <sqlite3_bind_text@plt>
mov    0x28da(%rip),%rcx
cmp    (%rcx),%rax
je     172c <new_db+0x5cc>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x289c(%rip),%rcx
cmp    (%rcx),%rax
je     175a <new_db+0x5fa>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x10(%rbp),%rdi
lea    0xd92(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2862(%rip),%rcx
cmp    (%rcx),%rax
je     179b <new_db+0x63b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <sqlite3_bind_int@plt>
mov    0x2833(%rip),%rcx
cmp    (%rcx),%rax
je     17d3 <new_db+0x673>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
lea    0xd58(%rip),%rdx
mov    $0xffffffff,%ecx
xor    %r8d,%r8d
call   1050 <sqlite3_bind_text@plt>
mov    0x27f1(%rip),%rcx
cmp    (%rcx),%rax
je     1815 <new_db+0x6b5>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    0x27b3(%rip),%rcx
cmp    (%rcx),%rax
je     1843 <new_db+0x6e3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1853 <new_db+0x6f3>
mov    -0x18(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_db>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     15f1 <new_db+0x491>
mov    %rdi,%r13
lea    0xe82(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x2e4d(%rip),%r15
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    0x2e21(%rip),%r12
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0xe81(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0xec0(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0xebc(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0xebb(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0xf00(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0xf7d(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0xfe8(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0x1024(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0x1080(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1060 <sqlite3_prepare@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0x106a(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <sqlite3_bind_int@plt>
mov    (%rsp),%rdi
cmp    (%r15),%rax
jne    1609 <new_db+0x4a9>
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0x1022(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <sqlite3_bind_int@plt>
mov    (%rsp),%rdi
cmp    (%r15),%rax
jne    1609 <new_db+0x4a9>
lea    0x100a(%rip),%rdx
mov    $0xffffffff,%r14d
mov    $0x2,%esi
mov    $0xffffffff,%ecx
xor    %r8d,%r8d
call   1050 <sqlite3_bind_text@plt>
mov    (%rsp),%rdi
cmp    (%r15),%rax
jne    1609 <new_db+0x4a9>
call   1040 <sqlite3_step@plt>
mov    %rax,%rbp
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
cmp    %rbx,%rbp
jne    15f7 <new_db+0x497>
lea    0xf8f(%rip),%rsi
mov    $0xffffffff,%r14d
mov    %rsp,%rcx
mov    %r13,%rdi
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
cmp    (%r15),%rax
jne    15f7 <new_db+0x497>
mov    (%rsp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
call   1030 <sqlite3_bind_int@plt>
mov    (%rsp),%rdi
cmp    (%r15),%rax
jne    1609 <new_db+0x4a9>
lea    0xf89(%rip),%rdx
mov    $0xffffffff,%r14d
mov    $0x2,%esi
mov    $0xffffffff,%ecx
xor    %r8d,%r8d
call   1050 <sqlite3_bind_text@plt>
mov    (%rsp),%rdi
cmp    (%r15),%rax
jne    1609 <new_db+0x4a9>
call   1040 <sqlite3_step@plt>
xor    %r14d,%r14d
cmp    (%r12),%rax
setne  %r14b
mov    (%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
neg    %r14d
jmp    15f7 <new_db+0x497>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
call   1070 <sqlite3_finalize@plt>
jmp    15f7 <new_db+0x497>

LLVM IR (-O0):
@.str = [85 x i8] c"CREATE TABLE Book(BookID INTEGER PRIMARY KEY,Title TEXT NOT NULL,Subtitle TEXT)\00"
@SQLITE_OK = global i64 0
@SQLITE_DONE = global i64 0
@.str.1 = [138 x i8] c"CREATE TABLE Owner(OwnerID INTEGER PRIMARY KEY,OwnerLast TEXT NOT NULL,OwnerFirst TEXT NOT NULL,OwnerMiddle TEXT,OwnerSuffix TEXT)\00"
@.str.2 = [71 x i8] c"CREATE TABLE Type(TypeID INTEGER PRIMARY KEY,TypeName TEXT NOT NULL)\00"
@.str.3 = [74 x i8] c"CREATE TABLE Genre(GenreID INTEGER PRIMARY KEY,GenreName TEXT NOT NULL)\00"
@.str.4 = [144 x i8] c"CREATE_TABLE Author(AuthorID INTEGER PRIMARY KEY,AuthorLast TEXT NOT NULL,AuthorFirst TEXT NOT NULL,AuthorMiddle TEXT,AuthorSuffix TEXT)\00"
@.str.5 = [200 x i8] c"CREATE TABLE Printing(PrintingID INTEGER PRIMARY KEY,BookID INTEGER REFERENCES Book(BookID),ISBN TEXT,Year INTEGER,TypeID INTEGER REFERENCES Type(TypeID),PrintingNum INTEGER)\00"
@.str.6 = [182 x i8] c"CREATE TABLE BookOwner(PrintingID INTEGER REFERENCES Printing(PrintingID),OwnerID INTEGER REFERENCES Owner(OwnerID),Quantity INTEGER NOT NULL),PRIMARY KEY(PrintingID, OwnerID))\00"
@.str.7 = [135 x i8] c"CREATE TABLE BookGenre(BookID INTEGER REFERENCES Book(BookID),GenreID INTEGER REFERENCES Genre(GenreID),PRIMARY KEY(BookID, GenreID))\00"
@.str.8 = [167 x i8] c"CREATE TABLE BookAuthor(BookID INTEGER REFERENCES Book(BookID),AuthorID INTEGER REFERENCES Author(AuthorID),AuthorOrder INTEGER,PRIMARY KEY(BookID, AuthorID))\00"
@.str.9 = [53 x i8] c"CREATE TABLE Version(SchemaVersion INTEGER NOT NULL)\00"
@.str.10 = [31 x i8] c"INSERT INTO Version VALUES (?)\00"
@.str.11 = [49 x i8] c"INSERT INTO Type (TypeID, TypeName) VALUES (?,?)\00"
@.str.12 = [10 x i8] c"Hardcover\00"
@.str.13 = [10 x i8] c"Softcover\00"
define i32 @new_db(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = icmp ne i32* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 -1, i32* %2
br label %257
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = call i64 @sqlite3_prepare_v2(i32* %9, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%11 = load i64, i64* @SQLITE_OK
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 -1, i32* %2
br label %257
14: ; preds = %8
%15 = load i32*, i32** %4
%16 = call i64 @sqlite3_step(i32* %15)
%17 = load i64, i64* @SQLITE_DONE
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32*, i32** %4
%21 = call i32 @sqlite3_finalize(i32* %20)
store i32 -1, i32* %2
br label %257
22: ; preds = %14
%23 = load i32*, i32** %4
%24 = call i32 @sqlite3_finalize(i32* %23)
%25 = load i32*, i32** %3
%26 = call i64 @sqlite3_prepare_v2(i32* %25, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%27 = load i64, i64* @SQLITE_OK
%28 = icmp ne i64 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %22
store i32 -1, i32* %2
br label %257
30: ; preds = %22
%31 = load i32*, i32** %4
%32 = call i64 @sqlite3_step(i32* %31)
%33 = load i64, i64* @SQLITE_DONE
%34 = icmp ne i64 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i32*, i32** %4
%37 = call i32 @sqlite3_finalize(i32* %36)
store i32 -1, i32* %2
br label %257
38: ; preds = %30
%39 = load i32*, i32** %4
%40 = call i32 @sqlite3_finalize(i32* %39)
%41 = load i32*, i32** %3
%42 = call i64 @sqlite3_prepare_v2(i32* %41, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%43 = load i64, i64* @SQLITE_OK
%44 = icmp ne i64 %42, %43
br i1 %44, label %45, label %46
45: ; preds = %38
store i32 -1, i32* %2
br label %257
46: ; preds = %38
%47 = load i32*, i32** %4
%48 = call i64 @sqlite3_step(i32* %47)
%49 = load i64, i64* @SQLITE_DONE
%50 = icmp ne i64 %48, %49
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = load i32*, i32** %4
%53 = call i32 @sqlite3_finalize(i32* %52)
store i32 -1, i32* %2
br label %257
54: ; preds = %46
%55 = load i32*, i32** %4
%56 = call i32 @sqlite3_finalize(i32* %55)
%57 = load i32*, i32** %3
%58 = call i64 @sqlite3_prepare_v2(i32* %57, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%59 = load i64, i64* @SQLITE_OK
%60 = icmp ne i64 %58, %59
br i1 %60, label %61, label %62
61: ; preds = %54
store i32 -1, i32* %2
br label %257
62: ; preds = %54
%63 = load i32*, i32** %4
%64 = call i64 @sqlite3_step(i32* %63)
%65 = load i64, i64* @SQLITE_DONE
%66 = icmp ne i64 %64, %65
br i1 %66, label %67, label %70
67: ; preds = %62
%68 = load i32*, i32** %4
%69 = call i32 @sqlite3_finalize(i32* %68)
store i32 -1, i32* %2
br label %257
70: ; preds = %62
%71 = load i32*, i32** %4
%72 = call i32 @sqlite3_finalize(i32* %71)
%73 = load i32*, i32** %3
%74 = call i64 @sqlite3_prepare_v2(i32* %73, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.4, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%75 = load i64, i64* @SQLITE_OK
%76 = icmp ne i64 %74, %75
br i1 %76, label %77, label %78
77: ; preds = %70
store i32 -1, i32* %2
br label %257
78: ; preds = %70
%79 = load i32*, i32** %4
%80 = call i64 @sqlite3_step(i32* %79)
%81 = load i64, i64* @SQLITE_DONE
%82 = icmp ne i64 %80, %81
br i1 %82, label %83, label %86
83: ; preds = %78
%84 = load i32*, i32** %4
%85 = call i32 @sqlite3_finalize(i32* %84)
store i32 -1, i32* %2
br label %257
86: ; preds = %78
%87 = load i32*, i32** %4
%88 = call i32 @sqlite3_finalize(i32* %87)
%89 = load i32*, i32** %3
%90 = call i64 @sqlite3_prepare_v2(i32* %89, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @.str.5, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%91 = load i64, i64* @SQLITE_OK
%92 = icmp ne i64 %90, %91
br i1 %92, label %93, label %94
93: ; preds = %86
store i32 -1, i32* %2
br label %257
94: ; preds = %86
%95 = load i32*, i32** %4
%96 = call i64 @sqlite3_step(i32* %95)
%97 = load i64, i64* @SQLITE_DONE
%98 = icmp ne i64 %96, %97
br i1 %98, label %99, label %102
99: ; preds = %94
%100 = load i32*, i32** %4
%101 = call i32 @sqlite3_finalize(i32* %100)
store i32 -1, i32* %2
br label %257
102: ; preds = %94
%103 = load i32*, i32** %4
%104 = call i32 @sqlite3_finalize(i32* %103)
%105 = load i32*, i32** %3
%106 = call i64 @sqlite3_prepare_v2(i32* %105, i8* getelementptr inbounds ([182 x i8], [182 x i8]* @.str.6, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%107 = load i64, i64* @SQLITE_OK
%108 = icmp ne i64 %106, %107
br i1 %108, label %109, label %110
109: ; preds = %102
store i32 -1, i32* %2
br label %257
110: ; preds = %102
%111 = load i32*, i32** %4
%112 = call i64 @sqlite3_step(i32* %111)
%113 = load i64, i64* @SQLITE_DONE
%114 = icmp ne i64 %112, %113
br i1 %114, label %115, label %118
115: ; preds = %110
%116 = load i32*, i32** %4
%117 = call i32 @sqlite3_finalize(i32* %116)
store i32 -1, i32* %2
br label %257
118: ; preds = %110
%119 = load i32*, i32** %4
%120 = call i32 @sqlite3_finalize(i32* %119)
%121 = load i32*, i32** %3
%122 = call i64 @sqlite3_prepare_v2(i32* %121, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.7, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%123 = load i64, i64* @SQLITE_OK
%124 = icmp ne i64 %122, %123
br i1 %124, label %125, label %126
125: ; preds = %118
store i32 -1, i32* %2
br label %257
126: ; preds = %118
%127 = load i32*, i32** %4
%128 = call i64 @sqlite3_step(i32* %127)
%129 = load i64, i64* @SQLITE_DONE
%130 = icmp ne i64 %128, %129
br i1 %130, label %131, label %134
131: ; preds = %126
%132 = load i32*, i32** %4
%133 = call i32 @sqlite3_finalize(i32* %132)
store i32 -1, i32* %2
br label %257
134: ; preds = %126
%135 = load i32*, i32** %4
%136 = call i32 @sqlite3_finalize(i32* %135)
%137 = load i32*, i32** %3
%138 = call i64 @sqlite3_prepare_v2(i32* %137, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.8, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%139 = load i64, i64* @SQLITE_OK
%140 = icmp ne i64 %138, %139
br i1 %140, label %141, label %142
141: ; preds = %134
store i32 -1, i32* %2
br label %257
142: ; preds = %134
%143 = load i32*, i32** %4
%144 = call i64 @sqlite3_step(i32* %143)
%145 = load i64, i64* @SQLITE_DONE
%146 = icmp ne i64 %144, %145
br i1 %146, label %147, label %150
147: ; preds = %142
%148 = load i32*, i32** %4
%149 = call i32 @sqlite3_finalize(i32* %148)
store i32 -1, i32* %2
br label %257
150: ; preds = %142
%151 = load i32*, i32** %4
%152 = call i32 @sqlite3_finalize(i32* %151)
%153 = load i32*, i32** %3
%154 = call i64 @sqlite3_prepare(i32* %153, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%155 = load i64, i64* @SQLITE_OK
%156 = icmp ne i64 %154, %155
br i1 %156, label %157, label %158
157: ; preds = %150
store i32 -1, i32* %2
br label %257
158: ; preds = %150
%159 = load i32*, i32** %4
%160 = call i64 @sqlite3_step(i32* %159)
%161 = load i64, i64* @SQLITE_DONE
%162 = icmp ne i64 %160, %161
br i1 %162, label %163, label %166
163: ; preds = %158
%164 = load i32*, i32** %4
%165 = call i32 @sqlite3_finalize(i32* %164)
store i32 -1, i32* %2
br label %257
166: ; preds = %158
%167 = load i32*, i32** %4
%168 = call i32 @sqlite3_finalize(i32* %167)
%169 = load i32*, i32** %3
%170 = call i64 @sqlite3_prepare_v2(i32* %169, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%171 = load i64, i64* @SQLITE_OK
%172 = icmp ne i64 %170, %171
br i1 %172, label %173, label %174
173: ; preds = %166
store i32 -1, i32* %2
br label %257
174: ; preds = %166
%175 = load i32*, i32** %4
%176 = call i64 @sqlite3_bind_int(i32* %175, i32 1, i32 1)
%177 = load i64, i64* @SQLITE_OK
%178 = icmp ne i64 %176, %177
br i1 %178, label %179, label %182
179: ; preds = %174
%180 = load i32*, i32** %4
%181 = call i32 @sqlite3_finalize(i32* %180)
store i32 -1, i32* %2
br label %257
182: ; preds = %174
%183 = load i32*, i32** %4
%184 = call i64 @sqlite3_step(i32* %183)
%185 = load i64, i64* @SQLITE_DONE
%186 = icmp ne i64 %184, %185
br i1 %186, label %187, label %190
187: ; preds = %182
%188 = load i32*, i32** %4
%189 = call i32 @sqlite3_finalize(i32* %188)
store i32 -1, i32* %2
br label %257
190: ; preds = %182
%191 = load i32*, i32** %4
%192 = call i32 @sqlite3_finalize(i32* %191)
%193 = load i32*, i32** %3
%194 = call i64 @sqlite3_prepare_v2(i32* %193, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%195 = load i64, i64* @SQLITE_OK
%196 = icmp ne i64 %194, %195
br i1 %196, label %197, label %198
197: ; preds = %190
store i32 -1, i32* %2
br label %257
198: ; preds = %190
%199 = load i32*, i32** %4
%200 = call i64 @sqlite3_bind_int(i32* %199, i32 1, i32 1)
%201 = load i64, i64* @SQLITE_OK
%202 = icmp ne i64 %200, %201
br i1 %202, label %203, label %206
203: ; preds = %198
%204 = load i32*, i32** %4
%205 = call i32 @sqlite3_finalize(i32* %204)
store i32 -1, i32* %2
br label %257
206: ; preds = %198
%207 = load i32*, i32** %4
%208 = call i64 @sqlite3_bind_text(i32* %207, i32 2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32 -1, i32 0)
%209 = load i64, i64* @SQLITE_OK
%210 = icmp ne i64 %208, %209
br i1 %210, label %211, label %214
211: ; preds = %206
%212 = load i32*, i32** %4
%213 = call i32 @sqlite3_finalize(i32* %212)
store i32 -1, i32* %2
br label %257
214: ; preds = %206
%215 = load i32*, i32** %4
%216 = call i64 @sqlite3_step(i32* %215)
%217 = load i64, i64* @SQLITE_DONE
%218 = icmp ne i64 %216, %217
br i1 %218, label %219, label %222
219: ; preds = %214
%220 = load i32*, i32** %4
%221 = call i32 @sqlite3_finalize(i32* %220)
store i32 -1, i32* %2
br label %257
222: ; preds = %214
%223 = load i32*, i32** %4
%224 = call i32 @sqlite3_finalize(i32* %223)
%225 = load i32*, i32** %3
%226 = call i64 @sqlite3_prepare_v2(i32* %225, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i32 -1, i32** %4, i32 0)
%227 = load i64, i64* @SQLITE_OK
%228 = icmp ne i64 %226, %227
br i1 %228, label %229, label %230
229: ; preds = %222
store i32 -1, i32* %2
br label %257
230: ; preds = %222
%231 = load i32*, i32** %4
%232 = call i64 @sqlite3_bind_int(i32* %231, i32 1, i32 2)
%233 = load i64, i64* @SQLITE_OK
%234 = icmp ne i64 %232, %233
br i1 %234, label %235, label %238
235: ; preds = %230
%236 = load i32*, i32** %4
%237 = call i32 @sqlite3_finalize(i32* %236)
store i32 -1, i32* %2
br label %257
238: ; preds = %230
%239 = load i32*, i32** %4
%240 = call i64 @sqlite3_bind_text(i32* %239, i32 2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 -1, i32 0)
%241 = load i64, i64* @SQLITE_OK
%242 = icmp ne i64 %240, %241
br i1 %242, label %243, label %246
243: ; preds = %238
%244 = load i32*, i32** %4
%245 = call i32 @sqlite3_finalize(i32* %244)
store i32 -1, i32* %2
br label %257
246: ; preds = %238
%247 = load i32*, i32** %4
%248 = call i64 @sqlite3_step(i32* %247)
%249 = load i64, i64* @SQLITE_DONE
%250 = icmp ne i64 %248, %249
br i1 %250, label %251, label %254
251: ; preds = %246
%252 = load i32*, i32** %4
%253 = call i32 @sqlite3_finalize(i32* %252)
store i32 -1, i32* %2
br label %257
254: ; preds = %246
%255 = load i32*, i32** %4
%256 = call i32 @sqlite3_finalize(i32* %255)
store i32 0, i32* %2
br label %257
257: ; preds = %254, %251, %243, %235, %229, %219, %211, %203, %197, %187, %179, %173, %163, %157, %147, %141, %131, %125, %115, %109, %99, %93, %83, %77, %67, %61, %51, %45, %35, %29, %19, %13, %7
%258 = load i32, i32* %2
ret i32 %258
}

LLVM IR (-O2):
@.str = [85 x i8] c"CREATE TABLE Book(BookID INTEGER PRIMARY KEY,Title TEXT NOT NULL,Subtitle TEXT)\00"
@SQLITE_OK = global i64 0
@SQLITE_DONE = global i64 0
@.str.1 = [138 x i8] c"CREATE TABLE Owner(OwnerID INTEGER PRIMARY KEY,OwnerLast TEXT NOT NULL,OwnerFirst TEXT NOT NULL,OwnerMiddle TEXT,OwnerSuffix TEXT)\00"
@.str.2 = [71 x i8] c"CREATE TABLE Type(TypeID INTEGER PRIMARY KEY,TypeName TEXT NOT NULL)\00"
@.str.3 = [74 x i8] c"CREATE TABLE Genre(GenreID INTEGER PRIMARY KEY,GenreName TEXT NOT NULL)\00"
@.str.4 = [144 x i8] c"CREATE_TABLE Author(AuthorID INTEGER PRIMARY KEY,AuthorLast TEXT NOT NULL,AuthorFirst TEXT NOT NULL,AuthorMiddle TEXT,AuthorSuffix TEXT)\00"
@.str.5 = [200 x i8] c"CREATE TABLE Printing(PrintingID INTEGER PRIMARY KEY,BookID INTEGER REFERENCES Book(BookID),ISBN TEXT,Year INTEGER,TypeID INTEGER REFERENCES Type(TypeID),PrintingNum INTEGER)\00"
@.str.6 = [182 x i8] c"CREATE TABLE BookOwner(PrintingID INTEGER REFERENCES Printing(PrintingID),OwnerID INTEGER REFERENCES Owner(OwnerID),Quantity INTEGER NOT NULL),PRIMARY KEY(PrintingID, OwnerID))\00"
@.str.7 = [135 x i8] c"CREATE TABLE BookGenre(BookID INTEGER REFERENCES Book(BookID),GenreID INTEGER REFERENCES Genre(GenreID),PRIMARY KEY(BookID, GenreID))\00"
@.str.8 = [167 x i8] c"CREATE TABLE BookAuthor(BookID INTEGER REFERENCES Book(BookID),AuthorID INTEGER REFERENCES Author(AuthorID),AuthorOrder INTEGER,PRIMARY KEY(BookID, AuthorID))\00"
@.str.9 = [53 x i8] c"CREATE TABLE Version(SchemaVersion INTEGER NOT NULL)\00"
@.str.10 = [31 x i8] c"INSERT INTO Version VALUES (?)\00"
@.str.11 = [49 x i8] c"INSERT INTO Type (TypeID, TypeName) VALUES (?,?)\00"
@.str.12 = [10 x i8] c"Hardcover\00"
@.str.13 = [10 x i8] c"Softcover\00"
define i32 @new_db(i32* %0) {
%2 = alloca i32*
%3 = icmp eq i32* %0, null
br i1 %3, label %186, label %4
4: ; preds = %1
%5 = bitcast i32** %2 to i8*
%6 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%7 = load i64, i64* @SQLITE_OK
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %184
9: ; preds = %4
%10 = load i32*, i32** %2
%11 = call i64 @sqlite3_step(i32* %10)
%12 = load i64, i64* @SQLITE_DONE
%13 = icmp eq i64 %11, %12
%14 = load i32*, i32** %2
%15 = call i32 @sqlite3_finalize(i32* %14)
br i1 %13, label %16, label %184
16: ; preds = %9
%17 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%18 = load i64, i64* @SQLITE_OK
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %184
20: ; preds = %16
%21 = load i32*, i32** %2
%22 = call i64 @sqlite3_step(i32* %21)
%23 = load i64, i64* @SQLITE_DONE
%24 = icmp eq i64 %22, %23
%25 = load i32*, i32** %2
%26 = call i32 @sqlite3_finalize(i32* %25)
br i1 %24, label %27, label %184
27: ; preds = %20
%28 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%29 = load i64, i64* @SQLITE_OK
%30 = icmp eq i64 %28, %29
br i1 %30, label %31, label %184
31: ; preds = %27
%32 = load i32*, i32** %2
%33 = call i64 @sqlite3_step(i32* %32)
%34 = load i64, i64* @SQLITE_DONE
%35 = icmp eq i64 %33, %34
%36 = load i32*, i32** %2
%37 = call i32 @sqlite3_finalize(i32* %36)
br i1 %35, label %38, label %184
38: ; preds = %31
%39 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%40 = load i64, i64* @SQLITE_OK
%41 = icmp eq i64 %39, %40
br i1 %41, label %42, label %184
42: ; preds = %38
%43 = load i32*, i32** %2
%44 = call i64 @sqlite3_step(i32* %43)
%45 = load i64, i64* @SQLITE_DONE
%46 = icmp eq i64 %44, %45
%47 = load i32*, i32** %2
%48 = call i32 @sqlite3_finalize(i32* %47)
br i1 %46, label %49, label %184
49: ; preds = %42
%50 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.4, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%51 = load i64, i64* @SQLITE_OK
%52 = icmp eq i64 %50, %51
br i1 %52, label %53, label %184
53: ; preds = %49
%54 = load i32*, i32** %2
%55 = call i64 @sqlite3_step(i32* %54)
%56 = load i64, i64* @SQLITE_DONE
%57 = icmp eq i64 %55, %56
%58 = load i32*, i32** %2
%59 = call i32 @sqlite3_finalize(i32* %58)
br i1 %57, label %60, label %184
60: ; preds = %53
%61 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([200 x i8], [200 x i8]* @.str.5, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%62 = load i64, i64* @SQLITE_OK
%63 = icmp eq i64 %61, %62
br i1 %63, label %64, label %184
64: ; preds = %60
%65 = load i32*, i32** %2
%66 = call i64 @sqlite3_step(i32* %65)
%67 = load i64, i64* @SQLITE_DONE
%68 = icmp eq i64 %66, %67
%69 = load i32*, i32** %2
%70 = call i32 @sqlite3_finalize(i32* %69)
br i1 %68, label %71, label %184
71: ; preds = %64
%72 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([182 x i8], [182 x i8]* @.str.6, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%73 = load i64, i64* @SQLITE_OK
%74 = icmp eq i64 %72, %73
br i1 %74, label %75, label %184
75: ; preds = %71
%76 = load i32*, i32** %2
%77 = call i64 @sqlite3_step(i32* %76)
%78 = load i64, i64* @SQLITE_DONE
%79 = icmp eq i64 %77, %78
%80 = load i32*, i32** %2
%81 = call i32 @sqlite3_finalize(i32* %80)
br i1 %79, label %82, label %184
82: ; preds = %75
%83 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.7, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%84 = load i64, i64* @SQLITE_OK
%85 = icmp eq i64 %83, %84
br i1 %85, label %86, label %184
86: ; preds = %82
%87 = load i32*, i32** %2
%88 = call i64 @sqlite3_step(i32* %87)
%89 = load i64, i64* @SQLITE_DONE
%90 = icmp eq i64 %88, %89
%91 = load i32*, i32** %2
%92 = call i32 @sqlite3_finalize(i32* %91)
br i1 %90, label %93, label %184
93: ; preds = %86
%94 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.8, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%95 = load i64, i64* @SQLITE_OK
%96 = icmp eq i64 %94, %95
br i1 %96, label %97, label %184
97: ; preds = %93
%98 = load i32*, i32** %2
%99 = call i64 @sqlite3_step(i32* %98)
%100 = load i64, i64* @SQLITE_DONE
%101 = icmp eq i64 %99, %100
%102 = load i32*, i32** %2
%103 = call i32 @sqlite3_finalize(i32* %102)
br i1 %101, label %104, label %184
104: ; preds = %97
%105 = call i64 @sqlite3_prepare(i32* %0, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%106 = load i64, i64* @SQLITE_OK
%107 = icmp eq i64 %105, %106
br i1 %107, label %108, label %184
108: ; preds = %104
%109 = load i32*, i32** %2
%110 = call i64 @sqlite3_step(i32* %109)
%111 = load i64, i64* @SQLITE_DONE
%112 = icmp eq i64 %110, %111
%113 = load i32*, i32** %2
%114 = call i32 @sqlite3_finalize(i32* %113)
br i1 %112, label %115, label %184
115: ; preds = %108
%116 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%117 = load i64, i64* @SQLITE_OK
%118 = icmp eq i64 %116, %117
br i1 %118, label %119, label %184
119: ; preds = %115
%120 = load i32*, i32** %2
%121 = call i64 @sqlite3_bind_int(i32* %120, i32 1, i32 1)
%122 = load i64, i64* @SQLITE_OK
%123 = icmp eq i64 %121, %122
%124 = load i32*, i32** %2
br i1 %123, label %127, label %125
125: ; preds = %119
%126 = call i32 @sqlite3_finalize(i32* %124)
br label %184
127: ; preds = %119
%128 = call i64 @sqlite3_step(i32* %124)
%129 = load i64, i64* @SQLITE_DONE
%130 = icmp eq i64 %128, %129
%131 = load i32*, i32** %2
%132 = call i32 @sqlite3_finalize(i32* %131)
br i1 %130, label %133, label %184
133: ; preds = %127
%134 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%135 = load i64, i64* @SQLITE_OK
%136 = icmp eq i64 %134, %135
br i1 %136, label %137, label %184
137: ; preds = %133
%138 = load i32*, i32** %2
%139 = call i64 @sqlite3_bind_int(i32* %138, i32 1, i32 1)
%140 = load i64, i64* @SQLITE_OK
%141 = icmp eq i64 %139, %140
%142 = load i32*, i32** %2
br i1 %141, label %145, label %143
143: ; preds = %137
%144 = call i32 @sqlite3_finalize(i32* %142)
br label %184
145: ; preds = %137
%146 = call i64 @sqlite3_bind_text(i32* %142, i32 2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32 -1, i32 0)
%147 = load i64, i64* @SQLITE_OK
%148 = icmp eq i64 %146, %147
%149 = load i32*, i32** %2
br i1 %148, label %152, label %150
150: ; preds = %145
%151 = call i32 @sqlite3_finalize(i32* %149)
br label %184
152: ; preds = %145
%153 = call i64 @sqlite3_step(i32* %149)
%154 = load i64, i64* @SQLITE_DONE
%155 = icmp eq i64 %153, %154
%156 = load i32*, i32** %2
%157 = call i32 @sqlite3_finalize(i32* %156)
br i1 %155, label %158, label %184
158: ; preds = %152
%159 = call i64 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.11, i64 0, i64 0), i32 -1, i32** %2, i32 0)
%160 = load i64, i64* @SQLITE_OK
%161 = icmp eq i64 %159, %160
br i1 %161, label %162, label %184
162: ; preds = %158
%163 = load i32*, i32** %2
%164 = call i64 @sqlite3_bind_int(i32* %163, i32 1, i32 2)
%165 = load i64, i64* @SQLITE_OK
%166 = icmp eq i64 %164, %165
%167 = load i32*, i32** %2
br i1 %166, label %170, label %168
168: ; preds = %162
%169 = call i32 @sqlite3_finalize(i32* %167)
br label %184
170: ; preds = %162
%171 = call i64 @sqlite3_bind_text(i32* %167, i32 2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0), i32 -1, i32 0)
%172 = load i64, i64* @SQLITE_OK
%173 = icmp eq i64 %171, %172
%174 = load i32*, i32** %2
br i1 %173, label %177, label %175
175: ; preds = %170
%176 = call i32 @sqlite3_finalize(i32* %174)
br label %184
177: ; preds = %170
%178 = call i64 @sqlite3_step(i32* %174)
%179 = load i64, i64* @SQLITE_DONE
%180 = icmp ne i64 %178, %179
%181 = load i32*, i32** %2
%182 = call i32 @sqlite3_finalize(i32* %181)
%183 = sext i1 %180 to i32
br label %184
184: ; preds = %177, %152, %127, %108, %97, %86, %75, %64, %53, %42, %31, %20, %9, %158, %133, %115, %104, %93, %82, %71, %60, %49, %38, %27, %16, %4, %175, %168, %150, %143, %125
%185 = phi i32 [ -1, %125 ], [ -1, %143 ], [ -1, %150 ], [ -1, %168 ], [ -1, %175 ], [ -1, %4 ], [ -1, %16 ], [ -1, %27 ], [ -1, %38 ], [ -1, %49 ], [ -1, %60 ], [ -1, %71 ], [ -1, %82 ], [ -1, %93 ], [ -1, %104 ], [ -1, %115 ], [ -1, %133 ], [ -1, %158 ], [ -1, %9 ], [ -1, %20 ], [ -1, %31 ], [ -1, %42 ], [ -1, %53 ], [ -1, %64 ], [ -1, %75 ], [ -1, %86 ], [ -1, %97 ], [ -1, %108 ], [ -1, %127 ], [ -1, %152 ], [ %183, %177 ]
br label %186
186: ; preds = %1, %184
%187 = phi i32 [ %185, %184 ], [ -1, %1 ]
ret i32 %187
}