#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 *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strstr(char *, char *);
int isRot(char *s1, char *s2) {
  char *substr = NULL;
  char temp[100] = {0};
  strcpy(temp, s1);
  strcat(temp, s1);
  printf("new modified string is :%s, will find substring %s \n", temp, s2);
  substr = strstr(temp, s2);
  if (substr) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<isRot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x90(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11e0 <isRot+0x90>
movl   $0x1,-0x4(%rbp)
jmp    11e7 <isRot+0x97>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isRot>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
lea    0xe69(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [53 x i8] c"new modified string is :%s, will find substring %s \0A\00"
define i32 @isRot(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [100 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* null, i8** %6
%8 = bitcast [100 x i8]* %7 to i8*
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%13 = load i8*, i8** %4
%14 = call i32 @strcat(i8* %12, i8* %13)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%16 = load i8*, i8** %5
%17 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%19 = load i8*, i8** %5
%20 = call i8* @strstr(i8* %18, i8* %19)
store i8* %20, i8** %6
%21 = load i8*, i8** %6
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %24
23: ; preds = %2
store i32 1, i32* %3
br label %25
24: ; preds = %2
store i32 0, i32* %3
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [53 x i8] c"new modified string is :%s, will find substring %s \0A\00"
define i32 @isRot(i8* %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %0)
%6 = call i32 @strcat(i8* %4, i8* %0)
%7 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %1)
%8 = call i8* @strstr(i8* %4, i8* dereferenceable(1) %1)
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i32
ret i32 %10
}