#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__ is_rotate_palindrome(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strlen(char *);
int main() {
  char str1[3] = "aab";
  if (is_rotate_palindrome(str1, strlen(str1))) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  char str2[4] = "abcd";
  if (is_rotate_palindrome(str2, strlen(str2))) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeb2(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x7(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x7(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1050 <is_rotate_palindrome@plt>
cmp    $0x0,%rax
je     118a <main+0x5a>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
jmp    1196 <main+0x66>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
mov    0xe70(%rip),%eax
mov    %eax,-0xb(%rbp)
lea    -0xb(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xb(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1050 <is_rotate_palindrome@plt>
cmp    $0x0,%rax
je     11d6 <main+0xa6>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
jmp    11e2 <main+0xb2>
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movb   $0x62,0xa(%rsp)
movw   $0x6161,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <is_rotate_palindrome@plt>
test   %rax,%rax
lea    0xe9d(%rip),%r15
lea    0xe99(%rip),%rbx
mov    %rbx,%rdi
cmove  %r15,%rdi
call   1030 <puts@plt>
movl   $0x64636261,0xc(%rsp)
64
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1050 <is_rotate_palindrome@plt>
test   %rax,%rax
cmove  %r15,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.str1 = [3 x i8] c"aab"
@.str = [5 x i8] c"YES\0A\00"
@.str.1 = [4 x i8] c"NO\0A\00"
@__const.main.str2 = [4 x i8] c"abcd"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
%3 = alloca [4 x i8]
store i32 0, i32* %1
%4 = bitcast [3 x i8]* %2 to i8*
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%7 = call i32 @strlen(i8* %6)
%8 = call i64 @is_rotate_palindrome(i8* %5, i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = bitcast [4 x i8]* %3 to i8*
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
%19 = call i64 @is_rotate_palindrome(i8* %16, i32 %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %25
23: ; preds = %14
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
ret i32 0
}

LLVM IR (-O2):
@__const.main.str1 = [3 x i8] c"aab"
@str.2 = [3 x i8] c"NO\00"
@str.4 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%4 = call i32 @strlen(i8* %3)
%5 = call i64 @is_rotate_palindrome(i8* %3, i32 %4)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
%9 = bitcast i32* %2 to i8*
store i32 1684234849, i32* %2
%10 = call i32 @strlen(i8* %9)
%11 = call i64 @is_rotate_palindrome(i8* %9, i32 %10)
%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 ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0)
%14 = call i32 @puts(i8* dereferenceable(1) %13)
ret i32 0
}