#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 getEqualsSignPosition(char *string) {
  int esp = -1;
  if (string == NULL)
    return -1;
  int j;
  for (j = 0; string[j] != '\0' && string[j] != '\n'; j++) {
    if (string[j] == '=') {
      esp = j;
      break;
    }
  }
  return esp;
}


x86 assembly (clang, -O0):
<getEqualsSignPosition>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1126 <getEqualsSignPosition+0x26>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a5 <getEqualsSignPosition+0xa5>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     115c <getEqualsSignPosition+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    116c <getEqualsSignPosition+0x6c>
jmp    119f <getEqualsSignPosition+0x9f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
jne    118c <getEqualsSignPosition+0x8c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    119f <getEqualsSignPosition+0x9f>
jmp    1191 <getEqualsSignPosition+0x91>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112d <getEqualsSignPosition+0x2d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getEqualsSignPosition>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     112a <getEqualsSignPosition+0x2a>
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl (%rdi,%rcx,1),%edx
test   %dl,%dl
je     112a <getEqualsSignPosition+0x2a>
cmp    $0xa,%dl
je     112a <getEqualsSignPosition+0x2a>
cmp    $0x3d,%dl
je     1128 <getEqualsSignPosition+0x28>
add    $0x1,%rcx
jmp    1110 <getEqualsSignPosition+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @getEqualsSignPosition(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %7
%4 = phi i64 [ %8, %7 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 0, label %11
i8 10, label %11
i8 61, label %9
]
7: ; preds = %3
%8 = add nuw i64 %4, 1
br label %3
9: ; preds = %3
%10 = trunc i64 %4 to i32
br label %11
11: ; preds = %3, %3, %9, %1
%12 = phi i32 [ -1, %1 ], [ %10, %9 ], [ -1, %3 ], [ -1, %3 ]
ret i32 %12
}