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

/* Variables and functions */
int FAN_ACCESS;
int FAN_CLOSE_NOWRITE;
int FAN_CLOSE_WRITE;
int FAN_MODIFY;
int FAN_ONDIR;
int FAN_OPEN;
const char *mask2str(uint64_t mask) {
  static char buffer[10];
  int offset = 0;
  if (mask & FAN_ACCESS)
    buffer[offset++] = 'R';
  if (mask & FAN_ONDIR)
    buffer[offset++] = 'D';
  if (mask & FAN_OPEN)
    buffer[offset++] = 'O';
  if (mask & FAN_CLOSE_WRITE || mask & FAN_CLOSE_NOWRITE)
    buffer[offset++] = 'C';
  if (mask & FAN_MODIFY || mask & FAN_CLOSE_WRITE)
    buffer[offset++] = 'W';
  buffer[offset] = '\0';
  return buffer;
}


x86 assembly (clang, -O0):
<mask2str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb8(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     113c <mask2str+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2eec(%rip),%rax
movb   $0x52,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    0x2e9a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     116a <mask2str+0x6a>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2ebe(%rip),%rax
movb   $0x44,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    0x2e44(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1198 <mask2str+0x98>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2e90(%rip),%rax
movb   $0x4f,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    0x2e36(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    11c2 <mask2str+0xc2>
mov    -0x4(%rbp),%eax
mov    0x2e11(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11db <mask2str+0xdb>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2e4d(%rip),%rax
movb   $0x43,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    0x2e03(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1205 <mask2str+0x105>
mov    -0x4(%rbp),%eax
mov    0x2dde(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     121e <mask2str+0x11e>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2e0a(%rip),%rax
movb   $0x57,(%rax,%rcx,1)
movslq -0x8(%rbp),%rcx
lea    0x2dfb(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2df0(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mask2str>:
mov    0x2ec9(%rip),%rax
test   %edi,(%rax)
je     1119 <mask2str+0x19>
movb   $0x52,0x2f12(%rip)
mov    $0x1,%eax
jmp    111b <mask2str+0x1b>
xor    %eax,%eax
mov    0x2ebe(%rip),%rcx
test   %edi,(%rcx)
je     1136 <mask2str+0x36>
mov    %eax,%ecx
add    $0x1,%eax
lea    0x2ef2(%rip),%rdx
movb   $0x44,(%rcx,%rdx,1)
mov    0x2e7b(%rip),%rcx
test   %edi,(%rcx)
je     1151 <mask2str+0x51>
mov    %eax,%ecx
add    $0x1,%eax
lea    0x2ed7(%rip),%rdx
movb   $0x4f,(%rcx,%rdx,1)
mov    0x2e80(%rip),%rcx
test   %edi,(%rcx)
je     116e <mask2str+0x6e>
mov    %eax,%ecx
add    $0x1,%eax
lea    0x2ebc(%rip),%rdx
movb   $0x43,(%rcx,%rdx,1)
jmp    1194 <mask2str+0x94>
mov    0x2e53(%rip),%rcx
test   %edi,(%rcx)
je     1189 <mask2str+0x89>
mov    %eax,%ecx
add    $0x1,%eax
lea    0x2e9f(%rip),%rdx
movb   $0x43,(%rcx,%rdx,1)
mov    0x2e58(%rip),%rcx
test   %edi,(%rcx)
je     11a4 <mask2str+0xa4>
mov    %eax,%ecx
add    $0x1,%eax
lea    0x2e84(%rip),%rdx
movb   $0x57,(%rcx,%rdx,1)
mov    %eax,%ecx
lea    0x2e77(%rip),%rax
movb   $0x0,(%rcx,%rax,1)
ret

LLVM IR (-O0):
@mask2str.buffer = internal global [10 x i8] zeroinitializer
@FAN_ACCESS = global i32 0
@FAN_ONDIR = global i32 0
@FAN_OPEN = global i32 0
@FAN_CLOSE_WRITE = global i32 0
@FAN_CLOSE_NOWRITE = global i32 0
@FAN_MODIFY = global i32 0
define i8* @mask2str(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @FAN_ACCESS
%6 = and i32 %4, %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %11
store i8 82, i8* %12
br label %13
13: ; preds = %8, %1
%14 = load i32, i32* %2
%15 = load i32, i32* @FAN_ONDIR
%16 = and i32 %14, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %21
store i8 68, i8* %22
br label %23
23: ; preds = %18, %13
%24 = load i32, i32* %2
%25 = load i32, i32* @FAN_OPEN
%26 = and i32 %24, %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %31
store i8 79, i8* %32
br label %33
33: ; preds = %28, %23
%34 = load i32, i32* %2
%35 = load i32, i32* @FAN_CLOSE_WRITE
%36 = and i32 %34, %35
%37 = icmp ne i32 %36, 0
br i1 %37, label %43, label %38
38: ; preds = %33
%39 = load i32, i32* %2
%40 = load i32, i32* @FAN_CLOSE_NOWRITE
%41 = and i32 %39, %40
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %38, %33
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
%46 = sext i32 %44 to i64
%47 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %46
store i8 67, i8* %47
br label %48
48: ; preds = %43, %38
%49 = load i32, i32* %2
%50 = load i32, i32* @FAN_MODIFY
%51 = and i32 %49, %50
%52 = icmp ne i32 %51, 0
br i1 %52, label %58, label %53
53: ; preds = %48
%54 = load i32, i32* %2
%55 = load i32, i32* @FAN_CLOSE_WRITE
%56 = and i32 %54, %55
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %53, %48
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
%61 = sext i32 %59 to i64
%62 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %61
store i8 87, i8* %62
br label %63
63: ; preds = %58, %53
%64 = load i32, i32* %3
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %65
store i8 0, i8* %66
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 0)
}

LLVM IR (-O2):
@mask2str.buffer = internal global [10 x i8] zeroinitializer
@FAN_ACCESS = global i32 0
@FAN_ONDIR = global i32 0
@FAN_OPEN = global i32 0
@FAN_CLOSE_WRITE = global i32 0
@FAN_CLOSE_NOWRITE = global i32 0
@FAN_MODIFY = global i32 0
define i8* @mask2str(i32 %0) {
%2 = load i32, i32* @FAN_ACCESS
%3 = and i32 %2, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %1
store i8 82, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 0)
br label %6
6: ; preds = %5, %1
%7 = phi i32 [ 1, %5 ], [ 0, %1 ]
%8 = load i32, i32* @FAN_ONDIR
%9 = and i32 %8, %0
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %6
%12 = add nuw nsw i32 %7, 1
%13 = zext i32 %7 to i64
%14 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %13
store i8 68, i8* %14
br label %15
15: ; preds = %11, %6
%16 = phi i32 [ %12, %11 ], [ %7, %6 ]
%17 = load i32, i32* @FAN_OPEN
%18 = and i32 %17, %0
%19 = icmp eq i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %15
%21 = add nuw nsw i32 %16, 1
%22 = zext i32 %16 to i64
%23 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %22
store i8 79, i8* %23
br label %24
24: ; preds = %20, %15
%25 = phi i32 [ %21, %20 ], [ %16, %15 ]
%26 = load i32, i32* @FAN_CLOSE_WRITE
%27 = and i32 %26, %0
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %24
%30 = load i32, i32* @FAN_CLOSE_NOWRITE
%31 = and i32 %30, %0
%32 = icmp eq i32 %31, 0
br i1 %32, label %44, label %33
33: ; preds = %29
%34 = add nuw nsw i32 %25, 1
%35 = zext i32 %25 to i64
%36 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %35
store i8 67, i8* %36
%37 = load i32, i32* @FAN_MODIFY
%38 = and i32 %37, %0
%39 = icmp eq i32 %38, 0
br i1 %39, label %53, label %48
40: ; preds = %24
%41 = add nuw nsw i32 %25, 1
%42 = zext i32 %25 to i64
%43 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %42
store i8 67, i8* %43
br label %48
44: ; preds = %29
%45 = load i32, i32* @FAN_MODIFY
%46 = and i32 %45, %0
%47 = icmp eq i32 %46, 0
br i1 %47, label %53, label %48
48: ; preds = %40, %44, %33
%49 = phi i32 [ %25, %44 ], [ %34, %33 ], [ %41, %40 ]
%50 = add nuw nsw i32 %49, 1
%51 = zext i32 %49 to i64
%52 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %51
store i8 87, i8* %52
br label %53
53: ; preds = %33, %44, %48
%54 = phi i32 [ %50, %48 ], [ %25, %44 ], [ %34, %33 ]
%55 = zext i32 %54 to i64
%56 = getelementptr inbounds [10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 %55
store i8 0, i8* %56
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @mask2str.buffer, i64 0, i64 0)
}