#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 buscarCadena(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
void main() {
  char *texto = "Más vale un ya que cien después se hará";
  char *cadena = "cien";
  if (buscarCadena(texto, cadena) != -1)
    printf("La cadena %s está en el texto\n", cadena);
  else
    printf("La cadena %s no está en el texto\n", cadena);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xef1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <buscarCadena@plt>
cmp    $0xffffffff,%eax
je     1169 <main+0x49>
mov    -0x10(%rbp),%rsi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
jmp    1179 <main+0x59>
mov    -0x10(%rbp),%rsi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
lea    0xefc(%rip),%rbx
mov    %rbx,%rsi
call   1040 <buscarCadena@plt>
cmp    $0xffffffff,%eax
lea    0xf0f(%rip),%rax
lea    0xee8(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"M\C3\A1s vale un ya que cien despu\C3\A9s se har\C3\A1\00"
@.str.1 = [5 x i8] c"cien\00"
@.str.2 = [32 x i8] c"La cadena %s est\C3\A1 en el texto\0A\00"
@.str.3 = [35 x i8] c"La cadena %s no est\C3\A1 en el texto\0A\00"
define void @main() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i32 @buscarCadena(i8* %3, i8* %4)
%6 = icmp ne i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %13
10: ; preds = %0
%11 = load i8*, i8** %2
%12 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
@.str = [43 x i8] c"M\C3\A1s vale un ya que cien despu\C3\A9s se har\C3\A1\00"
@.str.1 = [5 x i8] c"cien\00"
@.str.2 = [32 x i8] c"La cadena %s est\C3\A1 en el texto\0A\00"
@.str.3 = [35 x i8] c"La cadena %s no est\C3\A1 en el texto\0A\00"
define void @main() {
%1 = tail call i32 @buscarCadena(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
%3 = select i1 %2, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}