#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 /*<<< orphan*/ printf(char *, char *, char *, int);
int strStr(char *, char *);
int main() {
  char hay[] = "iloveleetcode";
  char needle1[] = "leet";
  char needle2[] = "geek";
  printf("%s, %s, %d\n", hay, needle1, strStr(hay, needle1));
  printf("%s, %s, %d\n", hay, needle2, strStr(hay, needle2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xeba(%rip),%eax
mov    %eax,-0x17(%rbp)
mov    0xeb5(%rip),%al
mov    %al,-0x13(%rbp)
mov    0xead(%rip),%eax
mov    %eax,-0x1c(%rbp)
mov    0xea8(%rip),%al
mov    %al,-0x18(%rbp)
lea    -0x12(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x17(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x12(%rbp),%rdi
lea    -0x17(%rbp),%rsi
call   1040 <strStr@plt>
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    %eax,%ecx
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
lea    -0x12(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x12(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <strStr@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movabs $0x65646f63746565,%rax
mov    %rax,0x16(%rsp)
movabs $0x65656c65766f6c69,%rax
6c 65 65
mov    %rax,0x10(%rsp)
movb   $0x0,0xc(%rsp)
movl   $0x7465656c,0x8(%rsp)
74
movb   $0x0,0x4(%rsp)
movl   $0x6b656567,(%rsp)
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strStr@plt>
lea    0xe9c(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strStr@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.hay = [14 x i8] c"iloveleetcode\00"
@__const.main.needle1 = [5 x i8] c"leet\00"
@__const.main.needle2 = [5 x i8] c"geek\00"
@.str = [12 x i8] c"%s, %s, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
%3 = alloca [5 x i8]
%4 = alloca [5 x i8]
store i32 0, i32* %1
%5 = bitcast [14 x i8]* %2 to i8*
%6 = bitcast [5 x i8]* %3 to i8*
%7 = bitcast [5 x i8]* %4 to i8*
%8 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%12 = call i32 @strStr(i8* %10, i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i32 %12)
%14 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%18 = call i32 @strStr(i8* %16, i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.hay = [14 x i8] c"iloveleetcode\00"
@__const.main.needle1 = [5 x i8] c"leet\00"
@__const.main.needle2 = [5 x i8] c"geek\00"
@.str = [12 x i8] c"%s, %s, %d\0A\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = call i32 @strStr(i8* %4, i8* %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5, i32 %7)
%9 = call i32 @strStr(i8* %4, i8* %6)
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6, i32 %9)
ret i32 0
}