#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *,
                           char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int run_daemon(int);
int run_dump_conns();
int run_dump_ifname(int /*<<< orphan*/);
int run_dump_load();
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int opt;
  int daemon = 0;
  int nofork = 0;
  while ((opt = getopt(argc, argv, "dfi:cl")) > -1) {
    switch (opt) {
    case 'd':
      daemon = 1;
      break;
    case 'f':
      nofork = 1;
      break;
    case 'i':
      if (optarg)
        return run_dump_ifname(optarg);
      break;
    case 'c':
      return run_dump_conns();
    case 'l':
      return run_dump_load();
    default:
      break;
    }
  }
  if (daemon)
    return run_daemon(nofork);
  else
    fprintf(stderr,
            "Usage:\n"
            "	%s -d [-f]\n"
            "	%s -i ifname\n"
            "	%s -c\n"
            "	%s -l\n",
            argv[0], argv[0], argv[0], argv[0]);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe96(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jle    1237 <main+0xd7>
mov    -0x14(%rbp),%eax
add    $0xffffff9d,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x9,%eax
ja     122d <main+0xcd>
mov    -0x28(%rbp),%rax
lea    0xe3d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x18(%rbp)
jmp    1232 <main+0xd2>
movl   $0x1,-0x1c(%rbp)
jmp    1232 <main+0xd2>
mov    0x2e0d(%rip),%rax
cmpl   $0x0,(%rax)
je     120a <main+0xaa>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
call   1080 <run_dump_ifname@plt>
mov    %eax,-0x4(%rbp)
jmp    1289 <main+0x129>
jmp    1232 <main+0xd2>
mov    $0x0,%al
call   1070 <run_dump_conns@plt>
mov    %eax,-0x4(%rbp)
jmp    1289 <main+0x129>
mov    $0x0,%al
call   1040 <run_dump_load@plt>
mov    %eax,-0x4(%rbp)
jmp    1289 <main+0x129>
jmp    1232 <main+0xd2>
jmp    1184 <main+0x24>
cmpl   $0x0,-0x18(%rbp)
je     1251 <main+0xf1>
mov    -0x1c(%rbp),%edi
call   1030 <run_daemon@plt>
mov    %eax,-0x4(%rbp)
jmp    1289 <main+0x129>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    (%rax),%r8
mov    -0x10(%rbp),%rax
mov    (%rax),%r9
lea    0xdb2(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb1(%rip),%rdx
call   1060 <getopt@plt>
test   %eax,%eax
js     120b <main+0xab>
xor    %r14d,%r14d
lea    0xe9a(%rip),%r15
lea    0xe6b(%rip),%r12
xor    %r13d,%r13d
jmp    11b7 <main+0x57>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%r13d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
test   %eax,%eax
js     11f0 <main+0x90>
add    $0xffffff9d,%eax
cmp    $0x9,%eax
ja     11a6 <main+0x46>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    $0x1,%r14d
jmp    11a6 <main+0x46>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
test   %edi,%edi
je     11a6 <main+0x46>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <run_dump_ifname@plt>
test   %r13d,%r13d
je     120b <main+0xab>
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <run_daemon@plt>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rcx
lea    0xe11(%rip),%rsi
mov    %rcx,%rdx
mov    %rcx,%r8
mov    %rcx,%r9
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <run_dump_conns@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <run_dump_load@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"dfi:cl\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [48 x i8] c"Usage:\0A\09%s -d [-f]\0A\09%s -i ifname\0A\09%s -c\0A\09%s -l\0A\00"
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %30, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %6
%13 = icmp sgt i32 %12, -1
br i1 %13, label %14, label %31
14: ; preds = %9
%15 = load i32, i32* %6
switch i32 %15, label %29 [
i32 100, label %16
i32 102, label %17
i32 105, label %18
i32 99, label %25
i32 108, label %27
]
16: ; preds = %14
store i32 1, i32* %7
br label %30
17: ; preds = %14
store i32 1, i32* %8
br label %30
18: ; preds = %14
%19 = load i32, i32* @optarg
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* @optarg
%23 = call i32 @run_dump_ifname(i32 %22)
store i32 %23, i32* %3
br label %53
24: ; preds = %18
br label %30
25: ; preds = %14
%26 = call i32 (...) @run_dump_conns()
store i32 %26, i32* %3
br label %53
27: ; preds = %14
%28 = call i32 (...) @run_dump_load()
store i32 %28, i32* %3
br label %53
29: ; preds = %14
br label %30
30: ; preds = %29, %24, %17, %16
br label %9
31: ; preds = %9
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %8
%36 = call i32 @run_daemon(i32 %35)
store i32 %36, i32* %3
br label %53
37: ; preds = %31
%38 = load i32, i32* @stderr
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 0
%44 = load i8*, i8** %43
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 0
%50 = load i8*, i8** %49
%51 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %41, i8* %44, i8* %47, i8* %50)
br label %52
52: ; preds = %37
store i32 1, i32* %3
br label %53
53: ; preds = %52, %34, %27, %25, %21
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@.str = [7 x i8] c"dfi:cl\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [48 x i8] c"Usage:\0A\09%s -d [-f]\0A\09%s -i ifname\0A\09%s -c\0A\09%s -l\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %29
5: ; preds = %2, %20
%6 = phi i32 [ %23, %20 ], [ %3, %2 ]
%7 = phi i32 [ %22, %20 ], [ 0, %2 ]
%8 = phi i32 [ %21, %20 ], [ 0, %2 ]
switch i32 %6, label %20 [
i32 100, label %9
i32 102, label %10
i32 105, label %11
i32 99, label %16
i32 108, label %18
]
9: ; preds = %5
br label %20
10: ; preds = %5
br label %20
11: ; preds = %5
%12 = load i32, i32* @optarg
%13 = icmp eq i32 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = tail call i32 @run_dump_ifname(i32 %12)
br label %33
16: ; preds = %5
%17 = tail call i32 (...) @run_dump_conns()
br label %33
18: ; preds = %5
%19 = tail call i32 (...) @run_dump_load()
br label %33
20: ; preds = %5, %11, %10, %9
%21 = phi i32 [ %8, %5 ], [ %8, %11 ], [ %8, %10 ], [ 1, %9 ]
%22 = phi i32 [ %7, %5 ], [ %7, %11 ], [ 1, %10 ], [ %7, %9 ]
%23 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%24 = icmp sgt i32 %23, -1
br i1 %24, label %5, label %25
25: ; preds = %20
%26 = icmp eq i32 %21, 0
br i1 %26, label %29, label %27
27: ; preds = %25
%28 = tail call i32 @run_daemon(i32 %22)
br label %33
29: ; preds = %2, %25
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %1
%32 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %31, i8* %31, i8* %31, i8* %31)
br label %33
33: ; preds = %29, %27, %18, %16, %14
%34 = phi i32 [ %19, %18 ], [ %17, %16 ], [ %15, %14 ], [ %28, %27 ], [ 1, %29 ]
ret i32 %34
}