#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 */
scalar_t__ inotify_backend_ignore(int);
int inotify_map_get_wd(char const *);
scalar_t__ inotify_unmap_path(char const *);
int /*<<< orphan*/ logmsg(int, char *, int, char const *);
int inotify_ignore(const char *path) {
  int wd = inotify_map_get_wd(path);
  if (wd <= 0)
    return -1;
  if (inotify_unmap_path(path) == 0) {
    logmsg((1 << 3), "remove watch: %i %s", wd, path);
    if (inotify_backend_ignore(wd) < 0)
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<inotify_ignore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <inotify_map_get_wd@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     116e <inotify_ignore+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c3 <inotify_ignore+0x83>
mov    -0x10(%rbp),%rdi
call   1060 <inotify_unmap_path@plt>
cmp    $0x0,%rax
jne    11bc <inotify_ignore+0x7c>
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x8,%edi
lea    0xe6c(%rip),%rsi
call   1040 <logmsg@plt>
mov    -0x14(%rbp),%edi
call   1050 <inotify_backend_ignore@plt>
cmp    $0x0,%rax
jge    11b7 <inotify_ignore+0x77>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c3 <inotify_ignore+0x83>
jmp    11bc <inotify_ignore+0x7c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inotify_ignore>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <inotify_map_get_wd@plt>
mov    $0xffffffff,%r14d
test   %eax,%eax
jle    118a <inotify_ignore+0x4a>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <inotify_unmap_path@plt>
test   %rax,%rax
jne    1187 <inotify_ignore+0x47>
lea    0xe94(%rip),%rsi
mov    $0x8,%edi
mov    %ebp,%edx
mov    %rbx,%rcx
call   1040 <logmsg@plt>
mov    %ebp,%edi
call   1050 <inotify_backend_ignore@plt>
test   %rax,%rax
js     118a <inotify_ignore+0x4a>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"remove watch: %i %s\00"
define i32 @inotify_ignore(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @inotify_map_get_wd(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %24
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i64 @inotify_unmap_path(i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i32, i32* %4
%16 = load i8*, i8** %3
%17 = call i32 @logmsg(i32 8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %16)
%18 = load i32, i32* %4
%19 = call i64 @inotify_backend_ignore(i32 %18)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %14
store i32 -1, i32* %2
br label %24
22: ; preds = %14
br label %23
23: ; preds = %22, %10
store i32 0, i32* %2
br label %24
24: ; preds = %23, %21, %9
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [20 x i8] c"remove watch: %i %s\00"
define i32 @inotify_ignore(i8* %0) {
%2 = tail call i32 @inotify_map_get_wd(i8* %0)
%3 = icmp slt i32 %2, 1
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = tail call i64 @inotify_unmap_path(i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i32 @logmsg(i32 8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2, i8* %0)
%9 = tail call i64 @inotify_backend_ignore(i32 %2)
%10 = icmp slt i64 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7, %4
br label %12
12: ; preds = %7, %1, %11
%13 = phi i32 [ 0, %11 ], [ -1, %1 ], [ -1, %7 ]
ret i32 %13
}