#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 */

/* Variables and functions */
int EOF;
int /*<<< orphan*/ doubleCapacity(char ***, int *, int *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getchar();
int hash_function(char *);
int /*<<< orphan*/ insertWord(char **, int *, char *);
int /*<<< orphan*/ printArray(char ***, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ removeWord(char **, int *, char *);
scalar_t__ saveDictionary(char *, char ****, int *, int *);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ search(char **, char *, int);
int /*<<< orphan*/ stderr;
void menu(char *outFileName, char ****array, int *count, int *capacity) {
  char choice;
  char word[50];
  do {
    int ch;
    printf("Choose: 'S'earch, 'I'nsert, 'R'emove, 'C'ount, 'Q'uit :\n");
    scanf("%c", &choice);
    if (choice == 'S') {
      printf("input the word you want to search:\n");
      scanf("%s", word);
      int index = hash_function(word);
      if (search((*array)[index], word, count[index])) {
        printf("is found\n");
      } else {
        printf("is not found\n");
      }
    } else if (choice == 'I') {
      printf("input a word to insert\n");
      scanf("%s", word);
      int index = hash_function(word);
      if (search((*array)[index], word, count[index])) {
        printf("%s ignored (duplicate)\n", word);
      } else {
        if (count[index] >= capacity[index]) {
          doubleCapacity(&((*array)[index]), &count[index], &capacity[index]);
        }
        insertWord((*array)[index], &count[index], word);
        printf("Insert word %s successfully\n", word);
      }
    } else if (choice == 'R') {
      printf("input a word to remove\n");
      scanf("%s", word);
      int index = hash_function(word);
      removeWord((*array)[index], &count[index], word);
    } else if (choice == 'C') {
      printf("The word number of the dictionary is %d\n",
             count[0] + count[1] + count[2] + count[3] + count[4] + count[5] +
                 count[6] + count[7]);
    } else if (choice == 'Q') {
      printf("program is ending and dictionary will be sent to %s\n",
             outFileName);
      if (saveDictionary(outFileName, array, count, capacity) != 0) {
        fprintf(stderr, "    save dictionary failed! Program terminating...\n");
      }
      break;
    } else if (choice == 'P') {
      printArray(*array, count);
    } else {
      printf("unrecognized order! please reinput!\n");
    }
    while ((ch = getchar()) != '\n' && ch != EOF)
      ;
  } while (1);
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
lea    -0x21(%rbp),%rsi
call   1070 <scanf@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x53,%eax
jne    1273 <menu+0xc3>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe51(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x60(%rbp),%rdi
call   10b0 <hash_function@plt>
mov    %eax,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rax
movslq -0x68(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1040 <search@plt>
cmp    $0x0,%rax
je     1260 <menu+0xb0>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126e <menu+0xbe>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14d8 <menu+0x328>
movsbl -0x21(%rbp),%eax
cmp    $0x49,%eax
jne    137d <menu+0x1cd>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xdc7(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x60(%rbp),%rdi
call   10b0 <hash_function@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1040 <search@plt>
cmp    $0x0,%rax
je     12ee <menu+0x13e>
lea    -0x60(%rbp),%rsi
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1378 <menu+0x1c8>
mov    -0x18(%rbp),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x20(%rbp),%rcx
movslq -0x6c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jl     133f <menu+0x18f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
movslq -0x6c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
movslq -0x6c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x20(%rbp),%rdx
movslq -0x6c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
call   1080 <doubleCapacity@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x6c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    -0x60(%rbp),%rdx
call   10a0 <insertWord@plt>
lea    -0x60(%rbp),%rsi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14d3 <menu+0x323>
movsbl -0x21(%rbp),%eax
cmp    $0x52,%eax
jne    13e0 <menu+0x230>
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xcbd(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x60(%rbp),%rdi
call   10b0 <hash_function@plt>
mov    %eax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x70(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x70(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    -0x60(%rbp),%rdx
call   10c0 <removeWord@plt>
jmp    14ce <menu+0x31e>
movsbl -0x21(%rbp),%eax
cmp    $0x43,%eax
jne    1437 <menu+0x287>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
add    0x4(%rax),%esi
mov    -0x18(%rbp),%rax
add    0x8(%rax),%esi
mov    -0x18(%rbp),%rax
add    0xc(%rax),%esi
mov    -0x18(%rbp),%rax
add    0x10(%rax),%esi
mov    -0x18(%rbp),%rax
add    0x14(%rax),%esi
mov    -0x18(%rbp),%rax
add    0x18(%rax),%esi
mov    -0x18(%rbp),%rax
add    0x1c(%rax),%esi
lea    0xcb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14c9 <menu+0x319>
movsbl -0x21(%rbp),%eax
cmp    $0x51,%eax
jne    148f <menu+0x2df>
mov    -0x8(%rbp),%rsi
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   10d0 <saveDictionary@plt>
cmp    $0x0,%rax
je     148a <menu+0x2da>
mov    0x2b5c(%rip),%rax
mov    (%rax),%edi
lea    0xcb9(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1532 <menu+0x382>
movsbl -0x21(%rbp),%eax
cmp    $0x50,%eax
jne    14b1 <menu+0x301>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <printArray@plt>
jmp    14bf <menu+0x30f>
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14c4 <menu+0x314>
jmp    14c9 <menu+0x319>
jmp    14ce <menu+0x31e>
jmp    14d3 <menu+0x323>
jmp    14d8 <menu+0x328>
jmp    14dd <menu+0x32d>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x64(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x71(%rbp)
je     1509 <menu+0x359>
mov    -0x64(%rbp),%eax
mov    0x2ae7(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
test   $0x1,%al
jne    1519 <menu+0x369>
jmp    151e <menu+0x36e>
jmp    14dd <menu+0x32d>
jmp    1523 <menu+0x373>
mov    $0x1,%al
test   $0x1,%al
jne    11cb <menu+0x1b>
jmp    1532 <menu+0x382>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rcx,0x20(%rsp)
mov    %rdx,%r12
mov    %rsi,0x18(%rsp)
mov    %rdi,0x28(%rsp)
lea    0xf2a(%rip),%r14
lea    0xe56(%rip),%r13
lea    0xf(%rsp),%r15
mov    0x2dee(%rip),%rbp
lea    0xdff(%rip),%rbx
mov    %rdx,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    0xf(%rsp),%al
add    $0xbd,%al
cmp    $0x10,%al
ja     1273 <menu+0xb3>
movzbl %al,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
movdqu (%r12),%xmm0
movdqu 0x10(%r12),%xmm1
paddd  %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
lea    0xe18(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1460 <menu+0x2a0>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
jmp    1460 <menu+0x2a0>
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xdb0(%rip),%rdi
mov    %r12,%r14
lea    0x30(%rsp),%r12
mov    %r12,%rsi
call   1080 <scanf@plt>
mov    %r12,%rdi
call   10c0 <hash_function@plt>
mov    0x18(%rsp),%rbx
mov    (%rbx),%rcx
movslq %eax,%r15
mov    (%rcx,%r15,8),%rdi
mov    (%r14,%r15,4),%edx
mov    %r12,%rsi
call   1050 <search@plt>
test   %rax,%rax
je     13c2 <menu+0x202>
lea    0xd70(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf(%rsp),%r15
lea    0xd10(%rip),%rbx
mov    %r14,%r12
lea    0xe17(%rip),%r14
jmp    1460 <menu+0x2a0>
mov    0x18(%rsp),%rax
mov    (%rax),%rdi
mov    %r12,%rsi
call   10a0 <printArray@plt>
jmp    1460 <menu+0x2a0>
lea    0xe52(%rip),%rdi
call   1030 <puts@plt>
lea    0xd20(%rip),%rdi
lea    0x30(%rsp),%r12
mov    %r12,%rsi
call   1080 <scanf@plt>
mov    %r12,%rdi
call   10c0 <hash_function@plt>
mov    0x18(%rsp),%rcx
mov    (%rcx),%rcx
cltq
mov    (%rcx,%rax,8),%rdi
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,4),%rsi
mov    %r12,%rdx
mov    0x10(%rsp),%r12
call   10d0 <removeWord@plt>
jmp    1460 <menu+0x2a0>
mov    %r14,%r13
lea    0xe2c(%rip),%rdi
call   1030 <puts@plt>
lea    0xccc(%rip),%rdi
mov    %r12,%r14
lea    0x30(%rsp),%r12
mov    %r12,%rsi
call   1080 <scanf@plt>
mov    %r12,%rdi
call   10c0 <hash_function@plt>
mov    0x18(%rsp),%rcx
mov    (%rcx),%rcx
cltq
mov    (%rcx,%rax,8),%rdi
mov    (%r14,%rax,4),%edx
mov    %r12,%rsi
call   1050 <search@plt>
test   %rax,%rax
je     143d <menu+0x27d>
lea    0xe0e(%rip),%rdi
jmp    1444 <menu+0x284>
lea    0xd48(%rip),%r12
lea    (%r14,%r15,4),%r13
mov    0x0(%r13),%eax
mov    0x20(%rsp),%rcx
cmp    (%rcx,%r15,4),%eax
jl     13f8 <menu+0x238>
mov    0x20(%rsp),%rax
lea    (%rax,%r15,4),%rdx
lea    0x0(,%r15,8),%rdi
add    (%rbx),%rdi
mov    %r13,%rsi
call   1090 <doubleCapacity@plt>
mov    (%rbx),%rax
mov    (%rax,%r15,8),%rdi
mov    %r13,%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdx
call   10b0 <insertWord@plt>
lea    0xc4c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%r14
lea    0xc1a(%rip),%r13
lea    0xf(%rsp),%r15
lea    0xbca(%rip),%rbx
mov    0x10(%rsp),%r12
jmp    1460 <menu+0x2a0>
lea    0xd7a(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%r12
mov    %r13,%r14
lea    0xbec(%rip),%r13
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x0(%rbp),%ecx
cmp    $0xa,%eax
je     1210 <menu+0x50>
cmp    %ecx,%eax
jne    1460 <menu+0x2a0>
jmp    1210 <menu+0x50>
lea    0xc25(%rip),%rdi
mov    0x28(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
mov    %r12,%rdx
mov    0x20(%rsp),%rcx
call   10e0 <saveDictionary@plt>
test   %rax,%rax
je     14c1 <menu+0x301>
mov    0x2b25(%rip),%rax
mov    (%rax),%edi
lea    0xc21(%rip),%rsi
call   1070 <fprintf@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [57 x i8] c"Choose: 'S'earch, 'I'nsert, 'R'emove, 'C'ount, 'Q'uit :\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [36 x i8] c"input the word you want to search:\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [10 x i8] c"is found\0A\00"
@.str.5 = [14 x i8] c"is not found\0A\00"
@.str.6 = [24 x i8] c"input a word to insert\0A\00"
@.str.7 = [24 x i8] c"%s ignored (duplicate)\0A\00"
@.str.8 = [29 x i8] c"Insert word %s successfully\0A\00"
@.str.9 = [24 x i8] c"input a word to remove\0A\00"
@.str.10 = [41 x i8] c"The word number of the dictionary is %d\0A\00"
@.str.11 = [53 x i8] c"program is ending and dictionary will be sent to %s\0A\00"
@stderr = global i32 0
@.str.12 = [52 x i8] c" save dictionary failed! Program terminating...\0A\00"
@.str.13 = [37 x i8] c"unrecognized order! please reinput!\0A\00"
@EOF = global i32 0
define void @menu(i8* %0, i8**** %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8****
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i8
%10 = alloca [50 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %5
store i8**** %1, i8***** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
br label %15
15: ; preds = %220, %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%18 = load i8, i8* %9
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 83
br i1 %20, label %21, label %46
21: ; preds = %15
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%26 = call i32 @hash_function(i8* %25)
store i32 %26, i32* %12
%27 = load i8****, i8***** %6
%28 = load i8***, i8**** %27
%29 = load i32, i32* %12
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8**, i8*** %28, i64 %30
%32 = load i8**, i8*** %31
%33 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%34 = load i32*, i32** %7
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i32, i32* %34, i64 %36
%38 = load i32, i32* %37
%39 = call i64 @search(i8** %32, i8* %33, i32 %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %21
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %45
43: ; preds = %21
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %45
45: ; preds = %43, %41
br label %208
46: ; preds = %15
%47 = load i8, i8* %9
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 73
br i1 %49, label %50, label %116
50: ; preds = %46
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%52 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%53 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %52)
%54 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%55 = call i32 @hash_function(i8* %54)
store i32 %55, i32* %13
%56 = load i8****, i8***** %6
%57 = load i8***, i8**** %56
%58 = load i32, i32* %13
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8**, i8*** %57, i64 %59
%61 = load i8**, i8*** %60
%62 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%63 = load i32*, i32** %7
%64 = load i32, i32* %13
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
%67 = load i32, i32* %66
%68 = call i64 @search(i8** %61, i8* %62, i32 %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %50
%71 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* %71)
br label %115
73: ; preds = %50
%74 = load i32*, i32** %7
%75 = load i32, i32* %13
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %74, i64 %76
%78 = load i32, i32* %77
%79 = load i32*, i32** %8
%80 = load i32, i32* %13
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %79, i64 %81
%83 = load i32, i32* %82
%84 = icmp sge i32 %78, %83
br i1 %84, label %85, label %100
85: ; preds = %73
%86 = load i8****, i8***** %6
%87 = load i8***, i8**** %86
%88 = load i32, i32* %13
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8**, i8*** %87, i64 %89
%91 = load i32*, i32** %7
%92 = load i32, i32* %13
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i32, i32* %91, i64 %93
%95 = load i32*, i32** %8
%96 = load i32, i32* %13
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i32, i32* %95, i64 %97
%99 = call i32 @doubleCapacity(i8*** %90, i32* %94, i32* %98)
br label %100
100: ; preds = %85, %73
%101 = load i8****, i8***** %6
%102 = load i8***, i8**** %101
%103 = load i32, i32* %13
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8**, i8*** %102, i64 %104
%106 = load i8**, i8*** %105
%107 = load i32*, i32** %7
%108 = load i32, i32* %13
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i32, i32* %107, i64 %109
%111 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%112 = call i32 @insertWord(i8** %106, i32* %110, i8* %111)
%113 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i8* %113)
br label %115
115: ; preds = %100, %70
br label %207
116: ; preds = %46
%117 = load i8, i8* %9
%118 = sext i8 %117 to i32
%119 = icmp eq i32 %118, 82
br i1 %119, label %120, label %138
120: ; preds = %116
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%122 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%123 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %122)
%124 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%125 = call i32 @hash_function(i8* %124)
store i32 %125, i32* %14
%126 = load i8****, i8***** %6
%127 = load i8***, i8**** %126
%128 = load i32, i32* %14
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8**, i8*** %127, i64 %129
%131 = load i8**, i8*** %130
%132 = load i32*, i32** %7
%133 = load i32, i32* %14
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i32, i32* %132, i64 %134
%136 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%137 = call i32 @removeWord(i8** %131, i32* %135, i8* %136)
br label %206
138: ; preds = %116
%139 = load i8, i8* %9
%140 = sext i8 %139 to i32
%141 = icmp eq i32 %140, 67
br i1 %141, label %142, label %175
142: ; preds = %138
%143 = load i32*, i32** %7
%144 = getelementptr inbounds i32, i32* %143, i64 0
%145 = load i32, i32* %144
%146 = load i32*, i32** %7
%147 = getelementptr inbounds i32, i32* %146, i64 1
%148 = load i32, i32* %147
%149 = add nsw i32 %145, %148
%150 = load i32*, i32** %7
%151 = getelementptr inbounds i32, i32* %150, i64 2
%152 = load i32, i32* %151
%153 = add nsw i32 %149, %152
%154 = load i32*, i32** %7
%155 = getelementptr inbounds i32, i32* %154, i64 3
%156 = load i32, i32* %155
%157 = add nsw i32 %153, %156
%158 = load i32*, i32** %7
%159 = getelementptr inbounds i32, i32* %158, i64 4
%160 = load i32, i32* %159
%161 = add nsw i32 %157, %160
%162 = load i32*, i32** %7
%163 = getelementptr inbounds i32, i32* %162, i64 5
%164 = load i32, i32* %163
%165 = add nsw i32 %161, %164
%166 = load i32*, i32** %7
%167 = getelementptr inbounds i32, i32* %166, i64 6
%168 = load i32, i32* %167
%169 = add nsw i32 %165, %168
%170 = load i32*, i32** %7
%171 = getelementptr inbounds i32, i32* %170, i64 7
%172 = load i32, i32* %171
%173 = add nsw i32 %169, %172
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), i32 %173)
br label %205
175: ; preds = %138
%176 = load i8, i8* %9
%177 = sext i8 %176 to i32
%178 = icmp eq i32 %177, 81
br i1 %178, label %179, label %192
179: ; preds = %175
%180 = load i8*, i8** %5
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.11, i64 0, i64 0), i8* %180)
%182 = load i8*, i8** %5
%183 = load i8****, i8***** %6
%184 = load i32*, i32** %7
%185 = load i32*, i32** %8
%186 = call i64 @saveDictionary(i8* %182, i8**** %183, i32* %184, i32* %185)
%187 = icmp ne i64 %186, 0
br i1 %187, label %188, label %191
188: ; preds = %179
%189 = load i32, i32* @stderr
%190 = call i32 @fprintf(i32 %189, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.12, i64 0, i64 0))
br label %191
191: ; preds = %188, %179
br label %221
192: ; preds = %175
%193 = load i8, i8* %9
%194 = sext i8 %193 to i32
%195 = icmp eq i32 %194, 80
br i1 %195, label %196, label %201
196: ; preds = %192
%197 = load i8****, i8***** %6
%198 = load i8***, i8**** %197
%199 = load i32*, i32** %7
%200 = call i32 @printArray(i8*** %198, i32* %199)
br label %203
201: ; preds = %192
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i64 0, i64 0))
br label %203
203: ; preds = %201, %196
br label %204
204: ; preds = %203
br label %205
205: ; preds = %204, %142
br label %206
206: ; preds = %205, %120
br label %207
207: ; preds = %206, %115
br label %208
208: ; preds = %207, %45
br label %209
209: ; preds = %218, %208
%210 = call i32 (...) @getchar()
store i32 %210, i32* %11
%211 = icmp ne i32 %210, 10
br i1 %211, label %212, label %216
212: ; preds = %209
%213 = load i32, i32* %11
%214 = load i32, i32* @EOF
%215 = icmp ne i32 %213, %214
br label %216
216: ; preds = %212, %209
%217 = phi i1 [ false, %209 ], [ %215, %212 ]
br i1 %217, label %218, label %219
218: ; preds = %216
br label %209
219: ; preds = %216
br label %220
220: ; preds = %219
br i1 true, label %15, label %221
221: ; preds = %220, %191
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.7 = [24 x i8] c"%s ignored (duplicate)\0A\00"
@.str.8 = [29 x i8] c"Insert word %s successfully\0A\00"
@.str.10 = [41 x i8] c"The word number of the dictionary is %d\0A\00"
@.str.11 = [53 x i8] c"program is ending and dictionary will be sent to %s\0A\00"
@stderr = global i32 0
@.str.12 = [52 x i8] c" save dictionary failed! Program terminating...\0A\00"
@EOF = global i32 0
@str = [56 x i8] c"Choose: 'S'earch, 'I'nsert, 'R'emove, 'C'ount, 'Q'uit :\00"
@str.14 = [36 x i8] c"unrecognized order! please reinput!\00"
@str.15 = [23 x i8] c"input a word to remove\00"
@str.16 = [23 x i8] c"input a word to insert\00"
@str.17 = [35 x i8] c"input the word you want to search:\00"
@str.18 = [13 x i8] c"is not found\00"
@str.19 = [9 x i8] c"is found\00"
define void @menu(i8* %0, i8**** %1, i32* %2, i32* %3) {
%5 = alloca i8
%6 = alloca [50 x i8]
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%8 = bitcast i32* %2 to <8 x i32>*
br label %9
9: ; preds = %85, %4
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%12 = load i8, i8* %5
switch i8 %12, label %82 [
i8 83, label %13
i8 73, label %29
i8 82, label %58
i8 67, label %68
i8 81, label %72
i8 80, label %79
]
13: ; preds = %9
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.17, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%16 = call i32 @hash_function(i8* %7)
%17 = load i8***, i8**** %1
%18 = sext i32 %16 to i64
%19 = getelementptr inbounds i8**, i8*** %17, i64 %18
%20 = load i8**, i8*** %19
%21 = getelementptr inbounds i32, i32* %2, i64 %18
%22 = load i32, i32* %21
%23 = call i64 @search(i8** %20, i8* %7, i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %13
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.19, i64 0, i64 0))
br label %84
27: ; preds = %13
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.18, i64 0, i64 0))
br label %84
29: ; preds = %9
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.16, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%32 = call i32 @hash_function(i8* %7)
%33 = load i8***, i8**** %1
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds i8**, i8*** %33, i64 %34
%36 = load i8**, i8*** %35
%37 = getelementptr inbounds i32, i32* %2, i64 %34
%38 = load i32, i32* %37
%39 = call i64 @search(i8** %36, i8* %7, i32 %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %29
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* %7)
br label %84
43: ; preds = %29
%44 = load i32, i32* %37
%45 = getelementptr inbounds i32, i32* %3, i64 %34
%46 = load i32, i32* %45
%47 = icmp slt i32 %44, %46
br i1 %47, label %52, label %48
48: ; preds = %43
%49 = load i8***, i8**** %1
%50 = getelementptr inbounds i8**, i8*** %49, i64 %34
%51 = call i32 @doubleCapacity(i8*** %50, i32* %37, i32* %45)
br label %52
52: ; preds = %48, %43
%53 = load i8***, i8**** %1
%54 = getelementptr inbounds i8**, i8*** %53, i64 %34
%55 = load i8**, i8*** %54
%56 = call i32 @insertWord(i8** %55, i32* %37, i8* %7)
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i8* %7)
br label %84
58: ; preds = %9
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%61 = call i32 @hash_function(i8* %7)
%62 = load i8***, i8**** %1
%63 = sext i32 %61 to i64
%64 = getelementptr inbounds i8**, i8*** %62, i64 %63
%65 = load i8**, i8*** %64
%66 = getelementptr inbounds i32, i32* %2, i64 %63
%67 = call i32 @removeWord(i8** %65, i32* %66, i8* %7)
br label %84
68: ; preds = %9
%69 = load <8 x i32>, <8 x i32>* %8
%70 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %69)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), i32 %70)
br label %84
72: ; preds = %9
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.11, i64 0, i64 0), i8* %0)
%74 = call i64 @saveDictionary(i8* %0, i8**** %1, i32* %2, i32* %3)
%75 = icmp eq i64 %74, 0
br i1 %75, label %91, label %76
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.12, i64 0, i64 0))
br label %91
79: ; preds = %9
%80 = load i8***, i8**** %1
%81 = call i32 @printArray(i8*** %80, i32* %2)
br label %84
82: ; preds = %9
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.14, i64 0, i64 0))
br label %84
84: ; preds = %41, %52, %25, %27, %68, %79, %82, %58
br label %85
85: ; preds = %84, %85
%86 = call i32 (...) @getchar()
%87 = icmp ne i32 %86, 10
%88 = load i32, i32* @EOF
%89 = icmp ne i32 %86, %88
%90 = select i1 %87, i1 %89, i1 false
br i1 %90, label %85, label %9
91: ; preds = %76, %72
ret void
}