#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*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fread(char **, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int hash(char *, int);
int /*<<< orphan*/ perror(char *);
void parse_files(char **list_of_files, int num_of_files, int **storage) {
  int *storage_array = *storage;
  for (int i = 0; i < num_of_files; i++) {
    FILE *current_file;
    current_file = fopen(list_of_files[i], "rb");
    if (current_file == NULL) {
      perror("ERROR: fopen\n");
    } else {
      int offset = 0;
      while (!feof(current_file)) {
        char buffer[5];
        if (fread(&buffer, sizeof(char), 5, current_file) == 0) {
          break;
        }
        if (buffer != NULL) {
          int hash_temp = hash(buffer, 5);
          if (hash_temp != -1) {
            storage_array[hash_temp] += 1;
          }
        }
        offset++;
        fseek(current_file, offset, SEEK_SET);
      }
    }
    fclose(current_file);
  }
}


x86 assembly (clang, -O0):
<parse_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    128f <parse_files+0x11f>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe4c(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11d9 <parse_files+0x69>
lea    0xe34(%rip),%rdi
call   1090 <perror@plt>
jmp    1278 <parse_files+0x108>
movl   $0x0,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11fe <parse_files+0x8e>
jmp    1273 <parse_files+0x103>
lea    -0x39(%rbp),%rdi
mov    -0x30(%rbp),%rcx
mov    $0x1,%esi
mov    $0x5,%edx
call   1030 <fread@plt>
cmp    $0x0,%rax
jne    1224 <parse_files+0xb4>
jmp    1273 <parse_files+0x103>
lea    -0x39(%rbp),%rdi
mov    $0x5,%esi
call   1050 <hash@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0xffffffff,-0x40(%rbp)
je     1250 <parse_files+0xe0>
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    0x2d79(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
jmp    11e0 <parse_files+0x70>
jmp    1278 <parse_files+0x108>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1195 <parse_files+0x25>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_files>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
test   %esi,%esi
jle    1265 <parse_files+0xf5>
mov    (%rdx),%r15
mov    %esi,%eax
mov    %rax,(%rsp)
xor    %r12d,%r12d
lea    0x13(%rsp),%r13
mov    0x2e3d(%rip),%r14
jmp    11d6 <parse_files+0x66>
lea    0xe57(%rip),%rdi
call   1090 <perror@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x1,%r12
cmp    (%rsp),%r12
je     1265 <parse_files+0xf5>
mov    0x8(%rsp),%rax
mov    (%rax,%r12,8),%rdi
lea    0xe1a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11a5 <parse_files+0x35>
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    11c0 <parse_files+0x50>
mov    $0x1,%ebp
jmp    122c <parse_files+0xbc>
cs nopw 0x0(%rax,%rax,1)
mov    (%r14),%edx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1070 <fseek@plt>
mov    %rbx,%rdi
call   1060 <feof@plt>
add    $0x1,%ebp
test   %eax,%eax
jne    11c0 <parse_files+0x50>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x5,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
test   %rax,%rax
je     11c0 <parse_files+0x50>
mov    %r13,%rdi
mov    $0x5,%esi
call   1050 <hash@plt>
cmp    $0xffffffff,%eax
je     1210 <parse_files+0xa0>
cltq
addl   $0x1,(%r15,%rax,4)
jmp    1210 <parse_files+0xa0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@.str.1 = [14 x i8] c"ERROR: fopen\0A\00"
@SEEK_SET = global i32 0
define void @parse_files(i8** %0, i32 %1, i32** %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32**
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca [5 x i8]
%12 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32** %2, i32*** %6
%13 = load i32**, i32*** %6
%14 = load i32*, i32** %13
store i32* %14, i32** %7
store i32 0, i32* %8
br label %15
15: ; preds = %65, %3
%16 = load i32, i32* %8
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %68
19: ; preds = %15
%20 = load i8**, i8*** %4
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %9
%26 = load i32*, i32** %9
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %19
%29 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %62
30: ; preds = %19
store i32 0, i32* %10
br label %31
31: ; preds = %54, %30
%32 = load i32*, i32** %9
%33 = call i32 @feof(i32* %32)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %36, label %61
36: ; preds = %31
%37 = bitcast [5 x i8]* %11 to i8**
%38 = load i32*, i32** %9
%39 = call i64 @fread(i8** %37, i32 1, i32 5, i32* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %36
br label %61
42: ; preds = %36
%43 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%44 = call i32 @hash(i8* %43, i32 5)
store i32 %44, i32* %12
%45 = load i32, i32* %12
%46 = icmp ne i32 %45, -1
br i1 %46, label %47, label %54
47: ; preds = %42
%48 = load i32*, i32** %7
%49 = load i32, i32* %12
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i32, i32* %48, i64 %50
%52 = load i32, i32* %51
%53 = add nsw i32 %52, 1
store i32 %53, i32* %51
br label %54
54: ; preds = %47, %42
%55 = load i32, i32* %10
%56 = add nsw i32 %55, 1
store i32 %56, i32* %10
%57 = load i32*, i32** %9
%58 = load i32, i32* %10
%59 = load i32, i32* @SEEK_SET
%60 = call i32 @fseek(i32* %57, i32 %58, i32 %59)
br label %31
61: ; preds = %41, %31
br label %62
62: ; preds = %61, %28
%63 = load i32*, i32** %9
%64 = call i32 @fclose(i32* %63)
br label %65
65: ; preds = %62
%66 = load i32, i32* %8
%67 = add nsw i32 %66, 1
store i32 %67, i32* %8
br label %15
68: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@.str.1 = [14 x i8] c"ERROR: fopen\0A\00"
@SEEK_SET = global i32 0
define void @parse_files(i8** nocapture %0, i32 %1, i32** nocapture %2) {
%4 = alloca [5 x i8]
%5 = load i32*, i32** %2
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%9 = bitcast [5 x i8]* %4 to i8**
%10 = zext i32 %1 to i64
br label %12
11: ; preds = %42, %3
ret void
12: ; preds = %7, %42
%13 = phi i64 [ 0, %7 ], [ %44, %42 ]
%14 = getelementptr inbounds i8*, i8** %0, i64 %13
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %21, label %18
18: ; preds = %12
%19 = call i32 @feof(i32* %16)
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %42
21: ; preds = %12
%22 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %42
23: ; preds = %18, %36
%24 = phi i32 [ %37, %36 ], [ 0, %18 ]
%25 = call i64 @fread(i8** %9, i32 1, i32 5, i32* %16)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
br label %42
28: ; preds = %23
%29 = call i32 @hash(i8* %8, i32 5)
%30 = icmp eq i32 %29, -1
br i1 %30, label %36, label %31
31: ; preds = %28
%32 = sext i32 %29 to i64
%33 = getelementptr inbounds i32, i32* %5, i64 %32
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
br label %36
36: ; preds = %28, %31
%37 = add nuw nsw i32 %24, 1
%38 = load i32, i32* @SEEK_SET
%39 = call i32 @fseek(i32* %16, i32 %37, i32 %38)
%40 = call i32 @feof(i32* %16)
%41 = icmp eq i32 %40, 0
br i1 %41, label %23, label %42
42: ; preds = %36, %18, %27, %21
%43 = call i32 @fclose(i32* %16)
%44 = add nuw nsw i64 %13, 1
%45 = icmp eq i64 %44, %10
br i1 %45, label %11, label %12
}