#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*/ evlog(int, char *, char const *, char const *);
int sqlite3_exec(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite_error(int, int /*<<< orphan*/ *, char *, char const *,
                                char const *);
void runStatement(sqlite3 *db, const char *sql, const char *description) {
  int res;
  evlog(3, "%s: %s", description, sql);
  res = sqlite3_exec(db, sql, NULL, NULL, NULL);
  if (res != SQLITE_OK)
    sqlite_error(res, db, "%s failed - statement %s", description, sql);
}


x86 assembly (clang, -O0):
<runStatement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x3,%edi
lea    0xea8(%rip),%rsi
call   1050 <evlog@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   1030 <sqlite3_exec@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%eax
je     11a5 <runStatement+0x75>
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe67(%rip),%rdx
call   1040 <sqlite_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runStatement>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xebb(%rip),%rsi
mov    $0x3,%edi
mov    %rbx,%rcx
call   1050 <evlog@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <sqlite3_exec@plt>
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%eax
jne    1175 <runStatement+0x45>
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe8b(%rip),%rdx
mov    %eax,%edi
mov    %r15,%rsi
mov    %r14,%rcx
mov    %rbx,%r8
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <sqlite_error@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%s: %s\00"
@SQLITE_OK = global i32 0
@.str.1 = [25 x i8] c"%s failed - statement %s\00"
define void @runStatement(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = load i8*, i8** %5
%10 = call i32 @evlog(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = load i32*, i32** %4
%12 = load i8*, i8** %5
%13 = call i32 @sqlite3_exec(i32* %11, i8* %12, i32* null, i32* null, i32* null)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = load i32, i32* @SQLITE_OK
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = load i32, i32* %7
%19 = load i32*, i32** %4
%20 = load i8*, i8** %6
%21 = load i8*, i8** %5
%22 = call i32 @sqlite_error(i32 %18, i32* %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21)
br label %23
23: ; preds = %17, %3
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s: %s\00"
@SQLITE_OK = global i32 0
@.str.1 = [25 x i8] c"%s failed - statement %s\00"
define void @runStatement(i32* %0, i8* %1, i8* %2) {
%4 = tail call i32 @evlog(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %1)
%5 = tail call i32 @sqlite3_exec(i32* %0, i8* %1, i32* null, i32* null, i32* null)
%6 = load i32, i32* @SQLITE_OK
%7 = icmp eq i32 %5, %6
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 @sqlite_error(i32 %5, i32* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %1)
br label %10
10: ; preds = %8, %3
ret void
}