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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int spell_check(char const *, char const *);
void test5(void) {
  int i, file_result, num_words, num_misspelled = 0;
  const char *dictionary = "allwords.txt",
             *words[] = {"Four",      "score", "and", "seven",
                         "years",     "ago",   "our", "fathers",
                         "brought",   "forth", "on",  "this",
                         "continent", "a",     "new", "nation"};
  num_words = sizeof(words) / sizeof(*words);
  printf("\nTest5--------------------------------------------------------\n");
  printf("Misspelled words: ");
  for (i = 0; i < num_words; i++) {
    file_result = spell_check(dictionary, words[i]);
    if (file_result == -2) {
      printf("Can't open %s\n", dictionary);
      return;
    }
    if (file_result == 2) {
      printf("%s ", words[i]);
      num_misspelled++;
    }
  }
  if (!num_misspelled) {
    printf("*** None ***");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x10(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0x2c45(%rip),%rsi
mov    $0x80,%edx
call   1050 <memcpy@plt>
movl   $0x10,-0xc(%rbp)
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1214 <test5+0xe4>
mov    -0x18(%rbp),%rdi
movslq -0x4(%rbp),%rax
mov    -0xa0(%rbp,%rax,8),%rsi
ff
call   1030 <spell_check@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xfffffffe,-0x8(%rbp)
jne    11d4 <test5+0xa4>
mov    -0x18(%rbp),%rsi
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    123a <test5+0x10a>
cmpl   $0x2,-0x8(%rbp)
jne    1201 <test5+0xd1>
movslq -0x4(%rbp),%rax
mov    -0xa0(%rbp,%rax,8),%rsi
ff
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1206 <test5+0xd6>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118f <test5+0x5f>
cmpl   $0x0,-0x10(%rbp)
jne    122c <test5+0xfc>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf3f(%rip),%rdi
call   1040 <puts@plt>
lea    0xf00(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x2c34(%rip),%r12
lea    0xe8d(%rip),%r15
lea    0xf06(%rip),%r14
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    11ae <test5+0x6e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r13d
add    $0x8,%rbp
cmp    $0x80,%rbp
je     11eb <test5+0xab>
mov    0x0(%rbp,%r12,1),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <spell_check@plt>
cmp    $0x2,%eax
je     1190 <test5+0x50>
cmp    $0xfffffffe,%eax
jne    11a1 <test5+0x61>
lea    0xea2(%rip),%rdi
lea    0xe2a(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <printf@plt>
test   %r13d,%r13d
jne    11fe <test5+0xbe>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"allwords.txt\00"
@.str.1 = [5 x i8] c"Four\00"
@.str.2 = [6 x i8] c"score\00"
@.str.3 = [4 x i8] c"and\00"
@.str.4 = [6 x i8] c"seven\00"
@.str.5 = [6 x i8] c"years\00"
@.str.6 = [4 x i8] c"ago\00"
@.str.7 = [4 x i8] c"our\00"
@.str.8 = [8 x i8] c"fathers\00"
@.str.9 = [8 x i8] c"brought\00"
@.str.10 = [6 x i8] c"forth\00"
@.str.11 = [3 x i8] c"on\00"
@.str.12 = [5 x i8] c"this\00"
@.str.13 = [10 x i8] c"continent\00"
@.str.14 = [2 x i8] c"a\00"
@.str.15 = [4 x i8] c"new\00"
@.str.16 = [7 x i8] c"nation\00"
@__const.test5.words = [16 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0)]
@.str.17 = [64 x i8] c"\0ATest5--------------------------------------------------------\0A\00"
@.str.18 = [19 x i8] c"Misspelled words: \00"
@.str.19 = [15 x i8] c"Can't open %s\0A\00"
@.str.20 = [4 x i8] c"%s \00"
@.str.21 = [13 x i8] c"*** None ***\00"
@.str.22 = [2 x i8] c"\0A\00"
define void @test5() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [16 x i8*]
store i32 0, i32* %4
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %5
%7 = bitcast [16 x i8*]* %6 to i8*
store i32 16, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.17, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
store i32 0, i32* %1
br label %10
10: ; preds = %38, %0
%11 = load i32, i32* %1
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %41
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = load i32, i32* %1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [16 x i8*], [16 x i8*]* %6, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @spell_check(i8* %15, i8* %19)
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, -2
br i1 %22, label %23, label %26
23: ; preds = %14
%24 = load i8*, i8** %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), i8* %24)
br label %48
26: ; preds = %14
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load i32, i32* %1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [16 x i8*], [16 x i8*]* %6, i64 0, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i8* %33)
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %37
37: ; preds = %29, %26
br label %38
38: ; preds = %37
%39 = load i32, i32* %1
%40 = add nsw i32 %39, 1
store i32 %40, i32* %1
br label %10
41: ; preds = %10
%42 = load i32, i32* %4
%43 = icmp ne i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0))
br label %46
46: ; preds = %44, %41
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0))
br label %48
48: ; preds = %46, %23
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"allwords.txt\00"
@.str.1 = [5 x i8] c"Four\00"
@.str.2 = [6 x i8] c"score\00"
@.str.3 = [4 x i8] c"and\00"
@.str.4 = [6 x i8] c"seven\00"
@.str.5 = [6 x i8] c"years\00"
@.str.6 = [4 x i8] c"ago\00"
@.str.7 = [4 x i8] c"our\00"
@.str.8 = [8 x i8] c"fathers\00"
@.str.9 = [8 x i8] c"brought\00"
@.str.10 = [6 x i8] c"forth\00"
@.str.11 = [3 x i8] c"on\00"
@.str.12 = [5 x i8] c"this\00"
@.str.13 = [10 x i8] c"continent\00"
@.str.14 = [2 x i8] c"a\00"
@.str.15 = [4 x i8] c"new\00"
@.str.16 = [7 x i8] c"nation\00"
@__const.test5.words = [16 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0)]
@.str.18 = [19 x i8] c"Misspelled words: \00"
@.str.19 = [15 x i8] c"Can't open %s\0A\00"
@.str.20 = [4 x i8] c"%s \00"
@.str.21 = [13 x i8] c"*** None ***\00"
@str = [63 x i8] c"\0ATest5--------------------------------------------------------\00"
define void @test5() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %3
3: ; preds = %0, %14
%4 = phi i64 [ 0, %0 ], [ %16, %14 ]
%5 = phi i32 [ 0, %0 ], [ %15, %14 ]
%6 = getelementptr inbounds [16 x i8*], [16 x i8*]* @__const.test5.words, i64 0, i64 %4
%7 = load i8*, i8** %6
%8 = tail call i32 @spell_check(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %7)
switch i32 %8, label %14 [
i32 -2, label %9
i32 2, label %11
]
9: ; preds = %3
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %24
11: ; preds = %3
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i8* %7)
%13 = add nsw i32 %5, 1
br label %14
14: ; preds = %3, %11
%15 = phi i32 [ %13, %11 ], [ %5, %3 ]
%16 = add nuw nsw i64 %4, 1
%17 = icmp eq i64 %16, 16
br i1 %17, label %18, label %3
18: ; preds = %14
%19 = icmp eq i32 %15, 0
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
%23 = tail call i32 @putchar(i32 10)
br label %24
24: ; preds = %22, %9
ret void
}