#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*/ LLVMFuzzerInitialize(int *, char ***);
int /*<<< orphan*/ LLVMFuzzerTestOneInput(unsigned char *, size_t);
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, 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*/ stderr;
int main(int argc, char **argv) {
  fprintf(stderr, "StandaloneFuzzTargetMain: running %d inputs\n", argc - 1);
  LLVMFuzzerInitialize(&argc, &argv);
  for (int i = 1; i < argc; i++) {
    fprintf(stderr, "Running: %s\n", argv[i]);
    FILE *f = fopen(argv[i], "rb");
    assert(f);
    fseek(f, 0, SEEK_END);
    size_t len = ftell(f);
    fseek(f, 0, SEEK_SET);
    unsigned char *buf = (unsigned char *)malloc(len);
    size_t n_read = fread(buf, 1, len, f);
    fclose(f);
    assert(n_read == len);
    LLVMFuzzerTestOneInput(buf, len);
    free(buf);
    fprintf(stderr, "Done:    %s: (%zd bytes)\n", argv[i], n_read);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   10a0 <LLVMFuzzerInitialize@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1312 <main+0x162>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe01(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x20(%rbp),%rdi
mov    0x2d90(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   1090 <ftell@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2d57(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    -0x28(%rbp),%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x38(%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>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x38(%rbp),%rcx
lea    0xd40(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f7 <main+0x47>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,0xc(%rsp)
mov    %rsi,0x10(%rsp)
mov    0x2e0a(%rip),%r15
mov    (%r15),%eax
lea    -0x1(%rdi),%edx
lea    0xe25(%rip),%rsi
mov    %eax,%edi
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   10a0 <LLVMFuzzerInitialize@plt>
cmpl   $0x2,0xc(%rsp)
jl     12f3 <main+0x143>
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15),%edi
mov    0x10(%rsp),%rax
mov    (%rax,%r12,8),%rdx
lea    0xe0a(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x10(%rsp),%rax
mov    (%rax,%r12,8),%rdi
lea    0xe00(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%rbx
mov    %ebx,%edi
call   1070 <assert@plt>
mov    0x2d98(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    %rbx,%rdi
call   1090 <ftell@plt>
mov    %rax,%r13
mov    0x2d62(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10c0 <fseek@plt>
mov    %r13,%rdi
call   10b0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    $0x1,%esi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1040 <fread@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
cmp    %r13,%r14
sete   %dil
call   1070 <assert@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1060 <LLVMFuzzerTestOneInput@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    (%r15),%edi
mov    0x10(%rsp),%rax
mov    (%rax,%r12,8),%rdx
lea    0xd66(%rip),%rsi
mov    %r14,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
add    $0x1,%r12
movslq 0xc(%rsp),%rax
cmp    %rax,%r12
jl     1210 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"StandaloneFuzzTargetMain: running %d inputs\0A\00"
@.str.1 = [13 x i8] c"Running: %s\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [26 x i8] c"Done: %s: (%zd bytes)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* @stderr
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @LLVMFuzzerInitialize(i32* %4, i8*** %5)
store i32 1, i32* %6
br label %16
16: ; preds = %72, %2
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %75
20: ; preds = %16
%21 = load i32, i32* @stderr
%22 = load i8**, i8*** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %33, i32** %7
%34 = load i32*, i32** %7
%35 = ptrtoint i32* %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = load i32*, i32** %7
%38 = load i32, i32* @SEEK_END
%39 = call i32 @fseek(i32* %37, i32 0, i32 %38)
%40 = load i32*, i32** %7
%41 = call i64 @ftell(i32* %40)
store i64 %41, i64* %8
%42 = load i32*, i32** %7
%43 = load i32, i32* @SEEK_SET
%44 = call i32 @fseek(i32* %42, i32 0, i32 %43)
%45 = load i64, i64* %8
%46 = call i64 @malloc(i64 %45)
%47 = inttoptr i64 %46 to i8*
store i8* %47, i8** %9
%48 = load i8*, i8** %9
%49 = load i64, i64* %8
%50 = load i32*, i32** %7
%51 = call i64 @fread(i8* %48, i32 1, i64 %49, i32* %50)
store i64 %51, i64* %10
%52 = load i32*, i32** %7
%53 = call i32 @fclose(i32* %52)
%54 = load i64, i64* %10
%55 = load i64, i64* %8
%56 = icmp eq i64 %54, %55
%57 = zext i1 %56 to i32
%58 = call i32 @assert(i32 %57)
%59 = load i8*, i8** %9
%60 = load i64, i64* %8
%61 = call i32 @LLVMFuzzerTestOneInput(i8* %59, i64 %60)
%62 = load i8*, i8** %9
%63 = call i32 @free(i8* %62)
%64 = load i32, i32* @stderr
%65 = load i8**, i8*** %5
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
%69 = load i8*, i8** %68
%70 = load i64, i64* %10
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %69, i64 %70)
br label %72
72: ; preds = %20
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 1
store i32 %74, i32* %6
br label %16
75: ; preds = %16
%76 = load i32, i32* %3
ret i32 %76
}

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