#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 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*/ *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];
  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    0x2e55(%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    0xe45(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     120c <main+0xbc>
mov    -0x14(%rbp),%eax
mov    %eax,-0x40(%rbp)
sub    $0x61,%eax
je     11f1 <main+0xa1>
jmp    11e0 <main+0x90>
mov    -0x40(%rbp),%eax
sub    $0x68,%eax
je     11f6 <main+0xa6>
jmp    11fb <main+0xab>
jmp    1207 <main+0xb7>
jmp    11fb <main+0xab>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usage@plt>
jmp    11ad <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x2dd1(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     123f <main+0xef>
mov    -0x10(%rbp),%rax
mov    0x2db8(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,0x8(%rax,%rcx,8)
je     124b <main+0xfb>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x2d92(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
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    1298 <main+0x148>
mov    -0x20(%rbp),%rdi
call   1050 <perror@plt>
xor    %edi,%edi
sub    -0x18(%rbp),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e75(%rip),%rax
mov    (%rax),%r14
lea    0xe93(%rip),%r15
nopl   (%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
cmp    $0x61,%eax
je     1170 <main+0x20>
cmp    $0xffffffff,%eax
je     1191 <main+0x41>
mov    (%rbx),%rdi
call   1040 <usage@plt>
jmp    1170 <main+0x20>
mov    0x2e50(%rip),%rbp
mov    0x0(%rbp),%rax
mov    (%rbx,%rax,8),%r15
test   %r15,%r15
je     11ad <main+0x5d>
cmpq   $0x0,0x8(%rbx,%rax,8)
je     11bd <main+0x6d>
mov    (%rbx),%rdi
call   1040 <usage@plt>
mov    0x0(%rbp),%rax
mov    (%rbx,%rax,8),%r15
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    11f1 <main+0xa1>
mov    %r15,%rdi
call   1050 <perror@plt>
neg    %ebx
mov    %ebx,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stdout = global i32* null
@.str = [2 x i8] c"h\00"
@optind = global i64 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 i8*, i8** %8
%55 = load i32*, i32** %9
%56 = load i32, i32* %10
%57 = load i32, i32* %11
%58 = load i32, i32* %12
%59 = load i32, i32* %13
%60 = load i32, i32* %14
%61 = call i32 @ccn_filewatch(i8* %54, i32* %55, i32 %56, i32 %57, i32 %58, i32 %59, i32 %60)
store i32 %61, i32* %7
%62 = load i32, i32* %7
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %67
64: ; preds = %49
%65 = load i8*, i8** %8
%66 = call i32 @perror(i8* %65)
br label %67
67: ; preds = %64, %49
%68 = load i32, i32* %7
%69 = sub nsw i32 0, %68
%70 = call i32 @exit(i32 %69)
unreachable
}

LLVM IR (-O2):
@stdout = global i32* null
@.str = [2 x i8] c"h\00"
@optind = global i64 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 = tail call i32 @ccn_filewatch(i8* %27, i32* %3, i32 1, i32 0, i32 600, i32 5000, i32 100)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = tail call i32 @perror(i8* %27)
br label %32
32: ; preds = %30, %26
%33 = sub nsw i32 0, %28
%34 = tail call i32 @exit(i32 %33)
unreachable
}