#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 */
typedef int time_t;
typedef int off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _IOLBF;
int ccn_filewatch(char const *, int /*<<< orphan*/ *, int, int, int, int, int);
int /*<<< orphan*/ exit(int);
int getopt(int, char **, char *);
size_t optind;
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  int opt = 0;
  int res = 0;
  const char *path = NULL;
  FILE *out = stdout;
  off_t minsize = 1;
  off_t maxsize = 0;
  time_t maxsec = 600;
  int msecstable = 5000;
  int msecpoll = 100;
  while ((opt = getopt(argc, argv, "h")) != -1) {
    switch (opt) {
    case 'a':
      break;
    case 'h':
    default:
      usage(argv[0]);
    }
  }
  if (argv[optind] == NULL || argv[optind + 1] != NULL)
    usage(argv[0]);
  path = argv[optind];
  setvbuf(out, NULL, _IOLBF, 0);
  res =
      ccn_filewatch(path, out, minsize, maxsize, maxsec, msecstable, msecpoll);
  if (res == -1)
    perror(path);
  exit(-res);
}


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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2e3d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x258,-0x34(%rbp)
movl   $0x1388,-0x38(%rbp)
movl   $0x64,-0x3c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe35(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     121c <main+0xbc>
mov    -0x14(%rbp),%eax
mov    %eax,-0x40(%rbp)
sub    $0x61,%eax
je     1201 <main+0xa1>
jmp    11f0 <main+0x90>
mov    -0x40(%rbp),%eax
sub    $0x68,%eax
je     1206 <main+0xa6>
jmp    120b <main+0xab>
jmp    1217 <main+0xb7>
jmp    120b <main+0xab>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usage@plt>
jmp    11bd <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x2dc1(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     124f <main+0xef>
mov    -0x10(%rbp),%rax
mov    0x2da8(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,0x8(%rax,%rcx,8)
je     125b <main+0xfb>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x2d82(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2d5c(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    -0x3c(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <ccn_filewatch@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    12c0 <main+0x160>
mov    -0x20(%rbp),%rdi
call   1060 <perror@plt>
xor    %edi,%edi
sub    -0x18(%rbp),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e5d(%rip),%rax
mov    (%rax),%r14
lea    0xe83(%rip),%r15
nopl   (%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1070 <getopt@plt>
cmp    $0x61,%eax
je     1180 <main+0x20>
cmp    $0xffffffff,%eax
je     11a1 <main+0x41>
mov    (%rbx),%rdi
call   1040 <usage@plt>
jmp    1180 <main+0x20>
mov    0x2e40(%rip),%rbp
mov    0x0(%rbp),%rax
mov    (%rbx,%rax,8),%r15
test   %r15,%r15
je     11bd <main+0x5d>
cmpq   $0x0,0x8(%rbx,%rax,8)
je     11cd <main+0x6d>
mov    (%rbx),%rdi
call   1040 <usage@plt>
mov    0x0(%rbp),%rax
mov    (%rbx,%rax,8),%r15
mov    0x2e04(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
xor    %ecx,%ecx
call   1050 <setvbuf@plt>
movl   $0x64,(%rsp)
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
mov    $0x258,%r8d
mov    $0x1388,%r9d
call   1030 <ccn_filewatch@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1216 <main+0xb6>
mov    %r15,%rdi
call   1060 <perror@plt>
neg    %ebx
mov    %ebx,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stdout = global i32* null
@.str = [2 x i8] c"h\00"
@optind = global i64 0
@_IOLBF = 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 i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i8* null, i8** %8
%15 = load i32*, i32** @stdout
store i32* %15, i32** %9
store i32 1, i32* %10
store i32 0, i32* %11
store i32 600, i32* %12
store i32 5000, i32* %13
store i32 100, i32* %14
br label %16
16: ; preds = %30, %2
%17 = load i32, i32* %4
%18 = load i8**, i8*** %5
%19 = call i32 @getopt(i32 %17, i8** %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %19, i32* %6
%20 = icmp ne i32 %19, -1
br i1 %20, label %21, label %31
21: ; preds = %16
%22 = load i32, i32* %6
switch i32 %22, label %25 [
i32 97, label %23
i32 104, label %24
]
23: ; preds = %21
br label %30
24: ; preds = %21
br label %25
25: ; preds = %21, %24
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 @usage(i8* %28)
br label %30
30: ; preds = %25, %23
br label %16
31: ; preds = %16
%32 = load i8**, i8*** %5
%33 = load i64, i64* @optind
%34 = getelementptr inbounds i8*, i8** %32, i64 %33
%35 = load i8*, i8** %34
%36 = icmp eq i8* %35, null
br i1 %36, label %44, label %37
37: ; preds = %31
%38 = load i8**, i8*** %5
%39 = load i64, i64* @optind
%40 = add i64 %39, 1
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %49
44: ; preds = %37, %31
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = call i32 @usage(i8* %47)
br label %49
49: ; preds = %44, %37
%50 = load i8**, i8*** %5
%51 = load i64, i64* @optind
%52 = getelementptr inbounds i8*, i8** %50, i64 %51
%53 = load i8*, i8** %52
store i8* %53, i8** %8
%54 = load i32*, i32** %9
%55 = load i32, i32* @_IOLBF
%56 = call i32 @setvbuf(i32* %54, i32* null, i32 %55, i32 0)
%57 = load i8*, i8** %8
%58 = load i32*, i32** %9
%59 = load i32, i32* %10
%60 = load i32, i32* %11
%61 = load i32, i32* %12
%62 = load i32, i32* %13
%63 = load i32, i32* %14
%64 = call i32 @ccn_filewatch(i8* %57, i32* %58, i32 %59, i32 %60, i32 %61, i32 %62, i32 %63)
store i32 %64, i32* %7
%65 = load i32, i32* %7
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %70
67: ; preds = %49
%68 = load i8*, i8** %8
%69 = call i32 @perror(i8* %68)
br label %70
70: ; preds = %67, %49
%71 = load i32, i32* %7
%72 = sub nsw i32 0, %71
%73 = call i32 @exit(i32 %72)
unreachable
}

LLVM IR (-O2):
@stdout = global i32* null
@.str = [2 x i8] c"h\00"
@optind = global i64 0
@_IOLBF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = load i32*, i32** @stdout
br label %4
4: ; preds = %6, %2
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %7 [
i32 -1, label %10
i32 97, label %6
]
6: ; preds = %4, %7
br label %4
7: ; preds = %4
%8 = load i8*, i8** %1
%9 = tail call i32 @usage(i8* %8)
br label %6
10: ; preds = %4
%11 = load i64, i64* @optind
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = add i64 %11, 1
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = icmp eq i8* %18, null
br i1 %19, label %26, label %20
20: ; preds = %15, %10
%21 = load i8*, i8** %1
%22 = tail call i32 @usage(i8* %21)
%23 = load i64, i64* @optind
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
%25 = load i8*, i8** %24
br label %26
26: ; preds = %20, %15
%27 = phi i8* [ %25, %20 ], [ %13, %15 ]
%28 = load i32, i32* @_IOLBF
%29 = tail call i32 @setvbuf(i32* %3, i32* null, i32 %28, i32 0)
%30 = tail call i32 @ccn_filewatch(i8* %27, i32* %3, i32 1, i32 0, i32 600, i32 5000, i32 100)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = tail call i32 @perror(i8* %27)
br label %34
34: ; preds = %32, %26
%35 = sub nsw i32 0, %30
%36 = tail call i32 @exit(i32 %35)
unreachable
}