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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_ace_type(uint8_t acetype, int raw) {
  if (raw) {
    printf("0x%x", acetype);
    return;
  }
  switch (acetype) {
  case 0:
    printf("ALLOWED");
    break;
  case 1:
    printf("DENIED");
    break;
  case 5:
    printf("OBJECT_ALLOWED");
    break;
  case 6:
    printf("OBJECT_DENIED");
    break;
  default:
    printf("UNKNOWN");
    break;
  }
}


x86 assembly (clang, -O0):
<print_ace_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113e <print_ace_type+0x2e>
mov    -0x4(%rbp),%esi
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <print_ace_type+0xad>
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x6,%rax
ja     11af <print_ace_type+0x9f>
mov    -0x10(%rbp),%rax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <print_ace_type+0xad>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <print_ace_type+0xad>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <print_ace_type+0xad>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bd <print_ace_type+0xad>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ace_type>:
mov    %edi,%eax
test   %esi,%esi
je     1126 <print_ace_type+0x16>
lea    0xeff(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
jmp    1030 <printf@plt>
cmp    $0x6,%eax
ja     1159 <print_ace_type+0x49>
mov    %eax,%eax
lea    0xecc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xee4(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xee5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xede(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"0x%x\00"
@.str.1 = [8 x i8] c"ALLOWED\00"
@.str.2 = [7 x i8] c"DENIED\00"
@.str.3 = [15 x i8] c"OBJECT_ALLOWED\00"
@.str.4 = [14 x i8] c"OBJECT_DENIED\00"
@.str.5 = [8 x i8] c"UNKNOWN\00"
define void @print_ace_type(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %22
10: ; preds = %2
%11 = load i32, i32* %3
switch i32 %11, label %20 [
i32 0, label %12
i32 1, label %14
i32 5, label %16
i32 6, label %18
]
12: ; preds = %10
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %22
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %22
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %22
18: ; preds = %10
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %22
20: ; preds = %10
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %22
22: ; preds = %7, %20, %18, %16, %14, %12
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"0x%x\00"
@.str.1 = [8 x i8] c"ALLOWED\00"
@.str.2 = [7 x i8] c"DENIED\00"
@.str.3 = [15 x i8] c"OBJECT_ALLOWED\00"
@.str.4 = [14 x i8] c"OBJECT_DENIED\00"
@.str.5 = [8 x i8] c"UNKNOWN\00"
define void @print_ace_type(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %17
6: ; preds = %2
switch i32 %0, label %15 [
i32 0, label %7
i32 1, label %9
i32 5, label %11
i32 6, label %13
]
7: ; preds = %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %17
9: ; preds = %6
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %17
11: ; preds = %6
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %17
13: ; preds = %6
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %17
15: ; preds = %6
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %17
17: ; preds = %4, %15, %13, %11, %9, %7
ret void
}