#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 */
int /*<<< orphan*/ logprintf(int /*<<< orphan*/, char *, ...);
int sqlite_delete_address_delegation(int /*<<< orphan*/ *, char *, char *);
int sqlite_delete_user_delegation(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int mode_delete(sqlite3 *db, int argc, char **argv) {
  int status = 0;
  if (argc < 4) {
    logprintf(0, "Not enough arguments for delete\n\n");
    return 20;
  }
  if (!strcmp(argv[1], "expression")) {
    status = sqlite_delete_address_delegation(db, argv[2], argv[3]);
  } else if (!strcmp(argv[1], "user")) {
    status = sqlite_delete_user_delegation(db, argv[2], argv[3]);
  } else {
    logprintf(0, "Mode %s not recognised\n\n", argv[1]);
    return 120;
  }
  return status;
}


x86 assembly (clang, -O0):
<mode_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1180 <mode_delete+0x40>
xor    %edi,%edi
lea    0xe93(%rip),%rsi
mov    $0x0,%al
call   1060 <logprintf@plt>
movl   $0x14,-0x4(%rbp)
jmp    122b <mode_delete+0xeb>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe93(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11be <mode_delete+0x7e>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rdx
call   1050 <sqlite_delete_address_delegation@plt>
mov    %eax,-0x24(%rbp)
jmp    1225 <mode_delete+0xe5>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe60(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11fc <mode_delete+0xbc>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x20(%rbp),%rax
mov    0x18(%rax),%rdx
call   1030 <sqlite_delete_user_delegation@plt>
mov    %eax,-0x24(%rbp)
jmp    1220 <mode_delete+0xe0>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdx
xor    %edi,%edi
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1060 <logprintf@plt>
movl   $0x78,-0x4(%rbp)
jmp    122b <mode_delete+0xeb>
jmp    1225 <mode_delete+0xe5>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_delete>:
push   %r15
push   %r14
push   %rbx
cmp    $0x3,%esi
jg     1161 <mode_delete+0x21>
lea    0xeaf(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
call   1060 <logprintf@plt>
mov    $0x14,%eax
jmp    11a9 <mode_delete+0x69>
mov    %rdx,%rbx
mov    %rdi,%r14
mov    0x8(%rdx),%r15
lea    0xeb0(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11af <mode_delete+0x6f>
lea    0xea8(%rip),%rsi
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11c4 <mode_delete+0x84>
lea    0xe9a(%rip),%rsi
xor    %edi,%edi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <logprintf@plt>
mov    $0x78,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x10(%rbx),%rsi
mov    0x18(%rbx),%rdx
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <sqlite_delete_address_delegation@plt>
mov    0x10(%rbx),%rsi
mov    0x18(%rbx),%rdx
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <sqlite_delete_user_delegation@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Not enough arguments for delete\0A\0A\00"
@.str.1 = [11 x i8] c"expression\00"
@.str.2 = [5 x i8] c"user\00"
@.str.3 = [25 x i8] c"Mode %s not recognised\0A\0A\00"
define i32 @mode_delete(i32* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i32 0, i32* %8
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 (i32, i8*, ...) @logprintf(i32 0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 20, i32* %4
br label %51
13: ; preds = %3
%14 = load i8**, i8*** %7
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %28, label %19
19: ; preds = %13
%20 = load i32*, i32** %5
%21 = load i8**, i8*** %7
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %7
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @sqlite_delete_address_delegation(i32* %20, i8* %23, i8* %26)
store i32 %27, i32* %8
br label %49
28: ; preds = %13
%29 = load i8**, i8*** %7
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %43, label %34
34: ; preds = %28
%35 = load i32*, i32** %5
%36 = load i8**, i8*** %7
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = load i8**, i8*** %7
%40 = getelementptr inbounds i8*, i8** %39, i64 3
%41 = load i8*, i8** %40
%42 = call i32 @sqlite_delete_user_delegation(i32* %35, i8* %38, i8* %41)
store i32 %42, i32* %8
br label %48
43: ; preds = %28
%44 = load i8**, i8*** %7
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 (i32, i8*, ...) @logprintf(i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %46)
store i32 120, i32* %4
br label %51
48: ; preds = %34
br label %49
49: ; preds = %48, %19
%50 = load i32, i32* %8
store i32 %50, i32* %4
br label %51
51: ; preds = %49, %43, %11
%52 = load i32, i32* %4
ret i32 %52
}

LLVM IR (-O2):
@.str = [34 x i8] c"Not enough arguments for delete\0A\0A\00"
@.str.1 = [11 x i8] c"expression\00"
@.str.2 = [5 x i8] c"user\00"
@.str.3 = [25 x i8] c"Mode %s not recognised\0A\0A\00"
define i32 @mode_delete(i32* %0, i32 %1, i8** nocapture %2) {
%4 = icmp slt i32 %1, 4
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (i32, i8*, ...) @logprintf(i32 0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %29
7: ; preds = %3
%8 = getelementptr inbounds i8*, i8** %2, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = getelementptr inbounds i8*, i8** %2, i64 2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %2, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @sqlite_delete_address_delegation(i32* %0, i8* %14, i8* %16)
br label %29
18: ; preds = %7
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = getelementptr inbounds i8*, i8** %2, i64 2
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %2, i64 3
%25 = load i8*, i8** %24
%26 = tail call i32 @sqlite_delete_user_delegation(i32* %0, i8* %23, i8* %25)
br label %29
27: ; preds = %18
%28 = tail call i32 (i32, i8*, ...) @logprintf(i32 0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %9)
br label %29
29: ; preds = %12, %21, %27, %5
%30 = phi i32 [ 20, %5 ], [ 120, %27 ], [ %26, %21 ], [ %17, %12 ]
ret i32 %30
}