#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 *);
int smp_str_substr_exist(char *, char *);
int smp_test_str_exist() {
  char *substr = "asdf45d231f";
  char *text = "12fg1323asdf45d231fd213gd321dcv312fg6sdfgdggdfd9";
  if (smp_str_substr_exist(text, substr) == (1))
    printf("have a sub %s\n", substr);
  else
    printf("havn't a sub %s\n", substr);
  return (0);
}


x86 assembly (clang, -O0):
<smp_test_str_exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xed2(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <smp_str_substr_exist@plt>
cmp    $0x1,%eax
jne    1169 <smp_test_str_exist+0x49>
mov    -0x8(%rbp),%rsi
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
jmp    1179 <smp_test_str_exist+0x59>
mov    -0x8(%rbp),%rsi
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smp_test_str_exist>:
push   %rbx
lea    0xee4(%rip),%rdi
lea    0xed1(%rip),%rbx
mov    %rbx,%rsi
call   1040 <smp_str_substr_exist@plt>
cmp    $0x1,%eax
lea    0xefc(%rip),%rax
lea    0xf04(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"asdf45d231f\00"
@.str.1 = [49 x i8] c"12fg1323asdf45d231fd213gd321dcv312fg6sdfgdggdfd9\00"
@.str.2 = [15 x i8] c"have a sub %s\0A\00"
@.str.3 = [17 x i8] c"havn't a sub %s\0A\00"
define i32 @smp_test_str_exist() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %1
%5 = call i32 @smp_str_substr_exist(i8* %3, i8* %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i8*, i8** %1
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %13
10: ; preds = %0
%11 = load i8*, i8** %1
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"asdf45d231f\00"
@.str.1 = [49 x i8] c"12fg1323asdf45d231fd213gd321dcv312fg6sdfgdggdfd9\00"
@.str.2 = [15 x i8] c"have a sub %s\0A\00"
@.str.3 = [17 x i8] c"havn't a sub %s\0A\00"
define i32 @smp_test_str_exist() {
%1 = tail call i32 @smp_str_substr_exist(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}