#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;
int /*<<< orphan*/ SQLITE_STATIC;
scalar_t__ sqlite3_bind_text(int /*<<< orphan*/ *, int, char *, int,
                             int /*<<< orphan*/);
int /*<<< orphan*/ sqlite3_finalize(int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_step(int /*<<< orphan*/ *);
int /*<<< orphan*/ *stmt_set(char *);
int settings_setString(char *name, char *value) {
  sqlite3_stmt *stmt = stmt_set(name);
  if (stmt == NULL)
    return -1;
  if (sqlite3_bind_text(stmt, 2, value, -1, SQLITE_STATIC) != SQLITE_OK) {
    sqlite3_finalize(stmt);
    return -1;
  }
  sqlite3_step(stmt);
  sqlite3_finalize(stmt);
  return 0;
}


x86 assembly (clang, -O0):
<settings_setString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <stmt_set@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1174 <settings_setString+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d3 <settings_setString+0x93>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    0x2e55(%rip),%rax
mov    (%rax),%r8d
mov    $0x2,%esi
mov    $0xffffffff,%ecx
call   1040 <sqlite3_bind_text@plt>
mov    0x2e4c(%rip),%rcx
cmp    (%rcx),%rax
je     11ba <settings_setString+0x7a>
mov    -0x20(%rbp),%rdi
call   1050 <sqlite3_finalize@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d3 <settings_setString+0x93>
mov    -0x20(%rbp),%rdi
call   1030 <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_setString>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
call   1060 <stmt_set@plt>
test   %rax,%rax
je     1198 <settings_setString+0x58>
mov    %rax,%rbx
mov    0x2e7d(%rip),%rax
mov    (%rax),%r8d
mov    $0xffffffff,%ebp
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r14,%rdx
mov    $0xffffffff,%ecx
call   1040 <sqlite3_bind_text@plt>
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%rax
jne    118e <settings_setString+0x4e>
mov    %rbx,%rdi
call   1030 <sqlite3_step@plt>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1050 <sqlite3_finalize@plt>
jmp    119d <settings_setString+0x5d>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SQLITE_STATIC = global i32 0
@SQLITE_OK = global i64 0
define i32 @settings_setString(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %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 %27
12: ; preds = %2
%13 = load i32*, i32** %6
%14 = load i8*, i8** %5
%15 = load i32, i32* @SQLITE_STATIC
%16 = call i64 @sqlite3_bind_text(i32* %13, i32 2, i8* %14, i32 -1, i32 %15)
%17 = load i64, i64* @SQLITE_OK
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = load i32*, i32** %6
%21 = call i32 @sqlite3_finalize(i32* %20)
store i32 -1, i32* %3
br label %27
22: ; preds = %12
%23 = load i32*, i32** %6
%24 = call i32 @sqlite3_step(i32* %23)
%25 = load i32*, i32** %6
%26 = call i32 @sqlite3_finalize(i32* %25)
store i32 0, i32* %3
br label %27
27: ; preds = %22, %19, %11
%28 = load i32, i32* %3
ret i32 %28
}

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