#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, int *);
int main(int argc, char *argv[]) {
  unsigned char realAccess = 0;
  int access = 0;
  printf("Please select the privleges you'd like to have:");
  if (scanf("%d", &access)) {
    if (access > 32) {
      printf(
          "Invalid access!  You must be root to have access above level 32!");
    } else {
      realAccess += access;
      if (realAccess > 32) {
        printf("Permissions bypassed!  The flag is ...");
      } else {
        printf("Permissions set!");
      }
    }
  } else {
    printf("Invalid access specified!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     11c2 <main+0xa2>
cmpl   $0x20,-0x18(%rbp)
jle    1182 <main+0x62>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
jmp    11bd <main+0x9d>
mov    -0x18(%rbp),%ecx
movzbl -0x11(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jle    11ac <main+0x8c>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
jmp    11b8 <main+0x98>
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
jmp    11bd <main+0x9d>
jmp    11ce <main+0xae>
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     115d <main+0x3d>
mov    0x4(%rsp),%eax
cmp    $0x20,%eax
jle    1166 <main+0x46>
lea    0xed8(%rip),%rdi
jmp    117e <main+0x5e>
lea    0xf48(%rip),%rdi
jmp    117e <main+0x5e>
movzbl %al,%eax
cmp    $0x21,%eax
lea    0xf01(%rip),%rax
lea    0xf21(%rip),%rdi
cmovae %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Please select the privleges you'd like to have:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [65 x i8] c"Invalid access! You must be root to have access above level 32!\00"
@.str.3 = [39 x i8] c"Permissions bypassed! The flag is ...\00"
@.str.4 = [17 x i8] c"Permissions set!\00"
@.str.5 = [26 x i8] c"Invalid access specified!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 0, i8* %6
store i32 0, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%9 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %2
%12 = load i32, i32* %7
%13 = icmp sgt i32 %12, 32
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
br label %30
16: ; preds = %11
%17 = load i32, i32* %7
%18 = load i8, i8* %6
%19 = zext i8 %18 to i32
%20 = add nsw i32 %19, %17
%21 = trunc i32 %20 to i8
store i8 %21, i8* %6
%22 = load i8, i8* %6
%23 = zext i8 %22 to i32
%24 = icmp sgt i32 %23, 32
br i1 %24, label %25, label %27
25: ; preds = %16
%26 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
br label %29
27: ; preds = %16
%28 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
br label %30
30: ; preds = %29, %14
br label %33
31: ; preds = %2
%32 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %33
33: ; preds = %31, %30
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"Please select the privleges you'd like to have:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [65 x i8] c"Invalid access! You must be root to have access above level 32!\00"
@.str.3 = [39 x i8] c"Permissions bypassed! The flag is ...\00"
@.str.4 = [17 x i8] c"Permissions set!\00"
@.str.5 = [26 x i8] c"Invalid access specified!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %2
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 32
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = and i32 %9, 255
%13 = icmp ugt i32 %12, 32
%14 = select i1 %13, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0)
br label %15
15: ; preds = %2, %11, %8
%16 = phi i8* [ getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), %8 ], [ %14, %11 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), %2 ]
%17 = call i32 @printf(i8* dereferenceable(1) %16)
ret i32 0
}