#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 longestPalindrome(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char *s1 =
      "aaaaaaaaaaAAAAAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"
      "caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
  if (longestPalindrome(s1) == 500)
    printf("case1: OK\n");
  else
    printf("case1: Failed\n");
  char *s2 = "bbbaaaa";
  if (longestPalindrome(s2) == 4)
    printf("case2: OK\n");
  else
    printf("case2: Failed\n");
  char *s3 = "abcccdd";
  if (longestPalindrome(s3) == 3)
    printf("case3: OK\n");
  else
    printf("case3: Failed\n");
  return 0;
}


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)
mov    -0x10(%rbp),%rdi
call   1040 <longestPalindrome@plt>
cmp    $0x1f4,%eax
jne    115f <main+0x3f>
lea    0x1299(%rip),%rdi
call   1030 <printf@plt>
jmp    116b <main+0x4b>
lea    0x1293(%rip),%rdi
call   1030 <printf@plt>
lea    0x1296(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <longestPalindrome@plt>
cmp    $0x4,%eax
jne    1199 <main+0x79>
lea    0x1281(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <main+0x85>
lea    0x127b(%rip),%rdi
call   1030 <printf@plt>
lea    0x127e(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <longestPalindrome@plt>
cmp    $0x3,%eax
jne    11d3 <main+0xb3>
lea    0x1269(%rip),%rdi
call   1030 <printf@plt>
jmp    11df <main+0xbf>
lea    0x1263(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <longestPalindrome@plt>
cmp    $0x1f4,%eax
lea    0x1303(%rip),%rax
lea    0x12be(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0x129e(%rip),%rdi
call   1040 <longestPalindrome@plt>
cmp    $0x4,%eax
lea    0x12d3(%rip),%rax
lea    0x12a6(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0x1280(%rip),%rdi
call   1040 <longestPalindrome@plt>
cmp    $0x3,%eax
lea    0x12a3(%rip),%rax
lea    0x128e(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1006 x i8] c"aaaaaaaaaaAAAAAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\00"
@.str.1 = [11 x i8] c"case1: OK\0A\00"
@.str.2 = [15 x i8] c"case1: Failed\0A\00"
@.str.3 = [8 x i8] c"bbbaaaa\00"
@.str.4 = [11 x i8] c"case2: OK\0A\00"
@.str.5 = [15 x i8] c"case2: Failed\0A\00"
@.str.6 = [8 x i8] c"abcccdd\00"
@.str.7 = [11 x i8] c"case3: OK\0A\00"
@.str.8 = [15 x i8] c"case3: Failed\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([1006 x i8], [1006 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @longestPalindrome(i8* %5)
%7 = icmp eq i32 %6, 500
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %3
%13 = load i8*, i8** %3
%14 = call i32 @longestPalindrome(i8* %13)
%15 = icmp eq i32 %14, 4
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %20
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %4
%21 = load i8*, i8** %4
%22 = call i32 @longestPalindrome(i8* %21)
%23 = icmp eq i32 %22, 3
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %28
26: ; preds = %20
%27 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
ret i32 0
}

LLVM IR (-O2):
@.str = [1006 x i8] c"aaaaaaaaaaAAAAAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\00"
@.str.3 = [8 x i8] c"bbbaaaa\00"
@.str.6 = [8 x i8] c"abcccdd\00"
@str = [14 x i8] c"case1: Failed\00"
@str.9 = [14 x i8] c"case2: Failed\00"
@str.10 = [14 x i8] c"case3: Failed\00"
@str.11 = [10 x i8] c"case3: OK\00"
@str.12 = [10 x i8] c"case2: OK\00"
@str.13 = [10 x i8] c"case1: OK\00"
define i32 @main() {
%1 = tail call i32 @longestPalindrome(i8* getelementptr inbounds ([1006 x i8], [1006 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 500
%3 = select i1 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.13, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
%5 = tail call i32 @longestPalindrome(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%6 = icmp eq i32 %5, 4
%7 = select i1 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
%9 = tail call i32 @longestPalindrome(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%10 = icmp eq i32 %9, 3
%11 = select i1 %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.10, i64 0, i64 0)
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
ret i32 0
}