#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 index_of_word(char *, char **, int);
char *index_of_word_01b() {
  char word[] = "asteroids";
  char *wordlist[4] = {"aahing\0\0\0\0\0", "aardvarik\0\0\0\0",
                       "aardvarks\0\0\0", "aardwolf\0\0\0"};
  int numwords = 4;
  int index = index_of_word(word, wordlist, numwords);
  do {
    if (!(index == -1))
      return "return -1 if the word given is not in the wordlist";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<index_of_word_01b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xede(%rip),%ax
mov    %ax,-0xa(%rbp)
mov    0x2ccb(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cc8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2cc5(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cc2(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x4,-0x44(%rbp)
lea    -0x12(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x44(%rbp),%edx
call   1030 <index_of_word@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0xffffffff,-0x48(%rbp)
je     118e <index_of_word_01b+0x7e>
lea    0xe85(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119b <index_of_word_01b+0x8b>
jmp    1193 <index_of_word_01b+0x83>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<index_of_word_01b>:
sub    $0x38,%rsp
movabs $0x64696f7265747361,%rax
6f 69 64
mov    %rax,(%rsp)
movw   $0x73,0x8(%rsp)
movaps 0x2ce0(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2cc4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rsp,%rdi
lea    0x10(%rsp),%rsi
mov    $0x4,%edx
call   1030 <index_of_word@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
lea    0xeab(%rip),%rax
cmovne %rax,%rcx
mov    %rcx,%rax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.index_of_word_01b.word = [10 x i8] c"asteroids\00"
@.str = [12 x i8] c"aahing\00\00\00\00\00\00"
@.str.1 = [14 x i8] c"aardvarik\00\00\00\00\00"
@.str.2 = [13 x i8] c"aardvarks\00\00\00\00"
@.str.3 = [12 x i8] c"aardwolf\00\00\00\00"
@__const.index_of_word_01b.wordlist = [4 x i8*] [i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [51 x i8] c"return -1 if the word given is not in the wordlist\00"
define i8* @index_of_word_01b() {
%1 = alloca i8*
%2 = alloca [10 x i8]
%3 = alloca [4 x i8*]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [10 x i8]* %2 to i8*
%7 = bitcast [4 x i8*]* %3 to i8*
store i32 4, i32* %4
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%10 = load i32, i32* %4
%11 = call i32 @index_of_word(i8* %8, i8** %9, i32 %10)
store i32 %11, i32* %5
br label %12
12: ; preds = %0
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, -1
br i1 %14, label %16, label %15
15: ; preds = %12
store i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i8** %1
br label %18
16: ; preds = %12
br label %17
17: ; preds = %16
store i8* null, i8** %1
br label %18
18: ; preds = %17, %15
%19 = load i8*, i8** %1
ret i8* %19
}

LLVM IR (-O2):
@__const.index_of_word_01b.word = [10 x i8] c"asteroids\00"
@.str = [12 x i8] c"aahing\00\00\00\00\00\00"
@.str.1 = [14 x i8] c"aardvarik\00\00\00\00\00"
@.str.2 = [13 x i8] c"aardvarks\00\00\00\00"
@.str.3 = [12 x i8] c"aardwolf\00\00\00\00"
@__const.index_of_word_01b.wordlist = [4 x i8*] [i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [51 x i8] c"return -1 if the word given is not in the wordlist\00"
define i8* @index_of_word_01b() {
%1 = alloca [10 x i8]
%2 = alloca [4 x i8*]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = bitcast [4 x i8*]* %2 to i8*
%5 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%6 = call i32 @index_of_word(i8* %3, i8** %5, i32 4)
%7 = icmp eq i32 %6, -1
%8 = select i1 %7, i8* null, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0)
ret i8* %8
}