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

/* Variables and functions */
scalar_t__ doesUserExist(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ listUsers(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ removeUser(int /*<<< orphan*/ *, char *);
char *stringInput(int /*<<< orphan*/);
void removeUserFunction(sqlite3 *db) {
  char *usernameToBeRemoved;
  printf("\nList of users:\n");
  listUsers(db);
  printf("User to remove: ");
  usernameToBeRemoved = stringInput(0);
  if (doesUserExist(db, usernameToBeRemoved)) {
    removeUser(db, usernameToBeRemoved);
    printf("%s has been removed from the database.\n", usernameToBeRemoved);
  } else {
    puts("This user does not exist. Please try again.");
  }
  free(usernameToBeRemoved);
}


x86 assembly (clang, -O0):
<removeUserFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1090 <listUsers@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %edi,%edi
call   1060 <stringInput@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <doesUserExist@plt>
cmp    $0x0,%rax
je     11e7 <removeUserFunction+0x77>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <removeUser@plt>
mov    -0x10(%rbp),%rsi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    11f3 <removeUserFunction+0x83>
lea    0xe5c(%rip),%rdi
call   1050 <puts@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeUserFunction>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xee7(%rip),%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   1090 <listUsers@plt>
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   1060 <stringInput@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <doesUserExist@plt>
test   %rax,%rax
je     11d1 <removeUserFunction+0x61>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <removeUser@plt>
lea    0xe4c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    11dd <removeUserFunction+0x6d>
lea    0xe61(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"\0AList of users:\0A\00"
@.str.1 = [17 x i8] c"User to remove: \00"
@.str.2 = [40 x i8] c"%s has been removed from the database.\0A\00"
@.str.3 = [44 x i8] c"This user does not exist. Please try again.\00"
define void @removeUserFunction(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @listUsers(i32* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%8 = call i8* @stringInput(i32 0)
store i8* %8, i8** %3
%9 = load i32*, i32** %2
%10 = load i8*, i8** %3
%11 = call i64 @doesUserExist(i32* %9, i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %1
%14 = load i32*, i32** %2
%15 = load i8*, i8** %3
%16 = call i32 @removeUser(i32* %14, i8* %15)
%17 = load i8*, i8** %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %21
19: ; preds = %1
%20 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %19, %13
%22 = load i8*, i8** %3
%23 = call i32 @free(i8* %22)
ret void
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"User to remove: \00"
@.str.2 = [40 x i8] c"%s has been removed from the database.\0A\00"
@.str.3 = [44 x i8] c"This user does not exist. Please try again.\00"
@str = [16 x i8] c"\0AList of users:\00"
define void @removeUserFunction(i32* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @listUsers(i32* %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i8* @stringInput(i32 0)
%6 = tail call i64 @doesUserExist(i32* %0, i8* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = tail call i32 @removeUser(i32* %0, i8* %5)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %5)
br label %13
11: ; preds = %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = tail call i32 @free(i8* %5)
ret void
}