#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 EXIT_SUCCESS;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
char *optarg;
int optopt;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  char *operation = NULL;
  char *interface = NULL;
  char *hostA = NULL;
  char *hostB = NULL;
  int c;
  while ((c = getopt(argc, argv, "m:i:a:b:")) != -1) {
    switch (c) {
    case 'm':
      operation = optarg;
      if (strncmp(operation, "mitm", 4) != 0 &&
          strncmp(operation, "flood", 5) != 0) {
        fprintf(stderr, "Operation %s is unknown.Abort\n", operation);
        abort();
      }
      break;
    case 'i':
      interface = optarg;
      break;
    case 'a':
      hostA = optarg;
      break;
    case 'b':
      hostB = optarg;
      break;
    case '?':
      fprintf(stderr, "Option %c requires an argument", optopt);
      abort();
    }
  }
  printf("Arguments are :");
  printf("\n\tMethod : %s", operation);
  printf("\n\tInterface : %s", interface);
  printf("\n\thostA : %s", hostA);
  printf("\n\thostB : %s\n", hostB);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf28(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
je     12a4 <main+0x154>
mov    -0x34(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x2e,%eax
ja     129f <main+0x14f>
mov    -0x40(%rbp),%rax
lea    0xe3b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e23(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xede(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
je     123a <main+0xea>
mov    -0x18(%rbp),%rdi
lea    0xec5(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
je     123a <main+0xea>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    129f <main+0x14f>
mov    0x2db2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    129f <main+0x14f>
mov    0x2d9f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    129f <main+0x14f>
mov    0x2d8c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    129f <main+0x14f>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
mov    0x2d58(%rip),%rax
mov    (%rax),%edx
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1186 <main+0x36>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2cc7(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xf4b(%rip),%r14
lea    0xe88(%rip),%r15
mov    0x2e79(%rip),%r12
xor    %eax,%eax
mov    %rax,(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %r13d,%r13d
jmp    11a9 <main+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
je     123c <main+0xec>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <getopt@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x2e,%ecx
ja     11a0 <main+0x50>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    (%r12),%rax
mov    %rax,(%rsp)
jmp    11a9 <main+0x59>
mov    (%r12),%rax
mov    %rax,0x10(%rsp)
jmp    11a9 <main+0x59>
mov    (%r12),%rax
mov    %rax,0x8(%rsp)
jmp    11a9 <main+0x59>
mov    (%r12),%r13
mov    %r13,%rdi
lea    0xed0(%rip),%rsi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     11a9 <main+0x59>
mov    %r13,%rdi
lea    0xebd(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
je     11a9 <main+0x59>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xecd(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeca(%rip),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec8(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec3(%rip),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d2e(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
mov    0x2d25(%rip),%rax
mov    (%rax),%edx
lea    0xe2b(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"m:i:a:b:\00"
@optarg = global i8* null
@.str.1 = [5 x i8] c"mitm\00"
@.str.2 = [6 x i8] c"flood\00"
@stderr = global i32 0
@.str.3 = [31 x i8] c"Operation %s is unknown.Abort\0A\00"
@.str.4 = [31 x i8] c"Option %c requires an argument\00"
@optopt = global i32 0
@.str.5 = [16 x i8] c"Arguments are :\00"
@.str.6 = [14 x i8] c"\0A\09Method : %s\00"
@.str.7 = [17 x i8] c"\0A\09Interface : %s\00"
@.str.8 = [13 x i8] c"\0A\09hostA : %s\00"
@.str.9 = [14 x i8] c"\0A\09hostB : %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
br label %11
11: ; preds = %44, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 %14, i32* %10
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %45
16: ; preds = %11
%17 = load i32, i32* %10
switch i32 %17, label %44 [
i32 109, label %18
i32 105, label %33
i32 97, label %35
i32 98, label %37
i32 63, label %39
]
18: ; preds = %16
%19 = load i8*, i8** @optarg
store i8* %19, i8** %6
%20 = load i8*, i8** %6
%21 = call i32 @strncmp(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %32
23: ; preds = %18
%24 = load i8*, i8** %6
%25 = call i32 @strncmp(i8* %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %6
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %29)
%31 = call i32 (...) @abort()
unreachable
32: ; preds = %23, %18
br label %44
33: ; preds = %16
%34 = load i8*, i8** @optarg
store i8* %34, i8** %7
br label %44
35: ; preds = %16
%36 = load i8*, i8** @optarg
store i8* %36, i8** %8
br label %44
37: ; preds = %16
%38 = load i8*, i8** @optarg
store i8* %38, i8** %9
br label %44
39: ; preds = %16
%40 = load i32, i32* @stderr
%41 = load i32, i32* @optopt
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %41)
%43 = call i32 (...) @abort()
unreachable
44: ; preds = %16, %37, %35, %33, %32
br label %11
45: ; preds = %11
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%47 = load i8*, i8** %6
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %47)
%49 = load i8*, i8** %7
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %49)
%51 = load i8*, i8** %8
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %51)
%53 = load i8*, i8** %9
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %53)
%55 = load i32, i32* @EXIT_SUCCESS
ret i32 %55
}

LLVM IR (-O2):
@.str = [9 x i8] c"m:i:a:b:\00"
@optarg = global i8* null
@.str.1 = [5 x i8] c"mitm\00"
@.str.2 = [6 x i8] c"flood\00"
@stderr = global i32 0
@.str.3 = [31 x i8] c"Operation %s is unknown.Abort\0A\00"
@.str.4 = [31 x i8] c"Option %c requires an argument\00"
@optopt = global i32 0
@.str.5 = [16 x i8] c"Arguments are :\00"
@.str.6 = [14 x i8] c"\0A\09Method : %s\00"
@.str.7 = [17 x i8] c"\0A\09Interface : %s\00"
@.str.8 = [13 x i8] c"\0A\09hostA : %s\00"
@.str.9 = [14 x i8] c"\0A\09hostB : %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %31, %2
%4 = phi i8* [ %32, %31 ], [ null, %2 ]
%5 = phi i8* [ %9, %31 ], [ null, %2 ]
%6 = phi i8* [ %13, %31 ], [ null, %2 ]
%7 = phi i8* [ %16, %31 ], [ null, %2 ]
br label %8
8: ; preds = %3, %33
%9 = phi i8* [ %5, %3 ], [ %34, %33 ]
%10 = phi i8* [ %6, %3 ], [ %13, %33 ]
%11 = phi i8* [ %7, %3 ], [ %16, %33 ]
br label %12
12: ; preds = %8, %35
%13 = phi i8* [ %10, %8 ], [ %36, %35 ]
%14 = phi i8* [ %11, %8 ], [ %16, %35 ]
br label %15
15: ; preds = %26, %12
%16 = phi i8* [ %14, %12 ], [ %20, %26 ]
br label %17
17: ; preds = %15, %17
%18 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
switch i32 %18, label %17 [
i32 -1, label %42
i32 109, label %19
i32 105, label %31
i32 97, label %33
i32 98, label %35
i32 63, label %37
]
19: ; preds = %17
%20 = load i8*, i8** @optarg
%21 = tail call i32 @strncmp(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%22 = icmp eq i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %19
%24 = tail call i32 @strncmp(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23, %19
br label %15
27: ; preds = %23
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%30 = tail call i32 (...) @abort()
unreachable
31: ; preds = %17
%32 = load i8*, i8** @optarg
br label %3
33: ; preds = %17
%34 = load i8*, i8** @optarg
br label %8
35: ; preds = %17
%36 = load i8*, i8** @optarg
br label %12
37: ; preds = %17
%38 = load i32, i32* @stderr
%39 = load i32, i32* @optopt
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = tail call i32 (...) @abort()
unreachable
42: ; preds = %17
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %16)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %4)
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %9)
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %13)
%48 = load i32, i32* @EXIT_SUCCESS
ret i32 %48
}