#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_word(char *, char *, char **);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int get_phrase(char buffer[], char hex_string[], char *wordlist[]) {
  memset(buffer, 0, sizeof(*buffer));
  int length = strlen(hex_string);
  char hex_quad[4];
  char word[11];
  for (int i = 0; i < length / 4; i++) {
    strncpy(hex_quad, hex_string + (i * 4), 4);
    if (i != 0) {
      strcat(buffer, " ");
    }
    get_word(word, hex_quad, wordlist);
    strcat(buffer, word);
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_phrase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <memset@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jge    1208 <get_phrase+0xb8>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%eax
shl    $0x2,%eax
cltq
add    %rax,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
cmpl   $0x0,-0x30(%rbp)
je     11dc <get_phrase+0x8c>
mov    -0x8(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x2b(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1060 <get_word@plt>
mov    -0x8(%rbp),%rdi
lea    -0x2b(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1187 <get_phrase+0x37>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_phrase>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %esi,%esi
mov    $0x1,%edx
call   1050 <memset@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
jl     1222 <get_phrase+0xd2>
mov    %eax,%r12d
lea    0x9(%rsp),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    0xd(%rsp),%rbp
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1060 <get_word@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1070 <strcat@plt>
mov    %r12d,%eax
and    $0xfffffffc,%eax
cmp    $0x4,%eax
je     1222 <get_phrase+0xd2>
shr    $0x2,%r12d
add    $0x4,%rbx
add    $0xffffffffffffffff,%r12
lea    0x9(%rsp),%r13
lea    0xd(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
mov    %r15,%rdi
lea    0xe06(%rip),%rsi
call   1070 <strcat@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1060 <get_word@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1070 <strcat@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r12
jne    11e0 <get_phrase+0x90>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define i32 @get_phrase(i8* %0, i8* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca [4 x i8]
%9 = alloca [11 x i8]
%10 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
%11 = load i8*, i8** %4
%12 = call i32 @memset(i8* %11, i32 0, i32 1)
%13 = load i8*, i8** %5
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %7
store i32 0, i32* %10
br label %15
15: ; preds = %41, %3
%16 = load i32, i32* %10
%17 = load i32, i32* %7
%18 = sdiv i32 %17, 4
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %44
20: ; preds = %15
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%22 = load i8*, i8** %5
%23 = load i32, i32* %10
%24 = mul nsw i32 %23, 4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
%27 = call i32 @strncpy(i8* %21, i8* %26, i32 4)
%28 = load i32, i32* %10
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %20
%31 = load i8*, i8** %4
%32 = call i32 @strcat(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %30, %20
%34 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%35 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%36 = load i8**, i8*** %6
%37 = call i32 @get_word(i8* %34, i8* %35, i8** %36)
%38 = load i8*, i8** %4
%39 = getelementptr inbounds [11 x i8], [11 x i8]* %9, i64 0, i64 0
%40 = call i32 @strcat(i8* %38, i8* %39)
br label %41
41: ; preds = %33
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %15
44: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i32 @get_phrase(i8* %0, i8* %1, i8** %2) {
%4 = alloca [4 x i8]
%5 = alloca [11 x i8]
%6 = tail call i32 @memset(i8* %0, i32 0, i32 1)
%7 = tail call i32 @strlen(i8* %1)
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%10 = icmp sgt i32 %7, 3
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = lshr i32 %7, 2
%13 = zext i32 %12 to i64
%14 = call i32 @strncpy(i8* %8, i8* %1, i32 4)
%15 = call i32 @get_word(i8* %9, i8* %8, i8** %2)
%16 = call i32 @strcat(i8* %0, i8* %9)
%17 = and i32 %7, -4
%18 = icmp eq i32 %17, 4
br i1 %18, label %19, label %20
19: ; preds = %20, %11, %3
ret i32 0
20: ; preds = %11, %20
%21 = phi i64 [ %28, %20 ], [ 1, %11 ]
%22 = shl nsw i64 %21, 2
%23 = getelementptr inbounds i8, i8* %1, i64 %22
%24 = call i32 @strncpy(i8* %8, i8* %23, i32 4)
%25 = call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @get_word(i8* %9, i8* %8, i8** %2)
%27 = call i32 @strcat(i8* %0, i8* %9)
%28 = add nuw nsw i64 %21, 1
%29 = icmp eq i64 %28, %13
br i1 %29, label %19, label %20
}