#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_stmt;
typedef int /*<<< orphan*/ sqlite3;
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int SQLITE_DONE;
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
char *sqlite3_errmsg(int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_finalize(int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_prepare_v2(int /*<<< orphan*/ *, char const *, int,
                                      int /*<<< orphan*/ **,
                                      int /*<<< orphan*/ *);
int sqlite3_step(int /*<<< orphan*/ *);
int odem_exec_noselect_db(sqlite3 *db, const char *sql) {
  int rc;
  char msg[100];
  sqlite3_stmt *stmt;
  sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
  rc = sqlite3_step(stmt);
  if (rc != SQLITE_DONE) {
    snprintf(msg, sizeof(msg), "ERROR: %s\n", sqlite3_errmsg(db));
    die(msg);
  }
  sqlite3_finalize(stmt);
  return rc;
}


x86 assembly (clang, -O0):
<odem_exec_noselect_db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xffffffff,%edx
lea    -0x88(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    -0x88(%rbp),%rdi
call   1050 <sqlite3_step@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e36(%rip),%rcx
cmp    (%rcx),%eax
je     11ea <odem_exec_noselect_db+0x8a>
lea    -0x80(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sqlite3_errmsg@plt>
mov    -0x90(%rbp),%rdi
mov    %rax,%rcx
mov    $0x64,%esi
lea    0xe24(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x80(%rbp),%rdi
call   1060 <die@plt>
mov    -0x88(%rbp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    -0x14(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odem_exec_noselect_db>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rdi,%r14
lea    0x8(%rsp),%rcx
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   1080 <sqlite3_prepare_v2@plt>
mov    0x8(%rsp),%rdi
call   1050 <sqlite3_step@plt>
mov    %eax,%ebx
mov    0x2e51(%rip),%rax
cmp    (%rax),%ebx
je     11bf <odem_exec_noselect_db+0x5f>
mov    %r14,%rdi
call   1040 <sqlite3_errmsg@plt>
lea    0xe5e(%rip),%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x64,%esi
mov    %rax,%rcx
call   1030 <snprintf@plt>
mov    %r14,%rdi
call   1060 <die@plt>
mov    0x8(%rsp),%rdi
call   1070 <sqlite3_finalize@plt>
mov    %ebx,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SQLITE_DONE = global i32 0
@.str = [11 x i8] c"ERROR: %s\0A\00"
define i32 @odem_exec_noselect_db(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [100 x i8]
%7 = alloca i32*
store i32* %0, i32** %3
store i8* %1, i8** %4
%8 = load i32*, i32** %3
%9 = load i8*, i8** %4
%10 = call i32 @sqlite3_prepare_v2(i32* %8, i8* %9, i32 -1, i32** %7, i32* null)
%11 = load i32*, i32** %7
%12 = call i32 @sqlite3_step(i32* %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = load i32, i32* @SQLITE_DONE
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %2
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%18 = load i32*, i32** %3
%19 = call i8* @sqlite3_errmsg(i32* %18)
%20 = call i32 @snprintf(i8* %17, i32 100, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%22 = call i32 @die(i8* %21)
br label %23
23: ; preds = %16, %2
%24 = load i32*, i32** %7
%25 = call i32 @sqlite3_finalize(i32* %24)
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
@SQLITE_DONE = global i32 0
@.str = [11 x i8] c"ERROR: %s\0A\00"
define i32 @odem_exec_noselect_db(i32* %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = alloca i32*
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = bitcast i32** %4 to i8*
%7 = call i32 @sqlite3_prepare_v2(i32* %0, i8* %1, i32 -1, i32** %4, i32* null)
%8 = load i32*, i32** %4
%9 = call i32 @sqlite3_step(i32* %8)
%10 = load i32, i32* @SQLITE_DONE
%11 = icmp eq i32 %9, %10
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = call i8* @sqlite3_errmsg(i32* %0)
%14 = call i32 @snprintf(i8* %5, i32 100, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @die(i8* %5)
br label %16
16: ; preds = %12, %2
%17 = load i32*, i32** %4
%18 = call i32 @sqlite3_finalize(i32* %17)
ret i32 %9
}