#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 IN_ATTRIB;
int IN_CREATE;
int IN_DELETE;
int IN_MODIFY;
int IN_MOVED_FROM;
int IN_MOVED_TO;
int IN_UNMOUNT;
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ output(char *, ...);
int /*<<< orphan*/ userlog(int /*<<< orphan*/, char *, ...);
void inotify_callback(char *path, int event) {
  if (event & IN_CREATE || event & IN_MOVED_TO) {
    output("CREATE\n%s\nCHANGE\n%s\n", path, path);
    userlog(LOG_DEBUG, "CREATE: %s", path);
    return;
  }
  if (event & IN_MODIFY) {
    output("CHANGE\n%s\n", path);
    userlog(LOG_DEBUG, "CHANGE: %s", path);
    return;
  }
  if (event & IN_ATTRIB) {
    output("STATS\n%s\n", path);
    userlog(LOG_DEBUG, "STATS: %s", path);
    return;
  }
  if (event & IN_DELETE || event & IN_MOVED_FROM) {
    output("DELETE\n%s\n", path);
    userlog(LOG_DEBUG, "DELETE: %s", path);
    return;
  }
  if (event & IN_UNMOUNT) {
    output("RESET\n");
    userlog(LOG_DEBUG, "RESET");
    return;
  }
}


