#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 */
scalar_t__ SQLITE_DONE;
int SQLITE_OK;
int /*<<< orphan*/ SQLITE_STATIC;
int /*<<< orphan*/ assert(int);
int sqlite3_bind_text(int /*<<< orphan*/ *, int, char const *, int,
                      int /*<<< orphan*/);
int /*<<< orphan*/ sqlite3_finalize(int /*<<< orphan*/ *);
int sqlite3_prepare_v2(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/,
                       int /*<<< orphan*/ **, int /*<<< orphan*/ *);
int /*<<< orphan*/ sqlite3_reset(int /*<<< orphan*/ *);
scalar_t__ sqlite3_step(int /*<<< orphan*/ *);
int /*<<< orphan*/ strlen(char const *);
int db_del_forbidden_nick(sqlite3 *db, const char *nickname) {
  static sqlite3_stmt *stmt;
  static const char query[] = "DELETE FROM forbidden_nick WHERE nickname = ?;";
  int ret;
  do {
    if (db == NULL) {
      if (stmt != NULL) {
        sqlite3_finalize(stmt);
        stmt = NULL;
      }
      return 0;
    }
  } while (0);
  do {
    if (stmt == NULL) {
      ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
      assert(ret == SQLITE_OK);
    }
  } while (0);
  sqlite3_reset(stmt);
  ret = sqlite3_bind_text(stmt, 1, nickname, -1, SQLITE_STATIC);
  assert(ret == SQLITE_OK);
  return (sqlite3_step(stmt) != SQLITE_DONE);
}


