#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*/ free(char *);
char *longest_palindrome_expanding(char *);
char *longest_palindrome_try_all(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int main() {
  char *a = "racecar";
  char *b = "not_a_palindrome";
  char *c = "aaaaaaaaaaaaaaaaaaa";
  char *d = "";
  char *tmp;
  tmp = longest_palindrome_try_all(a);
  printf("longest palindrome in '%s' is: '%s'\n", a, tmp);
  free(tmp);
  tmp = longest_palindrome_expanding(b);
  printf("longest palindrome in '%s' is: '%s'\n", b, tmp);
  free(tmp);
  tmp = longest_palindrome_try_all(c);
  printf("longest palindrome in '%s' is: '%s'\n", c, tmp);
  free(tmp);
  tmp = longest_palindrome_expanding(d);
  printf("longest palindrome in '%s' is: '%s'\n", d, tmp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <longest_palindrome_try_all@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1050 <longest_palindrome_expanding@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <longest_palindrome_try_all@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe42(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1050 <longest_palindrome_expanding@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xeb4(%rip),%r15
mov    %r15,%rdi
call   1060 <longest_palindrome_try_all@plt>
mov    %rax,%rbx
lea    0xecf(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe8d(%rip),%r15
mov    %r15,%rdi
call   1050 <longest_palindrome_expanding@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe76(%rip),%r15
mov    %r15,%rdi
call   1060 <longest_palindrome_try_all@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe86(%rip),%rbx
mov    %rbx,%rdi
call   1050 <longest_palindrome_expanding@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"racecar\00"
@.str.1 = [17 x i8] c"not_a_palindrome\00"
@.str.2 = [20 x i8] c"aaaaaaaaaaaaaaaaaaa\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [37 x i8] c"longest palindrome in '%s' is: '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8** %5
%7 = load i8*, i8** %2
%8 = call i8* @longest_palindrome_try_all(i8* %7)
store i8* %8, i8** %6
%9 = load i8*, i8** %2
%10 = load i8*, i8** %6
%11 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %9, i8* %10)
%12 = load i8*, i8** %6
%13 = call i32 @free(i8* %12)
%14 = load i8*, i8** %3
%15 = call i8* @longest_palindrome_expanding(i8* %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %3
%17 = load i8*, i8** %6
%18 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i8*, i8** %6
%20 = call i32 @free(i8* %19)
%21 = load i8*, i8** %4
%22 = call i8* @longest_palindrome_try_all(i8* %21)
store i8* %22, i8** %6
%23 = load i8*, i8** %4
%24 = load i8*, i8** %6
%25 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %23, i8* %24)
%26 = load i8*, i8** %6
%27 = call i32 @free(i8* %26)
%28 = load i8*, i8** %5
%29 = call i8* @longest_palindrome_expanding(i8* %28)
store i8* %29, i8** %6
%30 = load i8*, i8** %5
%31 = load i8*, i8** %6
%32 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %30, i8* %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"racecar\00"
@.str.1 = [17 x i8] c"not_a_palindrome\00"
@.str.2 = [20 x i8] c"aaaaaaaaaaaaaaaaaaa\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [37 x i8] c"longest palindrome in '%s' is: '%s'\0A\00"
define i32 @main() {
%1 = tail call i8* @longest_palindrome_try_all(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call i32 @free(i8* %1)
%4 = tail call i8* @longest_palindrome_expanding(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = tail call i32 @free(i8* %4)
%7 = tail call i8* @longest_palindrome_try_all(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = tail call i32 @free(i8* %7)
%10 = tail call i8* @longest_palindrome_expanding(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* %10)
ret i32 0
}