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

/* Variables and functions */
int SQLITE_DONE;
int SQLITE_OK;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ sqlite3_bind_text(int /*<<< orphan*/ *, int, char *,
                                     int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_close(int /*<<< orphan*/ *);
char *sqlite3_errmsg(int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_finalize(int /*<<< orphan*/ *);
int sqlite3_prepare_v2(int /*<<< orphan*/ *, char *, int, int /*<<< orphan*/ **,
                       int /*<<< orphan*/);
int sqlite3_step(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
void sql_label_delete(sqlite3 *db, char *label) {
  int err;
  sqlite3_stmt *res;
  err = sqlite3_prepare_v2(db, "DELETE from passwords WHERE label = ?;", -1,
                           &res, 0);
  if (err != SQLITE_OK) {
    fprintf(stderr, "SQL prepare failure: %s\n", sqlite3_errmsg(db));
    sqlite3_close(db);
    exit(1);
  } else {
    sqlite3_bind_text(res, 1, label, strlen(label), NULL);
  }
  err = sqlite3_step(res);
  if (err != SQLITE_OK && err != SQLITE_DONE) {
    fprintf(stderr, "Failed to execute prepared insert: %s\n",
            sqlite3_errmsg(db));
    sqlite3_close(db);
    exit(1);
  }
  sqlite3_finalize(res);
}


x86 assembly (clang, -O0):
<sql_label_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe55(%rip),%rsi
mov    $0xffffffff,%edx
lea    -0x20(%rbp),%rcx
xor    %r8d,%r8d
call   10a0 <sqlite3_prepare_v2@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e1f(%rip),%rcx
cmp    (%rcx),%eax
je     120b <sql_label_delete+0x7b>
mov    0x2e00(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sqlite3_errmsg@plt>
mov    -0x24(%rbp),%edi
mov    %rax,%rdx
lea    0xe34(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%r8d
call   1080 <sqlite3_bind_text@plt>
mov    -0x20(%rbp),%rdi
call   1050 <sqlite3_step@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2d95(%rip),%rcx
cmp    (%rcx),%eax
je     12a7 <sql_label_delete+0x117>
mov    -0x14(%rbp),%eax
mov    0x2d6b(%rip),%rcx
cmp    (%rcx),%eax
je     12a7 <sql_label_delete+0x117>
mov    0x2d64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sqlite3_errmsg@plt>
mov    -0x3c(%rbp),%edi
mov    %rax,%rdx
lea    0xdb1(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1090 <sqlite3_finalize@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sql_label_delete>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xe5b(%rip),%rsi
mov    %rsp,%rcx
mov    $0xffffffff,%edx
xor    %r8d,%r8d
call   10a0 <sqlite3_prepare_v2@plt>
mov    0x2e2c(%rip),%r12
cmp    (%r12),%eax
jne    1212 <sql_label_delete+0x82>
mov    (%rsp),%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
mov    %eax,%ecx
xor    %r8d,%r8d
call   1080 <sqlite3_bind_text@plt>
mov    (%rsp),%rdi
call   1050 <sqlite3_step@plt>
cmp    (%r12),%eax
je     11fd <sql_label_delete+0x6d>
mov    0x2dd7(%rip),%rcx
cmp    (%rcx),%eax
jne    122c <sql_label_delete+0x9c>
mov    (%rsp),%rdi
call   1090 <sqlite3_finalize@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2dbf(%rip),%rax
mov    (%rax),%ebx
mov    %r14,%rdi
call   1040 <sqlite3_errmsg@plt>
lea    0xdfd(%rip),%rsi
jmp    1244 <sql_label_delete+0xb4>
mov    0x2da5(%rip),%rax
mov    (%rax),%ebx
mov    %r14,%rdi
call   1040 <sqlite3_errmsg@plt>
lea    0xdfc(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1070 <sqlite3_close@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"DELETE from passwords WHERE label = ?;\00"
@SQLITE_OK = global i32 0
@stderr = global i32 0
@.str.1 = [25 x i8] c"SQL prepare failure: %s\0A\00"
@SQLITE_DONE = global i32 0
@.str.2 = [39 x i8] c"Failed to execute prepared insert: %s\0A\00"
define void @sql_label_delete(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = load i32*, i32** %3
%8 = call i32 @sqlite3_prepare_v2(i32* %7, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 -1, i32** %6, i32 0)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* @SQLITE_OK
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i32*, i32** %3
%15 = call i8* @sqlite3_errmsg(i32* %14)
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i32*, i32** %3
%18 = call i32 @sqlite3_close(i32* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i32*, i32** %6
%22 = load i8*, i8** %4
%23 = load i8*, i8** %4
%24 = call i32 @strlen(i8* %23)
%25 = call i32 @sqlite3_bind_text(i32* %21, i32 1, i8* %22, i32 %24, i32* null)
br label %26
26: ; preds = %20
%27 = load i32*, i32** %6
%28 = call i32 @sqlite3_step(i32* %27)
store i32 %28, i32* %5
%29 = load i32, i32* %5
%30 = load i32, i32* @SQLITE_OK
%31 = icmp ne i32 %29, %30
br i1 %31, label %32, label %44
32: ; preds = %26
%33 = load i32, i32* %5
%34 = load i32, i32* @SQLITE_DONE
%35 = icmp ne i32 %33, %34
br i1 %35, label %36, label %44
36: ; preds = %32
%37 = load i32, i32* @stderr
%38 = load i32*, i32** %3
%39 = call i8* @sqlite3_errmsg(i32* %38)
%40 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %39)
%41 = load i32*, i32** %3
%42 = call i32 @sqlite3_close(i32* %41)
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %32, %26
%45 = load i32*, i32** %6
%46 = call i32 @sqlite3_finalize(i32* %45)
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"DELETE from passwords WHERE label = ?;\00"
@SQLITE_OK = global i32 0
@stderr = global i32 0
@.str.1 = [25 x i8] c"SQL prepare failure: %s\0A\00"
@SQLITE_DONE = global i32 0
@.str.2 = [39 x i8] c"Failed to execute prepared insert: %s\0A\00"
define void @sql_label_delete(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = bitcast i32** %3 to i8*
%5 = call i32 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 -1, i32** %3, i32 0)
%6 = load i32, i32* @SQLITE_OK
%7 = icmp eq i32 %5, %6
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i8* @sqlite3_errmsg(i32* %0)
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i32 @sqlite3_close(i32* %0)
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i32*, i32** %3
%16 = call i32 @strlen(i8* %1)
%17 = call i32 @sqlite3_bind_text(i32* %15, i32 1, i8* %1, i32 %16, i32* null)
%18 = load i32*, i32** %3
%19 = call i32 @sqlite3_step(i32* %18)
%20 = load i32, i32* @SQLITE_OK
%21 = icmp eq i32 %19, %20
%22 = load i32, i32* @SQLITE_DONE
%23 = icmp eq i32 %19, %22
%24 = select i1 %21, i1 true, i1 %23
br i1 %24, label %31, label %25
25: ; preds = %14
%26 = load i32, i32* @stderr
%27 = call i8* @sqlite3_errmsg(i32* %0)
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %27)
%29 = call i32 @sqlite3_close(i32* %0)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %14
%32 = load i32*, i32** %3
%33 = call i32 @sqlite3_finalize(i32* %32)
ret void
}