x86 assembly (clang, -O0):
<db_del_forbidden_nick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11bc <db_del_forbidden_nick+0x4c>
cmpq   $0x0,0x2ecd(%rip)
je     11b0 <db_del_forbidden_nick+0x40>
mov    0x2ec0(%rip),%rdi
call   1080 <sqlite3_finalize@plt>
movq   $0x0,0x2eb0(%rip)
movl   $0x0,-0x4(%rbp)
jmp    1294 <db_del_forbidden_nick+0x124>
jmp    11c1 <db_del_forbidden_nick+0x51>
jmp    11c6 <db_del_forbidden_nick+0x56>
cmpq   $0x0,0x2e92(%rip)
jne    1222 <db_del_forbidden_nick+0xb2>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xe1d(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe0b(%rip),%rsi
lea    0x2e64(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1090 <sqlite3_prepare_v2@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2dd5(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
jmp    1227 <db_del_forbidden_nick+0xb7>
mov    0x2e32(%rip),%rdi
call   1030 <sqlite3_reset@plt>
mov    0x2e26(%rip),%rdi
mov    -0x18(%rbp),%rdx
mov    0x2d93(%rip),%rax
mov    (%rax),%r8d
mov    $0x1,%esi
mov    $0xffffffff,%ecx
call   1070 <sqlite3_bind_text@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2d84(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2de6(%rip),%rdi
call   1060 <sqlite3_step@plt>
mov    0x2d4a(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_del_forbidden_nick>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2ee1(%rip),%rdi
test   %rbx,%rbx
je     122a <db_del_forbidden_nick+0xba>
mov    %rsi,%r14
test   %rdi,%rdi
jne    11d1 <db_del_forbidden_nick+0x61>
lea    0xe69(%rip),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0x2eba(%rip),%rcx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %r8d,%r8d
call   1090 <sqlite3_prepare_v2@plt>
mov    0x2e2b(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%eax
sete   %dil
call   1050 <assert@plt>
mov    0x2e8f(%rip),%rdi
call   1030 <sqlite3_reset@plt>
mov    0x2e83(%rip),%rdi
mov    0x2df4(%rip),%rax
mov    (%rax),%r8d
mov    $0x1,%esi
mov    %r14,%rdx
mov    $0xffffffff,%ecx
call   1070 <sqlite3_bind_text@plt>
mov    0x2de8(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%eax
sete   %dil
call   1050 <assert@plt>
mov    0x2e4c(%rip),%rdi
call   1060 <sqlite3_step@plt>
mov    0x2db0(%rip),%rcx
xor    %ebx,%ebx
cmp    (%rcx),%rax
setne  %bl
jmp    1241 <db_del_forbidden_nick+0xd1>
xor    %ebx,%ebx
test   %rdi,%rdi
je     1241 <db_del_forbidden_nick+0xd1>
call   1080 <sqlite3_finalize@plt>
movq   $0x0,0x2e1f(%rip)
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@db_del_forbidden_nick.stmt = internal global i32* null
@db_del_forbidden_nick.query = internal constant [47 x i8] c"DELETE FROM forbidden_nick WHERE nickname = ?;\00"
@SQLITE_OK = global i32 0
@SQLITE_STATIC = global i32 0
@SQLITE_DONE = global i64 0
define i32 @db_del_forbidden_nick(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
br label %7
7: ; preds = %2
%8 = load i32*, i32** %4
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32*, i32** @db_del_forbidden_nick.stmt
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32*, i32** @db_del_forbidden_nick.stmt
%15 = call i32 @sqlite3_finalize(i32* %14)
store i32* null, i32** @db_del_forbidden_nick.stmt
br label %16
16: ; preds = %13, %10
store i32 0, i32* %3
br label %49
17: ; preds = %7
br label %18
18: ; preds = %17
br label %19
19: ; preds = %18
%20 = load i32*, i32** @db_del_forbidden_nick.stmt
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %31
22: ; preds = %19
%23 = load i32*, i32** %4
%24 = call i32 @strlen(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @db_del_forbidden_nick.query, i64 0, i64 0))
%25 = call i32 @sqlite3_prepare_v2(i32* %23, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @db_del_forbidden_nick.query, i64 0, i64 0), i32 %24, i32** @db_del_forbidden_nick.stmt, i32* null)
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = load i32, i32* @SQLITE_OK
%28 = icmp eq i32 %26, %27
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
br label %31
31: ; preds = %22, %19
br label %32
32: ; preds = %31
%33 = load i32*, i32** @db_del_forbidden_nick.stmt
%34 = call i32 @sqlite3_reset(i32* %33)
%35 = load i32*, i32** @db_del_forbidden_nick.stmt
%36 = load i8*, i8** %5
%37 = load i32, i32* @SQLITE_STATIC
%38 = call i32 @sqlite3_bind_text(i32* %35, i32 1, i8* %36, i32 -1, i32 %37)
store i32 %38, i32* %6
%39 = load i32, i32* %6
%40 = load i32, i32* @SQLITE_OK
%41 = icmp eq i32 %39, %40
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = load i32*, i32** @db_del_forbidden_nick.stmt
%45 = call i64 @sqlite3_step(i32* %44)
%46 = load i64, i64* @SQLITE_DONE
%47 = icmp ne i64 %45, %46
%48 = zext i1 %47 to i32
store i32 %48, i32* %3
br label %49
49: ; preds = %32, %16
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@db_del_forbidden_nick.stmt = internal global i32* null
@db_del_forbidden_nick.query = internal constant [47 x i8] c"DELETE FROM forbidden_nick WHERE nickname = ?;\00"
@SQLITE_OK = global i32 0
@SQLITE_STATIC = global i32 0
@SQLITE_DONE = global i64 0
define i32 @db_del_forbidden_nick(i32* %0, i8* %1) {
%3 = icmp eq i32* %0, null
%4 = load i32*, i32** @db_del_forbidden_nick.stmt
%5 = icmp eq i32* %4, null
br i1 %3, label %6, label %9
6: ; preds = %2
br i1 %5, label %33, label %7
7: ; preds = %6
%8 = tail call i32 @sqlite3_finalize(i32* %4)
store i32* null, i32** @db_del_forbidden_nick.stmt
br label %33
9: ; preds = %2
br i1 %5, label %10, label %18
10: ; preds = %9
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @db_del_forbidden_nick.query, i64 0, i64 0))
%12 = tail call i32 @sqlite3_prepare_v2(i32* %0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @db_del_forbidden_nick.query, i64 0, i64 0), i32 %11, i32** @db_del_forbidden_nick.stmt, i32* null)
%13 = load i32, i32* @SQLITE_OK
%14 = icmp eq i32 %12, %13
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = load i32*, i32** @db_del_forbidden_nick.stmt
br label %18
18: ; preds = %10, %9
%19 = phi i32* [ %17, %10 ], [ %4, %9 ]
%20 = tail call i32 @sqlite3_reset(i32* %19)
%21 = load i32*, i32** @db_del_forbidden_nick.stmt
%22 = load i32, i32* @SQLITE_STATIC
%23 = tail call i32 @sqlite3_bind_text(i32* %21, i32 1, i8* %1, i32 -1, i32 %22)
%24 = load i32, i32* @SQLITE_OK
%25 = icmp eq i32 %23, %24
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
%28 = load i32*, i32** @db_del_forbidden_nick.stmt
%29 = tail call i64 @sqlite3_step(i32* %28)
%30 = load i64, i64* @SQLITE_DONE
%31 = icmp ne i64 %29, %30
%32 = zext i1 %31 to i32
br label %33
33: ; preds = %6, %7, %18
%34 = phi i32 [ %32, %18 ], [ 0, %7 ], [ 0, %6 ]
ret i32 %34
}