#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__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
char *strcat(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
int isrotate(char str1[], char str2[]) {
  int len1 = strlen(str1);
  int len2 = strlen(str2);
  char *temp = (char *)malloc(len1 + len2 + 1);
  memset(temp, 0, (len1 + len2 + 1));
  temp = strcat(temp, str1);
  temp = strcat(temp, str2);
  char *res = strstr(temp, str2);
  if (res) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<isrotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
add    -0x20(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    -0x20(%rbp),%edx
add    $0x1,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11e8 <isrotate+0x98>
movl   $0x1,-0x4(%rbp)
jmp    11ef <isrotate+0x9f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrotate>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    %r12,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rax,1),%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isrotate(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add i32 %3, 1
%6 = add i32 %5, %4
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @memset(i8* %8, i32 0, i32 %6)
%10 = tail call i8* @strcat(i8* dereferenceable(1) %8, i8* dereferenceable(1) %0)
%11 = tail call i8* @strcat(i8* dereferenceable(1) %8, i8* dereferenceable(1) %1)
%12 = tail call i8* @strstr(i8* dereferenceable(1) %8, i8* dereferenceable(1) %1)
%13 = icmp ne i8* %12, null
%14 = zext i1 %13 to i32
ret i32 %14
}