#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 alphabetAndDigiCheck(char);
int specialCharCheck(char);
int findWord(char *in) {
  int index = 0;
  while ((alphabetAndDigiCheck(in[index]) == 1) ||
         (specialCharCheck(in[index]) == 1)) {
    index++;
  }
  return index;
}


x86 assembly (clang, -O0):
<findWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <alphabetAndDigiCheck@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
mov    %al,-0xd(%rbp)
je     116e <findWord+0x4e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <specialCharCheck@plt>
cmp    $0x1,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    117e <findWord+0x5e>
jmp    118c <findWord+0x6c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <findWord+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findWord>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
jmp    1134 <findWord+0x14>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movsbl (%r14,%rbx,1),%edi
call   1030 <alphabetAndDigiCheck@plt>
cmp    $0x1,%eax
je     1130 <findWord+0x10>
movsbl (%r14,%rbx,1),%edi
call   1040 <specialCharCheck@plt>
cmp    $0x1,%eax
je     1130 <findWord+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @findWord(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %22, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = call i32 @alphabetAndDigiCheck(i8 signext %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %20, label %12
12: ; preds = %4
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = call i32 @specialCharCheck(i8 signext %17)
%19 = icmp eq i32 %18, 1
br label %20
20: ; preds = %12, %4
%21 = phi i1 [ true, %4 ], [ %19, %12 ]
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %4
25: ; preds = %20
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @findWord(i8* nocapture %0) {
br label %2
2: ; preds = %12, %1
%3 = phi i64 [ %13, %12 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = tail call i32 @alphabetAndDigiCheck(i8 signext %5)
%7 = icmp eq i32 %6, 1
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i8, i8* %4
%10 = tail call i32 @specialCharCheck(i8 signext %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2, %8
%13 = add nuw i64 %3, 1
br label %2
14: ; preds = %8
%15 = trunc i64 %3 to i32
ret i32 %15
}