#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 */
unsigned int HashValue(void *, unsigned int);
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned int);
int /*<<< orphan*/ fread(unsigned int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(void *);
scalar_t__ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int fwrite(unsigned int *, int, int, int /*<<< orphan*/ *);
void *malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
int /*<<< orphan*/ *stdout;
void PreprocessLSH(char *inputFile) {
  FILE *fin;
  FILE *hfile[8];
  void *recordComplete;
  char fname[7];
  unsigned int i, id;
  unsigned int hashValue, filenum, bucketPosition, itemCount;
  unsigned int overflow;
  FILE *collisionLog;
  collisionLog = fopen("collisionLog.log", "w");
  if (collisionLog == NULL) {
    perror("collisionLog");
  }
  recordComplete = malloc(sizeof(char) * 1024);
  if (recordComplete == NULL) {
    perror("record in LSH");
    exit(-1);
  }
  fin = fopen(inputFile, "rb");
  if (fin == NULL) {
    perror("fin");
    exit(-1);
  }
  for (i = 0; i < 8; i++) {
    memset(fname, '\0', 4);
    sprintf(fname, "%u.hash", i);
    hfile[i] = fopen(fname, "rb+");
    if (hfile[i] == NULL) {
      perror("hfile");
      exit(-1);
    }
  }
  overflow = 0;
  while (!feof(fin)) {
    fread(recordComplete, 1024, 1, fin);
    for (i = 0; i < 32; i++) {
      hashValue = HashValue(recordComplete, i);
      filenum = hashValue & 7;
      bucketPosition = hashValue / 8;
      if (fseek(hfile[filenum], sizeof(unsigned int) * 64 * (bucketPosition),
                SEEK_SET) < 0) {
        perror("fseek in hfile");
      }
      if (1) {
        fprintf(collisionLog, "%u\n", hashValue);
      }
      itemCount = 1;
      while (itemCount <= 64) {
        fread(&id, sizeof(unsigned int), 1, hfile[filenum]);
        if (id == 0) {
          break;
        }
        itemCount++;
      }
      if (id != 0) {
        overflow++;
        continue;
      }
      if (fseek(hfile[filenum], -sizeof(unsigned int), SEEK_CUR) < 0) {
        perror("fseek in hfile2");
      }
      if (fwrite((unsigned int *)recordComplete, sizeof(unsigned int), 1,
                 hfile[filenum]) != 1) {
        perror("fwrite");
      }
    }
  }
  fprintf(stdout, "number of overflows = %u\n", overflow);
  fclose(fin);
  fclose(collisionLog);
  free(recordComplete);
}


x86 assembly (clang, -O0):
<PreprocessLSH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe0a(%rip),%rdi
lea    0xe14(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
jne    1223 <PreprocessLSH+0x43>
lea    0xdf5(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x400,%edi
call   1090 <malloc@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    1252 <PreprocessLSH+0x72>
lea    0xddd(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1287 <PreprocessLSH+0xa7>
lea    0xdb9(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x8,-0x64(%rbp)
jae    130e <PreprocessLSH+0x12e>
lea    -0x5f(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    -0x5f(%rbp),%rdi
mov    -0x64(%rbp),%edx
lea    0xd7f(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x5f(%rbp),%rdi
lea    0xd77(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rcx
mov    -0x64(%rbp),%eax
mov    %rcx,-0x50(%rbp,%rax,8)
mov    -0x64(%rbp),%eax
cmpq   $0x0,-0x50(%rbp,%rax,8)
jne    12fb <PreprocessLSH+0x11b>
lea    0xd5e(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>
jmp    1300 <PreprocessLSH+0x120>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    128e <PreprocessLSH+0xae>
movl   $0x0,-0x7c(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1333 <PreprocessLSH+0x153>
jmp    14a1 <PreprocessLSH+0x2c1>
mov    -0x58(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x400,%esi
mov    $0x1,%edx
call   1040 <fread@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x20,-0x64(%rbp)
jae    149c <PreprocessLSH+0x2bc>
mov    -0x58(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   10b0 <HashValue@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x70(%rbp)
mov    -0x6c(%rbp),%eax
shr    $0x3,%eax
mov    %eax,-0x74(%rbp)
mov    -0x70(%rbp),%eax
mov    -0x50(%rbp,%rax,8),%rdi
mov    -0x74(%rbp),%eax
shl    $0x8,%rax
mov    %eax,%esi
mov    0x2c44(%rip),%rax
mov    (%rax),%edx
call   10a0 <fseek@plt>
cmp    $0x0,%rax
jge    13b1 <PreprocessLSH+0x1d1>
lea    0xc95(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x88(%rbp),%rdi
mov    -0x6c(%rbp),%edx
lea    0xcbb(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x1,-0x78(%rbp)
cmpl   $0x40,-0x78(%rbp)
ja     1410 <PreprocessLSH+0x230>
mov    -0x70(%rbp),%eax
mov    -0x50(%rbp,%rax,8),%rcx
lea    -0x68(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <fread@plt>
cmpl   $0x0,-0x68(%rbp)
jne    1402 <PreprocessLSH+0x222>
jmp    1410 <PreprocessLSH+0x230>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    13ce <PreprocessLSH+0x1ee>
cmpl   $0x0,-0x68(%rbp)
je     1428 <PreprocessLSH+0x248>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    148e <PreprocessLSH+0x2ae>
mov    -0x70(%rbp),%eax
mov    -0x50(%rbp,%rax,8),%rdi
mov    0x2bb1(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffc,%esi
call   10a0 <fseek@plt>
cmp    $0x0,%rax
jge    1459 <PreprocessLSH+0x279>
lea    0xbfc(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x58(%rbp),%rdi
mov    -0x70(%rbp),%eax
mov    -0x50(%rbp,%rax,8),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1100 <fwrite@plt>
cmp    $0x1,%eax
je     1489 <PreprocessLSH+0x2a9>
lea    0xbdc(%rip),%rdi
call   10d0 <perror@plt>
jmp    148e <PreprocessLSH+0x2ae>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1351 <PreprocessLSH+0x171>
jmp    1315 <PreprocessLSH+0x135>
mov    0x2b28(%rip),%rax
mov    (%rax),%rdi
mov    -0x7c(%rbp),%edx
lea    0xbb2(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x88(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PreprocessLSH>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdi,%rbp
lea    0xe08(%rip),%rdi
lea    0xe12(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,0x20(%rsp)
test   %rax,%rax
je     15fb <PreprocessLSH+0x41b>
mov    $0x400,%edi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     1622 <PreprocessLSH+0x442>
lea    0xdfd(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     162b <PreprocessLSH+0x44b>
mov    %rax,%rbx
lea    0x9(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    0xdd5(%rip),%rsi
mov    %rbp,%rdi
xor    %edx,%edx
call   10e0 <sprintf@plt>
lea    0xdcc(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
mov    %rax,0x30(%rsp)
test   %rax,%rax
je     160c <PreprocessLSH+0x42c>
lea    0x9(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    0xd93(%rip),%rsi
mov    %rbp,%rdi
mov    $0x1,%edx
call   10e0 <sprintf@plt>
lea    0xd87(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
mov    %rax,0x38(%rsp)
test   %rax,%rax
je     160c <PreprocessLSH+0x42c>
lea    0x9(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    0xd4e(%rip),%rsi
mov    %rbp,%rdi
mov    $0x2,%edx
call   10e0 <sprintf@plt>
lea    0xd42(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
mov    %rax,0x40(%rsp)
test   %rax,%rax
je     160c <PreprocessLSH+0x42c>
lea    0x9(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    0xd09(%rip),%rsi
mov    %rbp,%rdi
mov    $0x3,%edx
call   10e0 <sprintf@plt>
lea    0xcfd(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
mov    %rax,0x48(%rsp)
test   %rax,%rax
je     160c <PreprocessLSH+0x42c>
lea    0x9(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    0xcc4(%rip),%rsi
mov    %rbp,%rdi
mov    $0x4,%edx
call   10e0 <sprintf@plt>
lea    0xcb8(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
mov    %rax,0x50(%rsp)
test   %rax,%rax
je     160c <PreprocessLSH+0x42c>
lea    0x9(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    0xc7f(%rip),%rsi
mov    %rbp,%rdi
mov    $0x5,%edx
call   10e0 <sprintf@plt>
lea    0xc73(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
mov    %rax,0x58(%rsp)
test   %rax,%rax
je     160c <PreprocessLSH+0x42c>
lea    0x9(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    0xc3a(%rip),%rsi
mov    %rbp,%rdi
mov    $0x6,%edx
call   10e0 <sprintf@plt>
lea    0xc2e(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
mov    %rax,0x60(%rsp)
test   %rax,%rax
je     160c <PreprocessLSH+0x42c>
lea    0x9(%rsp),%r14
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <memset@plt>
lea    0xbf3(%rip),%rsi
mov    %r14,%rdi
mov    $0x7,%edx
call   10e0 <sprintf@plt>
lea    0xbe7(%rip),%rsi
mov    %r14,%rdi
call   10c0 <fopen@plt>
mov    %rax,0x68(%rsp)
test   %rax,%rax
je     160c <PreprocessLSH+0x42c>
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
je     14bb <PreprocessLSH+0x2db>
mov    0x2b51(%rip),%rax
mov    (%rax),%rdi
lea    0xbde(%rip),%rsi
mov    %ebp,%edx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1050 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
lea    0x1c(%rsp),%r15
mov    %rbx,0x28(%rsp)
jmp    14e1 <PreprocessLSH+0x301>
nopl   0x0(%rax)
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    1478 <PreprocessLSH+0x298>
mov    0x10(%rsp),%rdi
mov    $0x400,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
xor    %r12d,%r12d
jmp    150a <PreprocessLSH+0x32a>
nopl   (%rax)
add    $0x1,%r12d
cmp    $0x20,%r12d
je     14d0 <PreprocessLSH+0x2f0>
mov    0x10(%rsp),%rdi
mov    %r12d,%esi
call   10b0 <HashValue@plt>
mov    %eax,%r13d
and    $0x7,%eax
mov    0x30(%rsp,%rax,8),%r14
mov    %r13d,%esi
and    $0xfffffff8,%esi
shl    $0x5,%esi
mov    0x2aa6(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
call   10a0 <fseek@plt>
test   %rax,%rax
js     15dc <PreprocessLSH+0x3fc>
mov    0x20(%rsp),%rdi
lea    0xb2c(%rip),%rsi
mov    %r13d,%edx
call   1070 <fprintf@plt>
mov    $0x40,%ebx
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmpl   $0x0,0x1c(%rsp)
je     1590 <PreprocessLSH+0x3b0>
add    $0xffffffff,%ebx
jne    1560 <PreprocessLSH+0x380>
add    $0x1,%ebp
jmp    1500 <PreprocessLSH+0x320>
nopl   0x0(%rax)
mov    0x2a51(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0xfffffffc,%esi
call   10a0 <fseek@plt>
test   %rax,%rax
js     15ed <PreprocessLSH+0x40d>
mov    0x10(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1100 <fwrite@plt>
cmp    $0x1,%eax
je     1500 <PreprocessLSH+0x320>
lea    0xa8e(%rip),%rdi
call   10d0 <perror@plt>
jmp    1500 <PreprocessLSH+0x320>
lea    0xa5e(%rip),%rdi
call   10d0 <perror@plt>
jmp    1545 <PreprocessLSH+0x365>
lea    0xa5c(%rip),%rdi
call   10d0 <perror@plt>
jmp    15ab <PreprocessLSH+0x3cb>
lea    0xa11(%rip),%rdi
call   10d0 <perror@plt>
jmp    1212 <PreprocessLSH+0x32>
lea    0xa37(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>
lea    0x9f7(%rip),%rdi
jmp    1613 <PreprocessLSH+0x433>
lea    0x9ff(%rip),%rdi
jmp    1613 <PreprocessLSH+0x433>

LLVM IR (-O0):
@.str = [17 x i8] c"collisionLog.log\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [13 x i8] c"collisionLog\00"
@.str.3 = [14 x i8] c"record in LSH\00"
@.str.4 = [3 x i8] c"rb\00"
@.str.5 = [4 x i8] c"fin\00"
@.str.6 = [8 x i8] c"%u.hash\00"
@.str.7 = [4 x i8] c"rb+\00"
@.str.8 = [6 x i8] c"hfile\00"
@SEEK_SET = global i32 0
@.str.9 = [15 x i8] c"fseek in hfile\00"
@.str.10 = [4 x i8] c"%u\0A\00"
@SEEK_CUR = global i32 0
@.str.11 = [16 x i8] c"fseek in hfile2\00"
@.str.12 = [7 x i8] c"fwrite\00"
@stdout = global i32* null
@.str.13 = [26 x i8] c"number of overflows = %u\0A\00"
define void @PreprocessLSH(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [8 x i32*]
%5 = alloca i8*
%6 = alloca [7 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
store i8* %0, i8** %2
%15 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %14
%16 = load i32*, i32** %14
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %1
%19 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %1
%21 = call i8* @malloc(i32 1024)
store i8* %21, i8** %5
%22 = load i8*, i8** %5
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %20
%28 = load i8*, i8** %2
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %29, i32** %3
%30 = load i32*, i32** %3
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%34 = call i32 @exit(i32 -1)
unreachable
35: ; preds = %27
store i32 0, i32* %7
br label %36
36: ; preds = %59, %35
%37 = load i32, i32* %7
%38 = icmp ult i32 %37, 8
br i1 %38, label %39, label %62
39: ; preds = %36
%40 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%41 = call i32 @memset(i8* %40, i8 signext 0, i32 4)
%42 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%43 = load i32, i32* %7
%44 = call i32 @sprintf(i8* %42, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%47 = load i32, i32* %7
%48 = zext i32 %47 to i64
%49 = getelementptr inbounds [8 x i32*], [8 x i32*]* %4, i64 0, i64 %48
store i32* %46, i32** %49
%50 = load i32, i32* %7
%51 = zext i32 %50 to i64
%52 = getelementptr inbounds [8 x i32*], [8 x i32*]* %4, i64 0, i64 %51
%53 = load i32*, i32** %52
%54 = icmp eq i32* %53, null
br i1 %54, label %55, label %58
55: ; preds = %39
%56 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%57 = call i32 @exit(i32 -1)
unreachable
58: ; preds = %39
br label %59
59: ; preds = %58
%60 = load i32, i32* %7
%61 = add i32 %60, 1
store i32 %61, i32* %7
br label %36
62: ; preds = %36
store i32 0, i32* %13
br label %63
63: ; preds = %147, %62
%64 = load i32*, i32** %3
%65 = call i32 @feof(i32* %64)
%66 = icmp ne i32 %65, 0
%67 = xor i1 %66, true
br i1 %67, label %68, label %148
68: ; preds = %63
%69 = load i8*, i8** %5
%70 = bitcast i8* %69 to i32*
%71 = load i32*, i32** %3
%72 = call i32 @fread(i32* %70, i32 1024, i32 1, i32* %71)
store i32 0, i32* %7
br label %73
73: ; preds = %144, %68
%74 = load i32, i32* %7
%75 = icmp ult i32 %74, 32
br i1 %75, label %76, label %147
76: ; preds = %73
%77 = load i8*, i8** %5
%78 = load i32, i32* %7
%79 = call i32 @HashValue(i8* %77, i32 %78)
store i32 %79, i32* %9
%80 = load i32, i32* %9
%81 = and i32 %80, 7
store i32 %81, i32* %10
%82 = load i32, i32* %9
%83 = udiv i32 %82, 8
store i32 %83, i32* %11
%84 = load i32, i32* %10
%85 = zext i32 %84 to i64
%86 = getelementptr inbounds [8 x i32*], [8 x i32*]* %4, i64 0, i64 %85
%87 = load i32*, i32** %86
%88 = load i32, i32* %11
%89 = zext i32 %88 to i64
%90 = mul i64 256, %89
%91 = trunc i64 %90 to i32
%92 = load i32, i32* @SEEK_SET
%93 = call i64 @fseek(i32* %87, i32 %91, i32 %92)
%94 = icmp slt i64 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %76
%96 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %97
97: ; preds = %95, %76
%98 = load i32*, i32** %14
%99 = load i32, i32* %9
%100 = call i32 @fprintf(i32* %98, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %99)
store i32 1, i32* %12
br label %101
101: ; preds = %113, %97
%102 = load i32, i32* %12
%103 = icmp ule i32 %102, 64
br i1 %103, label %104, label %116
104: ; preds = %101
%105 = load i32, i32* %10
%106 = zext i32 %105 to i64
%107 = getelementptr inbounds [8 x i32*], [8 x i32*]* %4, i64 0, i64 %106
%108 = load i32*, i32** %107
%109 = call i32 @fread(i32* %8, i32 4, i32 1, i32* %108)
%110 = load i32, i32* %8
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %113
112: ; preds = %104
br label %116
113: ; preds = %104
%114 = load i32, i32* %12
%115 = add i32 %114, 1
store i32 %115, i32* %12
br label %101
116: ; preds = %112, %101
%117 = load i32, i32* %8
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %116
%120 = load i32, i32* %13
%121 = add i32 %120, 1
store i32 %121, i32* %13
br label %144
122: ; preds = %116
%123 = load i32, i32* %10
%124 = zext i32 %123 to i64
%125 = getelementptr inbounds [8 x i32*], [8 x i32*]* %4, i64 0, i64 %124
%126 = load i32*, i32** %125
%127 = load i32, i32* @SEEK_CUR
%128 = call i64 @fseek(i32* %126, i32 -4, i32 %127)
%129 = icmp slt i64 %128, 0
br i1 %129, label %130, label %132
130: ; preds = %122
%131 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %132
132: ; preds = %130, %122
%133 = load i8*, i8** %5
%134 = bitcast i8* %133 to i32*
%135 = load i32, i32* %10
%136 = zext i32 %135 to i64
%137 = getelementptr inbounds [8 x i32*], [8 x i32*]* %4, i64 0, i64 %136
%138 = load i32*, i32** %137
%139 = call i32 @fwrite(i32* %134, i32 4, i32 1, i32* %138)
%140 = icmp ne i32 %139, 1
br i1 %140, label %141, label %143
141: ; preds = %132
%142 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
br label %143
143: ; preds = %141, %132
br label %144
144: ; preds = %143, %119
%145 = load i32, i32* %7
%146 = add i32 %145, 1
store i32 %146, i32* %7
br label %73
147: ; preds = %73
br label %63
148: ; preds = %63
%149 = load i32*, i32** @stdout
%150 = load i32, i32* %13
%151 = call i32 @fprintf(i32* %149, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i32 %150)
%152 = load i32*, i32** %3
%153 = call i32 @fclose(i32* %152)
%154 = load i32*, i32** %14
%155 = call i32 @fclose(i32* %154)
%156 = load i8*, i8** %5
%157 = call i32 @free(i8* %156)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"collisionLog.log\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [13 x i8] c"collisionLog\00"
@.str.3 = [14 x i8] c"record in LSH\00"
@.str.4 = [3 x i8] c"rb\00"
@.str.5 = [4 x i8] c"fin\00"
@.str.6 = [8 x i8] c"%u.hash\00"
@.str.7 = [4 x i8] c"rb+\00"
@.str.8 = [6 x i8] c"hfile\00"
@SEEK_SET = global i32 0
@.str.9 = [15 x i8] c"fseek in hfile\00"
@.str.10 = [4 x i8] c"%u\0A\00"
@SEEK_CUR = global i32 0
@.str.11 = [16 x i8] c"fseek in hfile2\00"
@.str.12 = [7 x i8] c"fwrite\00"
@stdout = global i32* null
@.str.13 = [26 x i8] c"number of overflows = %u\0A\00"
define void @PreprocessLSH(i8* nocapture %0) {
%2 = alloca [8 x i32*]
%3 = alloca [7 x i8]
%4 = alloca i32
%5 = bitcast [8 x i32*]* %2 to i8*
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%17 = tail call i32 @exit(i32 -1)
unreachable
18: ; preds = %12
%19 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = call i32 @memset(i8* %6, i8 signext 0, i32 4)
%23 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 0)
%24 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%25 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 0
store i32* %24, i32** %25
%26 = icmp eq i32* %24, null
br i1 %26, label %77, label %30
27: ; preds = %18
%28 = tail call i32 @perror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%29 = tail call i32 @exit(i32 -1)
unreachable
30: ; preds = %21
%31 = call i32 @memset(i8* %6, i8 signext 0, i32 4)
%32 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 1)
%33 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%34 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 1
store i32* %33, i32** %34
%35 = icmp eq i32* %33, null
br i1 %35, label %77, label %36
36: ; preds = %30
%37 = call i32 @memset(i8* %6, i8 signext 0, i32 4)
%38 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 2)
%39 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%40 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 2
store i32* %39, i32** %40
%41 = icmp eq i32* %39, null
br i1 %41, label %77, label %42
42: ; preds = %36
%43 = call i32 @memset(i8* %6, i8 signext 0, i32 4)
%44 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 3)
%45 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%46 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 3
store i32* %45, i32** %46
%47 = icmp eq i32* %45, null
br i1 %47, label %77, label %48
48: ; preds = %42
%49 = call i32 @memset(i8* %6, i8 signext 0, i32 4)
%50 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 4)
%51 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%52 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 4
store i32* %51, i32** %52
%53 = icmp eq i32* %51, null
br i1 %53, label %77, label %54
54: ; preds = %48
%55 = call i32 @memset(i8* %6, i8 signext 0, i32 4)
%56 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 5)
%57 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%58 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 5
store i32* %57, i32** %58
%59 = icmp eq i32* %57, null
br i1 %59, label %77, label %60
60: ; preds = %54
%61 = call i32 @memset(i8* %6, i8 signext 0, i32 4)
%62 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 6)
%63 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%64 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 6
store i32* %63, i32** %64
%65 = icmp eq i32* %63, null
br i1 %65, label %77, label %66
66: ; preds = %60
%67 = call i32 @memset(i8* %6, i8 signext 0, i32 4)
%68 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 7)
%69 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%70 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 7
store i32* %69, i32** %70
%71 = icmp eq i32* %69, null
br i1 %71, label %77, label %72
72: ; preds = %66
%73 = call i32 @feof(i32* %19)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %128
75: ; preds = %72
%76 = bitcast i8* %13 to i32*
br label %83
77: ; preds = %66, %60, %54, %48, %42, %36, %30, %21
%78 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%79 = call i32 @exit(i32 -1)
unreachable
80: ; preds = %124
%81 = call i32 @feof(i32* %19)
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %128
83: ; preds = %75, %80
%84 = phi i32 [ 0, %75 ], [ %125, %80 ]
%85 = call i32 @fread(i32* %76, i32 1024, i32 1, i32* %19)
br label %86
86: ; preds = %83, %124
%87 = phi i32 [ 0, %83 ], [ %126, %124 ]
%88 = phi i32 [ %84, %83 ], [ %125, %124 ]
%89 = call i32 @HashValue(i8* %13, i32 %87)
%90 = and i32 %89, 7
%91 = zext i32 %90 to i64
%92 = getelementptr inbounds [8 x i32*], [8 x i32*]* %2, i64 0, i64 %91
%93 = load i32*, i32** %92
%94 = shl i32 %89, 5
%95 = and i32 %94, -256
%96 = load i32, i32* @SEEK_SET
%97 = call i64 @fseek(i32* %93, i32 %95, i32 %96)
%98 = icmp slt i64 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %86
%100 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %101
101: ; preds = %99, %86
%102 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %89)
br label %106
103: ; preds = %106
%104 = add nuw nsw i32 %107, 1
%105 = icmp eq i32 %104, 65
br i1 %105, label %111, label %106
106: ; preds = %101, %103
%107 = phi i32 [ 1, %101 ], [ %104, %103 ]
%108 = call i32 @fread(i32* %4, i32 4, i32 1, i32* %93)
%109 = load i32, i32* %4
%110 = icmp eq i32 %109, 0
br i1 %110, label %113, label %103
111: ; preds = %103
%112 = add i32 %88, 1
br label %124
113: ; preds = %106
%114 = load i32, i32* @SEEK_CUR
%115 = call i64 @fseek(i32* %93, i32 -4, i32 %114)
%116 = icmp slt i64 %115, 0
br i1 %116, label %117, label %119
117: ; preds = %113
%118 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %119
119: ; preds = %117, %113
%120 = call i32 @fwrite(i32* %76, i32 4, i32 1, i32* %93)
%121 = icmp eq i32 %120, 1
br i1 %121, label %124, label %122
122: ; preds = %119
%123 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
br label %124
124: ; preds = %119, %122, %111
%125 = phi i32 [ %112, %111 ], [ %88, %122 ], [ %88, %119 ]
%126 = add nuw nsw i32 %87, 1
%127 = icmp eq i32 %126, 32
br i1 %127, label %80, label %86
128: ; preds = %80, %72
%129 = phi i32 [ 0, %72 ], [ %125, %80 ]
%130 = load i32*, i32** @stdout
%131 = call i32 @fprintf(i32* %130, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i32 %129)
%132 = call i32 @fclose(i32* %19)
%133 = call i32 @fclose(i32* %8)
%134 = call i32 @free(i8* %13)
ret void
}