#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__ isRotation(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int main() {
  char *s1 = "waterbottle";
  char *s2 = "erbottlewat";
  if (isRotation(s1, s2)) {
    printf("%s is a rotation of %s\n", s2, s1);
  } else {
    printf("%s is not a rotation of %s\n", s2, s1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xecb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <isRotation@plt>
cmp    $0x0,%rax
je     1175 <main+0x55>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
jmp    1189 <main+0x69>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
lea    0xeda(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <isRotation@plt>
test   %rax,%rax
lea    0xee9(%rip),%rax
lea    0xeca(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"waterbottle\00"
@.str.1 = [12 x i8] c"erbottlewat\00"
@.str.2 = [24 x i8] c"%s is a rotation of %s\0A\00"
@.str.3 = [28 x i8] c"%s is not a rotation of %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = load i8*, i8** %3
%6 = call i64 @isRotation(i8* %4, i8* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %10)
br label %16
12: ; preds = %0
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %13, i8* %14)
br label %16
16: ; preds = %12, %8
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [12 x i8] c"waterbottle\00"
@.str.1 = [12 x i8] c"erbottlewat\00"
@.str.2 = [24 x i8] c"%s is a rotation of %s\0A\00"
@.str.3 = [28 x i8] c"%s is not a rotation of %s\0A\00"
define i32 @main() {
%1 = tail call i64 @isRotation(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}