#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 */
char EOF;
int Key(char *);
int /*<<< orphan*/ MoveToHashTable(char **, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
void CreateHashTable(char hashTable[][5], char wordsFileName[]) {
  char word[5];
  char readStatus;
  int key;
  FILE *p_hashFile = fopen(wordsFileName, "r");
  if (!p_hashFile) {
    printf("Error occurred while opening \"%s\" file for read. Exiting..\n",
           wordsFileName);
    exit(-1);
  }
  do {
    readStatus = fscanf(p_hashFile, "%s", word);
    if (1)
      printf("Read word: %s\n", word);
    key = Key(word);
    MoveToHashTable(hashTable, word, key, 0);
  } while (readStatus != EOF);
  fclose(p_hashFile);
}


x86 assembly (clang, -O0):
<CreateHashTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11b9 <CreateHashTable+0x49>
mov    -0x10(%rbp),%rsi
lea    0xe58(%rip),%rdi
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
jmp    11be <CreateHashTable+0x4e>
mov    -0x28(%rbp),%rdi
lea    -0x15(%rbp),%rdx
lea    0xe71(%rip),%rsi
call   1060 <fscanf@plt>
mov    %al,-0x16(%rbp)
lea    -0x15(%rbp),%rsi
lea    0xe61(%rip),%rdi
call   1050 <printf@plt>
lea    -0x15(%rbp),%rdi
call   1030 <Key@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x15(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %ecx,%ecx
call   1070 <MoveToHashTable@plt>
movsbl -0x16(%rbp),%eax
mov    0x2dda(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11be <CreateHashTable+0x4e>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateHashTable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xe78(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1202 <CreateHashTable+0x92>
mov    %rax,%r12
lea    0x3(%rsp),%rbp
lea    0xe9d(%rip),%r13
mov    0x2e3d(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
lea    0xe84(%rip),%rsi
mov    %rbp,%rdx
call   1060 <fscanf@plt>
mov    %eax,%ebx
mov    %r13,%rdi
mov    %rbp,%rsi
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1030 <Key@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <MoveToHashTable@plt>
cmp    (%r15),%bl
jne    11b0 <CreateHashTable+0x40>
mov    %r12,%rdi
call   1040 <fclose@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdf9(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [60 x i8] c"Error occurred while opening \22%s\22 file for read. Exiting..\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [15 x i8] c"Read word: %s\0A\00"
@EOF = global i8 0
define void @CreateHashTable([5 x i8]* %0, i8* %1) {
%3 = alloca [5 x i8]*
%4 = alloca i8*
%5 = alloca [5 x i8]
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32*
store [5 x i8]* %0, [5 x i8]** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %4
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %8
%11 = load i32*, i32** %8
%12 = icmp ne i32* %11, null
br i1 %12, label %17, label %13
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %2
br label %18
18: ; preds = %31, %17
%19 = load i32*, i32** %8
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%21 = call signext i8 @fscanf(i32* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %20)
store i8 %21, i8* %6
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%25 = call i32 @Key(i8* %24)
store i32 %25, i32* %7
%26 = load [5 x i8]*, [5 x i8]** %3
%27 = bitcast [5 x i8]* %26 to i8**
%28 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%29 = load i32, i32* %7
%30 = call i32 @MoveToHashTable(i8** %27, i8* %28, i32 %29, i32 0)
br label %31
31: ; preds = %18
%32 = load i8, i8* %6
%33 = sext i8 %32 to i32
%34 = load i8, i8* @EOF
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %33, %35
br i1 %36, label %18, label %37
37: ; preds = %31
%38 = load i32*, i32** %8
%39 = call i32 @fclose(i32* %38)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [60 x i8] c"Error occurred while opening \22%s\22 file for read. Exiting..\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [15 x i8] c"Read word: %s\0A\00"
@EOF = global i8 0
define void @CreateHashTable([5 x i8]* %0, i8* %1) {
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = bitcast [5 x i8]* %0 to i8**
br label %12
9: ; preds = %2
%10 = tail call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%11 = tail call i32 @exit(i32 -1)
unreachable
12: ; preds = %7, %12
%13 = call signext i8 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%15 = call i32 @Key(i8* %4)
%16 = call i32 @MoveToHashTable(i8** %8, i8* %4, i32 %15, i32 0)
%17 = load i8, i8* @EOF
%18 = icmp eq i8 %13, %17
br i1 %18, label %19, label %12
19: ; preds = %12
%20 = call i32 @fclose(i32* %5)
ret void
}