#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 */
scalar_t__ contained(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int main() {
  char *first = "first";
  char *second = "we should find the first inside the second";
  printf("%s :: %s\ncontained %s\n", first, second,
         contained(first, second) ? "yes" : "no");
  first = "first";
  second = "we shouldn't find it inside the second";
  printf("%s :: %s\ncontained %s\n", first, second,
         contained(first, second) ? "yes" : "no");
  first = NULL;
  printf("%s :: %s\ncontained %s\n", first, second,
         contained(first, second) ? "yes" : "no");
  first = "";
  printf("%s :: %s\ncontained %s\n", first, second,
         contained(first, second) ? "yes" : "no");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xecc(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <contained@plt>
mov    -0x50(%rbp),%rsi
mov    -0x48(%rbp),%rdx
mov    %rax,%rdi
lea    0xedf(%rip),%rcx
lea    0xed4(%rip),%rax
cmp    $0x0,%rdi
cmovne %rax,%rcx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xe71(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <contained@plt>
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    %rax,%rdi
lea    0xe7f(%rip),%rcx
lea    0xe74(%rip),%rax
cmp    $0x0,%rdi
cmovne %rax,%rcx
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <contained@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %rax,%rdi
lea    0xe2d(%rip),%rcx
lea    0xe22(%rip),%rax
cmp    $0x0,%rdi
cmovne %rax,%rcx
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
lea    0xe06(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <contained@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    %rax,%rdi
lea    0xdd8(%rip),%rcx
lea    0xdcd(%rip),%rax
cmp    $0x0,%rdi
cmovne %rax,%rcx
lea    0xda7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xed0(%rip),%r12
lea    0xecf(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <contained@plt>
test   %rax,%rax
lea    0xf00(%rip),%r13
lea    0xef5(%rip),%rbx
mov    %rbx,%rcx
cmove  %r13,%rcx
lea    0xed0(%rip),%r14
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1030 <printf@plt>
lea    0xed9(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <contained@plt>
test   %rax,%rax
mov    %rbx,%rcx
cmove  %r13,%rcx
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1030 <printf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   1040 <contained@plt>
test   %rax,%rax
mov    %rbx,%rcx
cmove  %r13,%rcx
mov    %r14,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1030 <printf@plt>
lea    0xe86(%rip),%r12
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <contained@plt>
test   %rax,%rax
cmove  %r13,%rbx
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"first\00"
@.str.1 = [43 x i8] c"we should find the first inside the second\00"
@.str.2 = [23 x i8] c"%s :: %s\0Acontained %s\0A\00"
@.str.3 = [4 x i8] c"yes\00"
@.str.4 = [3 x i8] c"no\00"
@.str.5 = [39 x i8] c"we shouldn't find it inside the second\00"
@.str.6 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = load i8*, i8** %1
%6 = load i8*, i8** %2
%7 = call i64 @contained(i8* %5, i8* %6)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* %4, i8* %10)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8** %2
%12 = load i8*, i8** %1
%13 = load i8*, i8** %2
%14 = load i8*, i8** %1
%15 = load i8*, i8** %2
%16 = call i64 @contained(i8* %14, i8* %15)
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%20 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %12, i8* %13, i8* %19)
store i8* null, i8** %1
%21 = load i8*, i8** %1
%22 = load i8*, i8** %2
%23 = load i8*, i8** %1
%24 = load i8*, i8** %2
%25 = call i64 @contained(i8* %23, i8* %24)
%26 = icmp ne i64 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%29 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* %22, i8* %28)
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8** %1
%30 = load i8*, i8** %1
%31 = load i8*, i8** %2
%32 = load i8*, i8** %1
%33 = load i8*, i8** %2
%34 = call i64 @contained(i8* %32, i8* %33)
%35 = icmp ne i64 %34, 0
%36 = zext i1 %35 to i64
%37 = select i1 %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%38 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %30, i8* %31, i8* %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"first\00"
@.str.1 = [43 x i8] c"we should find the first inside the second\00"
@.str.2 = [23 x i8] c"%s :: %s\0Acontained %s\0A\00"
@.str.3 = [4 x i8] c"yes\00"
@.str.4 = [3 x i8] c"no\00"
@.str.5 = [39 x i8] c"we shouldn't find it inside the second\00"
@.str.6 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = tail call i64 @contained(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call i64 @contained(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%9 = tail call i64 @contained(i8* null, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* null, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %11)
%13 = tail call i64 @contained(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %15)
ret i32 0
}