#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 pollfd {
  int fd;
  int events;
  int revents;
};
struct fanotify_event_metadata {
  int dummy;
};
typedef int /*<<< orphan*/ buff;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int FAN_ACCESS;
int /*<<< orphan*/ FAN_CLASS_CONTENT;
int FAN_MARK_ADD;
int FAN_MARK_MOUNT;
int FAN_OPEN;
int FAN_OPEN_PERM;
int /*<<< orphan*/ O_RDWR;
int POLLIN;
int /*<<< orphan*/ exit(int);
int fanotify_init(int /*<<< orphan*/, int /*<<< orphan*/);
int fanotify_mark(int, int, int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fork();
int getopt(int, char **, char *);
size_t optind;
int /*<<< orphan*/ perror(char *);
int poll(struct pollfd *, int, int);
int /*<<< orphan*/ printUsage();
size_t read(int, void *, int);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printUsage();
  }
  int fd, ret, arg;
  int mask = FAN_OPEN;
  int flags = FAN_MARK_ADD;
  int listening = 0;
  while ((arg = getopt(argc, argv, "prlm")) != -1) {
    switch (arg) {
    case 'p':
      mask |= FAN_OPEN_PERM;
      break;
    case 'r':
      mask |= FAN_ACCESS;
      break;
    case 'l':
      listening = 1;
      break;
    case 'm':
      flags |= FAN_MARK_MOUNT;
      break;
    default:
      printUsage();
    }
  }
  fd = fanotify_init(FAN_CLASS_CONTENT, O_RDWR);
  if (fd < 0) {
    perror("fanotify_init:bad file descriptor");
    exit(1);
  }
  ret = fanotify_mark(fd, flags, mask, AT_FDCWD, argv[optind]);
  if (ret < 0) {
    perror("test_fanotify:watch denied");
    exit(1);
  }
  if (listening) {
    if (fork() == 0) {
      FILE *f;
      f = fopen(argv[optind], "r");
      fgetc(f);
      fclose(f);
    } else {
      struct pollfd fds;
      fds.fd = fd;
      fds.events = POLLIN;
      while (listening) {
        int polled = poll(&fds, 1, 1);
        if (polled > 0) {
          if (fds.revents & POLLIN) {
            struct fanotify_event_metadata buff[200];
            size_t len = read(fd, (void *)&buff, sizeof(buff));
            if (len == -1) {
              perror("test_fanotify:can't open file");
              exit(1);
            } else {
              listening = 0;
              break;
            }
          }
        } else if (polled == -1) {
          listening = 0;
        }
      }
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x380,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11ea <main+0x2a>
mov    $0x0,%al
call   1090 <printUsage@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe05(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     12ab <main+0xeb>
mov    -0x1c(%rbp),%eax
add    $0xffffff94,%eax
mov    %eax,%ecx
mov    %rcx,-0x380(%rbp)
sub    $0x6,%eax
ja     129f <main+0xdf>
mov    -0x380(%rbp),%rax
lea    0xdb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d52(%rip),%rax
mov    (%rax),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    12a6 <main+0xe6>
mov    0x2d66(%rip),%rax
mov    (%rax),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    12a6 <main+0xe6>
movl   $0x1,-0x28(%rbp)
jmp    12a6 <main+0xe6>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    12a6 <main+0xe6>
mov    $0x0,%al
call   1090 <printUsage@plt>
jmp    1209 <main+0x49>
mov    0x2d0e(%rip),%rax
mov    (%rax),%edi
mov    0x2d2d(%rip),%rax
mov    (%rax),%esi
call   1030 <fanotify_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12e5 <main+0x125>
lea    0xd4b(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    0x2c9b(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x2cce(%rip),%r8
mov    (%r8),%r8
mov    (%rax,%r8,8),%r8
call   1070 <fanotify_mark@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1331 <main+0x171>
lea    0xd21(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpl   $0x0,-0x28(%rbp)
je     1448 <main+0x288>
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%rax
jne    1385 <main+0x1c5>
mov    -0x10(%rbp),%rax
mov    0x2c79(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xcdc(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <fgetc@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1443 <main+0x283>
mov    -0x14(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    0x2c36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     143e <main+0x27e>
lea    -0x40(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1080 <poll@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jle    1423 <main+0x263>
mov    -0x38(%rbp),%eax
mov    0x2c00(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     141e <main+0x25e>
mov    -0x14(%rbp),%edi
lea    -0x370(%rbp),%rsi
mov    $0x320,%edx
call   1060 <read@plt>
mov    %rax,-0x378(%rbp)
cmpq   $0xffffffffffffffff,-0x378(%rbp)
ff
jne    1412 <main+0x252>
lea    0xc5b(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
movl   $0x0,-0x28(%rbp)
jmp    143e <main+0x27e>
jmp    1439 <main+0x279>
cmpl   $0xffffffff,-0x44(%rbp)
jne    1434 <main+0x274>
movl   $0x0,-0x28(%rbp)
jmp    1439 <main+0x279>
jmp    1397 <main+0x1d7>
jmp    1443 <main+0x283>
jmp    1448 <main+0x288>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x348,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x1,%edi
jg     11e2 <main+0x22>
xor    %eax,%eax
call   1090 <printUsage@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%r15d
mov    0x2db5(%rip),%rax
mov    (%rax),%r14d
mov    $0x1,%al
mov    %eax,0xc(%rsp)
lea    0xe19(%rip),%r12
lea    0xdf6(%rip),%r13
jmp    121c <main+0x5c>
nopl   0x0(%rax)
cmp    $0xffffffff,%eax
je     1269 <main+0xa9>
xor    %eax,%eax
call   1090 <printUsage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   10c0 <getopt@plt>
lea    -0x6c(%rax),%ecx
cmp    $0x6,%ecx
ja     1210 <main+0x50>
movslq 0x0(%r13,%rcx,4),%rax
add    %r13,%rax
jmp    *%rax
movl   $0x0,0xc(%rsp)
jmp    121c <main+0x5c>
mov    0x2d94(%rip),%rax
or     (%rax),%r14d
jmp    121c <main+0x5c>
mov    0x2d58(%rip),%rax
or     (%rax),%r15d
jmp    121c <main+0x5c>
mov    0x2d74(%rip),%rax
or     (%rax),%r15d
jmp    121c <main+0x5c>
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
mov    0x2d6f(%rip),%rax
mov    (%rax),%esi
call   1030 <fanotify_init@plt>
test   %eax,%eax
jns    128d <main+0xcd>
lea    0xd96(%rip),%rdi
jmp    12c1 <main+0x101>
mov    %eax,%r12d
mov    0x2cf9(%rip),%rax
mov    (%rax),%ecx
mov    0x2d30(%rip),%rbp
mov    0x0(%rbp),%rax
mov    (%rbx,%rax,8),%r8
mov    %r12d,%edi
mov    %r14d,%esi
mov    %r15d,%edx
call   1070 <fanotify_mark@plt>
test   %eax,%eax
jns    12d0 <main+0x110>
lea    0xd82(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
testb  $0x1,0xc(%rsp)
je     12de <main+0x11e>
xor    %edi,%edi
call   10d0 <exit@plt>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %rax,%rax
jne    1318 <main+0x158>
mov    0x0(%rbp),%rax
mov    (%rbx,%rax,8),%rdi
lea    0xd48(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <fgetc@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    %r12d,0x10(%rsp)
mov    0x2ca4(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x14(%rsp)
lea    0x10(%rsp),%rbx
jmp    134c <main+0x18c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
test   %ecx,%ecx
je     12d7 <main+0x117>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1080 <poll@plt>
test   %eax,%eax
jle    1340 <main+0x180>
mov    0x0(%rbp),%eax
mov    $0x1,%ecx
test   %eax,0x18(%rsp)
je     1348 <main+0x188>
lea    0x20(%rsp),%rsi
mov    %r12d,%edi
mov    $0x320,%edx
call   1060 <read@plt>
cmp    $0xffffffffffffffff,%rax
jne    12d7 <main+0x117>
lea    0xccb(%rip),%rdi
jmp    12c1 <main+0x101>

LLVM IR (-O0):
%struct.pollfd = type { i32, i32, i32 }
%struct.fanotify_event_metadata = type { i32 }
@FAN_OPEN = global i32 0
@FAN_MARK_ADD = global i32 0
@.str = [5 x i8] c"prlm\00"
@FAN_OPEN_PERM = global i32 0
@FAN_ACCESS = global i32 0
@FAN_MARK_MOUNT = global i32 0
@FAN_CLASS_CONTENT = global i32 0
@O_RDWR = global i32 0
@.str.1 = [34 x i8] c"fanotify_init:bad file descriptor\00"
@AT_FDCWD = global i32 0
@optind = global i64 0
@.str.2 = [27 x i8] c"test_fanotify:watch denied\00"
@.str.3 = [2 x i8] c"r\00"
@POLLIN = global i32 0
@.str.4 = [30 x i8] c"test_fanotify:can't open file\00"
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 i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca %struct.pollfd
%14 = alloca i32
%15 = alloca [200 x %struct.fanotify_event_metadata]
%16 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 (...) @printUsage()
br label %21
21: ; preds = %19, %2
%22 = load i32, i32* @FAN_OPEN
store i32 %22, i32* %9
%23 = load i32, i32* @FAN_MARK_ADD
store i32 %23, i32* %10
store i32 0, i32* %11
br label %24
24: ; preds = %46, %21
%25 = load i32, i32* %4
%26 = load i8**, i8*** %5
%27 = call i32 @getopt(i32 %25, i8** %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %27, i32* %8
%28 = icmp ne i32 %27, -1
br i1 %28, label %29, label %47
29: ; preds = %24
%30 = load i32, i32* %8
switch i32 %30, label %44 [
i32 112, label %31
i32 114, label %35
i32 108, label %39
i32 109, label %40
]
31: ; preds = %29
%32 = load i32, i32* @FAN_OPEN_PERM
%33 = load i32, i32* %9
%34 = or i32 %33, %32
store i32 %34, i32* %9
br label %46
35: ; preds = %29
%36 = load i32, i32* @FAN_ACCESS
%37 = load i32, i32* %9
%38 = or i32 %37, %36
store i32 %38, i32* %9
br label %46
39: ; preds = %29
store i32 1, i32* %11
br label %46
40: ; preds = %29
%41 = load i32, i32* @FAN_MARK_MOUNT
%42 = load i32, i32* %10
%43 = or i32 %42, %41
store i32 %43, i32* %10
br label %46
44: ; preds = %29
%45 = call i32 (...) @printUsage()
br label %46
46: ; preds = %44, %40, %39, %35, %31
br label %24
47: ; preds = %24
%48 = load i32, i32* @FAN_CLASS_CONTENT
%49 = load i32, i32* @O_RDWR
%50 = call i32 @fanotify_init(i32 %48, i32 %49)
store i32 %50, i32* %6
%51 = load i32, i32* %6
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %47
%54 = call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %47
%57 = load i32, i32* %6
%58 = load i32, i32* %10
%59 = load i32, i32* %9
%60 = load i32, i32* @AT_FDCWD
%61 = load i8**, i8*** %5
%62 = load i64, i64* @optind
%63 = getelementptr inbounds i8*, i8** %61, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 @fanotify_mark(i32 %57, i32 %58, i32 %59, i32 %60, i8* %64)
store i32 %65, i32* %7
%66 = load i32, i32* %7
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %56
%69 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %56
%72 = load i32, i32* %11
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %124
74: ; preds = %71
%75 = call i64 (...) @fork()
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %87
77: ; preds = %74
%78 = load i8**, i8*** %5
%79 = load i64, i64* @optind
%80 = getelementptr inbounds i8*, i8** %78, i64 %79
%81 = load i8*, i8** %80
%82 = call i32* @fopen(i8* %81, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %82, i32** %12
%83 = load i32*, i32** %12
%84 = call i32 @fgetc(i32* %83)
%85 = load i32*, i32** %12
%86 = call i32 @fclose(i32* %85)
br label %123
87: ; preds = %74
%88 = load i32, i32* %6
%89 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %13, i32 0, i32 0
store i32 %88, i32* %89
%90 = load i32, i32* @POLLIN
%91 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %13, i32 0, i32 1
store i32 %90, i32* %91
br label %92
92: ; preds = %121, %87
%93 = load i32, i32* %11
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %122
95: ; preds = %92
%96 = call i32 @poll(%struct.pollfd* %13, i32 1, i32 1)
store i32 %96, i32* %14
%97 = load i32, i32* %14
%98 = icmp sgt i32 %97, 0
br i1 %98, label %99, label %116
99: ; preds = %95
%100 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %13, i32 0, i32 2
%101 = load i32, i32* %100
%102 = load i32, i32* @POLLIN
%103 = and i32 %101, %102
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %115
105: ; preds = %99
%106 = load i32, i32* %6
%107 = bitcast [200 x %struct.fanotify_event_metadata]* %15 to i8*
%108 = call i64 @read(i32 %106, i8* %107, i32 800)
store i64 %108, i64* %16
%109 = load i64, i64* %16
%110 = icmp eq i64 %109, -1
br i1 %110, label %111, label %114
111: ; preds = %105
%112 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %105
store i32 0, i32* %11
br label %122
115: ; preds = %99
br label %121
116: ; preds = %95
%117 = load i32, i32* %14
%118 = icmp eq i32 %117, -1
br i1 %118, label %119, label %120
119: ; preds = %116
store i32 0, i32* %11
br label %120
120: ; preds = %119, %116
br label %121
121: ; preds = %120, %115
br label %92
122: ; preds = %114, %92
br label %123
123: ; preds = %122, %77
br label %124
124: ; preds = %123, %71
%125 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.pollfd = type { i32, i32, i32 }
%struct.fanotify_event_metadata = type { i32 }
@FAN_OPEN = global i32 0
@FAN_MARK_ADD = global i32 0
@.str = [5 x i8] c"prlm\00"
@FAN_OPEN_PERM = global i32 0
@FAN_ACCESS = global i32 0
@FAN_MARK_MOUNT = global i32 0
@FAN_CLASS_CONTENT = global i32 0
@O_RDWR = global i32 0
@.str.1 = [34 x i8] c"fanotify_init:bad file descriptor\00"
@AT_FDCWD = global i32 0
@optind = global i64 0
@.str.2 = [27 x i8] c"test_fanotify:watch denied\00"
@.str.3 = [2 x i8] c"r\00"
@POLLIN = global i32 0
@.str.4 = [30 x i8] c"test_fanotify:can't open file\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.pollfd
%4 = alloca [200 x %struct.fanotify_event_metadata]
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (...) @printUsage()
br label %8
8: ; preds = %6, %2
%9 = load i32, i32* @FAN_OPEN
%10 = load i32, i32* @FAN_MARK_ADD
br label %11
11: ; preds = %20, %8
%12 = phi i1 [ true, %8 ], [ false, %20 ]
%13 = phi i32 [ %10, %8 ], [ %16, %20 ]
%14 = phi i32 [ %9, %8 ], [ %19, %20 ]
br label %15
15: ; preds = %11, %27
%16 = phi i32 [ %13, %11 ], [ %29, %27 ]
%17 = phi i32 [ %14, %11 ], [ %19, %27 ]
br label %18
18: ; preds = %23, %15
%19 = phi i32 [ %17, %15 ], [ %26, %23 ]
br label %20
20: ; preds = %18, %30
%21 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %21, label %30 [
i32 -1, label %32
i32 112, label %23
i32 114, label %22
i32 108, label %11
i32 109, label %27
]
22: ; preds = %20
br label %23
23: ; preds = %20, %22
%24 = phi i32* [ @FAN_ACCESS, %22 ], [ @FAN_OPEN_PERM, %20 ]
%25 = load i32, i32* %24
%26 = or i32 %25, %19
br label %18
27: ; preds = %20
%28 = load i32, i32* @FAN_MARK_MOUNT
%29 = or i32 %28, %16
br label %15
30: ; preds = %20
%31 = tail call i32 (...) @printUsage()
br label %20
32: ; preds = %20
%33 = load i32, i32* @FAN_CLASS_CONTENT
%34 = load i32, i32* @O_RDWR
%35 = tail call i32 @fanotify_init(i32 %33, i32 %34)
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = tail call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%39 = tail call i32 @exit(i32 1)
unreachable
40: ; preds = %32
%41 = load i32, i32* @AT_FDCWD
%42 = load i64, i64* @optind
%43 = getelementptr inbounds i8*, i8** %1, i64 %42
%44 = load i8*, i8** %43
%45 = tail call i32 @fanotify_mark(i32 %35, i32 %16, i32 %19, i32 %41, i8* %44)
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %40
%48 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%49 = tail call i32 @exit(i32 1)
unreachable
50: ; preds = %40
br i1 %12, label %90, label %51
51: ; preds = %50
%52 = tail call i64 (...) @fork()
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = load i64, i64* @optind
%56 = getelementptr inbounds i8*, i8** %1, i64 %55
%57 = load i8*, i8** %56
%58 = tail call i32* @fopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%59 = tail call i32 @fgetc(i32* %58)
%60 = tail call i32 @fclose(i32* %58)
br label %90
61: ; preds = %51
%62 = bitcast %struct.pollfd* %3 to i8*
%63 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 0
store i32 %35, i32* %63
%64 = load i32, i32* @POLLIN
%65 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 1
store i32 %64, i32* %65
%66 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 2
br label %67
67: ; preds = %61, %86
%68 = call i32 @poll(%struct.pollfd* %3, i32 1, i32 1)
%69 = icmp sgt i32 %68, 0
br i1 %69, label %70, label %83
70: ; preds = %67
%71 = load i32, i32* %66
%72 = load i32, i32* @POLLIN
%73 = and i32 %72, %71
%74 = icmp eq i32 %73, 0
br i1 %74, label %86, label %75
75: ; preds = %70
%76 = bitcast [200 x %struct.fanotify_event_metadata]* %4 to i8*
%77 = call i64 @read(i32 %35, i8* %76, i32 800)
%78 = icmp eq i64 %77, -1
br i1 %78, label %79, label %82
79: ; preds = %75
%80 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %75
br label %89
83: ; preds = %67
%84 = icmp ne i32 %68, -1
%85 = zext i1 %84 to i32
br label %86
86: ; preds = %83, %70
%87 = phi i32 [ 1, %70 ], [ %85, %83 ]
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %67
89: ; preds = %86, %82
br label %90
90: ; preds = %54, %89, %50
%91 = call i32 @exit(i32 0)
unreachable
}