#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*/ findString(char *, char *, int);
int /*<<< orphan*/ test(int /*<<< orphan*/, int);
void testFindString(void) {
  test(findString("cad", "abracadabra", 0), 4);
  test(findString("cad", "abracadabra", 6), -1);
  test(findString("abr", "abracadabra", 6), 7);
}


x86 assembly (clang, -O0):
<testFindString>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed2(%rip),%rsi
xor    %edx,%edx
call   1030 <findString@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1040 <test@plt>
lea    0xeb4(%rip),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x6,%edx
call   1030 <findString@plt>
mov    %eax,%edi
mov    $0xffffffff,%esi
call   1040 <test@plt>
lea    0xea0(%rip),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x6,%edx
call   1030 <findString@plt>
mov    %eax,%edi
mov    $0x7,%esi
call   1040 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testFindString>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
lea    0xed2(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <findString@plt>
mov    %eax,%edi
mov    $0x4,%esi
call   1040 <test@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <findString@plt>
mov    %eax,%edi
mov    $0xffffffff,%esi
call   1040 <test@plt>
lea    0xea2(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <findString@plt>
mov    %eax,%edi
mov    $0x7,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <test@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"cad\00"
@.str.1 = [12 x i8] c"abracadabra\00"
@.str.2 = [4 x i8] c"abr\00"
define void @testFindString() {
%1 = call i32 @findString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0)
%2 = call i32 @test(i32 %1, i32 4)
%3 = call i32 @findString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6)
%4 = call i32 @test(i32 %3, i32 -1)
%5 = call i32 @findString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6)
%6 = call i32 @test(i32 %5, i32 7)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"cad\00"
@.str.1 = [12 x i8] c"abracadabra\00"
@.str.2 = [4 x i8] c"abr\00"
define void @testFindString() {
%1 = tail call i32 @findString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0)
%2 = tail call i32 @test(i32 %1, i32 4)
%3 = tail call i32 @findString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6)
%4 = tail call i32 @test(i32 %3, i32 -1)
%5 = tail call i32 @findString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6)
%6 = tail call i32 @test(i32 %5, i32 7)
ret void
}