#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*/ flv_parser_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ flv_parser_run();
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  FILE *infile = NULL;
  if (argc == 1) {
    infile = stdin;
  } else {
    infile = fopen(argv[1], "r");
    if (!infile) {
      usage(argv[0]);
    }
  }
  flv_parser_init(infile);
  flv_parser_run();
  printf("\nFinished analyzing\n");
  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)
movq   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    118b <main+0x3b>
mov    0x2e69(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11bf <main+0x6f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe66(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11ba <main+0x6a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
jmp    11bf <main+0x6f>
mov    -0x18(%rbp),%rdi
call   1040 <flv_parser_init@plt>
mov    $0x0,%al
call   1050 <flv_parser_run@plt>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jne    1162 <main+0x12>
mov    0x2e8b(%rip),%rax
mov    (%rax),%rdi
jmp    1187 <main+0x37>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe90(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rdi
test   %rax,%rax
jne    1187 <main+0x37>
mov    (%rbx),%rdi
call   1060 <usage@plt>
xor    %edi,%edi
call   1040 <flv_parser_init@plt>
xor    %eax,%eax
call   1050 <flv_parser_run@plt>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@.str.1 = [21 x i8] c"\0AFinished analyzing\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
store i32* null, i32** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32*, i32** @stdin
store i32* %10, i32** %6
br label %24
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %6
%16 = load i32*, i32** %6
%17 = icmp ne i32* %16, null
br i1 %17, label %23, label %18
18: ; preds = %11
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @usage(i8* %21)
br label %23
23: ; preds = %18, %11
br label %24
24: ; preds = %23, %9
%25 = load i32*, i32** %6
%26 = call i32 @flv_parser_init(i32* %25)
%27 = call i32 (...) @flv_parser_run()
%28 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [2 x i8] c"r\00"
@str = [20 x i8] c"\0AFinished analyzing\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = load i32*, i32** @stdin
br label %14
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i8*, i8** %1
%13 = tail call i32 @usage(i8* %12)
br label %14
14: ; preds = %6, %11, %4
%15 = phi i32* [ %5, %4 ], [ %9, %6 ], [ null, %11 ]
%16 = tail call i32 @flv_parser_init(i32* %15)
%17 = tail call i32 (...) @flv_parser_run()
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 0
}