#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 /*<<< orphan*/ events;
};
struct inotify_event {
  int dummy;
};
typedef int ssize_t;
typedef int /*<<< orphan*/ evbuf;

/* Variables and functions */
int /*<<< orphan*/ IN_MODIFY;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ POLLIN;
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int inotify_add_watch(int, char *, int /*<<< orphan*/);
int inotify_init();
int open(char *, int /*<<< orphan*/);
int poll(struct pollfd *, int, int);
int /*<<< orphan*/ pwrite(int, char *, int, int /*<<< orphan*/);
int read(int, struct inotify_event *, int);
int /*<<< orphan*/ read_val(char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int);
int main(int argc, char **argv) {
  int ifd = inotify_init();
  if (ifd < 0) {
    fprintf(stderr, "failed to initialize inotify: %d %d : %s\n", ifd, errno,
            strerror(errno));
    return 1;
  }
  int ret =
      inotify_add_watch(ifd, "/sys/kernel/debug/debugfs-test/do-it", IN_MODIFY);
  if (ret < 0) {
    fprintf(stderr, "failed to add watch: %s\n", strerror(errno));
    return 2;
  }
  int fd = open("/sys/kernel/debug/debugfs-test/do-it", O_RDWR);
  if (fd < 0) {
    fprintf(stderr, "failed to open file: %s\n", strerror(errno));
    return 3;
  }
  read_val("initial = %lld\n", fd);
  read_val("     #2 = %lld\n", fd);
  struct pollfd pfd = {.fd = ifd, .events = POLLIN};
  pwrite(fd, "1", 1, 0);
  for (;;) {
    struct inotify_event evbuf[1];
    ret = poll(&pfd, 1, 20000);
    if (ret == 0) {
      read_val("on timeout = %lld\n", fd);
      continue;
    } else if (ret < 0) {
      fprintf(stderr, "error: %s\n", strerror(errno));
      continue;
    }
    ssize_t r = read(ifd, evbuf, sizeof(evbuf));
    if (r != sizeof(evbuf)) {
      fprintf(stderr, "failed to read event: %s\n", strerror(errno));
      return 4;
    }
    read_val("--> change to %lld\n", fd);
    pwrite(fd, "1", 1, 0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <inotify_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    120c <main+0x7c>
mov    0x2e07(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2ded(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    %rax,%r8
lea    0xe07(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1409 <main+0x279>
mov    -0x14(%rbp),%edi
mov    0x2dda(%rip),%rax
mov    (%rax),%edx
lea    0xe0b(%rip),%rsi
call   1060 <inotify_add_watch@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    126b <main+0xdb>
mov    0x2d90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    %rax,%rdx
lea    0xdf7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1409 <main+0x279>
mov    0x2d6e(%rip),%rax
mov    (%rax),%esi
lea    0xdaf(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    12c7 <main+0x137>
mov    0x2d34(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x48(%rbp),%edi
mov    %rax,%rdx
lea    0xdb4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    1409 <main+0x279>
mov    -0x1c(%rbp),%esi
lea    0xdb0(%rip),%rdi
call   1070 <read_val@plt>
mov    -0x1c(%rbp),%esi
lea    0xdb1(%rip),%rdi
call   1070 <read_val@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    0x2ce6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%edi
lea    0xda0(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
lea    -0x28(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4e20,%edx
call   1090 <poll@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1341 <main+0x1b1>
mov    -0x1c(%rbp),%esi
lea    0xd6c(%rip),%rdi
call   1070 <read_val@plt>
jmp    130d <main+0x17d>
cmpl   $0x0,-0x18(%rbp)
jge    137e <main+0x1ee>
mov    0x2c76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    %rax,%rdx
lea    0xd44(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    130d <main+0x17d>
jmp    1383 <main+0x1f3>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1030 <read@plt>
mov    %eax,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    $0x4,%rax
je     13df <main+0x24f>
mov    0x2c1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2c08(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x50(%rbp),%edi
mov    %rax,%rdx
lea    0xcf5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x4,-0x4(%rbp)
jmp    1409 <main+0x279>
mov    -0x1c(%rbp),%esi
lea    0xcf2(%rip),%rdi
call   1070 <read_val@plt>
mov    -0x1c(%rbp),%edi
lea    0xca9(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
jmp    130d <main+0x17d>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1050 <inotify_init@plt>
mov    %eax,%r15d
test   %eax,%eax
js     12de <main+0x14e>
mov    0x2e39(%rip),%rax
mov    (%rax),%edx
lea    0xe6a(%rip),%rsi
mov    %r15d,%edi
call   1060 <inotify_add_watch@plt>
test   %eax,%eax
js     134a <main+0x1ba>
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
lea    0xe4a(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     137b <main+0x1eb>
mov    %eax,%ebp
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
call   1070 <read_val@plt>
lea    0xe8d(%rip),%rdi
mov    %ebp,%esi
call   1070 <read_val@plt>
mov    %r15d,0x8(%rsp)
mov    0x2dc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0xe7d(%rip),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
lea    0x8(%rsp),%rbx
lea    0x10(%rsp),%r13
lea    0xe98(%rip),%r14
jmp    125e <main+0xce>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe4c(%rip),%rdi
mov    %ebp,%esi
call   1070 <read_val@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4e20,%edx
call   1090 <poll@plt>
test   %eax,%eax
je     1250 <main+0xc0>
js     12b0 <main+0x120>
mov    %r15d,%edi
mov    %r13,%rsi
mov    $0x4,%edx
call   1030 <read@plt>
cmp    $0x4,%eax
jne    1319 <main+0x189>
mov    %r14,%rdi
mov    %ebp,%esi
call   1070 <read_val@plt>
mov    %ebp,%edi
lea    0xdff(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1080 <pwrite@plt>
jmp    125e <main+0xce>
mov    0x2d11(%rip),%rax
mov    (%rax),%r12d
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    %r12d,%edi
lea    0xde4(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    125e <main+0xce>
mov    0x2ce3(%rip),%rax
mov    (%rax),%ebx
mov    0x2cd2(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xd02(%rip),%rsi
mov    %ebx,%edi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
jmp    13aa <main+0x21a>
mov    0x2ca8(%rip),%rax
mov    (%rax),%ebx
mov    0x2c97(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd8a(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x4,%eax
jmp    13aa <main+0x21a>
mov    0x2c77(%rip),%rax
mov    (%rax),%ebx
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xce7(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x2,%eax
jmp    13aa <main+0x21a>
mov    0x2c46(%rip),%rax
mov    (%rax),%ebx
mov    0x2c35(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xccf(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x3,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.pollfd = type { i32, i32 }
%struct.inotify_event = type { i32 }
@stderr = global i32 0
@.str = [42 x i8] c"failed to initialize inotify: %d %d : %s\0A\00"
@errno = global i32 0
@.str.1 = [37 x i8] c"/sys/kernel/debug/debugfs-test/do-it\00"
@IN_MODIFY = global i32 0
@.str.2 = [25 x i8] c"failed to add watch: %s\0A\00"
@O_RDWR = global i32 0
@.str.3 = [25 x i8] c"failed to open file: %s\0A\00"
@.str.4 = [16 x i8] c"initial = %lld\0A\00"
@.str.5 = [16 x i8] c" = %lld\0A\00"
@POLLIN = global i32 0
@.str.6 = [2 x i8] c"1\00"
@.str.7 = [19 x i8] c"on timeout = %lld\0A\00"
@.str.8 = [11 x i8] c"error: %s\0A\00"
@.str.9 = [26 x i8] c"failed to read event: %s\0A\00"
@.str.10 = [20 x i8] c"--> change to %lld\0A\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 %struct.pollfd
%10 = alloca [1 x %struct.inotify_event]
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (...) @inotify_init()
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i32, i32* %6
%18 = load i32, i32* @errno
%19 = load i32, i32* @errno
%20 = call i8* @strerror(i32 %19)
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i8* %20)
store i32 1, i32* %3
br label %87
22: ; preds = %2
%23 = load i32, i32* %6
%24 = load i32, i32* @IN_MODIFY
%25 = call i32 @inotify_add_watch(i32 %23, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %24)
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %22
%29 = load i32, i32* @stderr
%30 = load i32, i32* @errno
%31 = call i8* @strerror(i32 %30)
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %31)
store i32 2, i32* %3
br label %87
33: ; preds = %22
%34 = load i32, i32* @O_RDWR
%35 = call i32 @open(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %34)
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %43
38: ; preds = %33
%39 = load i32, i32* @stderr
%40 = load i32, i32* @errno
%41 = call i8* @strerror(i32 %40)
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %41)
store i32 3, i32* %3
br label %87
43: ; preds = %33
%44 = load i32, i32* %8
%45 = call i32 @read_val(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %8
%47 = call i32 @read_val(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %9, i32 0, i32 0
%49 = load i32, i32* %6
store i32 %49, i32* %48
%50 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %9, i32 0, i32 1
%51 = load i32, i32* @POLLIN
store i32 %51, i32* %50
%52 = load i32, i32* %8
%53 = call i32 @pwrite(i32 %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 0)
br label %54
54: ; preds = %82, %64, %58, %43
%55 = call i32 @poll(%struct.pollfd* %9, i32 1, i32 20000)
store i32 %55, i32* %7
%56 = load i32, i32* %7
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load i32, i32* %8
%60 = call i32 @read_val(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %59)
br label %54
61: ; preds = %54
%62 = load i32, i32* %7
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %69
64: ; preds = %61
%65 = load i32, i32* @stderr
%66 = load i32, i32* @errno
%67 = call i8* @strerror(i32 %66)
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %67)
br label %54
69: ; preds = %61
br label %70
70: ; preds = %69
%71 = load i32, i32* %6
%72 = getelementptr inbounds [1 x %struct.inotify_event], [1 x %struct.inotify_event]* %10, i64 0, i64 0
%73 = call i32 @read(i32 %71, %struct.inotify_event* %72, i32 4)
store i32 %73, i32* %11
%74 = load i32, i32* %11
%75 = sext i32 %74 to i64
%76 = icmp ne i64 %75, 4
br i1 %76, label %77, label %82
77: ; preds = %70
%78 = load i32, i32* @stderr
%79 = load i32, i32* @errno
%80 = call i8* @strerror(i32 %79)
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %80)
store i32 4, i32* %3
br label %87
82: ; preds = %70
%83 = load i32, i32* %8
%84 = call i32 @read_val(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 %83)
%85 = load i32, i32* %8
%86 = call i32 @pwrite(i32 %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 0)
br label %54
87: ; preds = %77, %38, %28, %15
%88 = load i32, i32* %3
ret i32 %88
}

LLVM IR (-O2):
%struct.pollfd = type { i32, i32 }
%struct.inotify_event = type { i32 }
@stderr = global i32 0
@.str = [42 x i8] c"failed to initialize inotify: %d %d : %s\0A\00"
@errno = global i32 0
@.str.1 = [37 x i8] c"/sys/kernel/debug/debugfs-test/do-it\00"
@IN_MODIFY = global i32 0
@.str.2 = [25 x i8] c"failed to add watch: %s\0A\00"
@O_RDWR = global i32 0
@.str.3 = [25 x i8] c"failed to open file: %s\0A\00"
@.str.4 = [16 x i8] c"initial = %lld\0A\00"
@.str.5 = [16 x i8] c" = %lld\0A\00"
@POLLIN = global i32 0
@.str.6 = [2 x i8] c"1\00"
@.str.7 = [19 x i8] c"on timeout = %lld\0A\00"
@.str.8 = [11 x i8] c"error: %s\0A\00"
@.str.9 = [26 x i8] c"failed to read event: %s\0A\00"
@.str.10 = [20 x i8] c"--> change to %lld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.pollfd
%4 = alloca [1 x %struct.inotify_event]
%5 = tail call i32 (...) @inotify_init()
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %9, i8* %10)
br label %64
12: ; preds = %2
%13 = load i32, i32* @IN_MODIFY
%14 = tail call i32 @inotify_add_watch(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = load i32, i32* @errno
%19 = tail call i8* @strerror(i32 %18)
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %64
21: ; preds = %12
%22 = load i32, i32* @O_RDWR
%23 = tail call i32 @open(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i32, i32* @stderr
%27 = load i32, i32* @errno
%28 = tail call i8* @strerror(i32 %27)
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %28)
br label %64
30: ; preds = %21
%31 = tail call i32 @read_val(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%32 = tail call i32 @read_val(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%33 = bitcast %struct.pollfd* %3 to i8*
%34 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 0
store i32 %5, i32* %34
%35 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 1
%36 = load i32, i32* @POLLIN
store i32 %36, i32* %35
%37 = tail call i32 @pwrite(i32 %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 0)
%38 = getelementptr inbounds [1 x %struct.inotify_event], [1 x %struct.inotify_event]* %4, i64 0, i64 0
%39 = bitcast [1 x %struct.inotify_event]* %4 to i8*
br label %40
40: ; preds = %58, %30
%41 = call i32 @poll(%struct.pollfd* %3, i32 1, i32 20000)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @read_val(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %23)
br label %58
45: ; preds = %40
%46 = icmp slt i32 %41, 0
br i1 %46, label %47, label %52
47: ; preds = %45
%48 = load i32, i32* @stderr
%49 = load i32, i32* @errno
%50 = call i8* @strerror(i32 %49)
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %50)
br label %58
52: ; preds = %45
%53 = call i32 @read(i32 %5, %struct.inotify_event* %38, i32 4)
%54 = icmp eq i32 %53, 4
br i1 %54, label %55, label %59
55: ; preds = %52
%56 = call i32 @read_val(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 %23)
%57 = call i32 @pwrite(i32 %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 0)
br label %58
58: ; preds = %55, %47, %43
br label %40
59: ; preds = %52
%60 = load i32, i32* @stderr
%61 = load i32, i32* @errno
%62 = call i8* @strerror(i32 %61)
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %62)
br label %64
64: ; preds = %16, %59, %25, %7
%65 = phi i32 [ 1, %7 ], [ 2, %16 ], [ 3, %25 ], [ 4, %59 ]
ret i32 %65
}