#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 const FAN_ACCESS;
int const FAN_CLOSE_NOWRITE;
int const FAN_CLOSE_WRITE;
int const FAN_MODIFY;
int const FAN_OPEN;
const char *fnotify_mask_to_str(const int mask) {
  static char modes[5];
  int i = 0;
  if (mask & FAN_OPEN)
    modes[i++] = 'O';
  if (mask & (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE))
    modes[i++] = 'C';
  if (mask & FAN_ACCESS)
    modes[i++] = 'R';
  if (mask & (FAN_MODIFY | FAN_CLOSE_WRITE))
    modes[i++] = 'W';
  modes[i] = '\0';
  return modes;
}


x86 assembly (clang, -O0):
<fnotify_mask_to_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ea8(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     113c <fnotify_mask_to_str+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2ee9(%rip),%rax
movb   $0x4f,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    0x2e9a(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2e81(%rip),%rdx
or     (%rdx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1175 <fnotify_mask_to_str+0x75>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2eb0(%rip),%rax
movb   $0x43,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    0x2e59(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11a3 <fnotify_mask_to_str+0xa3>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2e82(%rip),%rax
movb   $0x52,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    0x2e3b(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2e2a(%rip),%rdx
or     (%rdx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11dc <fnotify_mask_to_str+0xdc>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
movslq %eax,%rcx
lea    0x2e49(%rip),%rax
movb   $0x57,(%rax,%rcx,1)
movslq -0x8(%rbp),%rcx
lea    0x2e3a(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2e2f(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnotify_mask_to_str>:
movb   $0x0,0x2f1a(%rip)
lea    0x2f13(%rip),%rax
ret

LLVM IR (-O0):
@fnotify_mask_to_str.modes = internal global [5 x i8] zeroinitializer
@FAN_OPEN = constant i32 0
@FAN_CLOSE_WRITE = constant i32 0
@FAN_CLOSE_NOWRITE = constant i32 0
@FAN_ACCESS = constant i32 0
@FAN_MODIFY = constant i32 0
define i8* @fnotify_mask_to_str(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_OPEN
%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 [5 x i8], [5 x i8]* @fnotify_mask_to_str.modes, i64 0, i64 %11
store i8 79, i8* %12
br label %13
13: ; preds = %8, %1
%14 = load i32, i32* %2
%15 = load i32, i32* @FAN_CLOSE_WRITE
%16 = load i32, i32* @FAN_CLOSE_NOWRITE
%17 = or i32 %15, %16
%18 = and i32 %14, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %13
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds [5 x i8], [5 x i8]* @fnotify_mask_to_str.modes, i64 0, i64 %23
store i8 67, i8* %24
br label %25
25: ; preds = %20, %13
%26 = load i32, i32* %2
%27 = load i32, i32* @FAN_ACCESS
%28 = and i32 %26, %27
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
%33 = sext i32 %31 to i64
%34 = getelementptr inbounds [5 x i8], [5 x i8]* @fnotify_mask_to_str.modes, i64 0, i64 %33
store i8 82, i8* %34
br label %35
35: ; preds = %30, %25
%36 = load i32, i32* %2
%37 = load i32, i32* @FAN_MODIFY
%38 = load i32, i32* @FAN_CLOSE_WRITE
%39 = or i32 %37, %38
%40 = and i32 %36, %39
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %35
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds [5 x i8], [5 x i8]* @fnotify_mask_to_str.modes, i64 0, i64 %45
store i8 87, i8* %46
br label %47
47: ; preds = %42, %35
%48 = load i32, i32* %3
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [5 x i8], [5 x i8]* @fnotify_mask_to_str.modes, i64 0, i64 %49
store i8 0, i8* %50
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @fnotify_mask_to_str.modes, i64 0, i64 0)
}

LLVM IR (-O2):
@fnotify_mask_to_str.modes = internal global [5 x i8] zeroinitializer
@FAN_OPEN = constant i32 0
@FAN_CLOSE_WRITE = constant i32 0
@FAN_CLOSE_NOWRITE = constant i32 0
@FAN_ACCESS = constant i32 0
@FAN_MODIFY = constant i32 0
define i8* @fnotify_mask_to_str(i32 %0) {
store i8 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @fnotify_mask_to_str.modes, i64 0, i64 0)
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @fnotify_mask_to_str.modes, i64 0, i64 0)
}