#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 /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int SQLITE_OK;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int sqlite3_changes(int /*<<< orphan*/ *);
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 *);
scalar_t__ sqlite3_open(char *, int /*<<< orphan*/ **);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  sqlite3 *db = NULL;
  char *sql_create = NULL;
  char *sql_insert = NULL;
  char *err = NULL;
  int rc = 0;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <database>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if (sqlite3_open(argv[1], &db)) {
    fprintf(stderr, "Err. can't create database: %s\n", sqlite3_errmsg(db));
    exit(EXIT_FAILURE);
  }
  sql_create = "CREATE TABLE IF NOT EXISTS song(                    id INTEGER "
               "PRIMARY KEY,                             data DATE NOT NULL,   "
               "                              time TIME NOT NULL,              "
               "                   msg TEXT NOT NULL)";
  rc = sqlite3_exec(db, sql_create, NULL, NULL, &err);
  if (rc != SQLITE_OK) {
    fprintf(stderr, "Err. Failed to execute SQL query: \'%s\'\n", err);
    sqlite3_free(err);
  }
  printf("Table successfully created: %s\n", argv[1]);
  sql_insert = "INSERT INTO song(data, time, msg) VALUES"
               "(date('now'), time('now'), 'Take a walk on the wild side'),"
               "(date('now'), time('now'), 'Get up Stand up'),"
               "(date('now'), time('now'), 'Jamming'),"
               "(date('now'), time('now'), 'Buffalo Soldier'),"
               "(date('now'), time('now'), 'Rastaman Vibration')";
  rc = sqlite3_exec(db, sql_insert, NULL, NULL, &err);
  if (rc != SQLITE_OK) {
    fprintf(stderr, "Err. Failed to execute SQL query: \'%s\'\n", err);
    sqlite3_free(err);
  }
  printf(" Rows Successfully created: %d\n", sqlite3_changes(db));
  sqlite3_close(db);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1201 <main+0x71>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe12(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <sqlite3_open@plt>
cmp    $0x0,%rax
je     1251 <main+0xc1>
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <sqlite3_errmsg@plt>
mov    -0x38(%rbp),%edi
mov    %rax,%rdx
lea    0xdd8(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0xdde(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x30(%rbp),%r8
mov    %rcx,%rdx
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    0x2d67(%rip),%rcx
cmp    (%rcx),%eax
je     12ab <main+0x11b>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xe7c(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   10a0 <sqlite3_free@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe99(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x30(%rbp),%r8
mov    %rcx,%rdx
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    0x2cf7(%rip),%rcx
cmp    (%rcx),%eax
je     131b <main+0x18b>
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xe0c(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   10a0 <sqlite3_free@plt>
mov    -0x18(%rbp),%rdi
call   1090 <sqlite3_changes@plt>
mov    %eax,%esi
lea    0xf4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1080 <sqlite3_close@plt>
mov    0x2c84(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
cmp    $0x2,%edi
jne    12a0 <main+0x110>
mov    0x8(%rbx),%rdi
lea    0x10(%rsp),%rsi
call   1040 <sqlite3_open@plt>
test   %rax,%rax
jne    12b5 <main+0x125>
mov    0x10(%rsp),%rdi
lea    0xe5e(%rip),%rsi
lea    0x8(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <sqlite3_exec@plt>
mov    0x2dfb(%rip),%r14
cmp    (%r14),%eax
je     1216 <main+0x86>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
lea    0xf12(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   10a0 <sqlite3_free@plt>
mov    0x8(%rbx),%rsi
lea    0xf20(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rdi
lea    0xf2d(%rip),%rsi
lea    0x8(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <sqlite3_exec@plt>
cmp    (%r14),%eax
je     126b <main+0xdb>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
lea    0xebd(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x8(%rsp),%rdi
call   10a0 <sqlite3_free@plt>
mov    0x10(%rsp),%rdi
call   1090 <sqlite3_changes@plt>
lea    0xffb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rdi
call   1080 <sqlite3_close@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2d31(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd4d(%rip),%rsi
jmp    12d4 <main+0x144>
mov    0x2d1c(%rip),%rax
mov    (%rax),%ebx
mov    0x10(%rsp),%rdi
call   1060 <sqlite3_errmsg@plt>
lea    0xd47(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1070 <fprintf@plt>
mov    0x2cf0(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s <database>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [32 x i8] c"Err. can't create database: %s\0A\00"
@.str.2 = [227 x i8] c"CREATE TABLE IF NOT EXISTS song( id INTEGER PRIMARY KEY, data DATE NOT NULL, time TIME NOT NULL, msg TEXT NOT NULL)\00"
@SQLITE_OK = global i32 0
@.str.3 = [40 x i8] c"Err. Failed to execute SQL query: '%s'\0A\00"
@.str.4 = [32 x i8] c"Table successfully created: %s\0A\00"
@.str.5 = [278 x i8] c"INSERT INTO song(data, time, msg) VALUES(date('now'), time('now'), 'Take a walk on the wild side'),(date('now'), time('now'), 'Get up Stand up'),(date('now'), time('now'), 'Jamming'),(date('now'), time('now'), 'Buffalo Soldier'),(date('now'), time('now'), 'Rastaman Vibration')\00"
@.str.6 = [32 x i8] c" Rows Successfully created: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
store i32 0, i32* %10
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @sqlite3_open(i8* %24, i32** %6)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %21
%28 = load i32, i32* @stderr
%29 = load i32*, i32** %6
%30 = call i8* @sqlite3_errmsg(i32* %29)
%31 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %21
store i8* getelementptr inbounds ([227 x i8], [227 x i8]* @.str.2, i64 0, i64 0), i8** %7
%35 = load i32*, i32** %6
%36 = load i8*, i8** %7
%37 = call i32 @sqlite3_exec(i32* %35, i8* %36, i32* null, i32* null, i8** %9)
store i32 %37, i32* %10
%38 = load i32, i32* %10
%39 = load i32, i32* @SQLITE_OK
%40 = icmp ne i32 %38, %39
br i1 %40, label %41, label %47
41: ; preds = %34
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %9
%44 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %43)
%45 = load i8*, i8** %9
%46 = call i32 @sqlite3_free(i8* %45)
br label %47
47: ; preds = %41, %34
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %50)
store i8* getelementptr inbounds ([278 x i8], [278 x i8]* @.str.5, i64 0, i64 0), i8** %8
%52 = load i32*, i32** %6
%53 = load i8*, i8** %8
%54 = call i32 @sqlite3_exec(i32* %52, i8* %53, i32* null, i32* null, i8** %9)
store i32 %54, i32* %10
%55 = load i32, i32* %10
%56 = load i32, i32* @SQLITE_OK
%57 = icmp ne i32 %55, %56
br i1 %57, label %58, label %64
58: ; preds = %47
%59 = load i32, i32* @stderr
%60 = load i8*, i8** %9
%61 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %60)
%62 = load i8*, i8** %9
%63 = call i32 @sqlite3_free(i8* %62)
br label %64
64: ; preds = %58, %47
%65 = load i32*, i32** %6
%66 = call i32 @sqlite3_changes(i32* %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %66)
%68 = load i32*, i32** %6
%69 = call i32 @sqlite3_close(i32* %68)
%70 = load i32, i32* @EXIT_SUCCESS
ret i32 %70
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s <database>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [32 x i8] c"Err. can't create database: %s\0A\00"
@.str.2 = [227 x i8] c"CREATE TABLE IF NOT EXISTS song( id INTEGER PRIMARY KEY, data DATE NOT NULL, time TIME NOT NULL, msg TEXT NOT NULL)\00"
@SQLITE_OK = global i32 0
@.str.3 = [40 x i8] c"Err. Failed to execute SQL query: '%s'\0A\00"
@.str.4 = [32 x i8] c"Table successfully created: %s\0A\00"
@.str.5 = [278 x i8] c"INSERT INTO song(data, time, msg) VALUES(date('now'), time('now'), 'Take a walk on the wild side'),(date('now'), time('now'), 'Get up Stand up'),(date('now'), time('now'), 'Jamming'),(date('now'), time('now'), 'Buffalo Soldier'),(date('now'), time('now'), 'Rastaman Vibration')\00"
@.str.6 = [32 x i8] c" Rows Successfully created: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = bitcast i32** %3 to i8*
store i32* null, i32** %3
%6 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%7 = icmp eq i32 %0, 2
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @sqlite3_open(i8* %16, i32** %3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = load i32*, i32** %3
%22 = call i8* @sqlite3_errmsg(i32* %21)
%23 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %14
%27 = load i32*, i32** %3
%28 = call i32 @sqlite3_exec(i32* %27, i8* getelementptr inbounds ([227 x i8], [227 x i8]* @.str.2, i64 0, i64 0), i32* null, i32* null, i8** %4)
%29 = load i32, i32* @SQLITE_OK
%30 = icmp eq i32 %28, %29
br i1 %30, label %37, label %31
31: ; preds = %26
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %4
%34 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = load i8*, i8** %4
%36 = call i32 @sqlite3_free(i8* %35)
br label %37
37: ; preds = %31, %26
%38 = load i8*, i8** %15
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %38)
%40 = load i32*, i32** %3
%41 = call i32 @sqlite3_exec(i32* %40, i8* getelementptr inbounds ([278 x i8], [278 x i8]* @.str.5, i64 0, i64 0), i32* null, i32* null, i8** %4)
%42 = load i32, i32* @SQLITE_OK
%43 = icmp eq i32 %41, %42
br i1 %43, label %50, label %44
44: ; preds = %37
%45 = load i32, i32* @stderr
%46 = load i8*, i8** %4
%47 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %46)
%48 = load i8*, i8** %4
%49 = call i32 @sqlite3_free(i8* %48)
br label %50
50: ; preds = %44, %37
%51 = load i32*, i32** %3
%52 = call i32 @sqlite3_changes(i32* %51)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %52)
%54 = load i32*, i32** %3
%55 = call i32 @sqlite3_close(i32* %54)
%56 = load i32, i32* @EXIT_SUCCESS
ret i32 %56
}