#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ERR_load_crypto_strings();
int /*<<< orphan*/ ERR_print_errors_fp(int /*<<< orphan*/);
scalar_t__ FIPS_mode_set(int);
int /*<<< orphan*/ dofile(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ strcmp(char *, char *);
main(int argc, char *argv[]) {
  char *opt = NULL;
  int verbose = 0;
  int fipsmode = 1;
  FILE *fp = stdin;
  int i;
  i = 0;
  while (++i < argc) {
    opt = argv[i];
    if (!strcmp(opt, "-v"))
      verbose = 1;
    else if (!strcmp(opt, "-c"))
      fipsmode = 0;
    else if ('-' == opt[0]) {
      printf("Usage: %s <filename>\n", argv[0]);
      puts("Options:");
      puts("\t-c\tUse non-FIPS mode");
      puts("\t-v\tVerbose output");
      exit(1);
    } else
      break;
  }
  if (fipsmode) {
    if (FIPS_mode_set(1)) {
      verbose &&fputs("FIPS mode enabled\n", stderr);
    } else {
      ERR_load_crypto_strings();
      ERR_print_errors_fp(stderr);
      exit(1);
    }
  }
  if (i >= argc) {
    dofile(fp);
  } else {
    while (i < argc) {
      opt = argv[i];
      if ((fp = fopen(opt, "rb")) == NULL) {
        fprintf(stderr, "Unable to open file \"%s\"\n", opt);
        exit(1);
      }
      dofile(fp);
      fclose(fp);
      i++;
    }
  }
  exit(0);
}


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)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
mov    0x2df5(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmp    -0x8(%rbp),%eax
jge    12d1 <main+0x111>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1248 <main+0x88>
movl   $0x1,-0x1c(%rbp)
jmp    12cc <main+0x10c>
mov    -0x18(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    126d <main+0xad>
movl   $0x0,-0x20(%rbp)
jmp    12c7 <main+0x107>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2d,%eax
cmp    %ecx,%eax
jne    12c2 <main+0x102>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd77(%rip),%rdi
call   1060 <printf@plt>
lea    0xd81(%rip),%rdi
call   1040 <puts@plt>
lea    0xd7e(%rip),%rdi
call   1040 <puts@plt>
lea    0xd88(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    12d1 <main+0x111>
jmp    12cc <main+0x10c>
jmp    1201 <main+0x41>
cmpl   $0x0,-0x20(%rbp)
je     1349 <main+0x189>
mov    $0x1,%edi
call   1070 <FIPS_mode_set@plt>
cmp    $0x0,%rax
je     1325 <main+0x165>
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x2d(%rbp)
je     131d <main+0x15d>
mov    0x2cd3(%rip),%rax
mov    (%rax),%esi
lea    0xd40(%rip),%rdi
call   1080 <fputs@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%al
jmp    1344 <main+0x184>
mov    $0x0,%al
call   10c0 <ERR_load_crypto_strings@plt>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
call   10e0 <ERR_print_errors_fp@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1349 <main+0x189>
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1363 <main+0x1a3>
mov    -0x28(%rbp),%rdi
call   1030 <dofile@plt>
jmp    13ea <main+0x22a>
jmp    1368 <main+0x1a8>
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13e5 <main+0x225>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xcd2(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    13c5 <main+0x205>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xcae(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x28(%rbp),%rdi
call   1030 <dofile@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1368 <main+0x1a8>
jmp    13ea <main+0x22a>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2e13(%rip),%rax
mov    (%rax),%rbx
cmp    $0x2,%edi
jl     1256 <main+0x96>
mov    %rsi,%r13
mov    %rbx,0x10(%rsp)
mov    %edi,0x4(%rsp)
mov    %edi,%r12d
movl   $0x0,0x8(%rsp)
movl   $0x1,0xc(%rsp)
mov    $0x1,%r14b
mov    $0x1,%r15d
lea    0xdf4(%rip),%rbp
jmp    1225 <main+0x65>
xchg   %ax,%ax
movl   $0x1,0x8(%rsp)
add    $0x1,%r15
cmp    %r12,%r15
setb   %r14b
je     126e <main+0xae>
mov    0x0(%r13,%r15,8),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
je     1210 <main+0x50>
mov    %rbx,%rdi
lea    0xdc0(%rip),%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    1273 <main+0xb3>
movl   $0x0,0xc(%rsp)
jmp    1218 <main+0x58>
mov    $0x1,%edi
call   1070 <FIPS_mode_set@plt>
test   %rax,%rax
jne    1331 <main+0x171>
jmp    134f <main+0x18f>
mov    %r12d,%r15d
jmp    12b6 <main+0xf6>
cmpb   $0x2d,(%rbx)
jne    12b6 <main+0xf6>
mov    0x0(%r13),%rsi
lea    0xd83(%rip),%rdi
call   1060 <printf@plt>
lea    0xd8d(%rip),%rdi
call   1040 <puts@plt>
lea    0xd8a(%rip),%rdi
call   1040 <puts@plt>
lea    0xd94(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpl   $0x0,0xc(%rsp)
mov    0x10(%rsp),%rbx
jne    1340 <main+0x180>
test   $0x1,%r14b
je     1331 <main+0x171>
cmp    0x4(%rsp),%r15d
jge    132a <main+0x16a>
mov    %r15d,%eax
lea    0x0(,%rax,8),%rbp
add    %r13,%rbp
lea    0xd7d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%rbp),%r12
mov    %r12,%rdi
mov    %r14,%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1393 <main+0x1d3>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <dofile@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
add    $0x8,%rbp
add    $0x1,%r15d
cmp    0x4(%rsp),%r15d
jl     12f0 <main+0x130>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    %rbx,%rdi
call   1030 <dofile@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    $0x1,%edi
call   1070 <FIPS_mode_set@plt>
test   %rax,%rax
jne    136e <main+0x1ae>
xor    %eax,%eax
call   10c0 <ERR_load_crypto_strings@plt>
mov    0x2c7b(%rip),%rax
mov    (%rax),%edi
call   10e0 <ERR_print_errors_fp@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpl   $0x0,0x8(%rsp)
je     12c2 <main+0x102>
mov    0x2c58(%rip),%rax
mov    (%rax),%esi
lea    0xcc5(%rip),%rdi
call   1080 <fputs@plt>
jmp    12c2 <main+0x102>
mov    0x2c3e(%rip),%rax
mov    (%rax),%edi
lea    0xcc1(%rip),%rsi
mov    %r12,%rdx
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@stdin = global i32* null
@.str = [3 x i8] c"-v\00"
@.str.1 = [3 x i8] c"-c\00"
@.str.2 = [22 x i8] c"Usage: %s <filename>\0A\00"
@.str.3 = [9 x i8] c"Options:\00"
@.str.4 = [22 x i8] c"\09-c\09Use non-FIPS mode\00"
@.str.5 = [19 x i8] c"\09-v\09Verbose output\00"
@.str.6 = [19 x i8] c"FIPS mode enabled\0A\00"
@stderr = global i32 0
@.str.7 = [3 x i8] c"rb\00"
@.str.8 = [26 x i8] c"Unable to open file \22%s\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %7
store i32 1, i32* %8
%11 = load i32*, i32** @stdin
store i32* %11, i32** %9
store i32 0, i32* %10
br label %12
12: ; preds = %49, %2
%13 = load i32, i32* %10
%14 = add nsw i32 %13, 1
store i32 %14, i32* %10
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %50
17: ; preds = %12
%18 = load i8**, i8*** %5
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
store i8* %22, i8** %6
%23 = load i8*, i8** %6
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %17
store i32 1, i32* %7
br label %49
27: ; preds = %17
%28 = load i8*, i8** %6
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %27
store i32 0, i32* %8
br label %48
32: ; preds = %27
%33 = load i8*, i8** %6
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 45, %36
br i1 %37, label %38, label %47
38: ; preds = %32
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%45 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %32
br label %50
48: ; preds = %31
br label %49
49: ; preds = %48, %26
br label %12
50: ; preds = %47, %12
%51 = load i32, i32* %8
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %72
53: ; preds = %50
%54 = call i64 @FIPS_mode_set(i32 1)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %66
56: ; preds = %53
%57 = load i32, i32* %7
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = load i32, i32* @stderr
%61 = call i64 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %60)
%62 = icmp ne i64 %61, 0
br label %63
63: ; preds = %59, %56
%64 = phi i1 [ false, %56 ], [ %62, %59 ]
%65 = zext i1 %64 to i32
br label %71
66: ; preds = %53
%67 = call i32 (...) @ERR_load_crypto_strings()
%68 = load i32, i32* @stderr
%69 = call i32 @ERR_print_errors_fp(i32 %68)
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %63
br label %72
72: ; preds = %71, %50
%73 = load i32, i32* %10
%74 = load i32, i32* %4
%75 = icmp sge i32 %73, %74
br i1 %75, label %76, label %79
76: ; preds = %72
%77 = load i32*, i32** %9
%78 = call i32 @dofile(i32* %77)
br label %106
79: ; preds = %72
br label %80
80: ; preds = %98, %79
%81 = load i32, i32* %10
%82 = load i32, i32* %4
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %105
84: ; preds = %80
%85 = load i8**, i8*** %5
%86 = load i32, i32* %10
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8*, i8** %85, i64 %87
%89 = load i8*, i8** %88
store i8* %89, i8** %6
%90 = load i8*, i8** %6
%91 = call i32* @fopen(i8* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32* %91, i32** %9
%92 = icmp eq i32* %91, null
br i1 %92, label %93, label %98
93: ; preds = %84
%94 = load i32, i32* @stderr
%95 = load i8*, i8** %6
%96 = call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %95)
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %84
%99 = load i32*, i32** %9
%100 = call i32 @dofile(i32* %99)
%101 = load i32*, i32** %9
%102 = call i32 @fclose(i32* %101)
%103 = load i32, i32* %10
%104 = add nsw i32 %103, 1
store i32 %104, i32* %10
br label %80
105: ; preds = %80
br label %106
106: ; preds = %105, %76
%107 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [3 x i8] c"-v\00"
@.str.1 = [3 x i8] c"-c\00"
@.str.2 = [22 x i8] c"Usage: %s <filename>\0A\00"
@.str.3 = [9 x i8] c"Options:\00"
@.str.4 = [22 x i8] c"\09-c\09Use non-FIPS mode\00"
@.str.5 = [19 x i8] c"\09-v\09Verbose output\00"
@.str.6 = [19 x i8] c"FIPS mode enabled\0A\00"
@stderr = global i32 0
@.str.7 = [3 x i8] c"rb\00"
@.str.8 = [26 x i8] c"Unable to open file \22%s\22\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32*, i32** @stdin
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %46
5: ; preds = %2
%6 = zext i32 %0 to i64
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %5, %31
%9 = phi i64 [ 1, %5 ], [ %34, %31 ]
%10 = phi i1 [ true, %5 ], [ %35, %31 ]
%11 = phi i32 [ 1, %5 ], [ %33, %31 ]
%12 = phi i32 [ 0, %5 ], [ %32, %31 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %9
%14 = load i8*, i8** %13
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %31, label %17
17: ; preds = %8
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %17
%21 = trunc i64 %9 to i32
%22 = load i8, i8* %14
%23 = icmp eq i8 %22, 45
br i1 %23, label %24, label %37
24: ; preds = %20
%25 = load i8*, i8** %1
%26 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%30 = tail call i32 @exit(i32 1)
unreachable
31: ; preds = %17, %8
%32 = phi i32 [ 1, %8 ], [ %12, %17 ]
%33 = phi i32 [ %11, %8 ], [ 0, %17 ]
%34 = add nuw nsw i64 %9, 1
%35 = icmp ult i64 %34, %6
%36 = icmp eq i64 %34, %7
br i1 %36, label %37, label %8
37: ; preds = %31, %20
%38 = phi i32 [ %12, %20 ], [ %32, %31 ]
%39 = phi i32 [ %11, %20 ], [ %33, %31 ]
%40 = phi i32 [ %21, %20 ], [ %0, %31 ]
%41 = phi i1 [ %10, %20 ], [ %35, %31 ]
%42 = icmp eq i32 %39, 0
br i1 %42, label %59, label %43
43: ; preds = %37
%44 = tail call i64 @FIPS_mode_set(i32 1)
%45 = icmp eq i64 %44, 0
br i1 %45, label %54, label %49
46: ; preds = %2
%47 = tail call i64 @FIPS_mode_set(i32 1)
%48 = icmp eq i64 %47, 0
br i1 %48, label %54, label %64
49: ; preds = %43
%50 = icmp eq i32 %38, 0
br i1 %50, label %59, label %51
51: ; preds = %49
%52 = load i32, i32* @stderr
%53 = tail call i64 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %52)
br i1 %41, label %60, label %64
54: ; preds = %46, %43
%55 = tail call i32 (...) @ERR_load_crypto_strings()
%56 = load i32, i32* @stderr
%57 = tail call i32 @ERR_print_errors_fp(i32 %56)
%58 = tail call i32 @exit(i32 1)
unreachable
59: ; preds = %49, %37
br i1 %41, label %60, label %64
60: ; preds = %51, %59
%61 = icmp slt i32 %40, %0
br i1 %61, label %62, label %82
62: ; preds = %60
%63 = zext i32 %40 to i64
br label %66
64: ; preds = %46, %51, %59
%65 = tail call i32 @dofile(i32* %3)
br label %82
66: ; preds = %62, %76
%67 = phi i64 [ %63, %62 ], [ %79, %76 ]
%68 = getelementptr inbounds i8*, i8** %1, i64 %67
%69 = load i8*, i8** %68
%70 = tail call i32* @fopen(i8* %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %76
72: ; preds = %66
%73 = load i32, i32* @stderr
%74 = tail call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %69)
%75 = tail call i32 @exit(i32 1)
unreachable
76: ; preds = %66
%77 = tail call i32 @dofile(i32* %70)
%78 = tail call i32 @fclose(i32* %70)
%79 = add nuw nsw i64 %67, 1
%80 = trunc i64 %79 to i32
%81 = icmp slt i32 %80, %0
br i1 %81, label %66, label %82
82: ; preds = %76, %60, %64
%83 = tail call i32 @exit(i32 0)
unreachable
}