#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 */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
scalar_t__ is_one_letter_off(char const *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  const char *word;
  FILE *dict;
  char *line;
  size_t len, words = 0;
  if (argc != 2) {
    printf("please provide a word to check\n");
    return EXIT_FAILURE;
  }
  word = argv[1];
  if (!(dict = fopen("/usr/share/dict/words", "r"))) {
    printf("could not open the dictionary file\n");
    return EXIT_FAILURE;
  }
  while (-1 != getline(&line, &len, dict)) {
    if (is_one_letter_off(word, line)) {
      printf("%s", line);
      ++words;
    }
  }
  free(line);
  fclose(dict);
  if (0 == words)
    printf("no words found\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x38(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a7 <main+0x47>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    128a <main+0x12a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
lea    0xe66(%rip),%rdi
lea    0xe75(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11f3 <main+0x93>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    128a <main+0x12a>
jmp    11f8 <main+0x98>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1080 <getline@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     1252 <main+0xf2>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <is_one_letter_off@plt>
cmp    $0x0,%rax
je     124d <main+0xed>
mov    -0x28(%rbp),%rsi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11f8 <main+0x98>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
cmp    -0x38(%rbp),%rax
jne    127e <main+0x11e>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d53(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    121a <main+0xaa>
mov    0x8(%rsi),%r14
lea    0xe6e(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1223 <main+0xb3>
mov    %rax,%rbx
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %rax,%rdx
call   1090 <getline@plt>
cmp    $0xffffffff,%eax
je     1238 <main+0xc8>
lea    0x8(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xe46(%rip),%r13
xor    %ebp,%ebp
jmp    11f3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1090 <getline@plt>
cmp    $0xffffffff,%eax
je     123a <main+0xca>
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1080 <is_one_letter_off@plt>
test   %rax,%rax
je     11e0 <main+0x70>
mov    0x8(%rsp),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbp
jmp    11e0 <main+0x70>
lea    0xe2c(%rip),%rdi
jmp    122a <main+0xba>
lea    0xdf1(%rip),%rdi
call   1040 <puts@plt>
mov    0x2daa(%rip),%rbx
jmp    1264 <main+0xf4>
xor    %ebp,%ebp
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x2d85(%rip),%rbx
test   %rbp,%rbp
jne    1264 <main+0xf4>
lea    0xddf(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"please provide a word to check\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [22 x i8] c"/usr/share/dict/words\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [36 x i8] c"could not open the dictionary file\0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [16 x i8] c"no words found\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %10
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
store i32 %15, i32* %3
br label %52
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
store i8* %19, i8** %6
%20 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %20, i32** %7
%21 = icmp ne i32* %20, null
br i1 %21, label %25, label %22
22: ; preds = %16
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%24 = load i32, i32* @EXIT_FAILURE
store i32 %24, i32* %3
br label %52
25: ; preds = %16
br label %26
26: ; preds = %40, %25
%27 = load i32*, i32** %7
%28 = call i32 @getline(i8** %8, i64* %9, i32* %27)
%29 = icmp ne i32 -1, %28
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = load i8*, i8** %6
%32 = load i8*, i8** %8
%33 = call i64 @is_one_letter_off(i8* %31, i8* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %30
%36 = load i8*, i8** %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %36)
%38 = load i64, i64* %10
%39 = add i64 %38, 1
store i64 %39, i64* %10
br label %40
40: ; preds = %35, %30
br label %26
41: ; preds = %26
%42 = load i8*, i8** %8
%43 = call i32 @free(i8* %42)
%44 = load i32*, i32** %7
%45 = call i32 @fclose(i32* %44)
%46 = load i64, i64* %10
%47 = icmp eq i64 0, %46
br i1 %47, label %48, label %50
48: ; preds = %41
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %48, %41
%51 = load i32, i32* @EXIT_SUCCESS
store i32 %51, i32* %3
br label %52
52: ; preds = %50, %22, %13
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [22 x i8] c"/usr/share/dict/words\00"
@.str.2 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
@str = [35 x i8] c"could not open the dictionary file\00"
@str.6 = [15 x i8] c"no words found\00"
@str.7 = [31 x i8] c"please provide a word to check\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
%6 = bitcast i64* %4 to i8*
%7 = icmp eq i32 %0, 2
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.7, i64 0, i64 0))
br label %41
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %10
%16 = call i32 @getline(i8** %3, i64* %4, i32* %13)
%17 = icmp eq i32 %16, -1
br i1 %17, label %33, label %20
18: ; preds = %10
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %41
20: ; preds = %15, %29
%21 = phi i64 [ %30, %29 ], [ 0, %15 ]
%22 = load i8*, i8** %3
%23 = call i64 @is_one_letter_off(i8* %12, i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %20
%26 = load i8*, i8** %3
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %26)
%28 = add i64 %21, 1
br label %29
29: ; preds = %25, %20
%30 = phi i64 [ %28, %25 ], [ %21, %20 ]
%31 = call i32 @getline(i8** %3, i64* %4, i32* %13)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %20
33: ; preds = %29, %15
%34 = phi i64 [ 0, %15 ], [ %30, %29 ]
%35 = load i8*, i8** %3
%36 = call i32 @free(i8* %35)
%37 = call i32 @fclose(i32* %13)
%38 = icmp eq i64 %34, 0
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0))
br label %41
41: ; preds = %33, %39, %18, %8
%42 = phi i32* [ @EXIT_FAILURE, %8 ], [ @EXIT_FAILURE, %18 ], [ @EXIT_SUCCESS, %39 ], [ @EXIT_SUCCESS, %33 ]
%43 = load i32, i32* %42
ret i32 %43
}