x86 assembly (clang, -O0):
<inotify_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e77(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1159 <inotify_callback+0x39>
mov    -0xc(%rbp),%eax
mov    0x2e72(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     118f <inotify_callback+0x6f>
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <output@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1040 <userlog@plt>
jmp    12b3 <inotify_callback+0x193>
mov    -0xc(%rbp),%eax
mov    0x2e57(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11d6 <inotify_callback+0xb6>
mov    -0x8(%rbp),%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <output@plt>
mov    0x2deb(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1040 <userlog@plt>
jmp    12b3 <inotify_callback+0x193>
mov    -0xc(%rbp),%eax
mov    0x2e00(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     121d <inotify_callback+0xfd>
mov    -0x8(%rbp),%rsi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <output@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1040 <userlog@plt>
jmp    12b3 <inotify_callback+0x193>
mov    -0xc(%rbp),%eax
mov    0x2db1(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1247 <inotify_callback+0x127>
mov    -0xc(%rbp),%eax
mov    0x2d7c(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1279 <inotify_callback+0x159>
mov    -0x8(%rbp),%rsi
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <output@plt>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xddd(%rip),%rsi
mov    $0x0,%al
call   1040 <userlog@plt>
jmp    12b3 <inotify_callback+0x193>
mov    -0xc(%rbp),%eax
mov    0x2d4d(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12b3 <inotify_callback+0x193>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <output@plt>
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
lea    0xdb0(%rip),%rsi
mov    $0x0,%al
call   1040 <userlog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inotify_callback>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e85(%rip),%rax
test   %esi,(%rax)
jne    113a <inotify_callback+0x1a>
mov    0x2e8a(%rip),%rax
test   %esi,(%rax)
je     1169 <inotify_callback+0x49>
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <output@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
pop    %rbx
jmp    1040 <userlog@plt>
mov    0x2e80(%rip),%rax
test   %esi,(%rax)
je     1197 <inotify_callback+0x77>
lea    0xe8f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <output@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
lea    0xe8b(%rip),%rsi
jmp    115e <inotify_callback+0x3e>
mov    0x2e42(%rip),%rax
test   %esi,(%rax)
je     11c5 <inotify_callback+0xa5>
lea    0xe82(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <output@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe72(%rip),%rsi
jmp    115e <inotify_callback+0x3e>
mov    0x2e0c(%rip),%rax
test   %esi,(%rax)
jne    11db <inotify_callback+0xbb>
mov    0x2de1(%rip),%rax
test   %esi,(%rax)
je     1201 <inotify_callback+0xe1>
lea    0xe5d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <output@plt>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
lea    0xe4e(%rip),%rsi
jmp    115e <inotify_callback+0x3e>
mov    0x2dc8(%rip),%rax
test   %esi,(%rax)
je     1232 <inotify_callback+0x112>
lea    0xe42(%rip),%rdi
xor    %eax,%eax
call   1030 <output@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
lea    0xe32(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <userlog@plt>
pop    %rbx
ret

LLVM IR (-O0):
@IN_CREATE = global i32 0
@IN_MOVED_TO = global i32 0
@.str = [21 x i8] c"CREATE\0A%s\0ACHANGE\0A%s\0A\00"
@LOG_DEBUG = global i32 0
@.str.1 = [11 x i8] c"CREATE: %s\00"
@IN_MODIFY = global i32 0
@.str.2 = [11 x i8] c"CHANGE\0A%s\0A\00"
@.str.3 = [11 x i8] c"CHANGE: %s\00"
@IN_ATTRIB = global i32 0
@.str.4 = [10 x i8] c"STATS\0A%s\0A\00"
@.str.5 = [10 x i8] c"STATS: %s\00"
@IN_DELETE = global i32 0
@IN_MOVED_FROM = global i32 0
@.str.6 = [11 x i8] c"DELETE\0A%s\0A\00"
@.str.7 = [11 x i8] c"DELETE: %s\00"
@IN_UNMOUNT = global i32 0
@.str.8 = [7 x i8] c"RESET\0A\00"
@.str.9 = [6 x i8] c"RESET\00"
define void @inotify_callback(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* @IN_CREATE
%7 = and i32 %5, %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* @IN_MOVED_TO
%12 = and i32 %10, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %9, %2
%15 = load i8*, i8** %3
%16 = load i8*, i8** %3
%17 = call i32 (i8*, ...) @output(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
%18 = load i32, i32* @LOG_DEBUG
%19 = load i8*, i8** %3
%20 = call i32 (i32, i8*, ...) @userlog(i32 %18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %68
21: ; preds = %9
%22 = load i32, i32* %4
%23 = load i32, i32* @IN_MODIFY
%24 = and i32 %22, %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = call i32 (i8*, ...) @output(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @LOG_DEBUG
%30 = load i8*, i8** %3
%31 = call i32 (i32, i8*, ...) @userlog(i32 %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %30)
br label %68
32: ; preds = %21
%33 = load i32, i32* %4
%34 = load i32, i32* @IN_ATTRIB
%35 = and i32 %33, %34
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %32
%38 = load i8*, i8** %3
%39 = call i32 (i8*, ...) @output(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %38)
%40 = load i32, i32* @LOG_DEBUG
%41 = load i8*, i8** %3
%42 = call i32 (i32, i8*, ...) @userlog(i32 %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %41)
br label %68
43: ; preds = %32
%44 = load i32, i32* %4
%45 = load i32, i32* @IN_DELETE
%46 = and i32 %44, %45
%47 = icmp ne i32 %46, 0
br i1 %47, label %53, label %48
48: ; preds = %43
%49 = load i32, i32* %4
%50 = load i32, i32* @IN_MOVED_FROM
%51 = and i32 %49, %50
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %59
53: ; preds = %48, %43
%54 = load i8*, i8** %3
%55 = call i32 (i8*, ...) @output(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %54)
%56 = load i32, i32* @LOG_DEBUG
%57 = load i8*, i8** %3
%58 = call i32 (i32, i8*, ...) @userlog(i32 %56, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %57)
br label %68
59: ; preds = %48
%60 = load i32, i32* %4
%61 = load i32, i32* @IN_UNMOUNT
%62 = and i32 %60, %61
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %59
%65 = call i32 (i8*, ...) @output(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%66 = load i32, i32* @LOG_DEBUG
%67 = call i32 (i32, i8*, ...) @userlog(i32 %66, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %68
68: ; preds = %14, %26, %37, %53, %64, %59
ret void
}

LLVM IR (-O2):
@IN_CREATE = global i32 0
@IN_MOVED_TO = global i32 0
@.str = [21 x i8] c"CREATE\0A%s\0ACHANGE\0A%s\0A\00"
@LOG_DEBUG = global i32 0
@.str.1 = [11 x i8] c"CREATE: %s\00"
@IN_MODIFY = global i32 0
@.str.2 = [11 x i8] c"CHANGE\0A%s\0A\00"
@.str.3 = [11 x i8] c"CHANGE: %s\00"
@IN_ATTRIB = global i32 0
@.str.4 = [10 x i8] c"STATS\0A%s\0A\00"
@.str.5 = [10 x i8] c"STATS: %s\00"
@IN_DELETE = global i32 0
@IN_MOVED_FROM = global i32 0
@.str.6 = [11 x i8] c"DELETE\0A%s\0A\00"
@.str.7 = [11 x i8] c"DELETE: %s\00"
@IN_UNMOUNT = global i32 0
@.str.8 = [7 x i8] c"RESET\0A\00"
@.str.9 = [6 x i8] c"RESET\00"
define void @inotify_callback(i8* %0, i32 %1) {
%3 = load i32, i32* @IN_CREATE
%4 = and i32 %3, %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @IN_MOVED_TO
%8 = and i32 %7, %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %6, %2
%11 = tail call i32 (i8*, ...) @output(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
%12 = load i32, i32* @LOG_DEBUG
%13 = tail call i32 (i32, i8*, ...) @userlog(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %50
14: ; preds = %6
%15 = load i32, i32* @IN_MODIFY
%16 = and i32 %15, %1
%17 = icmp eq i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = tail call i32 (i8*, ...) @output(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%20 = load i32, i32* @LOG_DEBUG
%21 = tail call i32 (i32, i8*, ...) @userlog(i32 %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %50
22: ; preds = %14
%23 = load i32, i32* @IN_ATTRIB
%24 = and i32 %23, %1
%25 = icmp eq i32 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = tail call i32 (i8*, ...) @output(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%28 = load i32, i32* @LOG_DEBUG
%29 = tail call i32 (i32, i8*, ...) @userlog(i32 %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %0)
br label %50
30: ; preds = %22
%31 = load i32, i32* @IN_DELETE
%32 = and i32 %31, %1
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i32, i32* @IN_MOVED_FROM
%36 = and i32 %35, %1
%37 = icmp eq i32 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %34, %30
%39 = tail call i32 (i8*, ...) @output(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%40 = load i32, i32* @LOG_DEBUG
%41 = tail call i32 (i32, i8*, ...) @userlog(i32 %40, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %0)
br label %50
42: ; preds = %34
%43 = load i32, i32* @IN_UNMOUNT
%44 = and i32 %43, %1
%45 = icmp eq i32 %44, 0
br i1 %45, label %50, label %46
46: ; preds = %42
%47 = tail call i32 (i8*, ...) @output(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%48 = load i32, i32* @LOG_DEBUG
%49 = tail call i32 (i32, i8*, ...) @userlog(i32 %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %50
50: ; preds = %10, %18, %26, %38, %46, %42
ret void
}