#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*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int validword(char play[], char dictionary[][7], int length) {
  if (1)
    printf("enters validword\n");
  int i;
  for (i = 0; i < length; i++) {
    if (strcmp(play, dictionary[i]))
      return 1;
  }
  if (1)
    printf("exits validword false\n");
  return 0;
}


x86 assembly (clang, -O0):
<validword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1193 <validword+0x73>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x20(%rbp),%rax
imul   $0x7,%rax,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1180 <validword+0x60>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <validword+0x86>
jmp    1185 <validword+0x65>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1146 <validword+0x26>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validword>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    115a <validword+0x3a>
mov    %ebp,%ebp
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    116a <validword+0x4a>
add    $0x7,%rbx
add    $0xffffffffffffffff,%rbp
jne    1140 <validword+0x20>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    116f <validword+0x4f>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"enters validword\0A\00"
@.str.1 = [23 x i8] c"exits validword false\0A\00"
define i32 @validword(i8* %0, [7 x i8]* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [7 x i8]*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store [7 x i8]* %1, [7 x i8]** %6
store i32 %2, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %10
10: ; preds = %25, %3
%11 = load i32, i32* %8
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = load [7 x i8]*, [7 x i8]** %6
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [7 x i8], [7 x i8]* %16, i64 %18
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %19, i64 0, i64 0
%21 = call i64 @strcmp(i8* %15, i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %14
store i32 1, i32* %4
br label %30
24: ; preds = %14
br label %25
25: ; preds = %24
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %10
28: ; preds = %10
%29 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %30
30: ; preds = %28, %23
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
@str = [17 x i8] c"enters validword\00"
@str.2 = [22 x i8] c"exits validword false\00"
define i32 @validword(i8* %0, [7 x i8]* %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = zext i32 %2 to i64
br label %10
8: ; preds = %10
%9 = icmp eq i64 %15, %7
br i1 %9, label %16, label %10
10: ; preds = %6, %8
%11 = phi i64 [ 0, %6 ], [ %15, %8 ]
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 %11, i64 0
%13 = tail call i64 @strcmp(i8* %0, i8* %12)
%14 = icmp eq i64 %13, 0
%15 = add nuw nsw i64 %11, 1
br i1 %14, label %8, label %18
16: ; preds = %8, %3
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0))
br label %18
18: ; preds = %10, %16
%19 = phi i32 [ 0, %16 ], [ 1, %10 ]
ret i32 %19
}