#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;

/* Variables and functions */
scalar_t__ SQLITE_OK;
scalar_t__ sqlite3_bind_int(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ sqlite3_finalize(int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_step(int /*<<< orphan*/ *);
int /*<<< orphan*/ *stmt_set(char *);
int settings_setInt(char *name, int value) {
  sqlite3_stmt *stmt = stmt_set(name);
  if (stmt == NULL)
    return -1;
  if (sqlite3_bind_int(stmt, 2, value) != SQLITE_OK) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_step(stmt);
  sqlite3_finalize(stmt);
  return 0;
}


x86 assembly (clang, -O0):
<settings_setInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <stmt_set@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1173 <settings_setInt+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c2 <settings_setInt+0x82>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x2,%esi
call   1030 <sqlite3_bind_int@plt>
mov    0x2e5d(%rip),%rcx
cmp    (%rcx),%rax
je     11a9 <settings_setInt+0x69>
mov    -0x20(%rbp),%rdi
call   1050 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c2 <settings_setInt+0x82>
mov    -0x20(%rbp),%rdi
call   1040 <sqlite3_step@plt>
mov    -0x20(%rbp),%rdi
call   1050 <sqlite3_finalize@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<settings_setInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1060 <stmt_set@plt>
test   %rax,%rax
je     1186 <settings_setInt+0x46>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2,%esi
mov    %ebp,%edx
call   1030 <sqlite3_bind_int@plt>
mov    0x2e80(%rip),%rcx
mov    $0xffffffff,%ebp
cmp    (%rcx),%rax
jne    117c <settings_setInt+0x3c>
mov    %rbx,%rdi
call   1040 <sqlite3_step@plt>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1050 <sqlite3_finalize@plt>
jmp    118b <settings_setInt+0x4b>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SQLITE_OK = global i64 0
define i32 @settings_setInt(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = call i32* @stmt_set(i8* %7)
store i32* %8, i32** %6
%9 = load i32*, i32** %6
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %26
12: ; preds = %2
%13 = load i32*, i32** %6
%14 = load i32, i32* %5
%15 = call i64 @sqlite3_bind_int(i32* %13, i32 2, i32 %14)
%16 = load i64, i64* @SQLITE_OK
%17 = icmp ne i64 %15, %16
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = load i32*, i32** %6
%20 = call i32 @sqlite3_finalize(i32* %19)
store i32 -1, i32* %3
br label %26
21: ; preds = %12
%22 = load i32*, i32** %6
%23 = call i32 @sqlite3_step(i32* %22)
%24 = load i32*, i32** %6
%25 = call i32 @sqlite3_finalize(i32* %24)
store i32 0, i32* %3
br label %26
26: ; preds = %21, %18, %11
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@SQLITE_OK = global i64 0
define i32 @settings_setInt(i8* %0, i32 %1) {
%3 = tail call i32* @stmt_set(i8* %0)
%4 = icmp eq i32* %3, null
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = tail call i64 @sqlite3_bind_int(i32* %3, i32 2, i32 %1)
%7 = load i64, i64* @SQLITE_OK
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @sqlite3_step(i32* %3)
br label %11
11: ; preds = %5, %9
%12 = phi i32 [ 0, %9 ], [ -1, %5 ]
%13 = tail call i32 @sqlite3_finalize(i32* %3)
br label %14
14: ; preds = %11, %2
%15 = phi i32 [ -1, %2 ], [ %12, %11 ]
ret i32 %15
}