#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 /*<<< orphan*/ printf(char *, ...);
int spell_check(char const *, char const *);
void test4(const char *dictionary, const char *word) {
  int file_result;
  printf("\nTest4--------------------------------------------------------\n");
  file_result = spell_check(dictionary, word);
  if (file_result == -2) {
    printf("Can't open %s\n", dictionary);
    return;
  }
  if (file_result == 1) {
    printf("The word %s is spelled correctly.\n", word);
  } else {
    printf("The word %s is misspelled.\n", word);
  }
}


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <spell_check@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xfffffffe,-0x14(%rbp)
jne    116f <test4+0x4f>
mov    -0x8(%rbp),%rsi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a2 <test4+0x82>
cmpl   $0x1,-0x14(%rbp)
jne    1190 <test4+0x70>
mov    -0x10(%rbp),%rsi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a2 <test4+0x82>
mov    -0x10(%rbp),%rsi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <spell_check@plt>
cmp    $0x1,%eax
je     1167 <test4+0x37>
cmp    $0xfffffffe,%eax
jne    1170 <test4+0x40>
lea    0xe9e(%rip),%rdi
mov    %r14,%rsi
jmp    117a <test4+0x4a>
lea    0xea1(%rip),%rdi
jmp    1177 <test4+0x47>
lea    0xebb(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"\0ATest4--------------------------------------------------------\0A\00"
@.str.1 = [15 x i8] c"Can't open %s\0A\00"
@.str.2 = [35 x i8] c"The word %s is spelled correctly.\0A\00"
@.str.3 = [28 x i8] c"The word %s is misspelled.\0A\00"
define void @test4(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @spell_check(i8* %7, i8* %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, -2
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %24
15: ; preds = %2
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i8*, i8** %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %24
21: ; preds = %15
%22 = load i8*, i8** %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %12, %21, %18
ret void
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Can't open %s\0A\00"
@.str.2 = [35 x i8] c"The word %s is spelled correctly.\0A\00"
@.str.3 = [28 x i8] c"The word %s is misspelled.\0A\00"
@str = [63 x i8] c"\0ATest4--------------------------------------------------------\00"
define void @test4(i8* %0, i8* %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @spell_check(i8* %0, i8* %1)
switch i32 %4, label %9 [
i32 -2, label %5
i32 1, label %7
]
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %11
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %11
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %11
11: ; preds = %7, %9, %5
ret void
}