#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__ IsSubString(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
main() {
  char s1[] = "Hello World";
  char s2[] = "Wor";
  char s3[] = "Wors";
  printf("%s, %s: %s\n", s1, s2,
         IsSubString(s1, s2) ? "Yes a substring" : "No");
  printf("%s, %s: %s\n", s1, s3,
         IsSubString(s1, s3) ? "Yes a substring" : "No");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xeca(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xec0(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <IsSubString@plt>
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    %rax,%rdi
lea    0xeab(%rip),%rcx
lea    0xe94(%rip),%rax
cmp    $0x0,%rdi
cmovne %rax,%rcx
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x15(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xc(%rbp),%rdi
lea    -0x15(%rbp),%rsi
call   1040 <IsSubString@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    %rax,%rdi
lea    0xe61(%rip),%rcx
lea    0xe4a(%rip),%rax
cmp    $0x0,%rdi
cmovne %rax,%rcx
lea    0xe2f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
movabs $0x6f57206f6c6c6548,%rax
20 57 6f
mov    %rax,0x10(%rsp)
movl   $0x646c72,0x18(%rsp)
movl   $0x726f57,0xc(%rsp)
movb   $0x0,0x8(%rsp)
movl   $0x73726f57,0x4(%rsp)
73
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <IsSubString@plt>
test   %rax,%rax
lea    0xeb5(%rip),%r13
lea    0xe9e(%rip),%rbx
mov    %rbx,%rcx
cmove  %r13,%rcx
lea    0xe84(%rip),%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
lea    0x4(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <IsSubString@plt>
test   %rax,%rax
cmove  %r13,%rbx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.s1 = [12 x i8] c"Hello World\00"
@__const.main.s2 = [4 x i8] c"Wor\00"
@__const.main.s3 = [5 x i8] c"Wors\00"
@.str = [12 x i8] c"%s, %s: %s\0A\00"
@.str.1 = [16 x i8] c"Yes a substring\00"
@.str.2 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = alloca [4 x i8]
%3 = alloca [5 x i8]
%4 = bitcast [12 x i8]* %1 to i8*
%5 = bitcast [4 x i8]* %2 to i8*
%6 = bitcast [5 x i8]* %3 to i8*
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%11 = call i64 @IsSubString(i8* %9, i8* %10)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i8* %14)
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%20 = call i64 @IsSubString(i8* %18, i8* %19)
%21 = icmp ne i64 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%24 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17, i8* %23)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s1 = [12 x i8] c"Hello World\00"
@__const.main.s3 = [5 x i8] c"Wors\00"
@.str = [12 x i8] c"%s, %s: %s\0A\00"
@.str.1 = [16 x i8] c"Yes a substring\00"
@.str.2 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = alloca i32
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
store i32 7499607, i32* %2
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = call i64 @IsSubString(i8* %4, i8* %5)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0)
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5, i8* %9)
%11 = call i64 @IsSubString(i8* %4, i8* %6)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0)
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6, i8* %13)
ret i32 0
}