#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_FAILURE;
int /*<<< orphan*/ do_init();
int /*<<< orphan*/ do_parse(int /*<<< orphan*/ *);
int /*<<< orphan*/ do_print();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int parse_options(int, char **);
int /*<<< orphan*/ perror(char *);
int main(int argc, char **argv) {
  FILE *file;
  int opt;
  opt = parse_options(argc, argv);
  file = fopen(argv[opt], "r");
  if (!file) {
    perror("open log file");
    exit(EXIT_FAILURE);
  }
  do_init();
  do_parse(file);
  do_print();
  fclose(file);
  return 0;
}


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <parse_options@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe48(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11e6 <main+0x66>
lea    0xe2f(%rip),%rdi
call   1070 <perror@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   1080 <do_init@plt>
mov    -0x18(%rbp),%rdi
call   1050 <do_parse@plt>
mov    $0x0,%al
call   10a0 <do_print@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
call   1030 <parse_options@plt>
cltq
mov    (%rbx,%rax,8),%rdi
lea    0xe6a(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11c5 <main+0x45>
mov    %rax,%rbx
xor    %eax,%eax
call   1080 <do_init@plt>
mov    %rbx,%rdi
call   1050 <do_parse@plt>
xor    %eax,%eax
call   10a0 <do_print@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe36(%rip),%rdi
call   1070 <perror@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [14 x i8] c"open log file\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @parse_options(i32 %8, i8** %9)
store i32 %10, i32* %7
%11 = load i8**, i8*** %5
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %6
%17 = load i32*, i32** %6
%18 = icmp ne i32* %17, null
br i1 %18, label %23, label %19
19: ; preds = %2
%20 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %2
%24 = call i32 (...) @do_init()
%25 = load i32*, i32** %6
%26 = call i32 @do_parse(i32* %25)
%27 = call i32 (...) @do_print()
%28 = load i32*, i32** %6
%29 = call i32 @fclose(i32* %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [14 x i8] c"open log file\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @parse_options(i32 %0, i8** %1)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8*, i8** %1, i64 %4
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = tail call i32 (...) @do_init()
%15 = tail call i32 @do_parse(i32* %7)
%16 = tail call i32 (...) @do_print()
%17 = tail call i32 @fclose(i32* %7)
ret i32 0
}