#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 */
char toupper(char);
int isCharInWord(char guess, char *randomWord, char *wordInUnderscores,
                 unsigned int wordLength) {
  unsigned int counter;
  unsigned int wasInWord = 0;
  for (counter = 0; counter < wordLength; counter++) {
    if ((randomWord[counter] == guess) ||
        (randomWord[counter] == toupper(guess))) {
      wasInWord = 1;
      wordInUnderscores[counter] = guess;
    }
  }
  return wasInWord;
}


x86 assembly (clang, -O0):
<isCharInWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    11a8 <isCharInWord+0x98>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
movsbl -0x1(%rbp),%ecx
cmp    %ecx,%eax
je     1181 <isCharInWord+0x71>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x28(%rbp),%eax
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    1195 <isCharInWord+0x85>
movl   $0x1,-0x24(%rbp)
mov    -0x1(%rbp),%dl
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
jmp    119a <isCharInWord+0x8a>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1137 <isCharInWord+0x27>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isCharInWord>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,0x10(%rsp)
test   %ecx,%ecx
je     1173 <isCharInWord+0x63>
mov    %rsi,%r13
mov    %edi,%ebp
mov    %ecx,%ebx
xor    %r12d,%r12d
movsbl %bpl,%eax
mov    %eax,0xc(%rsp)
xor    %r15d,%r15d
jmp    1158 <isCharInWord+0x48>
xchg   %ax,%ax
mov    0x10(%rsp),%rax
mov    %bpl,(%rax,%r12,1)
mov    $0x1,%r15d
add    $0x1,%r12
cmp    %r12,%rbx
je     1176 <isCharInWord+0x66>
movzbl 0x0(%r13,%r12,1),%r14d
cmp    %bpl,%r14b
je     1140 <isCharInWord+0x30>
mov    0xc(%rsp),%edi
call   1030 <toupper@plt>
cmp    %al,%r14b
je     1140 <isCharInWord+0x30>
jmp    114f <isCharInWord+0x3f>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isCharInWord(i8 signext %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %10
store i32 0, i32* %9
br label %11
11: ; preds = %43, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %8
%14 = icmp ult i32 %12, %13
br i1 %14, label %15, label %46
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i32, i32* %9
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %21, %23
br i1 %24, label %36, label %25
25: ; preds = %15
%26 = load i8*, i8** %6
%27 = load i32, i32* %9
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = load i8, i8* %5
%33 = call signext i8 @toupper(i8 signext %32)
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %31, %34
br i1 %35, label %36, label %42
36: ; preds = %25, %15
store i32 1, i32* %10
%37 = load i8, i8* %5
%38 = load i8*, i8** %7
%39 = load i32, i32* %9
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
store i8 %37, i8* %41
br label %42
42: ; preds = %36, %25
br label %43
43: ; preds = %42
%44 = load i32, i32* %9
%45 = add i32 %44, 1
store i32 %45, i32* %9
br label %11
46: ; preds = %11
%47 = load i32, i32* %10
ret i32 %47
}

LLVM IR (-O2):
define i32 @isCharInWord(i8 signext %0, i8* nocapture %1, i8* nocapture writeonly %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %23, label %6
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %8
8: ; preds = %6, %19
%9 = phi i64 [ 0, %6 ], [ %21, %19 ]
%10 = phi i32 [ 0, %6 ], [ %20, %19 ]
%11 = getelementptr inbounds i8, i8* %1, i64 %9
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, %0
br i1 %13, label %17, label %14
14: ; preds = %8
%15 = tail call signext i8 @toupper(i8 signext %0)
%16 = icmp eq i8 %12, %15
br i1 %16, label %17, label %19
17: ; preds = %14, %8
%18 = getelementptr inbounds i8, i8* %2, i64 %9
store i8 %0, i8* %18
br label %19
19: ; preds = %14, %17
%20 = phi i32 [ 1, %17 ], [ %10, %14 ]
%21 = add nuw nsw i64 %9, 1
%22 = icmp eq i64 %21, %7
br i1 %22, label %23, label %8
23: ; preds = %19, %4
%24 = phi i32 [ 0, %4 ], [ %20, %19 ]
ret i32 %24
}