#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *open_key_file(char *);
int /*<<< orphan*/ print_usege();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strstr(char *, char *);
int main(int argc, char **argv) {
  FILE *fd = stdout;
  if (argc > 1) {
    if (!strstr(argv[1], "-"))
      if (!(fd = open_key_file(argv[1]))) {
        fprintf(stderr, "Can't open key file.\n");
        exit(1);
      }
    if (argc > 2) {
      print_usege();
      exit(2);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11fa <main+0xaa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe73(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%eax
jne    11da <main+0x8a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <open_key_file@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11d5 <main+0x85>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
lea    0xe3c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11da <main+0x8a>
cmpl   $0x2,-0x8(%rbp)
jle    11f5 <main+0xa5>
mov    $0x0,%al
call   1050 <print_usege@plt>
mov    $0x2,%edi
call   1060 <exit@plt>
jmp    11fa <main+0xaa>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1185 <main+0x35>
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0xe97(%rip),%rsi
call   1070 <strstr@plt>
test   %eax,%eax
jne    1180 <main+0x30>
mov    0x8(%r14),%rdi
call   1030 <open_key_file@plt>
test   %rax,%rax
je     11a0 <main+0x50>
cmp    $0x3,%ebx
jae    118f <main+0x3f>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1050 <print_usege@plt>
mov    $0x2,%edi
call   1060 <exit@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stdout = global i32* null
@.str = [2 x i8] c"-\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Can't open key file.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32*, i32** @stdout
store i32* %7, i32** %6
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %34
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strstr(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %27, label %16
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32* @open_key_file(i8* %19)
store i32* %20, i32** %6
%21 = icmp ne i32* %20, null
br i1 %21, label %26, label %22
22: ; preds = %16
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %16
br label %27
27: ; preds = %26, %10
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 2
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = call i32 (...) @print_usege()
%32 = call i32 @exit(i32 2)
unreachable
33: ; preds = %27
br label %34
34: ; preds = %33, %2
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@stdout = global i32* null
@.str = [2 x i8] c"-\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Can't open key file.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %22
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strstr(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i32* @open_key_file(i8* %10)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %9, %4
%18 = icmp ugt i32 %0, 2
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = tail call i32 (...) @print_usege()
%21 = tail call i32 @exit(i32 2)
unreachable
22: ; preds = %17, %2
ret i32 0
}