#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 search_str(char *, char *);
void search_str2(char *strDestination, char *searchstr) {
  int strPosition = search_str(strDestination, searchstr);
  if (strPosition > -1)
    printf("'%s' found in '%s' at position #%d\n", searchstr, strDestination,
           strPosition);
  else
    printf("'%s' not found in '%s'\n", searchstr, strDestination);
}


x86 assembly (clang, -O0):
<search_str2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <search_str@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jle    1168 <search_str2+0x48>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117e <search_str2+0x5e>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_str2>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <search_str@plt>
test   %eax,%eax
js     1150 <search_str2+0x30>
lea    0xec6(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"'%s' found in '%s' at position #%d\0A\00"
@.str.1 = [24 x i8] c"'%s' not found in '%s'\0A\00"
define void @search_str2(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @search_str(i8* %6, i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, -1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = load i32, i32* %5
%15 = call i32 (i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13, i32 %14)
br label %20
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = load i8*, i8** %3
%19 = call i32 (i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %18)
br label %20
20: ; preds = %16, %11
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"'%s' found in '%s' at position #%d\0A\00"
@.str.1 = [24 x i8] c"'%s' not found in '%s'\0A\00"
define void @search_str2(i8* %0, i8* %1) {
%3 = tail call i32 @search_str(i8* %0, i8* %1)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0, i32 %3)
br label %9
7: ; preds = %2
%8 = tail call i32 (i8*, i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %0)
br label %9
9: ; preds = %7, %5
ret void
}