#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_permission(int /*<<< orphan*/ *, char *, char *);
int sqlite_delete_permissions(int /*<<< orphan*/ *, char *);
int mode_revoke(sqlite3 *db, int argc, char **argv) {
  int status = 0;
  if (argc < 2) {
    logprintf(0, "Not enough arguments for revoke\n\n");
    return 20;
  } else if (argc > 2) {
    int i;
    for (i = 2; i < argc; i++) {
      if (!status) {
        status = sqlite_delete_permission(db, argv[1], argv[i]);
      }
    }
  } else {
    status = sqlite_delete_permissions(db, argv[1]);
  }
  return status;
}


x86 assembly (clang, -O0):
<mode_revoke>:
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   $0x2,-0x14(%rbp)
jge    116e <mode_revoke+0x3e>
xor    %edi,%edi
lea    0xea3(%rip),%rsi
call   1050 <logprintf@plt>
movl   $0x14,-0x4(%rbp)
jmp    11ec <mode_revoke+0xbc>
cmpl   $0x2,-0x14(%rbp)
jle    11cd <mode_revoke+0x9d>
movl   $0x2,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c8 <mode_revoke+0x98>
cmpl   $0x0,-0x24(%rbp)
jne    11b5 <mode_revoke+0x85>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1040 <sqlite_delete_permission@plt>
mov    %eax,-0x24(%rbp)
jmp    11ba <mode_revoke+0x8a>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    117f <mode_revoke+0x4f>
jmp    11e1 <mode_revoke+0xb1>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <sqlite_delete_permissions@plt>
mov    %eax,-0x24(%rbp)
jmp    11e6 <mode_revoke+0xb6>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_revoke>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%esi
jg     115c <mode_revoke+0x2c>
lea    0xebc(%rip),%rsi
xor    %edi,%edi
call   1050 <logprintf@plt>
mov    $0x14,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rdx,%r15
mov    %rdi,%r14
cmp    $0x2,%esi
jne    117e <mode_revoke+0x4e>
mov    0x8(%r15),%rsi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <sqlite_delete_permissions@plt>
mov    %esi,%r12d
xor    %eax,%eax
mov    $0x2,%ebx
jmp    1199 <mode_revoke+0x69>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1150 <mode_revoke+0x20>
test   %eax,%eax
jne    1190 <mode_revoke+0x60>
mov    0x8(%r15),%rsi
mov    (%r15,%rbx,8),%rdx
mov    %r14,%rdi
call   1040 <sqlite_delete_permission@plt>
jmp    1190 <mode_revoke+0x60>

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

LLVM IR (-O2):
@.str = [34 x i8] c"Not enough arguments for revoke\0A\0A\00"
define i32 @mode_revoke(i32* %0, i32 %1, i8** nocapture %2) {
%4 = icmp slt i32 %1, 2
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @logprintf(i32 0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %28
7: ; preds = %3
%8 = icmp eq i32 %1, 2
%9 = getelementptr inbounds i8*, i8** %2, i64 1
br i1 %8, label %25, label %10
10: ; preds = %7
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %10, %21
%13 = phi i64 [ 2, %10 ], [ %23, %21 ]
%14 = phi i32 [ 0, %10 ], [ %22, %21 ]
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8*, i8** %9
%18 = getelementptr inbounds i8*, i8** %2, i64 %13
%19 = load i8*, i8** %18
%20 = tail call i32 @sqlite_delete_permission(i32* %0, i8* %17, i8* %19)
br label %21
21: ; preds = %12, %16
%22 = phi i32 [ %14, %12 ], [ %20, %16 ]
%23 = add nuw nsw i64 %13, 1
%24 = icmp eq i64 %23, %11
br i1 %24, label %28, label %12
25: ; preds = %7
%26 = load i8*, i8** %9
%27 = tail call i32 @sqlite_delete_permissions(i32* %0, i8* %26)
br label %28
28: ; preds = %21, %25, %5
%29 = phi i32 [ 20, %5 ], [ %27, %25 ], [ %22, %21 ]
ret i32 %29
}