#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_flags(uint8_t flags, int raw) {
  bool mflags = false;
  if (raw) {
    printf("0x%x", flags);
    return;
  }
  if (flags & 0x01) {
    if (mflags)
      printf("|");
    else
      mflags = true;
    printf("OI");
  }
  if (flags & 0x02) {
    if (mflags)
      printf("|");
    else
      mflags = true;
    printf("CI");
  }
  if (flags & 0x04) {
    if (mflags)
      printf("|");
    else
      mflags = true;
    printf("NP");
  }
  if (flags & 0x08) {
    if (mflags)
      printf("|");
    else
      mflags = true;
    printf("IO");
  }
  if (flags & 0x10) {
    if (mflags)
      printf("|");
    else
      mflags = true;
    printf("I");
  }
  if (!mflags)
    printf("0x0");
}


x86 assembly (clang, -O0):
<print_ace_flags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1145 <print_ace_flags+0x35>
mov    -0x4(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a2 <print_ace_flags+0x192>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1186 <print_ace_flags+0x76>
cmpl   $0x0,-0xc(%rbp)
je     1171 <print_ace_flags+0x61>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1178 <print_ace_flags+0x68>
movl   $0x1,-0xc(%rbp)
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11c7 <print_ace_flags+0xb7>
cmpl   $0x0,-0xc(%rbp)
je     11b2 <print_ace_flags+0xa2>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b9 <print_ace_flags+0xa9>
movl   $0x1,-0xc(%rbp)
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1208 <print_ace_flags+0xf8>
cmpl   $0x0,-0xc(%rbp)
je     11f3 <print_ace_flags+0xe3>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fa <print_ace_flags+0xea>
movl   $0x1,-0xc(%rbp)
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1249 <print_ace_flags+0x139>
cmpl   $0x0,-0xc(%rbp)
je     1234 <print_ace_flags+0x124>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123b <print_ace_flags+0x12b>
movl   $0x1,-0xc(%rbp)
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     128a <print_ace_flags+0x17a>
cmpl   $0x0,-0xc(%rbp)
je     1275 <print_ace_flags+0x165>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127c <print_ace_flags+0x16c>
movl   $0x1,-0xc(%rbp)
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    12a2 <print_ace_flags+0x192>
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ace_flags>:
push   %rbx
mov    %edi,%ebx
test   %esi,%esi
je     1138 <print_ace_flags+0x18>
lea    0xed2(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
test   $0x1,%bl
jne    1168 <print_ace_flags+0x48>
test   $0x2,%bl
jne    1196 <print_ace_flags+0x76>
test   $0x4,%bl
jne    11b3 <print_ace_flags+0x93>
test   $0x8,%bl
jne    11d0 <print_ace_flags+0xb0>
test   $0x10,%bl
jne    11ed <print_ace_flags+0xcd>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x2,%bl
jne    118c <print_ace_flags+0x6c>
test   $0x4,%bl
jne    11a9 <print_ace_flags+0x89>
test   $0x8,%bl
jne    11c6 <print_ace_flags+0xa6>
test   $0x10,%bl
jne    11e3 <print_ace_flags+0xc3>
pop    %rbx
ret
mov    $0x7c,%edi
call   1030 <putchar@plt>
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x4,%bl
je     1180 <print_ace_flags+0x60>
mov    $0x7c,%edi
call   1030 <putchar@plt>
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x8,%bl
je     1185 <print_ace_flags+0x65>
mov    $0x7c,%edi
call   1030 <putchar@plt>
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x10,%bl
je     118a <print_ace_flags+0x6a>
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    $0x49,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"0x%x\00"
@.str.1 = [2 x i8] c"|\00"
@.str.2 = [3 x i8] c"OI\00"
@.str.3 = [3 x i8] c"CI\00"
@.str.4 = [3 x i8] c"NP\00"
@.str.5 = [3 x i8] c"IO\00"
@.str.6 = [2 x i8] c"I\00"
@.str.7 = [4 x i8] c"0x0\00"
define void @print_ace_flags(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %76
11: ; preds = %2
%12 = load i32, i32* %3
%13 = and i32 %12, 1
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i32, i32* %5
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %21
20: ; preds = %15
store i32 1, i32* %5
br label %21
21: ; preds = %20, %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %11
%24 = load i32, i32* %3
%25 = and i32 %24, 2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %23
%28 = load i32, i32* %5
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %33
32: ; preds = %27
store i32 1, i32* %5
br label %33
33: ; preds = %32, %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %33, %23
%36 = load i32, i32* %3
%37 = and i32 %36, 4
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %47
39: ; preds = %35
%40 = load i32, i32* %5
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %45
44: ; preds = %39
store i32 1, i32* %5
br label %45
45: ; preds = %44, %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %47
47: ; preds = %45, %35
%48 = load i32, i32* %3
%49 = and i32 %48, 8
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %59
51: ; preds = %47
%52 = load i32, i32* %5
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %57
56: ; preds = %51
store i32 1, i32* %5
br label %57
57: ; preds = %56, %54
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %59
59: ; preds = %57, %47
%60 = load i32, i32* %3
%61 = and i32 %60, 16
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %71
63: ; preds = %59
%64 = load i32, i32* %5
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %69
68: ; preds = %63
store i32 1, i32* %5
br label %69
69: ; preds = %68, %66
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %71
71: ; preds = %69, %59
%72 = load i32, i32* %5
%73 = icmp ne i32 %72, 0
br i1 %73, label %76, label %74
74: ; preds = %71
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %76
76: ; preds = %8, %74, %71
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"0x%x\00"
@.str.2 = [3 x i8] c"OI\00"
@.str.3 = [3 x i8] c"CI\00"
@.str.4 = [3 x i8] c"NP\00"
@.str.5 = [3 x i8] c"IO\00"
@.str.7 = [4 x i8] c"0x0\00"
define void @print_ace_flags(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 %52
6: ; preds = %2
%7 = and i32 %0, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = and i32 %0, 2
%11 = icmp eq i32 %10, 0
br i1 %11, label %23, label %18
12: ; preds = %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%14 = and i32 %0, 2
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = tail call i32 @putchar(i32 124)
br label %18
18: ; preds = %9, %16
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %12, %18
%21 = and i32 %0, 4
%22 = icmp eq i32 %21, 0
br i1 %22, label %30, label %26
23: ; preds = %9
%24 = and i32 %0, 4
%25 = icmp eq i32 %24, 0
br i1 %25, label %33, label %28
26: ; preds = %20
%27 = tail call i32 @putchar(i32 124)
br label %28
28: ; preds = %23, %26
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %20
%31 = and i32 %0, 8
%32 = icmp eq i32 %31, 0
br i1 %32, label %40, label %36
33: ; preds = %23
%34 = and i32 %0, 8
%35 = icmp eq i32 %34, 0
br i1 %35, label %43, label %38
36: ; preds = %30
%37 = tail call i32 @putchar(i32 124)
br label %38
38: ; preds = %33, %36
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %40
40: ; preds = %38, %30
%41 = and i32 %0, 16
%42 = icmp eq i32 %41, 0
br i1 %42, label %52, label %46
43: ; preds = %33
%44 = and i32 %0, 16
%45 = icmp eq i32 %44, 0
br i1 %45, label %50, label %48
46: ; preds = %40
%47 = tail call i32 @putchar(i32 124)
br label %48
48: ; preds = %43, %46
%49 = tail call i32 @putchar(i32 73)
br label %52
50: ; preds = %43
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %52
52: ; preds = %40, %48, %50, %4
ret void
}