#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 */

/* Variables and functions */
int IN_ALL_EVENTS;
int IN_MODIFY;
int inotify_add_watch(int, char *, int);
int inotify_init();
int /*<<< orphan*/ inotify_init1(int);
int /*<<< orphan*/ inotify_rm_watch(int, int);
int main() {
  int fd = inotify_init();
  int wd = inotify_add_watch(fd, "/tmp", IN_ALL_EVENTS);
  inotify_rm_watch(fd, wd);
  inotify_init1(-1);
  inotify_add_watch(-1, "/tmp", IN_MODIFY);
  inotify_add_watch(fd, (char *)-1, IN_MODIFY);
  wd = inotify_add_watch(fd, "/tmp", -1);
  inotify_rm_watch(fd, wd);
  inotify_rm_watch(-1, wd);
  inotify_rm_watch(fd, -1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <inotify_init@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
lea    0xe94(%rip),%rsi
call   1040 <inotify_add_watch@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <inotify_rm_watch@plt>
mov    $0xffffffff,%edi
call   1060 <inotify_init1@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    0xe62(%rip),%rsi
call   1040 <inotify_add_watch@plt>
mov    -0x8(%rbp),%edi
mov    0x2e43(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffffffffffff,%rsi
call   1040 <inotify_add_watch@plt>
mov    -0x8(%rbp),%edi
lea    0xe3b(%rip),%rsi
mov    $0xffffffff,%edx
call   1040 <inotify_add_watch@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <inotify_rm_watch@plt>
mov    -0xc(%rbp),%esi
mov    $0xffffffff,%edi
call   1050 <inotify_rm_watch@plt>
mov    -0x8(%rbp),%edi
mov    $0xffffffff,%esi
call   1050 <inotify_rm_watch@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <inotify_init@plt>
mov    %eax,%ebx
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
lea    0xea3(%rip),%r14
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <inotify_add_watch@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <inotify_rm_watch@plt>
mov    $0xffffffff,%edi
call   1060 <inotify_init1@plt>
mov    0x2e6f(%rip),%rbp
mov    0x0(%rbp),%edx
mov    $0xffffffff,%edi
mov    %r14,%rsi
call   1040 <inotify_add_watch@plt>
mov    0x0(%rbp),%edx
mov    %ebx,%edi
mov    $0xffffffffffffffff,%rsi
call   1040 <inotify_add_watch@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0xffffffff,%edx
call   1040 <inotify_add_watch@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <inotify_rm_watch@plt>
mov    $0xffffffff,%edi
mov    %ebp,%esi
call   1050 <inotify_rm_watch@plt>
mov    %ebx,%edi
mov    $0xffffffff,%esi
call   1050 <inotify_rm_watch@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"/tmp\00"
@IN_ALL_EVENTS = global i32 0
@IN_MODIFY = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @inotify_init()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @IN_ALL_EVENTS
%7 = call i32 @inotify_add_watch(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @inotify_rm_watch(i32 %8, i32 %9)
%11 = call i32 @inotify_init1(i32 -1)
%12 = load i32, i32* @IN_MODIFY
%13 = call i32 @inotify_add_watch(i32 -1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = load i32, i32* @IN_MODIFY
%16 = call i32 @inotify_add_watch(i32 %14, i8* inttoptr (i64 -1 to i8*), i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @inotify_add_watch(i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 -1)
store i32 %18, i32* %3
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @inotify_rm_watch(i32 %19, i32 %20)
%22 = load i32, i32* %3
%23 = call i32 @inotify_rm_watch(i32 -1, i32 %22)
%24 = load i32, i32* %2
%25 = call i32 @inotify_rm_watch(i32 %24, i32 -1)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"/tmp\00"
@IN_ALL_EVENTS = global i32 0
@IN_MODIFY = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @inotify_init()
%2 = load i32, i32* @IN_ALL_EVENTS
%3 = tail call i32 @inotify_add_watch(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @inotify_rm_watch(i32 %1, i32 %3)
%5 = tail call i32 @inotify_init1(i32 -1)
%6 = load i32, i32* @IN_MODIFY
%7 = tail call i32 @inotify_add_watch(i32 -1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @IN_MODIFY
%9 = tail call i32 @inotify_add_watch(i32 %1, i8* inttoptr (i64 -1 to i8*), i32 %8)
%10 = tail call i32 @inotify_add_watch(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 -1)
%11 = tail call i32 @inotify_rm_watch(i32 %1, i32 %10)
%12 = tail call i32 @inotify_rm_watch(i32 -1, i32 %10)
%13 = tail call i32 @inotify_rm_watch(i32 %1, i32 -1)
ret i32 0
}