#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 */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ insert_itr(struct node **, char *);
scalar_t__ lookup_itr(struct node **, char *);
int print_rec(struct node **, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char word[1024];
  char done = 0;
  int num, i;
  struct node *heads[26];
  for (i = 0; i < 26; ++i)
    heads[i] = NULL;
  done = 0;
  while (!done) {
    num++;
    scanf("%s", word);
    printf("%3d. Adding: %s\n", num, word);
    insert_itr(heads, word);
    if (strcmp(word, "ok") == 0)
      done = 1;
  }
  printf("Added %d words to Dictionary\n", num);
  num = print_rec(heads, NULL, 0);
  printf("Found %d words in Dictionary\n", num);
  done = 0;
  while (!done) {
    printf("Enter word to lookup: ");
    scanf("%s", word);
    printf("Finding: %10s", word);
    if (lookup_itr(heads, word)) {
      printf(" - found\n");
    } else {
      printf(" - NOT found\n");
    }
    if (strcmp(word, "ok") == 0)
      done = 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4f0,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x411(%rbp)
movl   $0x0,-0x41c(%rbp)
cmpl   $0x1a,-0x41c(%rbp)
jge    11b7 <main+0x57>
movslq -0x41c(%rbp),%rax
movq   $0x0,-0x4f0(%rbp,%rax,8)
mov    -0x41c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x41c(%rbp)
jmp    1183 <main+0x23>
movb   $0x0,-0x411(%rbp)
cmpb   $0x0,-0x411(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11d7 <main+0x77>
jmp    1250 <main+0xf0>
mov    -0x418(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x418(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xe0c(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x418(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4f0(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1080 <insert_itr@plt>
lea    -0x410(%rbp),%rdi
lea    0xddf(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    124b <main+0xeb>
movb   $0x1,-0x411(%rbp)
jmp    11be <main+0x5e>
mov    -0x418(%rbp),%esi
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4f0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <print_rec@plt>
mov    %eax,-0x418(%rbp)
mov    -0x418(%rbp),%esi
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0x411(%rbp)
cmpb   $0x0,-0x411(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12b0 <main+0x150>
jmp    134d <main+0x1ed>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x410(%rbp),%rsi
lea    0xd34(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x410(%rbp),%rsi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4f0(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1060 <lookup_itr@plt>
cmp    $0x0,%rax
je     1316 <main+0x1b6>
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1324 <main+0x1c4>
lea    0xd65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x410(%rbp),%rdi
lea    0xce2(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1348 <main+0x1e8>
movb   $0x1,-0x411(%rbp)
jmp    1297 <main+0x137>
mov    -0x4(%rbp),%eax
add    $0x4f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4d8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe26(%rip),%r14
lea    0xd0(%rsp),%rbp
lea    0xe1a(%rip),%r15
mov    %rsp,%r12
lea    0xe21(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
mov    %r14,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1090 <insert_itr@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1200 <main+0x90>
lea    0xdd8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <print_rec@plt>
lea    0xdda(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd95(%rip),%r12
lea    0xd0(%rsp),%rbx
lea    0xdf0(%rip),%r13
lea    0xdf7(%rip),%r14
lea    0xdfd(%rip),%r15
lea    0xd85(%rip),%rbp
nop
lea    0xdbc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1070 <lookup_itr@plt>
test   %rax,%rax
mov    %r15,%rdi
cmove  %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1290 <main+0x120>
xor    %eax,%eax
add    $0x4d8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [3 x i8] c"%s\00"
@.str.1 = [17 x i8] c"%3d. Adding: %s\0A\00"
@.str.2 = [3 x i8] c"ok\00"
@.str.3 = [30 x i8] c"Added %d words to Dictionary\0A\00"
@.str.4 = [30 x i8] c"Found %d words in Dictionary\0A\00"
@.str.5 = [23 x i8] c"Enter word to lookup: \00"
@.str.6 = [14 x i8] c"Finding: %10s\00"
@.str.7 = [10 x i8] c" - found\0A\00"
@.str.8 = [14 x i8] c" - NOT found\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca [26 x %struct.node*]
store i32 0, i32* %1
store i8 0, i8* %3
store i32 0, i32* %5
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 26
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [26 x %struct.node*], [26 x %struct.node*]* %6, i64 0, i64 %12
store %struct.node* null, %struct.node** %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %7
17: ; preds = %7
store i8 0, i8* %3
br label %18
18: ; preds = %37, %17
%19 = load i8, i8* %3
%20 = icmp ne i8 %19, 0
%21 = xor i1 %20, true
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i32, i32* %4
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %27, i8* %28)
%30 = getelementptr inbounds [26 x %struct.node*], [26 x %struct.node*]* %6, i64 0, i64 0
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%32 = call i32 @insert_itr(%struct.node** %30, i8* %31)
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %22
store i8 1, i8* %3
br label %37
37: ; preds = %36, %22
br label %18
38: ; preds = %18
%39 = load i32, i32* %4
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [26 x %struct.node*], [26 x %struct.node*]* %6, i64 0, i64 0
%42 = call i32 @print_rec(%struct.node** %41, i32* null, i32 0)
store i32 %42, i32* %4
%43 = load i32, i32* %4
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %43)
store i8 0, i8* %3
br label %45
45: ; preds = %68, %38
%46 = load i8, i8* %3
%47 = icmp ne i8 %46, 0
%48 = xor i1 %47, true
br i1 %48, label %49, label %69
49: ; preds = %45
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %53)
%55 = getelementptr inbounds [26 x %struct.node*], [26 x %struct.node*]* %6, i64 0, i64 0
%56 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%57 = call i64 @lookup_itr(%struct.node** %55, i8* %56)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %49
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %63
61: ; preds = %49
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
br label %63
63: ; preds = %61, %59
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %63
store i8 1, i8* %3
br label %68
68: ; preds = %67, %63
br label %45
69: ; preds = %45
%70 = load i32, i32* %1
ret i32 %70
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [3 x i8] c"%s\00"
@.str.1 = [17 x i8] c"%3d. Adding: %s\0A\00"
@.str.2 = [3 x i8] c"ok\00"
@.str.3 = [30 x i8] c"Added %d words to Dictionary\0A\00"
@.str.4 = [30 x i8] c"Found %d words in Dictionary\0A\00"
@.str.5 = [23 x i8] c"Enter word to lookup: \00"
@.str.6 = [14 x i8] c"Finding: %10s\00"
@str = [13 x i8] c" - NOT found\00"
@str.9 = [9 x i8] c" - found\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [26 x %struct.node*]
%3 = bitcast [26 x %struct.node*]* %2 to i8*
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [26 x %struct.node*], [26 x %struct.node*]* %2, i64 0, i64 0
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ undef, %0 ], [ %8, %6 ]
%8 = add nsw i32 %7, 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* %4)
%11 = call i32 @insert_itr(%struct.node** %5, i8* %4)
%12 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%16 = call i32 @print_rec(%struct.node** %5, i32* null, i32 0)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %18
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%22 = call i64 @lookup_itr(%struct.node** %5, i8* %4)
%23 = icmp eq i64 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0)
%25 = call i32 @puts(i8* dereferenceable(1) %24)
%26 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %18
28: ; preds = %18
ret i32 0
}