#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;
  scalar_t__ len;
  int /*<<< orphan*/ name;
};

/* Variables and functions */
int EXIT_SUCCESS;
int IN_ACCESS;
int /*<<< orphan*/ IN_ALL_EVENTS;
int IN_ATTRIB;
int IN_CLOSE;
int IN_CLOSE_WRITE;
int IN_CREATE;
int IN_DELETE;
int IN_IGNORED;
int IN_ISDIR;
int IN_MODIFY;
int IN_OPEN;
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ closelog();
int inotify_add_watch(int, char *, int /*<<< orphan*/);
int inotify_init();
int /*<<< orphan*/ inotify_rm_watch(int, int);
int /*<<< orphan*/ perror(char *);
int read(int, char *, int);
int /*<<< orphan*/ skeleton_daemon();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int main(int argc, char *argv[]) {
  int length, i = 0;
  int fd;
  int wd;
  char buffer[(1024 * ((sizeof(struct inotify_event)) + 16))];
  skeleton_daemon();
  syslog(LOG_NOTICE, "------------  First testing daemon started.----------");
  fd = inotify_init();
  if (fd < 0) {
    perror("inotify_init");
  }
  wd = inotify_add_watch(fd, "/home/temp/test", IN_ALL_EVENTS);
  if (wd < 0) {
    syslog(LOG_NOTICE, "wd < 0");
    perror("inotify_add_watch");
  }
  while (1) {
    syslog(LOG_NOTICE, "~~~~~~~ One new testing daemon started.~~~~~~~~~");
    syslog(LOG_NOTICE, "BEFORE READ IN BUFFER");
    length = read(fd, buffer, (1024 * ((sizeof(struct inotify_event)) + 16)));
    syslog(LOG_NOTICE, "AFTER READ IN BUFFER.");
    if (length < 0) {
      perror("read");
    } else if (length == 0) {
      syslog(LOG_NOTICE, " length =0 ");
      continue;
    }
    while (i < length) {
      struct inotify_event *event = (struct inotify_event *)&buffer[i];
      if (event->len) {
        if (event->mask & IN_IGNORED) {
          inotify_rm_watch(fd, wd);
          inotify_add_watch(fd, "/home/test", IN_ALL_EVENTS);
        }
        if (event->mask & IN_ATTRIB) {
          if (event->mask & IN_ISDIR) {
            syslog(LOG_NOTICE, " directory:chaning     ATTRIB .");
            syslog(LOG_NOTICE, " directory:%s ATTRIB .", event->name);
          } else {
            syslog(LOG_NOTICE, " directory:chaning     ATTRIB .");
            syslog(LOG_NOTICE, " file:%s ATTRIB .", event->name);
          }
        }
        if (event->mask & IN_MODIFY) {
          if (event->mask & IN_ISDIR) {
            syslog(LOG_NOTICE, " dirtory:chaning    !!!!!!! .");
            syslog(LOG_NOTICE, " file:%s modify.", event->name);
          } else {
            syslog(LOG_NOTICE, " file  modify:chaning!!! .");
            syslog(LOG_NOTICE, " file:%s modify.", event->name);
          }
        }
        if (event->mask & IN_CLOSE_WRITE) {
          if (event->mask & IN_ISDIR) {
            syslog(LOG_NOTICE, " CLSOE WRITE    !!!!!!! .");
          } else {
            syslog(LOG_NOTICE, " CLSOE WRITE    !!!!!!! .");
          }
        }
        if (event->mask & IN_OPEN) {
          if (event->mask & IN_ISDIR) {
            syslog(LOG_NOTICE, " directory:%s open.", event->name);
          } else {
            syslog(LOG_NOTICE, " file:opening.");
            syslog(LOG_NOTICE, " file:%s open.", event->name);
          }
        }
        if (event->mask & IN_CREATE) {
          if (event->mask & IN_ISDIR) {
            syslog(LOG_NOTICE, "new directory:%s created.", event->name);
          } else {
            syslog(LOG_NOTICE, "new file:%s created.", event->name);
          }
        } else if (event->mask & IN_DELETE) {
          if (event->mask & IN_ISDIR) {
            syslog(LOG_NOTICE, "dir:%s is deleted.", event->name);
          } else {
            syslog(LOG_NOTICE, "file:%s is deleted.", event->name);
          }
        } else if (event->mask & IN_ACCESS) {
          if (event->mask & IN_ISDIR) {
            syslog(LOG_NOTICE, "dir:%s is accessed.", event->name);
          } else {
            syslog(LOG_NOTICE, "file:%s is accessed.", event->name);
          }
        }
        if (event->mask & IN_CLOSE) {
          if (event->mask & IN_ISDIR) {
            syslog(LOG_NOTICE, " directory:%s closed.", event->name);
          } else {
            syslog(LOG_NOTICE, " file:%s closed.", event->name);
          }
        }
      }
      i += (sizeof(struct inotify_event)) + event->len;
    }
    i = 0;
    syslog(LOG_NOTICE, "~~~~~~one testing daemon ended.~~~~~~~~~~");
    sleep(20);
  }
  inotify_rm_watch(fd, wd);
  close(fd);
  syslog(LOG_NOTICE,
         "--------------- first testing daemon terminated.----------------");
  closelog();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <skeleton_daemon@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    $0x0,%al
call   1050 <inotify_init@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    11de <main+0x5e>
lea    0xe5d(%rip),%rdi
call   1080 <perror@plt>
mov    -0x1c(%rbp),%edi
mov    0x2da8(%rip),%rax
mov    (%rax),%edx
lea    0xe52(%rip),%rsi
call   1060 <inotify_add_watch@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    1226 <main+0xa6>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
lea    0xe40(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
lea    0xe39(%rip),%rdi
call   1080 <perror@plt>
jmp    122b <main+0xab>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
lea    0xe31(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
lea    0xe4b(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    -0x1c(%rbp),%edi
lea    -0xa020(%rbp),%rsi
mov    $0xa000,%edx
call   1040 <read@plt>
mov    %eax,-0x14(%rbp)
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
cmpl   $0x0,-0x14(%rbp)
jge    12a2 <main+0x122>
lea    0xe31(%rip),%rdi
call   1080 <perror@plt>
jmp    12cd <main+0x14d>
cmpl   $0x0,-0x14(%rbp)
jne    12c8 <main+0x148>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
lea    0xe12(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    122b <main+0xab>
jmp    12cd <main+0x14d>
jmp    12d2 <main+0x152>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    17df <main+0x65f>
movslq -0x18(%rbp),%rcx
lea    -0xa020(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xa028(%rbp)
mov    -0xa028(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     17c1 <main+0x641>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2ce3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1343 <main+0x1c3>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1090 <inotify_rm_watch@plt>
mov    -0x1c(%rbp),%edi
mov    0x2c5b(%rip),%rax
mov    (%rax),%edx
lea    0xd9c(%rip),%rsi
call   1060 <inotify_add_watch@plt>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2c85(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13f3 <main+0x273>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2c52(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13b6 <main+0x236>
mov    0x2c18(%rip),%rax
mov    (%rax),%edi
lea    0xd5c(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xd5b(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    13ee <main+0x26e>
mov    0x2bdb(%rip),%rax
mov    (%rax),%edi
lea    0xd1f(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xd35(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    13f3 <main+0x273>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2be5(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     14a3 <main+0x323>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2ba2(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1466 <main+0x2e6>
mov    0x2b68(%rip),%rax
mov    (%rax),%edi
lea    0xcf5(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    0x2b51(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xcf2(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    149e <main+0x31e>
mov    0x2b2b(%rip),%rax
mov    (%rax),%edi
lea    0xce7(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    0x2b14(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xcb5(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    14a3 <main+0x323>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2b1d(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1511 <main+0x391>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2af2(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     14f5 <main+0x375>
mov    0x2ab8(%rip),%rax
mov    (%rax),%edi
lea    0xc8f(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    150c <main+0x38c>
mov    0x2a9c(%rip),%rax
mov    (%rax),%edi
lea    0xc73(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    1511 <main+0x391>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2a5f(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     15aa <main+0x42a>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2a84(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     156d <main+0x3ed>
mov    0x2a4a(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xc31(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    15a5 <main+0x425>
mov    0x2a24(%rip),%rax
mov    (%rax),%edi
lea    0xc29(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    0x2a0d(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xc17(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    15aa <main+0x42a>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x29ee(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     162c <main+0x4ac>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x29eb(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1606 <main+0x486>
mov    0x29b1(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xbca(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    1627 <main+0x4a7>
mov    0x298b(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xbbe(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    173a <main+0x5ba>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x298c(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     16ae <main+0x52e>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2969(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1688 <main+0x508>
mov    0x292f(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xb77(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    16a9 <main+0x529>
mov    0x2909(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xb64(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    1735 <main+0x5b5>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x28f2(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1730 <main+0x5b0>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x28e7(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     170a <main+0x58a>
mov    0x28ad(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xb1c(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    172b <main+0x5ab>
mov    0x2887(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xb0a(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    1730 <main+0x5b0>
jmp    1735 <main+0x5b5>
jmp    173a <main+0x5ba>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x2856(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     17bc <main+0x63c>
mov    -0xa028(%rbp),%rax
mov    (%rax),%eax
mov    0x285b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1796 <main+0x616>
mov    0x2821(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xab9(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    17b7 <main+0x637>
mov    0x27fb(%rip),%rax
mov    (%rax),%edi
mov    -0xa028(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xaa9(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    17bc <main+0x63c>
jmp    17c1 <main+0x641>
mov    -0xa028(%rbp),%rax
mov    0x8(%rax),%rcx
add    $0x18,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
jmp    12d2 <main+0x152>
movl   $0x0,-0x18(%rbp)
mov    0x27ab(%rip),%rax
mov    (%rax),%edi
lea    0xa74(%rip),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
mov    $0x14,%edi
call   10a0 <sleep@plt>
jmp    122b <main+0xab>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa018,%rsp
xor    %eax,%eax
call   1030 <skeleton_daemon@plt>
mov    0x2df9(%rip),%r15
mov    (%r15),%edi
lea    0xe57(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
xor    %eax,%eax
call   1050 <inotify_init@plt>
mov    %eax,%r14d
test   %eax,%eax
js     14c6 <main+0x346>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edx
lea    0xe71(%rip),%rsi
mov    %r14d,%edi
call   1060 <inotify_add_watch@plt>
mov    %eax,(%rsp)
test   %eax,%eax
js     14d7 <main+0x357>
mov    0x2dd4(%rip),%rbp
jmp    121b <main+0x9b>
lea    0xed4(%rip),%rdi
call   1080 <perror@plt>
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edi
lea    0x1060(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    $0x14,%edi
call   10a0 <sleep@plt>
mov    (%r15),%edi
lea    0xe47(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    (%r15),%edi
lea    0xe67(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    %r14d,%edi
lea    0x10(%rsp),%rsi
mov    $0xa000,%edx
call   1040 <read@plt>
mov    %eax,%ebx
mov    (%r15),%edi
lea    0xe58(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    %ebx,0x4(%rsp)
test   %ebx,%ebx
js     11ee <main+0x6e>
je     14b0 <main+0x330>
xor    %r12d,%r12d
jmp    12a5 <main+0x125>
nopl   0x0(%rax)
mov    (%r15),%edi
mov    0x20(%rsp,%rbx,1),%edx
xor    %eax,%eax
call   1070 <syslog@plt>
mov    0x8(%rsp),%rax
add    %eax,%r12d
add    $0x18,%r12d
cmp    0x4(%rsp),%r12d
jge    1200 <main+0x80>
movslq %r12d,%rbx
mov    0x18(%rsp,%rbx,1),%rcx
mov    %rcx,%rax
mov    %rcx,0x8(%rsp)
test   %rcx,%rcx
je     128e <main+0x10e>
mov    0x10(%rsp,%rbx,1),%r13d
mov    0x2d32(%rip),%rax
test   %r13d,(%rax)
je     12ee <main+0x16e>
mov    %r14d,%edi
mov    (%rsp),%esi
call   1090 <inotify_rm_watch@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
lea    0xdf1(%rip),%rsi
call   1060 <inotify_add_watch@plt>
mov    0x2ce3(%rip),%rax
test   %r13d,(%rax)
je     1348 <main+0x1c8>
mov    %r15,%rax
mov    %r14d,%r15d
mov    0x0(%rbp),%r14d
and    %r13d,%r14d
mov    %rax,%rbp
mov    (%rax),%edi
lea    0xdd2(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
lea    0xdfb(%rip),%rsi
test   %r14d,%r14d
je     132d <main+0x1ad>
lea    0xdd8(%rip),%rsi
mov    0x0(%rbp),%edi
mov    0x20(%rsp,%rbx,1),%edx
xor    %eax,%eax
call   1070 <syslog@plt>
mov    %r15d,%r14d
mov    %rbp,%r15
mov    0x2c78(%rip),%rbp
mov    0x2c99(%rip),%rax
test   %r13d,(%rax)
je     1389 <main+0x209>
mov    0x0(%rbp),%eax
lea    0xdff(%rip),%rsi
and    %r13d,%eax
je     136a <main+0x1ea>
lea    0xdc4(%rip),%rsi
mov    (%r15),%edi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    (%r15),%edi
mov    0x20(%rsp,%rbx,1),%edx
lea    0xdca(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    0x2c40(%rip),%rax
test   %r13d,(%rax)
je     13a6 <main+0x226>
mov    (%r15),%edi
lea    0xdd9(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    0x2bd3(%rip),%rax
test   %r13d,(%rax)
je     13eb <main+0x26b>
mov    (%r15),%edi
test   %r13d,0x0(%rbp)
je     13c8 <main+0x248>
mov    0x20(%rsp,%rbx,1),%edx
lea    0xdcc(%rip),%rsi
jmp    13e4 <main+0x264>
lea    0xdd7(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    (%r15),%edi
mov    0x20(%rsp,%rbx,1),%edx
lea    0xdd1(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
mov    0x2bb6(%rip),%rax
test   %r13d,(%rax)
je     1410 <main+0x290>
mov    (%r15),%edi
mov    0x20(%rsp,%rbx,1),%edx
test   %r13d,0x0(%rbp)
je     1432 <main+0x2b2>
lea    0xdb9(%rip),%rsi
jmp    1470 <main+0x2f0>
nopl   (%rax)
mov    0x2bb1(%rip),%rax
test   %r13d,(%rax)
je     143b <main+0x2bb>
mov    (%r15),%edi
mov    0x20(%rsp,%rbx,1),%edx
test   %r13d,0x0(%rbp)
je     145d <main+0x2dd>
lea    0xdc3(%rip),%rsi
jmp    1470 <main+0x2f0>
lea    0xda5(%rip),%rsi
jmp    1470 <main+0x2f0>
mov    0x2b6e(%rip),%rax
test   %r13d,(%rax)
je     1477 <main+0x2f7>
mov    (%r15),%edi
mov    0x20(%rsp,%rbx,1),%edx
test   %r13d,0x0(%rbp)
je     1466 <main+0x2e6>
lea    0xdbf(%rip),%rsi
jmp    1470 <main+0x2f0>
lea    0xda2(%rip),%rsi
jmp    1470 <main+0x2f0>
lea    0xdc1(%rip),%rsi
nopl   (%rax)
xor    %eax,%eax
call   1070 <syslog@plt>
mov    0x2b22(%rip),%rax
test   %r13d,(%rax)
je     128e <main+0x10e>
lea    0xdcb(%rip),%rsi
and    0x0(%rbp),%r13d
je     1280 <main+0x100>
lea    0xda4(%rip),%rsi
jmp    1280 <main+0x100>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15),%edi
lea    0xc14(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
jmp    121b <main+0x9b>
lea    0xb69(%rip),%rdi
call   1080 <perror@plt>
jmp    11c2 <main+0x42>
mov    (%r15),%edi
lea    0xb72(%rip),%rsi
xor    %eax,%eax
call   1070 <syslog@plt>
lea    0xb6b(%rip),%rdi
call   1080 <perror@plt>
jmp    11e5 <main+0x65>

LLVM IR (-O0):
%struct.inotify_event = type { i32, i64, i32 }
@LOG_NOTICE = global i32 0
@.str = [54 x i8] c"------------ First testing daemon started.----------\00"
@.str.1 = [13 x i8] c"inotify_init\00"
@.str.2 = [16 x i8] c"/home/temp/test\00"
@IN_ALL_EVENTS = global i32 0
@.str.3 = [7 x i8] c"wd < 0\00"
@.str.4 = [18 x i8] c"inotify_add_watch\00"
@.str.5 = [49 x i8] c"~~~~~~~ One new testing daemon started.~~~~~~~~~\00"
@.str.6 = [22 x i8] c"BEFORE READ IN BUFFER\00"
@.str.7 = [22 x i8] c"AFTER READ IN BUFFER.\00"
@.str.8 = [5 x i8] c"read\00"
@.str.9 = [12 x i8] c" length =0 \00"
@IN_IGNORED = global i32 0
@.str.10 = [11 x i8] c"/home/test\00"
@IN_ATTRIB = global i32 0
@IN_ISDIR = global i32 0
@.str.11 = [32 x i8] c" directory:chaning ATTRIB .\00"
@.str.12 = [23 x i8] c" directory:%s ATTRIB .\00"
@.str.13 = [18 x i8] c" file:%s ATTRIB .\00"
@IN_MODIFY = global i32 0
@.str.14 = [30 x i8] c" dirtory:chaning !!!!!!! .\00"
@.str.15 = [17 x i8] c" file:%s modify.\00"
@.str.16 = [27 x i8] c" file modify:chaning!!! .\00"
@IN_CLOSE_WRITE = global i32 0
@.str.17 = [26 x i8] c" CLSOE WRITE !!!!!!! .\00"
@IN_OPEN = global i32 0
@.str.18 = [20 x i8] c" directory:%s open.\00"
@.str.19 = [15 x i8] c" file:opening.\00"
@.str.20 = [15 x i8] c" file:%s open.\00"
@IN_CREATE = global i32 0
@.str.21 = [26 x i8] c"new directory:%s created.\00"
@.str.22 = [21 x i8] c"new file:%s created.\00"
@IN_DELETE = global i32 0
@.str.23 = [19 x i8] c"dir:%s is deleted.\00"
@.str.24 = [20 x i8] c"file:%s is deleted.\00"
@IN_ACCESS = global i32 0
@.str.25 = [20 x i8] c"dir:%s is accessed.\00"
@.str.26 = [21 x i8] c"file:%s is accessed.\00"
@IN_CLOSE = global i32 0
@.str.27 = [22 x i8] c" directory:%s closed.\00"
@.str.28 = [17 x i8] c" file:%s closed.\00"
@.str.29 = [42 x i8] c"~~~~~~one testing daemon ended.~~~~~~~~~~\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 i32
%10 = alloca [40960 x i8]
%11 = alloca %struct.inotify_event*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%12 = call i32 (...) @skeleton_daemon()
%13 = load i32, i32* @LOG_NOTICE
%14 = call i32 (i32, i8*, ...) @syslog(i32 %13, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (...) @inotify_init()
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %2
%21 = load i32, i32* %8
%22 = load i32, i32* @IN_ALL_EVENTS
%23 = call i32 @inotify_add_watch(i32 %21, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %22)
store i32 %23, i32* %9
%24 = load i32, i32* %9
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = load i32, i32* @LOG_NOTICE
%28 = call i32 (i32, i8*, ...) @syslog(i32 %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %26, %20
br label %31
31: ; preds = %30, %48, %312
%32 = load i32, i32* @LOG_NOTICE
%33 = call i32 (i32, i8*, ...) @syslog(i32 %32, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* @LOG_NOTICE
%35 = call i32 (i32, i8*, ...) @syslog(i32 %34, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%36 = load i32, i32* %8
%37 = getelementptr inbounds [40960 x i8], [40960 x i8]* %10, i64 0, i64 0
%38 = call i32 @read(i32 %36, i8* %37, i32 40960)
store i32 %38, i32* %6
%39 = load i32, i32* @LOG_NOTICE
%40 = call i32 (i32, i8*, ...) @syslog(i32 %39, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%41 = load i32, i32* %6
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %31
%44 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %52
45: ; preds = %31
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32, i32* @LOG_NOTICE
%50 = call i32 (i32, i8*, ...) @syslog(i32 %49, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
br label %31
51: ; preds = %45
br label %52
52: ; preds = %51, %43
br label %53
53: ; preds = %303, %52
%54 = load i32, i32* %7
%55 = load i32, i32* %6
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %312
57: ; preds = %53
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [40960 x i8], [40960 x i8]* %10, i64 0, i64 %59
%61 = bitcast i8* %60 to %struct.inotify_event*
store %struct.inotify_event* %61, %struct.inotify_event** %11
%62 = load %struct.inotify_event*, %struct.inotify_event** %11
%63 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %62, i32 0, i32 1
%64 = load i64, i64* %63
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %303
66: ; preds = %57
%67 = load %struct.inotify_event*, %struct.inotify_event** %11
%68 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %67, i32 0, i32 0
%69 = load i32, i32* %68
%70 = load i32, i32* @IN_IGNORED
%71 = and i32 %69, %70
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %80
73: ; preds = %66
%74 = load i32, i32* %8
%75 = load i32, i32* %9
%76 = call i32 @inotify_rm_watch(i32 %74, i32 %75)
%77 = load i32, i32* %8
%78 = load i32, i32* @IN_ALL_EVENTS
%79 = call i32 @inotify_add_watch(i32 %77, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %78)
br label %80
80: ; preds = %73, %66
%81 = load %struct.inotify_event*, %struct.inotify_event** %11
%82 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %81, i32 0, i32 0
%83 = load i32, i32* %82
%84 = load i32, i32* @IN_ATTRIB
%85 = and i32 %83, %84
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %111
87: ; preds = %80
%88 = load %struct.inotify_event*, %struct.inotify_event** %11
%89 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %88, i32 0, i32 0
%90 = load i32, i32* %89
%91 = load i32, i32* @IN_ISDIR
%92 = and i32 %90, %91
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %102
94: ; preds = %87
%95 = load i32, i32* @LOG_NOTICE
%96 = call i32 (i32, i8*, ...) @syslog(i32 %95, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
%97 = load i32, i32* @LOG_NOTICE
%98 = load %struct.inotify_event*, %struct.inotify_event** %11
%99 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %98, i32 0, i32 2
%100 = load i32, i32* %99
%101 = call i32 (i32, i8*, ...) @syslog(i32 %97, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i32 %100)
br label %110
102: ; preds = %87
%103 = load i32, i32* @LOG_NOTICE
%104 = call i32 (i32, i8*, ...) @syslog(i32 %103, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
%105 = load i32, i32* @LOG_NOTICE
%106 = load %struct.inotify_event*, %struct.inotify_event** %11
%107 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %106, i32 0, i32 2
%108 = load i32, i32* %107
%109 = call i32 (i32, i8*, ...) @syslog(i32 %105, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i32 %108)
br label %110
110: ; preds = %102, %94
br label %111
111: ; preds = %110, %80
%112 = load %struct.inotify_event*, %struct.inotify_event** %11
%113 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %112, i32 0, i32 0
%114 = load i32, i32* %113
%115 = load i32, i32* @IN_MODIFY
%116 = and i32 %114, %115
%117 = icmp ne i32 %116, 0
br i1 %117, label %118, label %142
118: ; preds = %111
%119 = load %struct.inotify_event*, %struct.inotify_event** %11
%120 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %119, i32 0, i32 0
%121 = load i32, i32* %120
%122 = load i32, i32* @IN_ISDIR
%123 = and i32 %121, %122
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %133
125: ; preds = %118
%126 = load i32, i32* @LOG_NOTICE
%127 = call i32 (i32, i8*, ...) @syslog(i32 %126, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0))
%128 = load i32, i32* @LOG_NOTICE
%129 = load %struct.inotify_event*, %struct.inotify_event** %11
%130 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %129, i32 0, i32 2
%131 = load i32, i32* %130
%132 = call i32 (i32, i8*, ...) @syslog(i32 %128, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 %131)
br label %141
133: ; preds = %118
%134 = load i32, i32* @LOG_NOTICE
%135 = call i32 (i32, i8*, ...) @syslog(i32 %134, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0))
%136 = load i32, i32* @LOG_NOTICE
%137 = load %struct.inotify_event*, %struct.inotify_event** %11
%138 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %137, i32 0, i32 2
%139 = load i32, i32* %138
%140 = call i32 (i32, i8*, ...) @syslog(i32 %136, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 %139)
br label %141
141: ; preds = %133, %125
br label %142
142: ; preds = %141, %111
%143 = load %struct.inotify_event*, %struct.inotify_event** %11
%144 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %143, i32 0, i32 0
%145 = load i32, i32* %144
%146 = load i32, i32* @IN_CLOSE_WRITE
%147 = and i32 %145, %146
%148 = icmp ne i32 %147, 0
br i1 %148, label %149, label %163
149: ; preds = %142
%150 = load %struct.inotify_event*, %struct.inotify_event** %11
%151 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %150, i32 0, i32 0
%152 = load i32, i32* %151
%153 = load i32, i32* @IN_ISDIR
%154 = and i32 %152, %153
%155 = icmp ne i32 %154, 0
br i1 %155, label %156, label %159
156: ; preds = %149
%157 = load i32, i32* @LOG_NOTICE
%158 = call i32 (i32, i8*, ...) @syslog(i32 %157, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.17, i64 0, i64 0))
br label %162
159: ; preds = %149
%160 = load i32, i32* @LOG_NOTICE
%161 = call i32 (i32, i8*, ...) @syslog(i32 %160, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.17, i64 0, i64 0))
br label %162
162: ; preds = %159, %156
br label %163
163: ; preds = %162, %142
%164 = load %struct.inotify_event*, %struct.inotify_event** %11
%165 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %164, i32 0, i32 0
%166 = load i32, i32* %165
%167 = load i32, i32* @IN_OPEN
%168 = and i32 %166, %167
%169 = icmp ne i32 %168, 0
br i1 %169, label %170, label %192
170: ; preds = %163
%171 = load %struct.inotify_event*, %struct.inotify_event** %11
%172 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %171, i32 0, i32 0
%173 = load i32, i32* %172
%174 = load i32, i32* @IN_ISDIR
%175 = and i32 %173, %174
%176 = icmp ne i32 %175, 0
br i1 %176, label %177, label %183
177: ; preds = %170
%178 = load i32, i32* @LOG_NOTICE
%179 = load %struct.inotify_event*, %struct.inotify_event** %11
%180 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %179, i32 0, i32 2
%181 = load i32, i32* %180
%182 = call i32 (i32, i8*, ...) @syslog(i32 %178, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.18, i64 0, i64 0), i32 %181)
br label %191
183: ; preds = %170
%184 = load i32, i32* @LOG_NOTICE
%185 = call i32 (i32, i8*, ...) @syslog(i32 %184, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
%186 = load i32, i32* @LOG_NOTICE
%187 = load %struct.inotify_event*, %struct.inotify_event** %11
%188 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %187, i32 0, i32 2
%189 = load i32, i32* %188
%190 = call i32 (i32, i8*, ...) @syslog(i32 %186, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.20, i64 0, i64 0), i32 %189)
br label %191
191: ; preds = %183, %177
br label %192
192: ; preds = %191, %163
%193 = load %struct.inotify_event*, %struct.inotify_event** %11
%194 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %193, i32 0, i32 0
%195 = load i32, i32* %194
%196 = load i32, i32* @IN_CREATE
%197 = and i32 %195, %196
%198 = icmp ne i32 %197, 0
br i1 %198, label %199, label %219
199: ; preds = %192
%200 = load %struct.inotify_event*, %struct.inotify_event** %11
%201 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %200, i32 0, i32 0
%202 = load i32, i32* %201
%203 = load i32, i32* @IN_ISDIR
%204 = and i32 %202, %203
%205 = icmp ne i32 %204, 0
br i1 %205, label %206, label %212
206: ; preds = %199
%207 = load i32, i32* @LOG_NOTICE
%208 = load %struct.inotify_event*, %struct.inotify_event** %11
%209 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %208, i32 0, i32 2
%210 = load i32, i32* %209
%211 = call i32 (i32, i8*, ...) @syslog(i32 %207, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.21, i64 0, i64 0), i32 %210)
br label %218
212: ; preds = %199
%213 = load i32, i32* @LOG_NOTICE
%214 = load %struct.inotify_event*, %struct.inotify_event** %11
%215 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %214, i32 0, i32 2
%216 = load i32, i32* %215
%217 = call i32 (i32, i8*, ...) @syslog(i32 %213, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.22, i64 0, i64 0), i32 %216)
br label %218
218: ; preds = %212, %206
br label %275
219: ; preds = %192
%220 = load %struct.inotify_event*, %struct.inotify_event** %11
%221 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %220, i32 0, i32 0
%222 = load i32, i32* %221
%223 = load i32, i32* @IN_DELETE
%224 = and i32 %222, %223
%225 = icmp ne i32 %224, 0
br i1 %225, label %226, label %246
226: ; preds = %219
%227 = load %struct.inotify_event*, %struct.inotify_event** %11
%228 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %227, i32 0, i32 0
%229 = load i32, i32* %228
%230 = load i32, i32* @IN_ISDIR
%231 = and i32 %229, %230
%232 = icmp ne i32 %231, 0
br i1 %232, label %233, label %239
233: ; preds = %226
%234 = load i32, i32* @LOG_NOTICE
%235 = load %struct.inotify_event*, %struct.inotify_event** %11
%236 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %235, i32 0, i32 2
%237 = load i32, i32* %236
%238 = call i32 (i32, i8*, ...) @syslog(i32 %234, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.23, i64 0, i64 0), i32 %237)
br label %245
239: ; preds = %226
%240 = load i32, i32* @LOG_NOTICE
%241 = load %struct.inotify_event*, %struct.inotify_event** %11
%242 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %241, i32 0, i32 2
%243 = load i32, i32* %242
%244 = call i32 (i32, i8*, ...) @syslog(i32 %240, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.24, i64 0, i64 0), i32 %243)
br label %245
245: ; preds = %239, %233
br label %274
246: ; preds = %219
%247 = load %struct.inotify_event*, %struct.inotify_event** %11
%248 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %247, i32 0, i32 0
%249 = load i32, i32* %248
%250 = load i32, i32* @IN_ACCESS
%251 = and i32 %249, %250
%252 = icmp ne i32 %251, 0
br i1 %252, label %253, label %273
253: ; preds = %246
%254 = load %struct.inotify_event*, %struct.inotify_event** %11
%255 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %254, i32 0, i32 0
%256 = load i32, i32* %255
%257 = load i32, i32* @IN_ISDIR
%258 = and i32 %256, %257
%259 = icmp ne i32 %258, 0
br i1 %259, label %260, label %266
260: ; preds = %253
%261 = load i32, i32* @LOG_NOTICE
%262 = load %struct.inotify_event*, %struct.inotify_event** %11
%263 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %262, i32 0, i32 2
%264 = load i32, i32* %263
%265 = call i32 (i32, i8*, ...) @syslog(i32 %261, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.25, i64 0, i64 0), i32 %264)
br label %272
266: ; preds = %253
%267 = load i32, i32* @LOG_NOTICE
%268 = load %struct.inotify_event*, %struct.inotify_event** %11
%269 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %268, i32 0, i32 2
%270 = load i32, i32* %269
%271 = call i32 (i32, i8*, ...) @syslog(i32 %267, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.26, i64 0, i64 0), i32 %270)
br label %272
272: ; preds = %266, %260
br label %273
273: ; preds = %272, %246
br label %274
274: ; preds = %273, %245
br label %275
275: ; preds = %274, %218
%276 = load %struct.inotify_event*, %struct.inotify_event** %11
%277 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %276, i32 0, i32 0
%278 = load i32, i32* %277
%279 = load i32, i32* @IN_CLOSE
%280 = and i32 %278, %279
%281 = icmp ne i32 %280, 0
br i1 %281, label %282, label %302
282: ; preds = %275
%283 = load %struct.inotify_event*, %struct.inotify_event** %11
%284 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %283, i32 0, i32 0
%285 = load i32, i32* %284
%286 = load i32, i32* @IN_ISDIR
%287 = and i32 %285, %286
%288 = icmp ne i32 %287, 0
br i1 %288, label %289, label %295
289: ; preds = %282
%290 = load i32, i32* @LOG_NOTICE
%291 = load %struct.inotify_event*, %struct.inotify_event** %11
%292 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %291, i32 0, i32 2
%293 = load i32, i32* %292
%294 = call i32 (i32, i8*, ...) @syslog(i32 %290, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.27, i64 0, i64 0), i32 %293)
br label %301
295: ; preds = %282
%296 = load i32, i32* @LOG_NOTICE
%297 = load %struct.inotify_event*, %struct.inotify_event** %11
%298 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %297, i32 0, i32 2
%299 = load i32, i32* %298
%300 = call i32 (i32, i8*, ...) @syslog(i32 %296, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.28, i64 0, i64 0), i32 %299)
br label %301
301: ; preds = %295, %289
br label %302
302: ; preds = %301, %275
br label %303
303: ; preds = %302, %57
%304 = load %struct.inotify_event*, %struct.inotify_event** %11
%305 = getelementptr inbounds %struct.inotify_event, %struct.inotify_event* %304, i32 0, i32 1
%306 = load i64, i64* %305
%307 = add i64 24, %306
%308 = load i32, i32* %7
%309 = sext i32 %308 to i64
%310 = add i64 %309, %307
%311 = trunc i64 %310 to i32
store i32 %311, i32* %7
br label %53
312: ; preds = %53
store i32 0, i32* %7
%313 = load i32, i32* @LOG_NOTICE
%314 = call i32 (i32, i8*, ...) @syslog(i32 %313, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.29, i64 0, i64 0))
%315 = call i32 @sleep(i32 20)
br label %31
}

LLVM IR (-O2):
@LOG_NOTICE = global i32 0
@.str = [54 x i8] c"------------ First testing daemon started.----------\00"
@.str.1 = [13 x i8] c"inotify_init\00"
@.str.2 = [16 x i8] c"/home/temp/test\00"
@IN_ALL_EVENTS = global i32 0
@.str.3 = [7 x i8] c"wd < 0\00"
@.str.4 = [18 x i8] c"inotify_add_watch\00"
@.str.5 = [49 x i8] c"~~~~~~~ One new testing daemon started.~~~~~~~~~\00"
@.str.6 = [22 x i8] c"BEFORE READ IN BUFFER\00"
@.str.7 = [22 x i8] c"AFTER READ IN BUFFER.\00"
@.str.8 = [5 x i8] c"read\00"
@.str.9 = [12 x i8] c" length =0 \00"
@IN_IGNORED = global i32 0
@.str.10 = [11 x i8] c"/home/test\00"
@IN_ATTRIB = global i32 0
@IN_ISDIR = global i32 0
@.str.11 = [32 x i8] c" directory:chaning ATTRIB .\00"
@.str.12 = [23 x i8] c" directory:%s ATTRIB .\00"
@.str.13 = [18 x i8] c" file:%s ATTRIB .\00"
@IN_MODIFY = global i32 0
@.str.14 = [30 x i8] c" dirtory:chaning !!!!!!! .\00"
@.str.15 = [17 x i8] c" file:%s modify.\00"
@.str.16 = [27 x i8] c" file modify:chaning!!! .\00"
@IN_CLOSE_WRITE = global i32 0
@.str.17 = [26 x i8] c" CLSOE WRITE !!!!!!! .\00"
@IN_OPEN = global i32 0
@.str.18 = [20 x i8] c" directory:%s open.\00"
@.str.19 = [15 x i8] c" file:opening.\00"
@.str.20 = [15 x i8] c" file:%s open.\00"
@IN_CREATE = global i32 0
@.str.21 = [26 x i8] c"new directory:%s created.\00"
@.str.22 = [21 x i8] c"new file:%s created.\00"
@IN_DELETE = global i32 0
@.str.23 = [19 x i8] c"dir:%s is deleted.\00"
@.str.24 = [20 x i8] c"file:%s is deleted.\00"
@IN_ACCESS = global i32 0
@.str.25 = [20 x i8] c"dir:%s is accessed.\00"
@.str.26 = [21 x i8] c"file:%s is accessed.\00"
@IN_CLOSE = global i32 0
@.str.27 = [22 x i8] c" directory:%s closed.\00"
@.str.28 = [17 x i8] c" file:%s closed.\00"
@.str.29 = [42 x i8] c"~~~~~~one testing daemon ended.~~~~~~~~~~\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [40960 x i8]
%4 = getelementptr inbounds [40960 x i8], [40960 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (...) @skeleton_daemon()
%6 = load i32, i32* @LOG_NOTICE
%7 = tail call i32 (i32, i8*, ...) @syslog(i32 %6, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (...) @inotify_init()
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i32, i32* @IN_ALL_EVENTS
%14 = tail call i32 @inotify_add_watch(i32 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* @LOG_NOTICE
%18 = tail call i32 (i32, i8*, ...) @syslog(i32 %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%19 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %16, %12
br label %21
21: ; preds = %35, %20
%22 = load i32, i32* @LOG_NOTICE
%23 = tail call i32 (i32, i8*, ...) @syslog(i32 %22, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32, i32* @LOG_NOTICE
%25 = tail call i32 (i32, i8*, ...) @syslog(i32 %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%26 = call i32 @read(i32 %8, i8* %4, i32 40960)
%27 = load i32, i32* @LOG_NOTICE
%28 = tail call i32 (i32, i8*, ...) @syslog(i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%29 = icmp slt i32 %26, 0
br i1 %29, label %36, label %30
30: ; preds = %21
%31 = icmp eq i32 %26, 0
br i1 %31, label %32, label %38
32: ; preds = %30
%33 = load i32, i32* @LOG_NOTICE
%34 = tail call i32 (i32, i8*, ...) @syslog(i32 %33, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
br label %35
35: ; preds = %32, %183
br label %21
36: ; preds = %21
%37 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %183
38: ; preds = %30, %178
%39 = phi i32 [ %181, %178 ], [ 0, %30 ]
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [40960 x i8], [40960 x i8]* %3, i64 0, i64 %40
%42 = getelementptr inbounds i8, i8* %41, i64 8
%43 = bitcast i8* %42 to i64*
%44 = load i64, i64* %43
%45 = icmp eq i64 %44, 0
br i1 %45, label %178, label %46
46: ; preds = %38
%47 = bitcast i8* %41 to i32*
%48 = load i32, i32* %47
%49 = load i32, i32* @IN_IGNORED
%50 = and i32 %49, %48
%51 = icmp eq i32 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %46
%53 = tail call i32 @inotify_rm_watch(i32 %8, i32 %14)
%54 = load i32, i32* @IN_ALL_EVENTS
%55 = tail call i32 @inotify_add_watch(i32 %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %52, %46
%57 = load i32, i32* @IN_ATTRIB
%58 = and i32 %57, %48
%59 = icmp eq i32 %58, 0
br i1 %59, label %72, label %60
60: ; preds = %56
%61 = load i32, i32* @IN_ISDIR
%62 = and i32 %61, %48
%63 = icmp eq i32 %62, 0
%64 = load i32, i32* @LOG_NOTICE
%65 = tail call i32 (i32, i8*, ...) @syslog(i32 %64, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.11, i64 0, i64 0))
%66 = load i32, i32* @LOG_NOTICE
%67 = getelementptr inbounds i8, i8* %41, i64 16
%68 = bitcast i8* %67 to i32*
%69 = load i32, i32* %68
%70 = select i1 %63, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0)
%71 = tail call i32 (i32, i8*, ...) @syslog(i32 %66, i8* %70, i32 %69)
br label %72
72: ; preds = %60, %56
%73 = load i32, i32* @IN_MODIFY
%74 = and i32 %73, %48
%75 = icmp eq i32 %74, 0
br i1 %75, label %88, label %76
76: ; preds = %72
%77 = load i32, i32* @IN_ISDIR
%78 = and i32 %77, %48
%79 = icmp eq i32 %78, 0
%80 = load i32, i32* @LOG_NOTICE
%81 = select i1 %79, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0)
%82 = tail call i32 (i32, i8*, ...) @syslog(i32 %80, i8* %81)
%83 = load i32, i32* @LOG_NOTICE
%84 = getelementptr inbounds i8, i8* %41, i64 16
%85 = bitcast i8* %84 to i32*
%86 = load i32, i32* %85
%87 = tail call i32 (i32, i8*, ...) @syslog(i32 %83, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0), i32 %86)
br label %88
88: ; preds = %76, %72
%89 = load i32, i32* @IN_CLOSE_WRITE
%90 = and i32 %89, %48
%91 = icmp eq i32 %90, 0
br i1 %91, label %95, label %92
92: ; preds = %88
%93 = load i32, i32* @LOG_NOTICE
%94 = tail call i32 (i32, i8*, ...) @syslog(i32 %93, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.17, i64 0, i64 0))
br label %95
95: ; preds = %92, %88
%96 = load i32, i32* @IN_OPEN
%97 = and i32 %96, %48
%98 = icmp eq i32 %97, 0
br i1 %98, label %116, label %99
99: ; preds = %95
%100 = load i32, i32* @IN_ISDIR
%101 = and i32 %100, %48
%102 = icmp eq i32 %101, 0
%103 = load i32, i32* @LOG_NOTICE
br i1 %102, label %109, label %104
104: ; preds = %99
%105 = getelementptr inbounds i8, i8* %41, i64 16
%106 = bitcast i8* %105 to i32*
%107 = load i32, i32* %106
%108 = tail call i32 (i32, i8*, ...) @syslog(i32 %103, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.18, i64 0, i64 0), i32 %107)
br label %116
109: ; preds = %99
%110 = tail call i32 (i32, i8*, ...) @syslog(i32 %103, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0))
%111 = load i32, i32* @LOG_NOTICE
%112 = getelementptr inbounds i8, i8* %41, i64 16
%113 = bitcast i8* %112 to i32*
%114 = load i32, i32* %113
%115 = tail call i32 (i32, i8*, ...) @syslog(i32 %111, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.20, i64 0, i64 0), i32 %114)
br label %116
116: ; preds = %104, %109, %95
%117 = load i32, i32* @IN_CREATE
%118 = and i32 %117, %48
%119 = icmp eq i32 %118, 0
br i1 %119, label %132, label %120
120: ; preds = %116
%121 = load i32, i32* @IN_ISDIR
%122 = and i32 %121, %48
%123 = icmp eq i32 %122, 0
%124 = load i32, i32* @LOG_NOTICE
%125 = getelementptr inbounds i8, i8* %41, i64 16
%126 = bitcast i8* %125 to i32*
%127 = load i32, i32* %126
br i1 %123, label %130, label %128
128: ; preds = %120
%129 = tail call i32 (i32, i8*, ...) @syslog(i32 %124, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.21, i64 0, i64 0), i32 %127)
br label %164
130: ; preds = %120
%131 = tail call i32 (i32, i8*, ...) @syslog(i32 %124, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.22, i64 0, i64 0), i32 %127)
br label %164
132: ; preds = %116
%133 = load i32, i32* @IN_DELETE
%134 = and i32 %133, %48
%135 = icmp eq i32 %134, 0
br i1 %135, label %148, label %136
136: ; preds = %132
%137 = load i32, i32* @IN_ISDIR
%138 = and i32 %137, %48
%139 = icmp eq i32 %138, 0
%140 = load i32, i32* @LOG_NOTICE
%141 = getelementptr inbounds i8, i8* %41, i64 16
%142 = bitcast i8* %141 to i32*
%143 = load i32, i32* %142
br i1 %139, label %146, label %144
144: ; preds = %136
%145 = tail call i32 (i32, i8*, ...) @syslog(i32 %140, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.23, i64 0, i64 0), i32 %143)
br label %164
146: ; preds = %136
%147 = tail call i32 (i32, i8*, ...) @syslog(i32 %140, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.24, i64 0, i64 0), i32 %143)
br label %164
148: ; preds = %132
%149 = load i32, i32* @IN_ACCESS
%150 = and i32 %149, %48
%151 = icmp eq i32 %150, 0
br i1 %151, label %164, label %152
152: ; preds = %148
%153 = load i32, i32* @IN_ISDIR
%154 = and i32 %153, %48
%155 = icmp eq i32 %154, 0
%156 = load i32, i32* @LOG_NOTICE
%157 = getelementptr inbounds i8, i8* %41, i64 16
%158 = bitcast i8* %157 to i32*
%159 = load i32, i32* %158
br i1 %155, label %162, label %160
160: ; preds = %152
%161 = tail call i32 (i32, i8*, ...) @syslog(i32 %156, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.25, i64 0, i64 0), i32 %159)
br label %164
162: ; preds = %152
%163 = tail call i32 (i32, i8*, ...) @syslog(i32 %156, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.26, i64 0, i64 0), i32 %159)
br label %164
164: ; preds = %146, %144, %160, %162, %148, %128, %130
%165 = load i32, i32* @IN_CLOSE
%166 = and i32 %165, %48
%167 = icmp eq i32 %166, 0
br i1 %167, label %178, label %168
168: ; preds = %164
%169 = load i32, i32* @IN_ISDIR
%170 = and i32 %169, %48
%171 = icmp eq i32 %170, 0
%172 = load i32, i32* @LOG_NOTICE
%173 = getelementptr inbounds i8, i8* %41, i64 16
%174 = bitcast i8* %173 to i32*
%175 = load i32, i32* %174
%176 = select i1 %171, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.28, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.27, i64 0, i64 0)
%177 = tail call i32 (i32, i8*, ...) @syslog(i32 %172, i8* %176, i32 %175)
br label %178
178: ; preds = %168, %164, %38
%179 = trunc i64 %44 to i32
%180 = add i32 %39, 24
%181 = add i32 %180, %179
%182 = icmp slt i32 %181, %26
br i1 %182, label %38, label %183
183: ; preds = %178, %36
%184 = load i32, i32* @LOG_NOTICE
%185 = tail call i32 (i32, i8*, ...) @syslog(i32 %184, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.29, i64 0, i64 0))
%186 = tail call i32 @sleep(i32 20)
br label %35
}