#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*/ get_key(char *, char *, char **, char, char *);
int key_length(char *);
scalar_t__ strcmp(char *, char *);
char *get_key_02b() {
  char wordlist_size = 4;
  char *wordlist[4] = {"aahing\0\0\0\0\0", "aardvark\0\0\0\0",
                       "aardvarks\0\0\0", "aardwolf\0\0\0"};
  char phrase[] = "ojo";
  char expected_error[] = "Could not find 'ojo' in the wordlist!";
  char key[key_length(phrase)];
  char err_msg[64];
  get_key(key, phrase, wordlist, wordlist_size, err_msg);
  do {
    if (!(strcmp(err_msg, expected_error) == 0))
      return "return an error message when the phrase is a short unknown word";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<get_key_02b>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movb   $0x4,-0x9(%rbp)
movaps 0x2cca(%rip),%xmm0
movaps %xmm0,-0x20(%rbp)
movaps 0x2caf(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
movl   $0x6f6a6f,-0x34(%rbp)
movabs $0x217473696c6472,%rax
mov    %rax,-0x42(%rbp)
movaps 0xf1f(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movaps 0xf04(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
lea    -0x34(%rbp),%rdi
call   1050 <key_length@plt>
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,%rsp
mov    %rax,-0x70(%rbp)
lea    -0x34(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    -0x9(%rbp),%al
lea    -0xb0(%rbp),%r8
movsbl %al,%ecx
call   1040 <get_key@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11f8 <get_key_02b+0xc8>
lea    0xe51(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0xb4(%rbp)
jmp    1214 <get_key_02b+0xe4>
jmp    11fd <get_key_02b+0xcd>
jmp    1202 <get_key_02b+0xd2>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0xb4(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_key_02b>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
movaps 0x2cae(%rip),%xmm0
movaps %xmm0,-0x70(%rbp)
movl   $0x6f6a6f,-0x1c(%rbp)
movaps 0xeec(%rip),%xmm0
movaps %xmm0,-0x40(%rbp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movabs $0x217473696c6472,%rax
mov    %rax,-0x32(%rbp)
lea    -0x1c(%rbp),%r14
mov    %r14,%rdi
call   1050 <key_length@plt>
mov    %rsp,%r15
mov    %eax,%eax
mov    %rsp,%rdi
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdi
mov    %rdi,%rsp
lea    -0x70(%rbp),%rdx
lea    -0xb0(%rbp),%rbx
mov    %r14,%rsi
mov    $0x4,%ecx
mov    %rbx,%r8
call   1040 <get_key@plt>
lea    -0x50(%rbp),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
lea    0xe92(%rip),%rcx
cmovne %rcx,%rax
mov    %r15,%rsp
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"aahing\00\00\00\00\00\00"
@.str.1 = [13 x i8] c"aardvark\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.get_key_02b.wordlist = [4 x i8*] [i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 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)]
@__const.get_key_02b.phrase = [4 x i8] c"ojo\00"
@__const.get_key_02b.expected_error = [38 x i8] c"Could not find 'ojo' in the wordlist!\00"
@.str.4 = [64 x i8] c"return an error message when the phrase is a short unknown word\00"
define i8* @get_key_02b() {
%1 = alloca i8*
%2 = alloca i8
%3 = alloca [4 x i8*]
%4 = alloca [4 x i8]
%5 = alloca [38 x i8]
%6 = alloca i8*
%7 = alloca i64
%8 = alloca [64 x i8]
%9 = alloca i32
store i8 4, i8* %2
%10 = bitcast [4 x i8*]* %3 to i8*
%11 = bitcast [4 x i8]* %4 to i8*
%12 = bitcast [38 x i8]* %5 to i8*
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%14 = call i32 @key_length(i8* %13)
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %6
%17 = alloca i8, i64 %15
store i64 %15, i64* %7
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%20 = load i8, i8* %2
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%22 = call i32 @get_key(i8* %17, i8* %18, i8** %19, i8 signext %20, i8* %21)
br label %23
23: ; preds = %0
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %8, i64 0, i64 0
%25 = getelementptr inbounds [38 x i8], [38 x i8]* %5, i64 0, i64 0
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %23
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i8** %1
store i32 1, i32* %9
br label %32
29: ; preds = %23
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
store i8* null, i8** %1
store i32 1, i32* %9
br label %32
32: ; preds = %31, %28
%33 = load i8*, i8** %6
%34 = load i8*, i8** %1
ret i8* %34
}

LLVM IR (-O2):
@.str = [12 x i8] c"aahing\00\00\00\00\00\00"
@.str.1 = [13 x i8] c"aardvark\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.get_key_02b.wordlist = [4 x i8*] [i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 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)]
@__const.get_key_02b.expected_error = [38 x i8] c"Could not find 'ojo' in the wordlist!\00"
@.str.4 = [64 x i8] c"return an error message when the phrase is a short unknown word\00"
define i8* @get_key_02b() {
%1 = alloca [4 x i8*]
%2 = alloca i32
%3 = alloca [38 x i8]
%4 = alloca [64 x i8]
%5 = bitcast [4 x i8*]* %1 to i8*
%6 = bitcast i32* %2 to i8*
store i32 7301743, i32* %2
%7 = getelementptr inbounds [38 x i8], [38 x i8]* %3, i64 0, i64 0
%8 = call i32 @key_length(i8* %6)
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
%11 = alloca i8, i64 %9
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%14 = call i32 @get_key(i8* %11, i8* %6, i8** %13, i8 signext 4, i8* %12)
%15 = call i64 @strcmp(i8* %12, i8* %7)
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i8* null, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0)
ret i8* %17
}