#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 strlen(char *);
int eq_index(char *str) {
  do {
  } while (0);
  int len = strlen(str);
  for (int i = 0; i < len; i++) {
    if (str[i] == '=') {
      do {
      } while (0);
      return i;
    }
  }
  do {
  } while (0);
  return -1;
}


x86 assembly (clang, -O0):
<eq_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
jmp    1121 <eq_index+0x11>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    117d <eq_index+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
jne    116a <eq_index+0x5a>
jmp    115a <eq_index+0x4a>
jmp    115f <eq_index+0x4f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118e <eq_index+0x7e>
jmp    116f <eq_index+0x5f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1134 <eq_index+0x24>
jmp    1182 <eq_index+0x72>
jmp    1187 <eq_index+0x77>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eq_index>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
jle    113f <eq_index+0x2f>
mov    %ecx,%edx
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmpb   $0x3d,(%rbx,%rcx,1)
je     1141 <eq_index+0x31>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1130 <eq_index+0x20>
pop    %rbx
ret
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @eq_index(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ 0, %4 ], [ %12, %11 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 61
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, %1
%17 = phi i32 [ -1, %1 ], [ %15, %14 ], [ -1, %11 ]
ret i32 %17
}