#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 /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ generate_source_set_from_file(int /*<<< orphan*/ *);
int /*<<< orphan*/ print_usage(char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int usage_error = 1;
  char *fname_ptr;
  FILE *f_ptr = NULL;
  if (argc == 3) {
    if (strcmp(argv[1], "-f") == 0) {
      fname_ptr = argv[2];
      usage_error = 0;
    }
  }
  if (usage_error) {
    print_usage(argv[0]);
  } else {
    if ((f_ptr = fopen(fname_ptr, "r")) == NULL) {
      fprintf(stderr, "%s [ERROR]: cannot open %s for reading\n", argv[1],
              fname_ptr);
    } else {
      generate_source_set_from_file(f_ptr);
      fclose(f_ptr);
    }
  }
  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)
movl   $0x1,-0x14(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11d5 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe52(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11d0 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    11d5 <main+0x65>
cmpl   $0x0,-0x14(%rbp)
je     11f0 <main+0x80>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <print_usage@plt>
jmp    124b <main+0xdb>
mov    -0x20(%rbp),%rdi
lea    0xe08(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1234 <main+0xc4>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x20(%rbp),%rcx
lea    0xddb(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1246 <main+0xd6>
mov    -0x28(%rbp),%rdi
call   1060 <generate_source_set_from_file@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
jmp    124b <main+0xdb>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    11cd <main+0x5d>
mov    0x8(%rbx),%rdi
lea    0xe78(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11cd <main+0x5d>
mov    0x10(%rbx),%r14
lea    0xe66(%rip),%rsi
mov    %r14,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
jne    11dc <main+0x6c>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe47(%rip),%rsi
mov    %r14,%rcx
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    (%rbx),%rdi
call   1090 <print_usage@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1060 <generate_source_set_from_file@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-f\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [40 x i8] c"%s [ERROR]: cannot open %s for reading\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32* null, i32** %8
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %22
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
store i8* %20, i8** %7
store i32 0, i32* %6
br label %21
21: ; preds = %17, %11
br label %22
22: ; preds = %21, %2
%23 = load i32, i32* %6
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 @print_usage(i8* %28)
br label %47
30: ; preds = %22
%31 = load i8*, i8** %7
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %32, i32** %8
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %41
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = load i8*, i8** %7
%40 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %38, i8* %39)
br label %46
41: ; preds = %30
%42 = load i32*, i32** %8
%43 = call i32 @generate_source_set_from_file(i32* %42)
%44 = load i32*, i32** %8
%45 = call i32 @fclose(i32* %44)
br label %46
46: ; preds = %41, %34
br label %47
47: ; preds = %46, %25
%48 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"-f\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [40 x i8] c"%s [ERROR]: cannot open %s for reading\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4, %2
%10 = load i8*, i8** %1
%11 = tail call i32 @print_usage(i8* %10)
br label %24
12: ; preds = %4
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %5
%20 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %19, i8* %14)
br label %24
21: ; preds = %12
%22 = tail call i32 @generate_source_set_from_file(i32* %15)
%23 = tail call i32 @fclose(i32* %15)
br label %24
24: ; preds = %17, %21, %9
%25 = tail call i32 @exit(i32 0)
unreachable
}