#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*/ LLVMFuzzerTestOneInput(unsigned char *, size_t);
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ *fopen(char *, char *);
size_t fread(unsigned char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
size_t ftell(int /*<<< orphan*/ *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  FILE *f;
  size_t n_read, len;
  unsigned char *buf;
  if (argc < 2)
    return 1;
  f = fopen(argv[1], "r");
  assert(f);
  fseek(f, 0, SEEK_END);
  len = ftell(f);
  fseek(f, 0, SEEK_SET);
  buf = (unsigned char *)malloc(len);
  n_read = fread(buf, 1, len, f);
  assert(n_read == len);
  LLVMFuzzerTestOneInput(buf, len);
  free(buf);
  printf("Done!\n");
  return 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)
cmpl   $0x2,-0x8(%rbp)
jge    11bc <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1279 <main+0xe9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe35(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x18(%rbp),%rdi
mov    0x2dfe(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1080 <ftell@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2dcd(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x28(%rbp),%rdi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <LLVMFuzzerTestOneInput@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
lea    0xd95(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
cmp    $0x2,%edi
jl     123f <main+0xaf>
mov    0x8(%rsi),%rdi
lea    0xe4f(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbx
mov    %ebx,%edi
call   1070 <assert@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%edx
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %rbx,%rdi
call   1080 <ftell@plt>
mov    %rax,%rbp
mov    0x2df0(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %rbp,%rdi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1050 <fread@plt>
xor    %edi,%edi
cmp    %rbp,%rax
sete   %dil
call   1070 <assert@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1060 <LLVMFuzzerTestOneInput@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xdc8(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.1 = [7 x i8] c"Done!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %47
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %6
%18 = load i32*, i32** %6
%19 = ptrtoint i32* %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32*, i32** %6
%22 = load i32, i32* @SEEK_END
%23 = call i32 @fseek(i32* %21, i32 0, i32 %22)
%24 = load i32*, i32** %6
%25 = call i64 @ftell(i32* %24)
store i64 %25, i64* %8
%26 = load i32*, i32** %6
%27 = load i32, i32* @SEEK_SET
%28 = call i32 @fseek(i32* %26, i32 0, i32 %27)
%29 = load i64, i64* %8
%30 = call i64 @malloc(i64 %29)
%31 = inttoptr i64 %30 to i8*
store i8* %31, i8** %9
%32 = load i8*, i8** %9
%33 = load i64, i64* %8
%34 = load i32*, i32** %6
%35 = call i64 @fread(i8* %32, i32 1, i64 %33, i32* %34)
store i64 %35, i64* %7
%36 = load i64, i64* %7
%37 = load i64, i64* %8
%38 = icmp eq i64 %36, %37
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = load i8*, i8** %9
%42 = load i64, i64* %8
%43 = call i32 @LLVMFuzzerTestOneInput(i8* %41, i64 %42)
%44 = load i8*, i8** %9
%45 = call i32 @free(i8* %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %47
47: ; preds = %13, %12
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@str = [6 x i8] c"Done!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %25, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%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 = ptrtoint i32* %7 to i64
%9 = trunc i64 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = load i32, i32* @SEEK_END
%12 = tail call i32 @fseek(i32* %7, i32 0, i32 %11)
%13 = tail call i64 @ftell(i32* %7)
%14 = load i32, i32* @SEEK_SET
%15 = tail call i32 @fseek(i32* %7, i32 0, i32 %14)
%16 = tail call i64 @malloc(i64 %13)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i64 @fread(i8* %17, i32 1, i64 %13, i32* %7)
%19 = icmp eq i64 %18, %13
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i32 @LLVMFuzzerTestOneInput(i8* %17, i64 %13)
%23 = tail call i32 @free(i8* %17)
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %2, %4
%26 = phi i32 [ 0, %4 ], [ 1, %2 ]
ret i32 %26
}