#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_01a() {
  char wordlist_size = 4;
  char *wordlist[4] = {"aahing\0\0\0\0\0", "aardvark\0\0\0\0",
                       "aardvarks\0\0\0", "elevententh"};
  char phrase[] = "aahing aardvark elevententh aardvarks aahing aardvarks "
                  "aardvark elevententh aahing";
  char expected_key[] = "000000010003000200000002000100030000";
  char key[key_length(phrase)];
  char err_msg[64];
  get_key(key, phrase, wordlist, wordlist_size, err_msg);
  do {
    if (!(strcmp(key, expected_key) == 0))
      return "return the right key for a given phrase";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<get_key_01a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movb   $0x4,-0x9(%rbp)
movaps 0x2cca(%rip),%xmm0
movaps %xmm0,-0x20(%rbp)
movaps 0x2caf(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
movaps 0xf44(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movaps 0xf29(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
movaps 0xf0e(%rip),%xmm0
movaps %xmm0,-0x70(%rbp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,-0x80(%rbp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,-0x90(%rbp)
movl   $0x676e69,-0x41(%rbp)
movabs $0x30303030333030,%rax
mov    %rax,-0xa3(%rbp)
movaps 0xf22(%rip),%xmm0
movaps %xmm0,-0xb0(%rbp)
movaps 0xf04(%rip),%xmm0
movaps %xmm0,-0xc0(%rbp)
lea    -0x90(%rbp),%rdi
call   1050 <key_length@plt>
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0xc8(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x120(%rbp)
mov    %rdi,%rsp
mov    %rax,-0xd0(%rbp)
lea    -0x90(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    -0x9(%rbp),%al
lea    -0x110(%rbp),%r8
movsbl %al,%ecx
call   1040 <get_key@plt>
mov    -0x120(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1251 <get_key_01a+0x121>
lea    0xdf4(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x114(%rbp)
jmp    126d <get_key_01a+0x13d>
jmp    1256 <get_key_01a+0x126>
jmp    125b <get_key_01a+0x12b>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x114(%rbp)
mov    -0xc8(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_key_01a>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0xe8,%rsp
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,-0x50(%rbp)
movaps 0x2cae(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
movaps 0xf43(%rip),%xmm0
movaps %xmm0,-0x80(%rbp)
movaps 0xf28(%rip),%xmm0
movaps %xmm0,-0x90(%rbp)
movaps 0xf0a(%rip),%xmm0
movaps %xmm0,-0xa0(%rbp)
movaps 0xeec(%rip),%xmm0
movaps %xmm0,-0xb0(%rbp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,-0xc0(%rbp)
movl   $0x676e69,-0x71(%rbp)
movabs $0x30303030333030,%rax
mov    %rax,-0x23(%rbp)
movaps 0xf1b(%rip),%xmm0
movaps %xmm0,-0x30(%rbp)
movaps 0xf00(%rip),%xmm0
movaps %xmm0,-0x40(%rbp)
lea    -0xc0(%rbp),%r14
mov    %r14,%rdi
call   1050 <key_length@plt>
mov    %rsp,%r15
mov    %eax,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x60(%rbp),%rdx
lea    -0x100(%rbp),%r8
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%ecx
call   1040 <get_key@plt>
lea    -0x40(%rbp),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
lea    0xe18(%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"elevententh\00"
@__const.get_key_01a.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_01a.phrase = [83 x i8] c"aahing aardvark elevententh aardvarks aahing aardvarks aardvark elevententh aahing\00"
@__const.get_key_01a.expected_key = [37 x i8] c"000000010003000200000002000100030000\00"
@.str.4 = [40 x i8] c"return the right key for a given phrase\00"
define i8* @get_key_01a() {
%1 = alloca i8*
%2 = alloca i8
%3 = alloca [4 x i8*]
%4 = alloca [83 x i8]
%5 = alloca [37 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 [83 x i8]* %4 to i8*
%12 = bitcast [37 x i8]* %5 to i8*
%13 = getelementptr inbounds [83 x i8], [83 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 [83 x i8], [83 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 [37 x i8], [37 x i8]* %5, i64 0, i64 0
%25 = call i64 @strcmp(i8* %17, i8* %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %23
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8** %1
store i32 1, i32* %9
br label %31
28: ; preds = %23
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
store i8* null, i8** %1
store i32 1, i32* %9
br label %31
31: ; preds = %30, %27
%32 = load i8*, i8** %6
%33 = load i8*, i8** %1
ret i8* %33
}

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"elevententh\00"
@__const.get_key_01a.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_01a.phrase = [83 x i8] c"aahing aardvark elevententh aardvarks aahing aardvarks aardvark elevententh aahing\00"
@__const.get_key_01a.expected_key = [37 x i8] c"000000010003000200000002000100030000\00"
@.str.4 = [40 x i8] c"return the right key for a given phrase\00"
define i8* @get_key_01a() {
%1 = alloca [4 x i8*]
%2 = alloca [83 x i8]
%3 = alloca [37 x i8]
%4 = alloca [64 x i8]
%5 = bitcast [4 x i8*]* %1 to i8*
%6 = getelementptr inbounds [83 x i8], [83 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [37 x i8], [37 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* %11, i8* %7)
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i8* null, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0)
ret i8* %17
}