#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 */
char *malloc(int);
int /*<<< orphan*/ rotate(char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ strstr(char *, char *);
bool IsSubString(char s1[], char s2[]) {
  int len;
  int k;
  char *new;
  len = strlen(s2);
  new = malloc(len + 1);
  strncpy(new, s2, len);
  *(new + len) = '\0';
  for (k = 0; k < len; k++)
    if (strstr(s1, new))
      return true;
    else
      rotate(new);
  return false;
}


x86 assembly (clang, -O0):
<IsSubString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
add    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11e9 <IsSubString+0x99>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     11cd <IsSubString+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    11f0 <IsSubString+0xa0>
mov    -0x28(%rbp),%rdi
call   1050 <rotate@plt>
jmp    11db <IsSubString+0x8b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119e <IsSubString+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsSubString>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
lea    0x1(%rbx),%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rax
movb   $0x0,0x0(%rbp,%rax,1)
xor    %r15d,%r15d
test   %ebx,%ebx
jle    11b5 <IsSubString+0x65>
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbp,%rsi
call   1070 <strstr@plt>
test   %rax,%rax
jne    11af <IsSubString+0x5f>
mov    %rbp,%rdi
call   1050 <rotate@plt>
add    $0xffffffff,%ebx
jne    1190 <IsSubString+0x40>
jmp    11b5 <IsSubString+0x65>
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @IsSubString(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %8
%14 = load i8*, i8** %8
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = call i32 @strncpy(i8* %14, i8* %15, i32 %16)
%18 = load i8*, i8** %8
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
store i32 0, i32* %7
br label %22
22: ; preds = %36, %2
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %39
26: ; preds = %22
%27 = load i8*, i8** %4
%28 = load i8*, i8** %8
%29 = call i64 @strstr(i8* %27, i8* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 1, i32* %3
br label %40
32: ; preds = %26
%33 = load i8*, i8** %8
%34 = call i32 @rotate(i8* %33)
br label %35
35: ; preds = %32
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %22
39: ; preds = %22
store i32 0, i32* %3
br label %40
40: ; preds = %39, %31
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
define i32 @IsSubString(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = add nsw i32 %3, 1
%5 = tail call i8* @malloc(i32 %4)
%6 = tail call i32 @strncpy(i8* %5, i8* %1, i32 %3)
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
%9 = icmp sgt i32 %3, 0
br i1 %9, label %10, label %18
10: ; preds = %2, %14
%11 = phi i32 [ %16, %14 ], [ 0, %2 ]
%12 = tail call i64 @strstr(i8* %0, i8* %5)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = tail call i32 @rotate(i8* %5)
%16 = add nuw nsw i32 %11, 1
%17 = icmp eq i32 %16, %3
br i1 %17, label %18, label %10
18: ; preds = %10, %14, %2
%19 = phi i32 [ 0, %2 ], [ 0, %14 ], [ 1, %10 ]
ret i32 %19
}