#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*/ exit(int);
int getopt(int, char **, char *);
int /*<<< orphan*/ one(char *, char *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
void *strtol(int /*<<< orphan*/, char **, int);
int /*<<< orphan*/ two(char *, long, long, char *, char *, int);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  char iftext[20];
  char sizetmp[20];
  char filename[100];
  long mode = 0, delay = 100000, number = 1;
  int c, period = 0;
  char *p;
  sizetmp[0] = '\0';
  while ((c = getopt(argc, argv, "hi:m:d:n:s:p:f:")) != -1) {
    switch (c) {
    case 'h':
      usage();
      break;
    case 'i':
      strcpy(iftext, optarg);
      break;
    case 'm': {
      mode = strtol(optarg, &p, 10);
      break;
    }
    case 'd': {
      delay = strtol(optarg, &p, 10);
      break;
    }
    case 'n': {
      number = strtol(optarg, &p, 10);
      break;
    }
    case 's': {
      strncpy(sizetmp, optarg, 20);
      break;
    }
    case 'p': {
      period = strtol(optarg, &p, 10);
      break;
    }
    case 'f': {
      strncpy(filename, optarg, 99);
      break;
    }
    default:
      usage();
    }
  }
  if ((mode != 1) && (mode != 2) && (mode != 3))
    usage();
  switch (mode) {
  case 1: {
    one(iftext, filename);
    break;
  }
  case 2: {
    two(iftext, delay, number, filename, sizetmp, period);
    break;
  }
  case 3: {
    printf("Not yet implemented...\n");
    exit(8);
    break;
  }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0xc8(%rbp)
movq   $0x186a0,-0xd0(%rbp)
movq   $0x1,-0xd8(%rbp)
movl   $0x0,-0xe0(%rbp)
movb   $0x0,-0x50(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe5a(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0xdc(%rbp)
cmp    $0xffffffff,%eax
je     132d <main+0x19d>
mov    -0xdc(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0xf0(%rbp)
sub    $0xf,%eax
ja     1321 <main+0x191>
mov    -0xf0(%rbp),%rax
lea    0xddd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1090 <usage@plt>
jmp    1328 <main+0x198>
lea    -0x30(%rbp),%rdi
mov    0x2db5(%rip),%rax
mov    (%rax),%esi
call   1050 <strcpy@plt>
jmp    1328 <main+0x198>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
lea    -0xe8(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0xc8(%rbp)
jmp    1328 <main+0x198>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
lea    -0xe8(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0xd0(%rbp)
jmp    1328 <main+0x198>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
lea    -0xe8(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0xd8(%rbp)
jmp    1328 <main+0x198>
lea    -0x50(%rbp),%rdi
mov    0x2d2c(%rip),%rax
mov    (%rax),%esi
mov    $0x14,%edx
call   1040 <strncpy@plt>
jmp    1328 <main+0x198>
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
lea    -0xe8(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0xe0(%rbp)
jmp    1328 <main+0x198>
lea    -0xc0(%rbp),%rdi
mov    0x2ce8(%rip),%rax
mov    (%rax),%esi
mov    $0x63,%edx
call   1040 <strncpy@plt>
jmp    1328 <main+0x198>
mov    $0x0,%al
call   1090 <usage@plt>
jmp    11d8 <main+0x48>
cmpq   $0x1,-0xc8(%rbp)
01
je     135e <main+0x1ce>
cmpq   $0x2,-0xc8(%rbp)
02
je     135e <main+0x1ce>
cmpq   $0x3,-0xc8(%rbp)
03
je     135e <main+0x1ce>
mov    $0x0,%al
call   1090 <usage@plt>
mov    -0xc8(%rbp),%rax
mov    %rax,-0xf8(%rbp)
sub    $0x1,%rax
je     13a7 <main+0x217>
jmp    137b <main+0x1eb>
mov    -0xf8(%rbp),%rax
sub    $0x2,%rax
je     13bc <main+0x22c>
jmp    1391 <main+0x201>
mov    -0xf8(%rbp),%rax
sub    $0x3,%rax
je     13ea <main+0x25a>
jmp    1400 <main+0x270>
lea    -0x30(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1080 <one@plt>
jmp    1400 <main+0x270>
lea    -0x30(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
mov    -0xd8(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    -0x50(%rbp),%r8
mov    -0xe0(%rbp),%r9d
call   1030 <two@plt>
jmp    1400 <main+0x270>
lea    0xc5f(%rip),%rdi
call   1060 <printf@plt>
mov    $0x8,%edi
call   10b0 <exit@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movb   $0x0,0x20(%rsp)
mov    $0x1,%eax
mov    %rax,0x10(%rsp)
mov    $0x186a0,%eax
mov    %rax,0x8(%rsp)
lea    0xe7a(%rip),%r14
lea    0xe33(%rip),%r12
mov    0x2e24(%rip),%r13
lea    0x58(%rsp),%r15
xor    %eax,%eax
mov    %rax,0x18(%rsp)
xor    %eax,%eax
jmp    1201 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,(%rsp)
jmp    1217 <main+0x87>
cmp    $0xffffffff,%eax
je     12bd <main+0x12d>
xor    %eax,%eax
call   1090 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10a0 <getopt@plt>
lea    -0x64(%rax),%ecx
cmp    $0xf,%ecx
ja     1207 <main+0x77>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,0x8(%rsp)
jmp    1217 <main+0x87>
mov    0x0(%r13),%esi
lea    0x40(%rsp),%rdi
call   1050 <strcpy@plt>
jmp    1217 <main+0x87>
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,0x10(%rsp)
jmp    1217 <main+0x87>
mov    0x0(%r13),%esi
lea    0x20(%rsp),%rdi
mov    $0x14,%edx
call   1040 <strncpy@plt>
jmp    1217 <main+0x87>
mov    0x0(%r13),%esi
lea    0x60(%rsp),%rdi
mov    $0x63,%edx
call   1040 <strncpy@plt>
jmp    1217 <main+0x87>
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,0x18(%rsp)
jmp    1217 <main+0x87>
mov    0x18(%rsp),%rbx
lea    -0x4(%rbx),%rax
cmp    $0xfffffffffffffffc,%rax
ja     12d3 <main+0x143>
xor    %eax,%eax
call   1090 <usage@plt>
cmp    $0x1,%rbx
je     12fb <main+0x16b>
cmp    $0x2,%rbx
je     130c <main+0x17c>
cmp    $0x3,%rbx
jne    132e <main+0x19e>
lea    0xd64(%rip),%rdi
call   1060 <puts@plt>
mov    $0x8,%edi
call   10b0 <exit@plt>
lea    0x40(%rsp),%rdi
lea    0x60(%rsp),%rsi
call   1080 <one@plt>
jmp    132e <main+0x19e>
lea    0x40(%rsp),%rdi
lea    0x60(%rsp),%rcx
lea    0x20(%rsp),%r8
mov    0x8(%rsp),%rsi
mov    0x10(%rsp),%rdx
mov    (%rsp),%r9
call   1030 <two@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"hi:m:d:n:s:p:f:\00"
@optarg = global i32 0
@.str.1 = [24 x i8] c"Not yet implemented...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i8]
%7 = alloca [20 x i8]
%8 = alloca [100 x i8]
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %9
store i64 100000, i64* %10
store i64 1, i64* %11
store i32 0, i32* %13
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
store i8 0, i8* %15
br label %16
16: ; preds = %55, %2
%17 = load i32, i32* %4
%18 = load i8**, i8*** %5
%19 = call i32 @getopt(i32 %17, i8** %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 %19, i32* %12
%20 = icmp ne i32 %19, -1
br i1 %20, label %21, label %56
21: ; preds = %16
%22 = load i32, i32* %12
switch i32 %22, label %53 [
i32 104, label %23
i32 105, label %25
i32 109, label %29
i32 100, label %33
i32 110, label %37
i32 115, label %41
i32 112, label %45
i32 102, label %49
]
23: ; preds = %21
%24 = call i32 (...) @usage()
br label %55
25: ; preds = %21
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%27 = load i32, i32* @optarg
%28 = call i32 @strcpy(i8* %26, i32 %27)
br label %55
29: ; preds = %21
%30 = load i32, i32* @optarg
%31 = call i8* @strtol(i32 %30, i8** %14, i32 10)
%32 = ptrtoint i8* %31 to i64
store i64 %32, i64* %9
br label %55
33: ; preds = %21
%34 = load i32, i32* @optarg
%35 = call i8* @strtol(i32 %34, i8** %14, i32 10)
%36 = ptrtoint i8* %35 to i64
store i64 %36, i64* %10
br label %55
37: ; preds = %21
%38 = load i32, i32* @optarg
%39 = call i8* @strtol(i32 %38, i8** %14, i32 10)
%40 = ptrtoint i8* %39 to i64
store i64 %40, i64* %11
br label %55
41: ; preds = %21
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%43 = load i32, i32* @optarg
%44 = call i32 @strncpy(i8* %42, i32 %43, i32 20)
br label %55
45: ; preds = %21
%46 = load i32, i32* @optarg
%47 = call i8* @strtol(i32 %46, i8** %14, i32 10)
%48 = ptrtoint i8* %47 to i32
store i32 %48, i32* %13
br label %55
49: ; preds = %21
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%51 = load i32, i32* @optarg
%52 = call i32 @strncpy(i8* %50, i32 %51, i32 99)
br label %55
53: ; preds = %21
%54 = call i32 (...) @usage()
br label %55
55: ; preds = %53, %49, %45, %41, %37, %33, %29, %25, %23
br label %16
56: ; preds = %16
%57 = load i64, i64* %9
%58 = icmp ne i64 %57, 1
br i1 %58, label %59, label %67
59: ; preds = %56
%60 = load i64, i64* %9
%61 = icmp ne i64 %60, 2
br i1 %61, label %62, label %67
62: ; preds = %59
%63 = load i64, i64* %9
%64 = icmp ne i64 %63, 3
br i1 %64, label %65, label %67
65: ; preds = %62
%66 = call i32 (...) @usage()
br label %67
67: ; preds = %65, %62, %59, %56
%68 = load i64, i64* %9
switch i64 %68, label %84 [
i64 1, label %69
i64 2, label %73
i64 3, label %81
]
69: ; preds = %67
%70 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%71 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%72 = call i32 @one(i8* %70, i8* %71)
br label %84
73: ; preds = %67
%74 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%75 = load i64, i64* %10
%76 = load i64, i64* %11
%77 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%78 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%79 = load i32, i32* %13
%80 = call i32 @two(i8* %74, i64 %75, i64 %76, i8* %77, i8* %78, i32 %79)
br label %84
81: ; preds = %67
%82 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%83 = call i32 @exit(i32 8)
unreachable
84: ; preds = %67, %73, %69
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"hi:m:d:n:s:p:f:\00"
@optarg = global i32 0
@str = [23 x i8] c"Not yet implemented...\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [100 x i8]
%6 = alloca i8*
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = bitcast i8** %6 to i8*
store i8 0, i8* %8
br label %11
11: ; preds = %47, %2
%12 = phi i64 [ 100000, %2 ], [ %48, %47 ]
%13 = phi i64 [ 1, %2 ], [ %49, %47 ]
%14 = phi i64 [ 0, %2 ], [ %50, %47 ]
%15 = phi i32 [ 0, %2 ], [ %51, %47 ]
%16 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
switch i32 %16, label %45 [
i32 -1, label %52
i32 104, label %17
i32 105, label %19
i32 109, label %22
i32 100, label %26
i32 110, label %30
i32 115, label %34
i32 112, label %37
i32 102, label %42
]
17: ; preds = %11
%18 = call i32 (...) @usage()
br label %47
19: ; preds = %11
%20 = load i32, i32* @optarg
%21 = call i32 @strcpy(i8* %7, i32 %20)
br label %47
22: ; preds = %11
%23 = load i32, i32* @optarg
%24 = call i8* @strtol(i32 %23, i8** %6, i32 10)
%25 = ptrtoint i8* %24 to i64
br label %47
26: ; preds = %11
%27 = load i32, i32* @optarg
%28 = call i8* @strtol(i32 %27, i8** %6, i32 10)
%29 = ptrtoint i8* %28 to i64
br label %47
30: ; preds = %11
%31 = load i32, i32* @optarg
%32 = call i8* @strtol(i32 %31, i8** %6, i32 10)
%33 = ptrtoint i8* %32 to i64
br label %47
34: ; preds = %11
%35 = load i32, i32* @optarg
%36 = call i32 @strncpy(i8* %8, i32 %35, i32 20)
br label %47
37: ; preds = %11
%38 = load i32, i32* @optarg
%39 = call i8* @strtol(i32 %38, i8** %6, i32 10)
%40 = ptrtoint i8* %39 to i64
%41 = trunc i64 %40 to i32
br label %47
42: ; preds = %11
%43 = load i32, i32* @optarg
%44 = call i32 @strncpy(i8* %9, i32 %43, i32 99)
br label %47
45: ; preds = %11
%46 = call i32 (...) @usage()
br label %47
47: ; preds = %45, %42, %37, %34, %30, %26, %22, %19, %17
%48 = phi i64 [ %12, %45 ], [ %12, %42 ], [ %12, %37 ], [ %12, %34 ], [ %12, %30 ], [ %29, %26 ], [ %12, %22 ], [ %12, %19 ], [ %12, %17 ]
%49 = phi i64 [ %13, %45 ], [ %13, %42 ], [ %13, %37 ], [ %13, %34 ], [ %33, %30 ], [ %13, %26 ], [ %13, %22 ], [ %13, %19 ], [ %13, %17 ]
%50 = phi i64 [ %14, %45 ], [ %14, %42 ], [ %14, %37 ], [ %14, %34 ], [ %14, %30 ], [ %14, %26 ], [ %25, %22 ], [ %14, %19 ], [ %14, %17 ]
%51 = phi i32 [ %15, %45 ], [ %15, %42 ], [ %41, %37 ], [ %15, %34 ], [ %15, %30 ], [ %15, %26 ], [ %15, %22 ], [ %15, %19 ], [ %15, %17 ]
br label %11
52: ; preds = %11
%53 = add i64 %14, -4
%54 = icmp ult i64 %53, -3
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 (...) @usage()
br label %57
57: ; preds = %55, %52
switch i64 %14, label %65 [
i64 1, label %58
i64 2, label %60
i64 3, label %62
]
58: ; preds = %57
%59 = call i32 @one(i8* %7, i8* %9)
br label %65
60: ; preds = %57
%61 = call i32 @two(i8* %7, i64 %12, i64 %13, i8* %9, i8* %8, i32 %15)
br label %65
62: ; preds = %57
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%64 = call i32 @exit(i32 8)
unreachable
65: ; preds = %57, %60, %58
ret i32 0
}