#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 EXIT_SUCCESS;
int comparer(char *, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int main(void) {
  char *word = "hello";
  int result = comparer(word, "ehy man hello dfdsf", -1, 0);
  if (result == -1) {
    puts("Index not found");
  } else {
    printf("%d\n", result);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb1(%rip),%rsi
mov    $0xffffffff,%edx
xor    %ecx,%ecx
call   1050 <comparer@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    117f <main+0x4f>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
jmp    118e <main+0x5e>
mov    -0x14(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec7(%rip),%rsi
mov    $0xffffffff,%edx
xor    %ecx,%ecx
call   1050 <comparer@plt>
cmp    $0xffffffff,%eax
je     1160 <main+0x30>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
jmp    116c <main+0x3c>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [20 x i8] c"ehy man hello dfdsf\00"
@.str.2 = [16 x i8] c"Index not found\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @comparer(i8* %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 0)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %13
10: ; preds = %0
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10, %8
%14 = load i32, i32* @EXIT_SUCCESS
ret i32 %14
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [20 x i8] c"ehy man hello dfdsf\00"
@.str.2 = [16 x i8] c"Index not found\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @comparer(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 0)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %1)
br label %7
7: ; preds = %5, %3
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}