#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*/ BMK_benchMem(void *const, size_t const);
size_t BMK_selectBenchedSize(char const *const);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ calloc(size_t const, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *const);
int /*<<< orphan*/ *fopen(char const *const, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t fread(void *const, int, size_t const, int /*<<< orphan*/ *const);
int /*<<< orphan*/ free(char *const);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int BMK_benchFiles(const char *const *fileNamesTable, int nbFiles) {
  int fileIdx;
  for (fileIdx = 0; fileIdx < nbFiles; fileIdx++) {
    const char *const inFileName = fileNamesTable[fileIdx];
    assert(inFileName != NULL);
    {
      FILE *const inFile = fopen(inFileName, "rb");
      size_t const benchedSize = BMK_selectBenchedSize(inFileName);
      char *const buffer = (char *)calloc(benchedSize + 16 + 3, 1);
      void *const alignedBuffer =
          (buffer + 15) - (((size_t)(buffer + 15)) & 0xF);
      if (inFile == NULL) {
        fprintf(stderr, "Error: Could not open '%s': %s.\n", inFileName,
                strerror(errno));
        free(buffer);
        exit(11);
      }
      if (!buffer) {
        fprintf(stderr, "\nError: Out of memory.\n");
        fclose(inFile);
        exit(12);
      }
      {
        size_t const readSize = fread(alignedBuffer, 1, benchedSize, inFile);
        fclose(inFile);
        if (readSize != benchedSize) {
          fprintf(stderr, "\nError: Could not read '%s': %s.\n", inFileName,
                  strerror(errno));
          free(buffer);
          exit(13);
        }
      }
      BMK_benchMem(alignedBuffer, benchedSize);
      free(buffer);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<BMK_benchFiles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    137e <BMK_benchFiles+0x1ce>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x18(%rbp),%rdi
lea    0xe01(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1090 <BMK_selectBenchedSize@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
add    $0x10,%rdi
add    $0x3,%rdi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0xf,%rax
mov    -0x30(%rbp),%rdx
add    $0xf,%rdx
and    $0xf,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12a7 <BMK_benchFiles+0xf7>
mov    0x2d7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rdx
mov    %rax,%rcx
lea    0xd76(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    $0xb,%edi
call   10b0 <exit@plt>
cmpq   $0x0,-0x30(%rbp)
jne    12dc <BMK_benchFiles+0x12c>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
lea    0xd62(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    $0xc,%edi
call   10b0 <exit@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     135a <BMK_benchFiles+0x1aa>
mov    0x2ccc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2cb0(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xcfc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    $0xd,%edi
call   10b0 <exit@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10d0 <BMK_benchMem@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c6 <BMK_benchFiles+0x16>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BMK_benchFiles>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
sub    $0x20,%rsp
mov    %rdi,0x18(%rsp)
test   %esi,%esi
jle    128e <BMK_benchFiles+0xde>
mov    %esi,%eax
mov    %rax,0x10(%rsp)
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%rax
mov    (%rax,%r15,8),%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1070 <assert@plt>
mov    %r14,%rdi
lea    0xdff(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r12
mov    %r14,%rdi
call   1090 <BMK_selectBenchedSize@plt>
mov    %rax,%rbp
lea    0x13(%rax),%rdi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%r13
test   %r12,%r12
je     129e <BMK_benchFiles+0xee>
mov    %r14,0x8(%rsp)
test   %r13,%r13
je     12dd <BMK_benchFiles+0x12d>
mov    %r13,(%rsp)
add    $0xf,%r13
and    $0xfffffffffffffff0,%r13
mov    %r13,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %r12,%rcx
call   1040 <fread@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1050 <fclose@plt>
cmp    %rbp,%r14
jne    1306 <BMK_benchFiles+0x156>
mov    %r13,%rdi
mov    %rbp,%rsi
call   10d0 <BMK_benchMem@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
add    $0x1,%r15
cmp    %r15,0x10(%rsp)
jne    11e0 <BMK_benchFiles+0x30>
xor    %eax,%eax
add    $0x20,%rsp
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d3b(%rip),%rax
mov    (%rax),%ebp
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd47(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    $0xb,%edi
call   10b0 <exit@plt>
mov    0x2cfc(%rip),%rax
mov    (%rax),%edi
lea    0xd37(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    $0xc,%edi
call   10b0 <exit@plt>
mov    0x2cd3(%rip),%rax
mov    (%rax),%ebp
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd18(%rip),%rsi
mov    %ebp,%edi
mov    0x8(%rsp),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    $0xd,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [33 x i8] c"Error: Could not open '%s': %s.\0A\00"
@errno = global i32 0
@.str.2 = [24 x i8] c"\0AError: Out of memory.\0A\00"
@.str.3 = [34 x i8] c"\0AError: Could not read '%s': %s.\0A\00"
define i32 @BMK_benchFiles(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64
store i8** %0, i8*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %12
12: ; preds = %88, %2
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %91
16: ; preds = %12
%17 = load i8**, i8*** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
store i8* %21, i8** %6
%22 = load i8*, i8** %6
%23 = icmp ne i8* %22, null
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i8*, i8** %6
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %27, i32** %7
%28 = load i8*, i8** %6
%29 = call i64 @BMK_selectBenchedSize(i8* %28)
store i64 %29, i64* %8
%30 = load i64, i64* %8
%31 = add i64 %30, 16
%32 = add i64 %31, 3
%33 = call i64 @calloc(i64 %32, i32 1)
%34 = inttoptr i64 %33 to i8*
store i8* %34, i8** %9
%35 = load i8*, i8** %9
%36 = getelementptr inbounds i8, i8* %35, i64 15
%37 = load i8*, i8** %9
%38 = getelementptr inbounds i8, i8* %37, i64 15
%39 = ptrtoint i8* %38 to i64
%40 = and i64 %39, 15
%41 = sub i64 0, %40
%42 = getelementptr inbounds i8, i8* %36, i64 %41
store i8* %42, i8** %10
%43 = load i32*, i32** %7
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %54
45: ; preds = %16
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %6
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %47, i8* %49)
%51 = load i8*, i8** %9
%52 = call i32 @free(i8* %51)
%53 = call i32 @exit(i32 11)
unreachable
54: ; preds = %16
%55 = load i8*, i8** %9
%56 = icmp ne i8* %55, null
br i1 %56, label %63, label %57
57: ; preds = %54
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%60 = load i32*, i32** %7
%61 = call i32 @fclose(i32* %60)
%62 = call i32 @exit(i32 12)
unreachable
63: ; preds = %54
%64 = load i8*, i8** %10
%65 = load i64, i64* %8
%66 = load i32*, i32** %7
%67 = call i64 @fread(i8* %64, i32 1, i64 %65, i32* %66)
store i64 %67, i64* %11
%68 = load i32*, i32** %7
%69 = call i32 @fclose(i32* %68)
%70 = load i64, i64* %11
%71 = load i64, i64* %8
%72 = icmp ne i64 %70, %71
br i1 %72, label %73, label %82
73: ; preds = %63
%74 = load i32, i32* @stderr
%75 = load i8*, i8** %6
%76 = load i32, i32* @errno
%77 = call i8* @strerror(i32 %76)
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %75, i8* %77)
%79 = load i8*, i8** %9
%80 = call i32 @free(i8* %79)
%81 = call i32 @exit(i32 13)
unreachable
82: ; preds = %63
%83 = load i8*, i8** %10
%84 = load i64, i64* %8
%85 = call i32 @BMK_benchMem(i8* %83, i64 %84)
%86 = load i8*, i8** %9
%87 = call i32 @free(i8* %86)
br label %88
88: ; preds = %82
%89 = load i32, i32* %5
%90 = add nsw i32 %89, 1
store i32 %90, i32* %5
br label %12
91: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [33 x i8] c"Error: Could not open '%s': %s.\0A\00"
@errno = global i32 0
@.str.2 = [24 x i8] c"\0AError: Out of memory.\0A\00"
@.str.3 = [34 x i8] c"\0AError: Could not read '%s': %s.\0A\00"
define i32 @BMK_benchFiles(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %56
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %51
%7 = phi i64 [ 0, %4 ], [ %54, %51 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = tail call i64 @BMK_selectBenchedSize(i8* %9)
%15 = add i64 %14, 19
%16 = tail call i64 @calloc(i64 %15, i32 1)
%17 = inttoptr i64 %16 to i8*
%18 = getelementptr inbounds i8, i8* %17, i64 15
%19 = ptrtoint i8* %18 to i64
%20 = and i64 %19, 15
%21 = sub nsw i64 0, %20
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = icmp eq i32* %13, null
br i1 %23, label %24, label %32
24: ; preds = %6
%25 = inttoptr i64 %16 to i8*
%26 = load i32, i32* @stderr
%27 = load i32, i32* @errno
%28 = tail call i8* @strerror(i32 %27)
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %28)
%30 = tail call i32 @free(i8* %25)
%31 = tail call i32 @exit(i32 11)
unreachable
32: ; preds = %6
%33 = icmp eq i64 %16, 0
br i1 %33, label %34, label %39
34: ; preds = %32
%35 = load i32, i32* @stderr
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%37 = tail call i32 @fclose(i32* %13)
%38 = tail call i32 @exit(i32 12)
unreachable
39: ; preds = %32
%40 = tail call i64 @fread(i8* %22, i32 1, i64 %14, i32* %13)
%41 = tail call i32 @fclose(i32* %13)
%42 = icmp eq i64 %40, %14
br i1 %42, label %51, label %43
43: ; preds = %39
%44 = inttoptr i64 %16 to i8*
%45 = load i32, i32* @stderr
%46 = load i32, i32* @errno
%47 = tail call i8* @strerror(i32 %46)
%48 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %9, i8* %47)
%49 = tail call i32 @free(i8* %44)
%50 = tail call i32 @exit(i32 13)
unreachable
51: ; preds = %39
%52 = tail call i32 @BMK_benchMem(i8* %22, i64 %14)
%53 = tail call i32 @free(i8* %17)
%54 = add nuw nsw i64 %7, 1
%55 = icmp eq i64 %54, %5
br i1 %55, label %56, label %6
56: ; preds = %51, %2
ret i32 0
}