#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 */
long strlen(char const *);
long Find_Index(char letter, const char *letter_Array, long *index) {
  long i = 0;
  long not_Found = 1;
  long length = strlen(letter_Array);
  long Error_Code = 0x0000;
  while ((i < length) && (not_Found)) {
    if (letter == letter_Array[i]) {
      *index = i;
      not_Found = 0;
    }
    i++;
  }
  if (not_Found)
    Error_Code = 0x0020;
  return Error_Code;
}


x86 assembly (clang, -O0):
<Find_Index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
cmp    -0x30(%rbp),%rcx
mov    %al,-0x39(%rbp)
jge    1169 <Find_Index+0x59>
cmpq   $0x0,-0x28(%rbp)
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    1179 <Find_Index+0x69>
jmp    11b5 <Find_Index+0xa5>
movsbl -0x1(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    11a4 <Find_Index+0x94>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114b <Find_Index+0x3b>
cmpq   $0x0,-0x28(%rbp)
je     11c8 <Find_Index+0xb8>
movq   $0x20,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Find_Index>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbp
mov    %edi,%r15d
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    $0x20,%eax
test   %rcx,%rcx
jle    115c <Find_Index+0x4c>
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movzbl 0x0(%rbp,%rdx,1),%ebx
cmp    %r15b,%bl
je     1157 <Find_Index+0x47>
je     115c <Find_Index+0x4c>
add    $0x1,%rdx
cmp    %rcx,%rdx
jl     1140 <Find_Index+0x30>
jmp    115c <Find_Index+0x4c>
mov    %rdx,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i64 @Find_Index(i8 signext %0, i8* nocapture %1, i64* nocapture writeonly %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %3, %12
%7 = phi i64 [ %13, %12 ], [ 0, %3 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, %0
br i1 %10, label %11, label %12
11: ; preds = %6
store i64 %7, i64* %2
br label %16
12: ; preds = %6
%13 = add nuw nsw i64 %7, 1
%14 = icmp sge i64 %13, %4
%15 = or i1 %10, %14
br i1 %15, label %16, label %6
16: ; preds = %12, %11, %3
%17 = phi i64 [ 32, %3 ], [ 0, %11 ], [ 32, %12 ]
ret i64 %17
}