#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;
scalar_t__ SQLITE_OK;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sqlite3_initialize();
char *sqlite3_libversion();
scalar_t__ sqlite3_shutdown();
int main(void) {
  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    $0x0,%al
call   1030 <sqlite3_initialize@plt>
mov    0x2e8b(%rip),%rcx
cmp    (%rcx),%rax
jne    117e <main+0x3e>
mov    $0x0,%al
call   1040 <sqlite3_libversion@plt>
mov    %rax,%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <sqlite3_shutdown@plt>
mov    0x2e5c(%rip),%rcx
cmp    (%rcx),%rax
jne    11a3 <main+0x63>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <sqlite3_initialize@plt>
mov    0x2e89(%rip),%rbx
cmp    (%rbx),%rax
jne    117c <main+0x2c>
xor    %eax,%eax
call   1040 <sqlite3_libversion@plt>
lea    0xe8e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <sqlite3_shutdown@plt>
cmp    (%rbx),%rax
jne    1194 <main+0x44>
lea    0xe8b(%rip),%rdi
call   1050 <puts@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

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

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