#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 */
struct inotify_event {
  int mask;
  char *name;
  int cookie;
  scalar_t__ len;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int IN_CREATE;
int IN_DELETE;
int IN_ISDIR;
int IN_MODIFY;
int IN_MOVED_FROM;
int IN_MOVED_TO;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int inotify_add_watch(int, char *, int);
int inotify_init();
int /*<<< orphan*/ inotify_rm_watch(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int read(int, char *, int);
int main(int argc, char **argv) {
  int bytes_read;
  int file_descriptor;
  int watch_descriptor;
  char buffer[(1024 * ((sizeof(struct inotify_event)) + 16))];
  file_descriptor = inotify_init();
  if (file_descriptor < 0) {
    perror("inotify_init");
    exit(EXIT_FAILURE);
  }
  watch_descriptor = inotify_add_watch(file_descriptor, argv[1],
                                       IN_MODIFY | IN_CREATE | IN_DELETE |
                                           IN_MOVED_FROM | IN_MOVED_TO);
  if (watch_descriptor < 0) {
    perror("inotify_add_watch");
    exit(EXIT_FAILURE);
  }
  bytes_read = read(file_descriptor, buffer,
                    (1024 * ((sizeof(struct inotify_event)) + 16)));
  if (bytes_read < 0) {
    perror("read");
    exit(EXIT_FAILURE);
  }
  while (bytes_read > 0) {
    int bytes_processed = 0;
    while (bytes_processed < bytes_read) {
      struct inotify_event *event =
          (struct inotify_event *)&buffer[bytes_processed];
      if (event->len) {
        if (event->mask & IN_MOVED_FROM) {
          if (event->mask & IN_ISDIR) {
            printf("The directory %s was moved from (cookie: %d).\n",
                   event->name, event->cookie);
          } else {
            printf("The file %s was moved from (cookie: %d).\n", event->name,
                   event->cookie);
          }
        } else if (event->mask & IN_MOVED_TO) {
          if (event->mask & IN_ISDIR) {
            printf("The directory %s was moved to (cookie: %d).\n", event->name,
                   event->cookie);
          } else {
            printf("The file %s was moved to (cookie: %d).\n", event->name,
                   event->cookie);
          }
        } else if (event->mask & IN_CREATE) {
          if (event->mask & IN_ISDIR) {
            printf("The directory %s was created.\n", event->name);
          } else {
            printf("The file %s was created.\n", event->name);
          }
        } else if (event->mask & IN_DELETE) {
          if (event->mask & IN_ISDIR) {
            printf("The directory %s was deleted.\n", event->name);
          } else {
            printf("The file %s was deleted.\n", event->name);
          }
        } else if (event->mask & IN_MODIFY) {
          if (event->mask & IN_ISDIR) {
            printf("The directory %s was modified.\n", event->name);
          } else {
            printf("The file %s was modified.\n", event->name);
          }
        }
      }
      bytes_processed += (sizeof(struct inotify_event)) + event->len;
    }
    bytes_read = read(file_descriptor, buffer,
                      (1024 * ((sizeof(struct inotify_event)) + 16)));
    if (bytes_read < 0) {
      perror("read");
      exit(EXIT_FAILURE);
    }
  }
  (void)inotify_rm_watch(file_descriptor, watch_descriptor);
  (void)close(file_descriptor);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <inotify_init@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    11c7 <main+0x47>
lea    0xe4c(%rip),%rdi
call   1080 <perror@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    0x2e17(%rip),%rax
mov    (%rax),%edx
mov    0x2dd6(%rip),%rax
or     (%rax),%edx
mov    0x2df5(%rip),%rax
or     (%rax),%edx
mov    0x2dcc(%rip),%rax
or     (%rax),%edx
mov    0x2dcb(%rip),%rax
or     (%rax),%edx
call   1070 <inotify_add_watch@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    122b <main+0xab>
lea    0xdf5(%rip),%rdi
call   1080 <perror@plt>
mov    0x2d8c(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x18(%rbp),%edi
lea    -0xc020(%rbp),%rsi
mov    $0xc000,%edx
call   1050 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1266 <main+0xe6>
lea    0xdcc(%rip),%rdi
call   1080 <perror@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
jmp    126b <main+0xeb>
cmpl   $0x0,-0x14(%rbp)
jle    1597 <main+0x417>
movl   $0x0,-0xc024(%rbp)
mov    -0xc024(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1557 <main+0x3d7>
movslq -0xc024(%rbp),%rcx
lea    -0xc020(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xc030(%rbp)
mov    -0xc030(%rbp),%rax
cmpq   $0x0,0x18(%rax)
je     1533 <main+0x3b3>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2cf8(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     133e <main+0x1be>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2cf5(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1316 <main+0x196>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0xc030(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1339 <main+0x1b9>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0xc030(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xd21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    152e <main+0x3ae>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2c7a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13c4 <main+0x244>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2c6f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     139c <main+0x21c>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0xc030(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xced(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13bf <main+0x23f>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0xc030(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1529 <main+0x3a9>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2be4(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1436 <main+0x2b6>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2be9(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1418 <main+0x298>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xcc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1431 <main+0x2b1>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1524 <main+0x3a4>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2b9a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     14a8 <main+0x328>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2b77(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     148a <main+0x30a>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14a3 <main+0x323>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    151f <main+0x39f>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2b38(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     151a <main+0x39a>
mov    -0xc030(%rbp),%rax
mov    (%rax),%eax
mov    0x2b05(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     14fc <main+0x37c>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xc54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1515 <main+0x395>
mov    -0xc030(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xc56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    151a <main+0x39a>
jmp    151f <main+0x39f>
jmp    1524 <main+0x3a4>
jmp    1529 <main+0x3a9>
jmp    152e <main+0x3ae>
jmp    1533 <main+0x3b3>
mov    -0xc030(%rbp),%rax
mov    0x18(%rax),%rcx
add    $0x20,%rcx
movslq -0xc024(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc024(%rbp)
jmp    127f <main+0xff>
mov    -0x18(%rbp),%edi
lea    -0xc020(%rbp),%rsi
mov    $0xc000,%edx
call   1050 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1592 <main+0x412>
lea    0xaa0(%rip),%rdi
call   1080 <perror@plt>
mov    0x2a25(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
jmp    126b <main+0xeb>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10a0 <inotify_rm_watch@plt>
mov    -0x18(%rbp),%edi
call   1040 <close@plt>
mov    0x29f7(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc018,%rsp
mov    %rsi,%rbp
xor    %eax,%eax
call   1060 <inotify_init@plt>
test   %eax,%eax
jns    11a8 <main+0x28>
lea    0xe5a(%rip),%rdi
jmp    1210 <main+0x90>
mov    %eax,%ebx
mov    0x2e3f(%rip),%rax
mov    0x2e00(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e1d(%rip),%rax
or     (%rax),%edx
mov    0x2df4(%rip),%r12
or     (%r12),%edx
mov    0x8(%rbp),%rsi
mov    0x2ded(%rip),%rax
or     (%rax),%edx
mov    %ebx,%edi
call   1070 <inotify_add_watch@plt>
test   %eax,%eax
jns    11f1 <main+0x71>
lea    0xe1e(%rip),%rdi
jmp    1210 <main+0x90>
mov    %eax,%r14d
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc000,%edx
call   1050 <read@plt>
test   %eax,%eax
jns    1223 <main+0xa3>
lea    0xe0f(%rip),%rdi
call   1080 <perror@plt>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    %eax,%ebp
mov    %r14d,0x8(%rsp)
mov    0x2da7(%rip),%r13
lea    0xdec(%rip),%r14
mov    %ebx,0xc(%rsp)
jmp    125b <main+0xdb>
xchg   %ax,%ax
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
lea    0x10(%rsp),%rsi
mov    $0xc000,%edx
call   1050 <read@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1209 <main+0x89>
test   %ebp,%ebp
je     1375 <main+0x1f5>
xor    %r15d,%r15d
jmp    1286 <main+0x106>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%r15d
add    $0x20,%r15d
cmp    %ebp,%r15d
jge    1240 <main+0xc0>
movslq %r15d,%rax
mov    0x28(%rsp,%rax,1),%rbx
test   %rbx,%rbx
je     127a <main+0xfa>
mov    0x10(%rsp,%rax,1),%ecx
test   %ecx,(%r12)
je     12c0 <main+0x140>
mov    0x18(%rsp,%rax,1),%rsi
mov    0x20(%rsp,%rax,1),%edx
test   %ecx,0x0(%r13)
jne    1270 <main+0xf0>
lea    0xda0(%rip),%rdi
jmp    1273 <main+0xf3>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x2d01(%rip),%rdx
test   %ecx,(%rdx)
je     12e3 <main+0x163>
mov    0x18(%rsp,%rax,1),%rsi
mov    0x20(%rsp,%rax,1),%edx
test   %ecx,0x0(%r13)
je     1302 <main+0x182>
lea    0xd9c(%rip),%rdi
jmp    1273 <main+0xf3>
mov    0x2cce(%rip),%rdx
test   %ecx,(%rdx)
je     130e <main+0x18e>
mov    0x18(%rsp,%rax,1),%rsi
test   %ecx,0x0(%r13)
je     132d <main+0x1ad>
lea    0xdd2(%rip),%rdi
jmp    1369 <main+0x1e9>
lea    0xda1(%rip),%rdi
jmp    1273 <main+0xf3>
mov    0x2ccb(%rip),%rdx
test   %ecx,(%rdx)
je     1336 <main+0x1b6>
mov    0x18(%rsp,%rax,1),%rsi
test   %ecx,0x0(%r13)
je     1359 <main+0x1d9>
lea    0xde0(%rip),%rdi
jmp    1369 <main+0x1e9>
lea    0xdbd(%rip),%rdi
jmp    1369 <main+0x1e9>
mov    0x2cb3(%rip),%rdx
test   %ecx,(%rdx)
je     127a <main+0xfa>
mov    0x18(%rsp,%rax,1),%rsi
test   %ecx,0x0(%r13)
je     1362 <main+0x1e2>
lea    0xded(%rip),%rdi
jmp    1369 <main+0x1e9>
lea    0xdca(%rip),%rdi
jmp    1369 <main+0x1e9>
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    127a <main+0xfa>
mov    %ebx,%edi
mov    0x8(%rsp),%esi
call   10a0 <inotify_rm_watch@plt>
mov    %ebx,%edi
call   1040 <close@plt>
mov    0x2c1a(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.inotify_event = type { i32, i8*, i32, i64 }
@.str = [13 x i8] c"inotify_init\00"
@EXIT_FAILURE = global i32 0
@IN_MODIFY = global i32 0
@IN_CREATE = global i32 0
@IN_DELETE = global i32 0
@IN_MOVED_FROM = global i32 0
@IN_MOVED_TO = global i32 0
@.str.1 = [18 x i8] c"inotify_add_watch\00"
@.str.2 = [5 x i8] c"read\00"
@IN_ISDIR = global i32 0
@.str.3 = [47 x i8] c"The directory %s was moved from (cookie: %d).\0A\00"
@.str.4 = [42 x i8] c"The file %s was moved from (cookie: %d).\0A\00"
@.str.5 = [45 x i8] c"The directory %s was moved to (cookie: %d).\0A\00"
@.str.6 = [40 x i8] c"The file %s was moved to (cookie: %d).\0A\00"
@.str.7 = [31 x i8] c"The directory %s was created.\0A\00"
@.str.8 = [26 x i8] c"The file %s was created.\0A\00"
@.str.9 = [31 x i8] c"The directory %s was deleted.\0A\00"
@.str.10 = [26 x i8] c"The file %s was deleted.\0A\00"
@.str.11 = [32 x i8] c"The directory %s was modified.\0A\00"
@.str.12 = [27 x i8] c"The file %s was modified.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [49152 x i8]
%10 = alloca i32
%11 = alloca %struct.inotify_event*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (...) @inotify_init()
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = load i32, i32* %7
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i32, i32* @IN_MODIFY
%25 = load i32, i32* @IN_CREATE
%26 = or i32 %24, %25
%27 = load i32, i32* @IN_DELETE
%28 = or i32 %26, %27
%29 = load i32, i32* @IN_MOVED_FROM
%30 = or i32 %28, %29
%31 = load i32, i32* @IN_MOVED_TO
%32 = or i32 %30, %31
%33 = call i32 @inotify_add_watch(i32 %20, i8* %23, i32 %32)
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %19
%37 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %19
%41 = load i32, i32* %7
%42 = getelementptr inbounds [49152 x i8], [49152 x i8]* %9, i64 0, i64 0
%43 = call i32 @read(i32 %41, i8* %42, i32 49152)
store i32 %43, i32* %6
%44 = load i32, i32* %6
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %40
%47 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%48 = load i32, i32* @EXIT_FAILURE
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %40
br label %51
51: ; preds = %229, %50
%52 = load i32, i32* %6
%53 = icmp sgt i32 %52, 0
br i1 %53, label %54, label %230
54: ; preds = %51
store i32 0, i32* %10
br label %55
55: ; preds = %210, %54
%56 = load i32, i32* %10
%57 = load i32, i32* %6
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %219
59: ; preds = %55
%60 = load i32, i32* %10
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [49152 x i8], [49152 x i8]* %9, i64 0, i64 %61
%63 = bitcast i8* %62 to %struct.inotify_event*
store %struct.inotify_event* %63, %struct.inotify_event** %11
%64 = load %struct.inotify_event*, %struct.inotify_event** %11
%65 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %64, i32 0, i32 3
%66 = load i64, i64* %65
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %210
68: ; preds = %59
%69 = load %struct.inotify_event*, %struct.inotify_event** %11
%70 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %69, i32 0, i32 0
%71 = load i32, i32* %70
%72 = load i32, i32* @IN_MOVED_FROM
%73 = and i32 %71, %72
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %99
75: ; preds = %68
%76 = load %struct.inotify_event*, %struct.inotify_event** %11
%77 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %76, i32 0, i32 0
%78 = load i32, i32* %77
%79 = load i32, i32* @IN_ISDIR
%80 = and i32 %78, %79
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %90
82: ; preds = %75
%83 = load %struct.inotify_event*, %struct.inotify_event** %11
%84 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %83, i32 0, i32 1
%85 = load i8*, i8** %84
%86 = load %struct.inotify_event*, %struct.inotify_event** %11
%87 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %86, i32 0, i32 2
%88 = load i32, i32* %87
%89 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %85, i32 %88)
br label %98
90: ; preds = %75
%91 = load %struct.inotify_event*, %struct.inotify_event** %11
%92 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %91, i32 0, i32 1
%93 = load i8*, i8** %92
%94 = load %struct.inotify_event*, %struct.inotify_event** %11
%95 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %94, i32 0, i32 2
%96 = load i32, i32* %95
%97 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %93, i32 %96)
br label %98
98: ; preds = %90, %82
br label %209
99: ; preds = %68
%100 = load %struct.inotify_event*, %struct.inotify_event** %11
%101 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %100, i32 0, i32 0
%102 = load i32, i32* %101
%103 = load i32, i32* @IN_MOVED_TO
%104 = and i32 %102, %103
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %130
106: ; preds = %99
%107 = load %struct.inotify_event*, %struct.inotify_event** %11
%108 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %107, i32 0, i32 0
%109 = load i32, i32* %108
%110 = load i32, i32* @IN_ISDIR
%111 = and i32 %109, %110
%112 = icmp ne i32 %111, 0
br i1 %112, label %113, label %121
113: ; preds = %106
%114 = load %struct.inotify_event*, %struct.inotify_event** %11
%115 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %114, i32 0, i32 1
%116 = load i8*, i8** %115
%117 = load %struct.inotify_event*, %struct.inotify_event** %11
%118 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %117, i32 0, i32 2
%119 = load i32, i32* %118
%120 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i8* %116, i32 %119)
br label %129
121: ; preds = %106
%122 = load %struct.inotify_event*, %struct.inotify_event** %11
%123 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %122, i32 0, i32 1
%124 = load i8*, i8** %123
%125 = load %struct.inotify_event*, %struct.inotify_event** %11
%126 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %125, i32 0, i32 2
%127 = load i32, i32* %126
%128 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i8* %124, i32 %127)
br label %129
129: ; preds = %121, %113
br label %208
130: ; preds = %99
%131 = load %struct.inotify_event*, %struct.inotify_event** %11
%132 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %131, i32 0, i32 0
%133 = load i32, i32* %132
%134 = load i32, i32* @IN_CREATE
%135 = and i32 %133, %134
%136 = icmp ne i32 %135, 0
br i1 %136, label %137, label %155
137: ; preds = %130
%138 = load %struct.inotify_event*, %struct.inotify_event** %11
%139 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %138, i32 0, i32 0
%140 = load i32, i32* %139
%141 = load i32, i32* @IN_ISDIR
%142 = and i32 %140, %141
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %149
144: ; preds = %137
%145 = load %struct.inotify_event*, %struct.inotify_event** %11
%146 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %145, i32 0, i32 1
%147 = load i8*, i8** %146
%148 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %147)
br label %154
149: ; preds = %137
%150 = load %struct.inotify_event*, %struct.inotify_event** %11
%151 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %150, i32 0, i32 1
%152 = load i8*, i8** %151
%153 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %152)
br label %154
154: ; preds = %149, %144
br label %207
155: ; preds = %130
%156 = load %struct.inotify_event*, %struct.inotify_event** %11
%157 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %156, i32 0, i32 0
%158 = load i32, i32* %157
%159 = load i32, i32* @IN_DELETE
%160 = and i32 %158, %159
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %180
162: ; preds = %155
%163 = load %struct.inotify_event*, %struct.inotify_event** %11
%164 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %163, i32 0, i32 0
%165 = load i32, i32* %164
%166 = load i32, i32* @IN_ISDIR
%167 = and i32 %165, %166
%168 = icmp ne i32 %167, 0
br i1 %168, label %169, label %174
169: ; preds = %162
%170 = load %struct.inotify_event*, %struct.inotify_event** %11
%171 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %170, i32 0, i32 1
%172 = load i8*, i8** %171
%173 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %172)
br label %179
174: ; preds = %162
%175 = load %struct.inotify_event*, %struct.inotify_event** %11
%176 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %175, i32 0, i32 1
%177 = load i8*, i8** %176
%178 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i8* %177)
br label %179
179: ; preds = %174, %169
br label %206
180: ; preds = %155
%181 = load %struct.inotify_event*, %struct.inotify_event** %11
%182 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %181, i32 0, i32 0
%183 = load i32, i32* %182
%184 = load i32, i32* @IN_MODIFY
%185 = and i32 %183, %184
%186 = icmp ne i32 %185, 0
br i1 %186, label %187, label %205
187: ; preds = %180
%188 = load %struct.inotify_event*, %struct.inotify_event** %11
%189 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %188, i32 0, i32 0
%190 = load i32, i32* %189
%191 = load i32, i32* @IN_ISDIR
%192 = and i32 %190, %191
%193 = icmp ne i32 %192, 0
br i1 %193, label %194, label %199
194: ; preds = %187
%195 = load %struct.inotify_event*, %struct.inotify_event** %11
%196 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %195, i32 0, i32 1
%197 = load i8*, i8** %196
%198 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0), i8* %197)
br label %204
199: ; preds = %187
%200 = load %struct.inotify_event*, %struct.inotify_event** %11
%201 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %200, i32 0, i32 1
%202 = load i8*, i8** %201
%203 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i8* %202)
br label %204
204: ; preds = %199, %194
br label %205
205: ; preds = %204, %180
br label %206
206: ; preds = %205, %179
br label %207
207: ; preds = %206, %154
br label %208
208: ; preds = %207, %129
br label %209
209: ; preds = %208, %98
br label %210
210: ; preds = %209, %59
%211 = load %struct.inotify_event*, %struct.inotify_event** %11
%212 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %211, i32 0, i32 3
%213 = load i64, i64* %212
%214 = add i64 32, %213
%215 = load i32, i32* %10
%216 = sext i32 %215 to i64
%217 = add i64 %216, %214
%218 = trunc i64 %217 to i32
store i32 %218, i32* %10
br label %55
219: ; preds = %55
%220 = load i32, i32* %7
%221 = getelementptr inbounds [49152 x i8], [49152 x i8]* %9, i64 0, i64 0
%222 = call i32 @read(i32 %220, i8* %221, i32 49152)
store i32 %222, i32* %6
%223 = load i32, i32* %6
%224 = icmp slt i32 %223, 0
br i1 %224, label %225, label %229
225: ; preds = %219
%226 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%227 = load i32, i32* @EXIT_FAILURE
%228 = call i32 @exit(i32 %227)
unreachable
229: ; preds = %219
br label %51
230: ; preds = %51
%231 = load i32, i32* %7
%232 = load i32, i32* %8
%233 = call i32 @inotify_rm_watch(i32 %231, i32 %232)
%234 = load i32, i32* %7
%235 = call i32 @close(i32 %234)
%236 = load i32, i32* @EXIT_SUCCESS
%237 = call i32 @exit(i32 %236)
unreachable
}

LLVM IR (-O2):
@.str = [13 x i8] c"inotify_init\00"
@EXIT_FAILURE = global i32 0
@IN_MODIFY = global i32 0
@IN_CREATE = global i32 0
@IN_DELETE = global i32 0
@IN_MOVED_FROM = global i32 0
@IN_MOVED_TO = global i32 0
@.str.1 = [18 x i8] c"inotify_add_watch\00"
@.str.2 = [5 x i8] c"read\00"
@IN_ISDIR = global i32 0
@.str.3 = [47 x i8] c"The directory %s was moved from (cookie: %d).\0A\00"
@.str.4 = [42 x i8] c"The file %s was moved from (cookie: %d).\0A\00"
@.str.5 = [45 x i8] c"The directory %s was moved to (cookie: %d).\0A\00"
@.str.6 = [40 x i8] c"The file %s was moved to (cookie: %d).\0A\00"
@.str.7 = [31 x i8] c"The directory %s was created.\0A\00"
@.str.8 = [26 x i8] c"The file %s was created.\0A\00"
@.str.9 = [31 x i8] c"The directory %s was deleted.\0A\00"
@.str.10 = [26 x i8] c"The file %s was deleted.\0A\00"
@.str.11 = [32 x i8] c"The directory %s was modified.\0A\00"
@.str.12 = [27 x i8] c"The file %s was modified.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [49152 x i8]
%4 = getelementptr inbounds [49152 x i8], [49152 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (...) @inotify_init()
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = load i32, i32* @IN_MODIFY
%15 = load i32, i32* @IN_CREATE
%16 = or i32 %15, %14
%17 = load i32, i32* @IN_DELETE
%18 = or i32 %16, %17
%19 = load i32, i32* @IN_MOVED_FROM
%20 = or i32 %18, %19
%21 = load i32, i32* @IN_MOVED_TO
%22 = or i32 %20, %21
%23 = tail call i32 @inotify_add_watch(i32 %5, i8* %13, i32 %22)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %11
%26 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = tail call i32 @exit(i32 %27)
unreachable
29: ; preds = %11
%30 = call i32 @read(i32 %5, i8* %4, i32 49152)
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* @EXIT_FAILURE
%35 = tail call i32 @exit(i32 %34)
unreachable
36: ; preds = %29, %135
%37 = phi i32 [ %136, %135 ], [ %30, %29 ]
%38 = icmp eq i32 %37, 0
br i1 %38, label %142, label %39
39: ; preds = %36, %130
%40 = phi i32 [ %133, %130 ], [ 0, %36 ]
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [49152 x i8], [49152 x i8]* %3, i64 0, i64 %41
%43 = getelementptr inbounds i8, i8* %42, i64 24
%44 = bitcast i8* %43 to i64*
%45 = load i64, i64* %44
%46 = icmp eq i64 %45, 0
br i1 %46, label %130, label %47
47: ; preds = %39
%48 = bitcast i8* %42 to i32*
%49 = load i32, i32* %48
%50 = load i32, i32* @IN_MOVED_FROM
%51 = and i32 %50, %49
%52 = icmp eq i32 %51, 0
br i1 %52, label %67, label %53
53: ; preds = %47
%54 = load i32, i32* @IN_ISDIR
%55 = and i32 %54, %49
%56 = icmp eq i32 %55, 0
%57 = getelementptr inbounds i8, i8* %42, i64 8
%58 = bitcast i8* %57 to i8**
%59 = load i8*, i8** %58
%60 = getelementptr inbounds i8, i8* %42, i64 16
%61 = bitcast i8* %60 to i32*
%62 = load i32, i32* %61
br i1 %56, label %65, label %63
63: ; preds = %53
%64 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %59, i32 %62)
br label %130
65: ; preds = %53
%66 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %59, i32 %62)
br label %130
67: ; preds = %47
%68 = load i32, i32* @IN_MOVED_TO
%69 = and i32 %68, %49
%70 = icmp eq i32 %69, 0
br i1 %70, label %85, label %71
71: ; preds = %67
%72 = load i32, i32* @IN_ISDIR
%73 = and i32 %72, %49
%74 = icmp eq i32 %73, 0
%75 = getelementptr inbounds i8, i8* %42, i64 8
%76 = bitcast i8* %75 to i8**
%77 = load i8*, i8** %76
%78 = getelementptr inbounds i8, i8* %42, i64 16
%79 = bitcast i8* %78 to i32*
%80 = load i32, i32* %79
br i1 %74, label %83, label %81
81: ; preds = %71
%82 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i8* %77, i32 %80)
br label %130
83: ; preds = %71
%84 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i8* %77, i32 %80)
br label %130
85: ; preds = %67
%86 = load i32, i32* @IN_CREATE
%87 = and i32 %86, %49
%88 = icmp eq i32 %87, 0
br i1 %88, label %100, label %89
89: ; preds = %85
%90 = load i32, i32* @IN_ISDIR
%91 = and i32 %90, %49
%92 = icmp eq i32 %91, 0
%93 = getelementptr inbounds i8, i8* %42, i64 8
%94 = bitcast i8* %93 to i8**
%95 = load i8*, i8** %94
br i1 %92, label %98, label %96
96: ; preds = %89
%97 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %95)
br label %130
98: ; preds = %89
%99 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %95)
br label %130
100: ; preds = %85
%101 = load i32, i32* @IN_DELETE
%102 = and i32 %101, %49
%103 = icmp eq i32 %102, 0
br i1 %103, label %115, label %104
104: ; preds = %100
%105 = load i32, i32* @IN_ISDIR
%106 = and i32 %105, %49
%107 = icmp eq i32 %106, 0
%108 = getelementptr inbounds i8, i8* %42, i64 8
%109 = bitcast i8* %108 to i8**
%110 = load i8*, i8** %109
br i1 %107, label %113, label %111
111: ; preds = %104
%112 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %110)
br label %130
113: ; preds = %104
%114 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i8* %110)
br label %130
115: ; preds = %100
%116 = load i32, i32* @IN_MODIFY
%117 = and i32 %116, %49
%118 = icmp eq i32 %117, 0
br i1 %118, label %130, label %119
119: ; preds = %115
%120 = load i32, i32* @IN_ISDIR
%121 = and i32 %120, %49
%122 = icmp eq i32 %121, 0
%123 = getelementptr inbounds i8, i8* %42, i64 8
%124 = bitcast i8* %123 to i8**
%125 = load i8*, i8** %124
br i1 %122, label %128, label %126
126: ; preds = %119
%127 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0), i8* %125)
br label %130
128: ; preds = %119
%129 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i8* %125)
br label %130
130: ; preds = %65, %63, %98, %96, %115, %128, %126, %111, %113, %81, %83, %39
%131 = trunc i64 %45 to i32
%132 = add i32 %40, 32
%133 = add i32 %132, %131
%134 = icmp slt i32 %133, %37
br i1 %134, label %39, label %135
135: ; preds = %130
%136 = call i32 @read(i32 %5, i8* %4, i32 49152)
%137 = icmp slt i32 %136, 0
br i1 %137, label %138, label %36
138: ; preds = %135
%139 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%140 = load i32, i32* @EXIT_FAILURE
%141 = tail call i32 @exit(i32 %140)
unreachable
142: ; preds = %36
%143 = tail call i32 @inotify_rm_watch(i32 %5, i32 %23)
%144 = tail call i32 @close(i32 %5)
%145 = load i32, i32* @EXIT_SUCCESS
%146 = tail call i32 @exit(i32 %145)
unreachable
}