#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 */
scalar_t__ strcmp2(char *, char *);
int findToValueIndex(char tokenArray[][20], int numberOfTokens) {
  int tvi = -1;
  if (numberOfTokens < 6)
    return tvi;
  int idx;
  for (idx = 5; idx < numberOfTokens; idx++) {
    if (strcmp2(tokenArray[idx], "to") == 0) {
      tvi = idx;
      break;
    }
  }
  return tvi;
}


x86 assembly (clang, -O0):
<findToValueIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    113b <findToValueIndex+0x2b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1197 <findToValueIndex+0x87>
movl   $0x5,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1191 <findToValueIndex+0x81>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
imul   $0x14,%rax,%rax
add    %rax,%rdi
lea    0xe9c(%rip),%rsi
call   1030 <strcmp2@plt>
cmp    $0x0,%rax
jne    117e <findToValueIndex+0x6e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1191 <findToValueIndex+0x81>
jmp    1183 <findToValueIndex+0x73>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1142 <findToValueIndex+0x32>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findToValueIndex>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
cmp    $0x6,%esi
jl     1162 <findToValueIndex+0x52>
mov    %rdi,%rbx
mov    %esi,%r12d
add    $0x64,%rbx
mov    $0x5,%ebp
lea    0xec7(%rip),%r15
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcmp2@plt>
test   %rax,%rax
je     115f <findToValueIndex+0x4f>
add    $0x1,%rbp
add    $0x14,%rbx
cmp    %rbp,%r12
jne    1140 <findToValueIndex+0x30>
jmp    1162 <findToValueIndex+0x52>
mov    %ebp,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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