#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 /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
struct inotify_event {
  int mask;
  scalar_t__ len;
};

/* Variables and functions */
int IN_CREATE;
int IN_DELETE;
int IN_ISDIR;
int IN_MODIFY;
int inotify_add_watch(int, char *, int);
int inotify_init();
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printEvent(char *, char *, struct tm *,
                              struct inotify_event *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  time_t now;
  struct tm *current;
  int fd, wd, length;
  char buffer[(1024 * ((sizeof(struct inotify_event)) + 16))];
  char *dirName = argv[1];
  fd = inotify_init();
  if (fd < 0) {
    printf("[ERROR] Lib \"inotify.h\" not found!\n");
    return 1;
  }
  if (argc == 1) {
    printf("[ERROR] Usage: %s directory_to_monitor\n", argv[0]);
    return 1;
  }
  wd = inotify_add_watch(fd, dirName, IN_MODIFY | IN_CREATE | IN_DELETE);
  if (wd < 0) {
    printf("[ERRO] Can't watch dir \"%s\"\n", dirName);
    return 1;
  }
  while (1) {
    length = read(fd, buffer, (1024 * ((sizeof(struct inotify_event)) + 16)));
    struct inotify_event *event = (struct inotify_event *)&buffer[0];
    if (event->len) {
      if (event->mask & IN_CREATE) {
        if (event->mask & IN_ISDIR) {
          now = time(0);
          current = localtime(&now);
          printEvent("Directory", "created", current, event);
        } else {
          now = time(0);
          current = localtime(&now);
          printEvent("File", "created", current, event);
        }
      }
      if (event->mask & IN_MODIFY) {
        if (event->mask & IN_ISDIR) {
          now = time(0);
          current = localtime(&now);
          printEvent("Directory", "modified", current, event);
        } else {
          now = time(0);
          current = localtime(&now);
          printEvent("File", "modified", current, event);
        }
      }
      if (event->mask & IN_DELETE) {
        if (event->mask & IN_ISDIR) {
          now = time(0);
          current = localtime(&now);
          printEvent("Directory", "deleted", current, event);
        } else {
          now = time(0);
          current = localtime(&now);
          printEvent("File", "deleted", current, event);
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8040,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8038(%rbp)
mov    $0x0,%al
call   1070 <inotify_init@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    11c6 <main+0x56>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148d <main+0x31d>
cmpl   $0x1,-0x8(%rbp)
jne    11f1 <main+0x81>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148d <main+0x31d>
mov    -0x24(%rbp),%edi
mov    -0x8038(%rbp),%rsi
mov    0x2dee(%rip),%rax
mov    (%rax),%edx
mov    0x2dbd(%rip),%rax
or     (%rax),%edx
mov    0x2dcc(%rip),%rax
or     (%rax),%edx
call   1090 <inotify_add_watch@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    1249 <main+0xd9>
mov    -0x8038(%rbp),%rsi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148d <main+0x31d>
jmp    124e <main+0xde>
mov    -0x24(%rbp),%edi
lea    -0x8030(%rbp),%rsi
mov    $0x8000,%edx
call   1060 <read@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x8030(%rbp),%rax
mov    %rax,-0x8040(%rbp)
mov    -0x8040(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1488 <main+0x318>
mov    -0x8040(%rbp),%rax
mov    (%rax),%eax
mov    0x2d33(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     132f <main+0x1bf>
mov    -0x8040(%rbp),%rax
mov    (%rax),%eax
mov    0x2d28(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     12f5 <main+0x185>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x8040(%rbp),%rcx
lea    0xd85(%rip),%rdi
lea    0xd88(%rip),%rsi
call   1040 <printEvent@plt>
jmp    132a <main+0x1ba>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x8040(%rbp),%rcx
lea    0xd5d(%rip),%rdi
lea    0xd4e(%rip),%rsi
call   1040 <printEvent@plt>
jmp    132f <main+0x1bf>
mov    -0x8040(%rbp),%rax
mov    (%rax),%eax
mov    0x2cb1(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13d9 <main+0x269>
mov    -0x8040(%rbp),%rax
mov    (%rax),%eax
mov    0x2c7e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     139f <main+0x22f>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x8040(%rbp),%rcx
lea    0xcdb(%rip),%rdi
lea    0xceb(%rip),%rsi
call   1040 <printEvent@plt>
jmp    13d4 <main+0x264>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x8040(%rbp),%rcx
lea    0xcb3(%rip),%rdi
lea    0xcb1(%rip),%rsi
call   1040 <printEvent@plt>
jmp    13d9 <main+0x269>
mov    -0x8040(%rbp),%rax
mov    (%rax),%eax
mov    0x2bf7(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1483 <main+0x313>
mov    -0x8040(%rbp),%rax
mov    (%rax),%eax
mov    0x2bd4(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1449 <main+0x2d9>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x8040(%rbp),%rcx
lea    0xc31(%rip),%rdi
lea    0xc4a(%rip),%rsi
call   1040 <printEvent@plt>
jmp    147e <main+0x30e>
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x8040(%rbp),%rcx
lea    0xc09(%rip),%rdi
lea    0xc10(%rip),%rsi
call   1040 <printEvent@plt>
jmp    1483 <main+0x313>
jmp    1488 <main+0x318>
jmp    124e <main+0xde>
mov    -0x4(%rbp),%eax
add    $0x8040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8018,%rsp
mov    %rsi,%rbx
mov    %edi,%r15d
mov    0x8(%rsi),%r14
xor    %eax,%eax
call   1080 <inotify_init@plt>
test   %eax,%eax
js     11bb <main+0x3b>
cmp    $0x1,%r15d
jne    11cc <main+0x4c>
mov    (%rbx),%rsi
lea    0xe4a(%rip),%rdi
jmp    1326 <main+0x1a6>
lea    0xeab(%rip),%rdi
call   1050 <puts@plt>
jmp    132d <main+0x1ad>
mov    %eax,%r12d
mov    0x2e1a(%rip),%rax
mov    0x2deb(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2df8(%rip),%rax
or     (%rax),%edx
mov    %r12d,%edi
mov    %r14,%rsi
call   10a0 <inotify_add_watch@plt>
test   %eax,%eax
js     131c <main+0x19c>
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r14
lea    0xe37(%rip),%r13
xchg   %ax,%ax
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x8000,%edx
call   1070 <read@plt>
cmpq   $0x0,0x18(%rsp)
je     1210 <main+0x90>
mov    0x10(%rsp),%r15d
mov    0x2d94(%rip),%rax
test   %r15d,(%rax)
je     1279 <main+0xf9>
mov    0x2d98(%rip),%rax
and    (%rax),%r15d
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1030 <localtime@plt>
test   %r15d,%r15d
mov    %r13,%rdi
lea    0xdf4(%rip),%rcx
cmove  %rcx,%rdi
lea    0xde1(%rip),%rsi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <printEvent@plt>
mov    0x10(%rsp),%ebp
mov    0x2d6c(%rip),%rax
test   %ebp,(%rax)
je     12c6 <main+0x146>
mov    0x2d49(%rip),%rax
and    (%rax),%ebp
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1030 <localtime@plt>
test   %ebp,%ebp
mov    %r13,%rdi
lea    0xda7(%rip),%rcx
cmove  %rcx,%rdi
lea    0xda1(%rip),%rsi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <printEvent@plt>
mov    0x10(%rsp),%ebp
mov    0x2d0f(%rip),%rax
test   %ebp,(%rax)
je     1210 <main+0x90>
mov    0x2cf8(%rip),%rax
and    (%rax),%ebp
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1030 <localtime@plt>
test   %ebp,%ebp
mov    %r13,%rdi
lea    0xd56(%rip),%rcx
cmove  %rcx,%rdi
lea    0xd59(%rip),%rsi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <printEvent@plt>
jmp    1210 <main+0x90>
lea    0xd05(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
add    $0x8018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
%struct.inotify_event = type { i32, i64 }
@.str = [36 x i8] c"[ERROR] Lib \22inotify.h\22 not found!\0A\00"
@.str.1 = [40 x i8] c"[ERROR] Usage: %s directory_to_monitor\0A\00"
@IN_MODIFY = global i32 0
@IN_CREATE = global i32 0
@IN_DELETE = global i32 0
@.str.2 = [29 x i8] c"[ERRO] Can't watch dir \22%s\22\0A\00"
@IN_ISDIR = global i32 0
@.str.3 = [10 x i8] c"Directory\00"
@.str.4 = [8 x i8] c"created\00"
@.str.5 = [5 x i8] c"File\00"
@.str.6 = [9 x i8] c"modified\00"
@.str.7 = [8 x i8] c"deleted\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.tm*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [32768 x i8]
%12 = alloca i8*
%13 = alloca %struct.inotify_event*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %12
%17 = call i32 (...) @inotify_init()
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %138
22: ; preds = %2
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %28)
store i32 1, i32* %3
br label %138
30: ; preds = %22
%31 = load i32, i32* %8
%32 = load i8*, i8** %12
%33 = load i32, i32* @IN_MODIFY
%34 = load i32, i32* @IN_CREATE
%35 = or i32 %33, %34
%36 = load i32, i32* @IN_DELETE
%37 = or i32 %35, %36
%38 = call i32 @inotify_add_watch(i32 %31, i8* %32, i32 %37)
store i32 %38, i32* %9
%39 = load i32, i32* %9
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %30
%42 = load i8*, i8** %12
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %42)
store i32 1, i32* %3
br label %138
44: ; preds = %30
br label %45
45: ; preds = %44, %137
%46 = load i32, i32* %8
%47 = getelementptr inbounds [32768 x i8], [32768 x i8]* %11, i64 0, i64 0
%48 = call i32 @read(i32 %46, i8* %47, i32 32768)
store i32 %48, i32* %10
%49 = getelementptr inbounds [32768 x i8], [32768 x i8]* %11, i64 0, i64 0
%50 = bitcast i8* %49 to %struct.inotify_event*
store %struct.inotify_event* %50, %struct.inotify_event** %13
%51 = load %struct.inotify_event*, %struct.inotify_event** %13
%52 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %51, i32 0, i32 1
%53 = load i64, i64* %52
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %137
55: ; preds = %45
%56 = load %struct.inotify_event*, %struct.inotify_event** %13
%57 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %56, i32 0, i32 0
%58 = load i32, i32* %57
%59 = load i32, i32* @IN_CREATE
%60 = and i32 %58, %59
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %82
62: ; preds = %55
%63 = load %struct.inotify_event*, %struct.inotify_event** %13
%64 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %63, i32 0, i32 0
%65 = load i32, i32* %64
%66 = load i32, i32* @IN_ISDIR
%67 = and i32 %65, %66
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %75
69: ; preds = %62
%70 = call i32 @time(i32 0)
store i32 %70, i32* %6
%71 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %71, %struct.tm** %7
%72 = load %struct.tm*, %struct.tm** %7
%73 = load %struct.inotify_event*, %struct.inotify_event** %13
%74 = call i32 @printEvent(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %72, %struct.inotify_event* %73)
br label %81
75: ; preds = %62
%76 = call i32 @time(i32 0)
store i32 %76, i32* %6
%77 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %77, %struct.tm** %7
%78 = load %struct.tm*, %struct.tm** %7
%79 = load %struct.inotify_event*, %struct.inotify_event** %13
%80 = call i32 @printEvent(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %78, %struct.inotify_event* %79)
br label %81
81: ; preds = %75, %69
br label %82
82: ; preds = %81, %55
%83 = load %struct.inotify_event*, %struct.inotify_event** %13
%84 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %83, i32 0, i32 0
%85 = load i32, i32* %84
%86 = load i32, i32* @IN_MODIFY
%87 = and i32 %85, %86
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %109
89: ; preds = %82
%90 = load %struct.inotify_event*, %struct.inotify_event** %13
%91 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %90, i32 0, i32 0
%92 = load i32, i32* %91
%93 = load i32, i32* @IN_ISDIR
%94 = and i32 %92, %93
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %102
96: ; preds = %89
%97 = call i32 @time(i32 0)
store i32 %97, i32* %6
%98 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %98, %struct.tm** %7
%99 = load %struct.tm*, %struct.tm** %7
%100 = load %struct.inotify_event*, %struct.inotify_event** %13
%101 = call i32 @printEvent(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), %struct.tm* %99, %struct.inotify_event* %100)
br label %108
102: ; preds = %89
%103 = call i32 @time(i32 0)
store i32 %103, i32* %6
%104 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %104, %struct.tm** %7
%105 = load %struct.tm*, %struct.tm** %7
%106 = load %struct.inotify_event*, %struct.inotify_event** %13
%107 = call i32 @printEvent(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), %struct.tm* %105, %struct.inotify_event* %106)
br label %108
108: ; preds = %102, %96
br label %109
109: ; preds = %108, %82
%110 = load %struct.inotify_event*, %struct.inotify_event** %13
%111 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %110, i32 0, i32 0
%112 = load i32, i32* %111
%113 = load i32, i32* @IN_DELETE
%114 = and i32 %112, %113
%115 = icmp ne i32 %114, 0
br i1 %115, label %116, label %136
116: ; preds = %109
%117 = load %struct.inotify_event*, %struct.inotify_event** %13
%118 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %117, i32 0, i32 0
%119 = load i32, i32* %118
%120 = load i32, i32* @IN_ISDIR
%121 = and i32 %119, %120
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %129
123: ; preds = %116
%124 = call i32 @time(i32 0)
store i32 %124, i32* %6
%125 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %125, %struct.tm** %7
%126 = load %struct.tm*, %struct.tm** %7
%127 = load %struct.inotify_event*, %struct.inotify_event** %13
%128 = call i32 @printEvent(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %struct.tm* %126, %struct.inotify_event* %127)
br label %135
129: ; preds = %116
%130 = call i32 @time(i32 0)
store i32 %130, i32* %6
%131 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %131, %struct.tm** %7
%132 = load %struct.tm*, %struct.tm** %7
%133 = load %struct.inotify_event*, %struct.inotify_event** %13
%134 = call i32 @printEvent(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %struct.tm* %132, %struct.inotify_event* %133)
br label %135
135: ; preds = %129, %123
br label %136
136: ; preds = %135, %109
br label %137
137: ; preds = %136, %45
br label %45
138: ; preds = %41, %25, %20
%139 = load i32, i32* %3
ret i32 %139
}

LLVM IR (-O2):
%struct.inotify_event = type { i32, i64 }
%struct.tm = type { i32 }
@.str.1 = [40 x i8] c"[ERROR] Usage: %s directory_to_monitor\0A\00"
@IN_MODIFY = global i32 0
@IN_CREATE = global i32 0
@IN_DELETE = global i32 0
@.str.2 = [29 x i8] c"[ERRO] Can't watch dir \22%s\22\0A\00"
@IN_ISDIR = global i32 0
@.str.3 = [10 x i8] c"Directory\00"
@.str.4 = [8 x i8] c"created\00"
@.str.5 = [5 x i8] c"File\00"
@.str.6 = [9 x i8] c"modified\00"
@.str.7 = [8 x i8] c"deleted\00"
@str = [35 x i8] c"[ERROR] Lib \22inotify.h\22 not found!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [32768 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [32768 x i8], [32768 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 (...) @inotify_init()
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %77
13: ; preds = %2
%14 = icmp eq i32 %0, 1
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %1
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %77
18: ; preds = %13
%19 = load i32, i32* @IN_MODIFY
%20 = load i32, i32* @IN_CREATE
%21 = or i32 %20, %19
%22 = load i32, i32* @IN_DELETE
%23 = or i32 %21, %22
%24 = tail call i32 @inotify_add_watch(i32 %9, i8* %8, i32 %23)
%25 = icmp slt i32 %24, 0
br i1 %25, label %31, label %26
26: ; preds = %18
%27 = bitcast [32768 x i8]* %4 to %struct.inotify_event*
%28 = getelementptr inbounds [32768 x i8], [32768 x i8]* %4, i64 0, i64 8
%29 = bitcast i8* %28 to i64*
%30 = bitcast [32768 x i8]* %4 to i32*
br label %33
31: ; preds = %18
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %77
33: ; preds = %76, %26
%34 = call i32 @read(i32 %9, i8* %6, i32 32768)
%35 = load i64, i64* %29
%36 = icmp eq i64 %35, 0
br i1 %36, label %76, label %37
37: ; preds = %33
%38 = load i32, i32* %30
%39 = load i32, i32* @IN_CREATE
%40 = and i32 %39, %38
%41 = icmp eq i32 %40, 0
br i1 %41, label %50, label %42
42: ; preds = %37
%43 = load i32, i32* @IN_ISDIR
%44 = and i32 %43, %38
%45 = icmp eq i32 %44, 0
%46 = call i32 @time(i32 0)
store i32 %46, i32* %3
%47 = call %struct.tm* @localtime(i32* %3)
%48 = select i1 %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0)
%49 = call i32 @printEvent(i8* %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %struct.tm* %47, %struct.inotify_event* %27)
br label %50
50: ; preds = %42, %37
%51 = load i32, i32* %30
%52 = load i32, i32* @IN_MODIFY
%53 = and i32 %52, %51
%54 = icmp eq i32 %53, 0
br i1 %54, label %63, label %55
55: ; preds = %50
%56 = load i32, i32* @IN_ISDIR
%57 = and i32 %56, %51
%58 = icmp eq i32 %57, 0
%59 = call i32 @time(i32 0)
store i32 %59, i32* %3
%60 = call %struct.tm* @localtime(i32* %3)
%61 = select i1 %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0)
%62 = call i32 @printEvent(i8* %61, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), %struct.tm* %60, %struct.inotify_event* %27)
br label %63
63: ; preds = %55, %50
%64 = load i32, i32* %30
%65 = load i32, i32* @IN_DELETE
%66 = and i32 %65, %64
%67 = icmp eq i32 %66, 0
br i1 %67, label %76, label %68
68: ; preds = %63
%69 = load i32, i32* @IN_ISDIR
%70 = and i32 %69, %64
%71 = icmp eq i32 %70, 0
%72 = call i32 @time(i32 0)
store i32 %72, i32* %3
%73 = call %struct.tm* @localtime(i32* %3)
%74 = select i1 %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0)
%75 = call i32 @printEvent(i8* %74, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %struct.tm* %73, %struct.inotify_event* %27)
br label %76
76: ; preds = %68, %63, %33
br label %33
77: ; preds = %31, %15, %11
ret i32 1
}