#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 EXIT_SUCCESS;
int /*<<< orphan*/ SQLITE_CONFIG_MULTITHREAD;
scalar_t__ SQLITE_OK;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sqlite3_config(int /*<<< orphan*/);
scalar_t__ sqlite3_initialize();
char *sqlite3_libversion();
scalar_t__ sqlite3_shutdown();
int main(void) {
  sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
  if (sqlite3_initialize() == SQLITE_OK)
    printf("Library: \'%s\' initialized\n", sqlite3_libversion());
  if (sqlite3_shutdown() == SQLITE_OK)
    printf("Library: freed\n");
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1050 <sqlite3_config@plt>
mov    $0x0,%al
call   1030 <sqlite3_initialize@plt>
mov    0x2e6d(%rip),%rcx
cmp    (%rcx),%rax
jne    119c <main+0x4c>
mov    $0x0,%al
call   1040 <sqlite3_libversion@plt>
mov    %rax,%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <sqlite3_shutdown@plt>
mov    0x2e3e(%rip),%rcx
cmp    (%rcx),%rax
jne    11c1 <main+0x71>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1050 <sqlite3_config@plt>
xor    %eax,%eax
call   1030 <sqlite3_initialize@plt>
mov    0x2e6b(%rip),%rbx
cmp    (%rbx),%rax
jne    119a <main+0x3a>
xor    %eax,%eax
call   1040 <sqlite3_libversion@plt>
lea    0xe70(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1080 <sqlite3_shutdown@plt>
cmp    (%rbx),%rax
jne    11b2 <main+0x52>
lea    0xe6e(%rip),%rdi
call   1060 <puts@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@SQLITE_CONFIG_MULTITHREAD = global i32 0
@SQLITE_OK = global i64 0
@.str = [27 x i8] c"Library: '%s' initialized\0A\00"
@.str.1 = [16 x i8] c"Library: freed\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @SQLITE_CONFIG_MULTITHREAD
%3 = call i32 @sqlite3_config(i32 %2)
%4 = call i64 (...) @sqlite3_initialize()
%5 = load i64, i64* @SQLITE_OK
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i8* (...) @sqlite3_libversion()
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %7, %0
%11 = call i64 (...) @sqlite3_shutdown()
%12 = load i64, i64* @SQLITE_OK
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %10
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}

LLVM IR (-O2):
@SQLITE_CONFIG_MULTITHREAD = global i32 0
@SQLITE_OK = global i64 0
@.str = [27 x i8] c"Library: '%s' initialized\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [15 x i8] c"Library: freed\00"
define i32 @main() {
%1 = load i32, i32* @SQLITE_CONFIG_MULTITHREAD
%2 = tail call i32 @sqlite3_config(i32 %1)
%3 = tail call i64 (...) @sqlite3_initialize()
%4 = load i64, i64* @SQLITE_OK
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = tail call i8* (...) @sqlite3_libversion()
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %0
%10 = tail call i64 (...) @sqlite3_shutdown()
%11 = load i64, i64* @SQLITE_OK
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}