#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*/ abort();
unsigned char *char2hex(char *, int);
int /*<<< orphan*/ decrypt_epw(unsigned char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(unsigned char *);
int getopt(int, char **, char *);
char *optarg;
scalar_t__ opterr;
float optopt;
int /*<<< orphan*/ process_file(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage(char **);
int main(int argc, char **argv) {
  if (argc < 2) {
    usage(argv);
    exit(-1);
  }
  int fflag = 0;
  int sflag = 0;
  char *filename = NULL;
  char *epw = NULL;
  int index;
  int c;
  opterr = 0;
  while ((c = getopt(argc, argv, "f:s:")) != -1)
    switch (c) {
    case 'f':
      fflag = 1;
      filename = optarg;
      break;
    case 's':
      sflag = 1;
      epw = optarg;
      break;
      break;
    case '?':
      if (optopt == 'f') {
        fprintf(stderr, "Option -%c requires an argument.\n\n", optopt);
        usage(argv);
      } else if (optopt == 's') {
        fprintf(stderr, "Option -%c requires an argument.\n", optopt);
        usage(argv);
      } else if (optopt) {
        fprintf(stderr, "Unknown option requested\n\n");
        usage(argv);
      }
      return 1;
    default:
      abort();
    }
  if (sflag) {
    unsigned char *ct = char2hex(epw, 16);
    decrypt_epw(ct);
    free(ct);
  } else if (fflag)
    process_file(filename);
  return 0;
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    11c3 <main+0x33>
mov    -0x10(%rbp),%rdi
call   1080 <usage@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2de0(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe0b(%rip),%rdx
call   1090 <getopt@plt>
mov    %eax,-0x30(%rbp)
cmp    $0xffffffff,%eax
je     1388 <main+0x1f8>
mov    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x3f,%eax
je     1278 <main+0xe8>
jmp    1222 <main+0x92>
mov    -0x3c(%rbp),%eax
sub    $0x66,%eax
je     1244 <main+0xb4>
jmp    1233 <main+0xa3>
mov    -0x3c(%rbp),%eax
sub    $0x73,%eax
je     125e <main+0xce>
jmp    137c <main+0x1ec>
movl   $0x1,-0x14(%rbp)
mov    0x2da6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1383 <main+0x1f3>
movl   $0x1,-0x18(%rbp)
mov    0x2d8c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1383 <main+0x1f3>
mov    0x2d61(%rip),%rax
movss  (%rax),%xmm0
movss  0xd75(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    12ce <main+0x13e>
jp     12ce <main+0x13e>
mov    0x2d2f(%rip),%rax
mov    (%rax),%edi
mov    0x2d36(%rip),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd54(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <usage@plt>
jmp    1370 <main+0x1e0>
mov    0x2d0b(%rip),%rax
movss  (%rax),%xmm0
movss  0xd23(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1324 <main+0x194>
jp     1324 <main+0x194>
mov    0x2cd9(%rip),%rax
mov    (%rax),%edi
mov    0x2ce0(%rip),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd21(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <usage@plt>
jmp    136b <main+0x1db>
mov    0x2cb5(%rip),%rax
movss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1346 <main+0x1b6>
jp     1346 <main+0x1b6>
jmp    1366 <main+0x1d6>
mov    0x2c83(%rip),%rax
mov    (%rax),%edi
lea    0xcfc(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <usage@plt>
jmp    136b <main+0x1db>
jmp    1370 <main+0x1e0>
movl   $0x1,-0x4(%rbp)
jmp    13da <main+0x24a>
mov    $0x0,%al
call   1050 <abort@plt>
jmp    11ef <main+0x5f>
cmpl   $0x0,-0x18(%rbp)
je     13bb <main+0x22b>
mov    -0x28(%rbp),%rdi
mov    $0x10,%esi
call   1040 <char2hex@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   10b0 <decrypt_epw@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
jmp    13d3 <main+0x243>
cmpl   $0x0,-0x14(%rbp)
je     13ce <main+0x23e>
mov    -0x20(%rbp),%rdi
call   1060 <process_file@plt>
jmp    13d3 <main+0x243>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%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,%r15
cmp    $0x1,%edi
jle    130f <main+0x17f>
mov    %edi,%ebp
mov    0x2e15(%rip),%rax
movq   $0x0,(%rax)
mov    $0x1,%al
mov    %eax,0xc(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xe4a(%rip),%r12
mov    0x2e23(%rip),%r13
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    11ea <main+0x5a>
nopl   0x0(%rax)
mov    0x0(%r13),%rbx
mov    $0x1,%r14d
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1090 <getopt@plt>
cmp    $0x73,%eax
je     11e0 <main+0x50>
cmp    $0xffffffff,%eax
je     1222 <main+0x92>
cmp    $0x3f,%eax
je     124b <main+0xbb>
cmp    $0x66,%eax
jne    1308 <main+0x178>
mov    0x0(%r13),%rax
mov    %rax,0x10(%rsp)
movl   $0x0,0xc(%rsp)
jmp    11ea <main+0x5a>
test   %r14d,%r14d
je     127b <main+0xeb>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <char2hex@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10b0 <decrypt_epw@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
jmp    12c7 <main+0x137>
mov    0x2d8e(%rip),%rax
movss  (%rax),%xmm0
ucomiss 0xda3(%rip),%xmm0
jne    1290 <main+0x100>
jp     1290 <main+0x100>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
lea    0xdac(%rip),%rsi
movsd  0xd97(%rip),%xmm0
jmp    12b3 <main+0x123>
xor    %ebx,%ebx
testb  $0x1,0xc(%rsp)
jne    12c7 <main+0x137>
mov    0x10(%rsp),%rdi
call   1060 <process_file@plt>
jmp    12c7 <main+0x137>
ucomiss 0xd6d(%rip),%xmm0
jne    12d8 <main+0x148>
jp     12d8 <main+0x148>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
lea    0xd95(%rip),%rsi
movsd  0xd55(%rip),%xmm0
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    %r15,%rdi
call   1080 <usage@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ebx
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12e7 <main+0x157>
jnp    12c7 <main+0x137>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
lea    0xd6b(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r15,%rdi
call   1080 <usage@plt>
jmp    12c7 <main+0x137>
xor    %eax,%eax
call   1050 <abort@plt>
mov    %r15,%rdi
call   1080 <usage@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [5 x i8] c"f:s:\00"
@optarg = global i8* null
@optopt = global float 0.000000e+00
@stderr = global i32 0
@.str.1 = [35 x i8] c"Option -%c requires an argument.\0A\0A\00"
@.str.2 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.3 = [27 x i8] c"Unknown option requested\0A\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 i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = call i32 @usage(i8** %16)
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %2
store i32 0, i32* %6
store i32 0, i32* %7
store i8* null, i8** %8
store i8* null, i8** %9
store i64 0, i64* @opterr
br label %20
20: ; preds = %64, %19
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i32 @getopt(i32 %21, i8** %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %23, i32* %11
%24 = icmp ne i32 %23, -1
br i1 %24, label %25, label %65
25: ; preds = %20
%26 = load i32, i32* %11
switch i32 %26, label %62 [
i32 102, label %27
i32 115, label %29
i32 63, label %31
]
27: ; preds = %25
store i32 1, i32* %6
%28 = load i8*, i8** @optarg
store i8* %28, i8** %8
br label %64
29: ; preds = %25
store i32 1, i32* %7
%30 = load i8*, i8** @optarg
store i8* %30, i8** %9
br label %64
31: ; preds = %25
%32 = load float, float* @optopt
%33 = fcmp oeq float %32, 1.020000e+02
br i1 %33, label %34, label %41
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = load float, float* @optopt
%37 = fpext float %36 to double
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), double %37)
%39 = load i8**, i8*** %5
%40 = call i32 @usage(i8** %39)
br label %61
41: ; preds = %31
%42 = load float, float* @optopt
%43 = fcmp oeq float %42, 1.150000e+02
br i1 %43, label %44, label %51
44: ; preds = %41
%45 = load i32, i32* @stderr
%46 = load float, float* @optopt
%47 = fpext float %46 to double
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %47)
%49 = load i8**, i8*** %5
%50 = call i32 @usage(i8** %49)
br label %60
51: ; preds = %41
%52 = load float, float* @optopt
%53 = fcmp une float %52, 0.000000e+00
br i1 %53, label %54, label %59
54: ; preds = %51
%55 = load i32, i32* @stderr
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%57 = load i8**, i8*** %5
%58 = call i32 @usage(i8** %57)
br label %59
59: ; preds = %54, %51
br label %60
60: ; preds = %59, %44
br label %61
61: ; preds = %60, %34
store i32 1, i32* %3
br label %83
62: ; preds = %25
%63 = call i32 (...) @abort()
unreachable
64: ; preds = %29, %27
br label %20
65: ; preds = %20
%66 = load i32, i32* %7
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %75
68: ; preds = %65
%69 = load i8*, i8** %9
%70 = call i8* @char2hex(i8* %69, i32 16)
store i8* %70, i8** %12
%71 = load i8*, i8** %12
%72 = call i32 @decrypt_epw(i8* %71)
%73 = load i8*, i8** %12
%74 = call i32 @free(i8* %73)
br label %82
75: ; preds = %65
%76 = load i32, i32* %6
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %75
%79 = load i8*, i8** %8
%80 = call i32 @process_file(i8* %79)
br label %81
81: ; preds = %78, %75
br label %82
82: ; preds = %81, %68
store i32 0, i32* %3
br label %83
83: ; preds = %82, %61
%84 = load i32, i32* %3
ret i32 %84
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [5 x i8] c"f:s:\00"
@optarg = global i8* null
@optopt = global float 0.000000e+00
@stderr = global i32 0
@.str.1 = [35 x i8] c"Option -%c requires an argument.\0A\0A\00"
@.str.2 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.3 = [27 x i8] c"Unknown option requested\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @usage(i8** %1)
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
store i64 0, i64* @opterr
br label %8
8: ; preds = %17, %7
%9 = phi i8* [ %18, %17 ], [ null, %7 ]
%10 = phi i8* [ %14, %17 ], [ null, %7 ]
%11 = phi i32 [ %15, %17 ], [ 0, %7 ]
%12 = phi i1 [ false, %17 ], [ true, %7 ]
br label %13
13: ; preds = %8, %19
%14 = phi i8* [ %20, %19 ], [ %10, %8 ]
%15 = phi i32 [ 1, %19 ], [ %11, %8 ]
%16 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %16, label %40 [
i32 -1, label %42
i32 102, label %17
i32 115, label %19
i32 63, label %21
]
17: ; preds = %13
%18 = load i8*, i8** @optarg
br label %8
19: ; preds = %13
%20 = load i8*, i8** @optarg
br label %13
21: ; preds = %13
%22 = load float, float* @optopt
%23 = fcmp oeq float %22, 1.020000e+02
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), double 1.020000e+02)
%27 = tail call i32 @usage(i8** %1)
br label %51
28: ; preds = %21
%29 = fcmp oeq float %22, 1.150000e+02
br i1 %29, label %30, label %34
30: ; preds = %28
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 1.150000e+02)
%33 = tail call i32 @usage(i8** %1)
br label %51
34: ; preds = %28
%35 = fcmp une float %22, 0.000000e+00
br i1 %35, label %36, label %51
36: ; preds = %34
%37 = load i32, i32* @stderr
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%39 = tail call i32 @usage(i8** %1)
br label %51
40: ; preds = %13
%41 = tail call i32 (...) @abort()
unreachable
42: ; preds = %13
%43 = icmp eq i32 %15, 0
br i1 %43, label %48, label %44
44: ; preds = %42
%45 = tail call i8* @char2hex(i8* %14, i32 16)
%46 = tail call i32 @decrypt_epw(i8* %45)
%47 = tail call i32 @free(i8* %45)
br label %51
48: ; preds = %42
br i1 %12, label %51, label %49
49: ; preds = %48
%50 = tail call i32 @process_file(i8* %9)
br label %51
51: ; preds = %44, %49, %48, %24, %34, %36, %30
%52 = phi i32 [ 1, %30 ], [ 1, %36 ], [ 1, %34 ], [ 1, %24 ], [ 0, %48 ], [ 0, %49 ], [ 0, %44 ]
ret i32 %52
}