#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*/ printf(char *);
int sqlite3_exec(int /*<<< orphan*/ *, char *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/, char **);
int createTable(sqlite3 *db) {
  char *result = {0};
  char *sql = "CREATE TABLE IF NOT EXISTS student("
              "`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"
              "`name`          TEXT    NOT NULL,"
              "`age`            INT     NOT NULL,"
              "`address`      TEXT NOT NULL);";
  int r = sqlite3_exec(db, sql, NULL, 0, &result);
  if (r == SQLITE_OK) {
    printf("create table success!\n");
  }
  return r;
}


x86 assembly (clang, -O0):
<createTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xec5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
lea    -0x10(%rbp),%r8
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e85(%rip),%rcx
cmp    (%rcx),%eax
jne    1177 <createTable+0x57>
lea    0xf43(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createTable>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0xecb(%rip),%rsi
lea    0x8(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <sqlite3_exec@plt>
mov    %eax,%ebx
mov    0x2e9c(%rip),%rax
cmp    (%rax),%ebx
jne    115c <createTable+0x3c>
lea    0xf5e(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [181 x i8] c"CREATE TABLE IF NOT EXISTS student(`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,`name` TEXT NOT NULL,`age` INT NOT NULL,`address` TEXT NOT NULL);\00"
@SQLITE_OK = global i32 0
@.str.1 = [23 x i8] c"create table success!\0A\00"
define i32 @createTable(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i32* %0, i32** %2
store i8* null, i8** %3
store i8* getelementptr inbounds ([181 x i8], [181 x i8]* @.str, i64 0, i64 0), i8** %4
%6 = load i32*, i32** %2
%7 = load i8*, i8** %4
%8 = call i32 @sqlite3_exec(i32* %6, i8* %7, i32* null, i32 0, i8** %3)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* @SQLITE_OK
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %1
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
@.str = [181 x i8] c"CREATE TABLE IF NOT EXISTS student(`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,`name` TEXT NOT NULL,`age` INT NOT NULL,`address` TEXT NOT NULL);\00"
@SQLITE_OK = global i32 0
@str = [22 x i8] c"create table success!\00"
define i32 @createTable(i32* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = call i32 @sqlite3_exec(i32* %0, i8* getelementptr inbounds ([181 x i8], [181 x i8]* @.str, i64 0, i64 0), i32* null, i32 0, i8** %2)
%5 = load i32, i32* @SQLITE_OK
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret i32 %4
}