#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 */
char *palindrome1(char *);
char *palindrome2(char *);
char *palindrome3(char *);
char *palindrome4(char *);
char *palindrome5(char *);
char *palindrome6(char *);
int /*<<< orphan*/ palindrome8(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char string[] = "red";
  char *res = palindrome1(string);
  printf("%s\n", string);
  printf("%s\n", res);
  res = palindrome2(string);
  printf("%s\n", string);
  printf("%s\n", res);
  res = palindrome3(string);
  printf("%s\n", string);
  printf("%s\n", res);
  res = palindrome4(string);
  printf("%s\n", string);
  printf("%s\n", res);
  res = palindrome5(string);
  printf("%s\n", string);
  printf("%s\n", res);
  res = palindrome6(string);
  printf("%s\n", string);
  printf("%s\n", res);
  char dest[128];
  palindrome8(string, dest);
  printf("%s\n", string);
  printf("%s\n", dest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe68(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <palindrome1@plt>
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1070 <palindrome2@plt>
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1050 <palindrome3@plt>
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xdf7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1080 <palindrome4@plt>
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xdca(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdba(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1060 <palindrome5@plt>
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xd9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xd8d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1090 <palindrome6@plt>
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xd70(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xd60(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   10a0 <palindrome8@plt>
lea    -0x8(%rbp),%rsi
lea    0xd40(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    0xd2d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
movl   $0x646572,0xc(%rsp)
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1040 <palindrome1@plt>
mov    %rax,%r15
lea    0xe55(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1070 <palindrome2@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1050 <palindrome3@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1080 <palindrome4@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1060 <palindrome5@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1090 <palindrome6@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    0x10(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   10a0 <palindrome8@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.string = [4 x i8] c"red\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca i8*
%4 = alloca [128 x i8]
store i32 0, i32* %1
%5 = bitcast [4 x i8]* %2 to i8*
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%7 = call i8* @palindrome1(i8* %6)
store i8* %7, i8** %3
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%13 = call i8* @palindrome2(i8* %12)
store i8* %13, i8** %3
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %3
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%19 = call i8* @palindrome3(i8* %18)
store i8* %19, i8** %3
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = load i8*, i8** %3
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%25 = call i8* @palindrome4(i8* %24)
store i8* %25, i8** %3
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = load i8*, i8** %3
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%31 = call i8* @palindrome5(i8* %30)
store i8* %31, i8** %3
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = load i8*, i8** %3
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%37 = call i8* @palindrome6(i8* %36)
store i8* %37, i8** %3
%38 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %38)
%40 = load i8*, i8** %3
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%44 = call i32 @palindrome8(i8* %42, i8* %43)
%45 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %45)
%47 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %47)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = bitcast i32* %1 to i8*
store i32 6579570, i32* %1
%4 = call i8* @palindrome1(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = call i8* @palindrome2(i8* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%10 = call i8* @palindrome3(i8* %3)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%13 = call i8* @palindrome4(i8* %3)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
%16 = call i8* @palindrome5(i8* %3)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%19 = call i8* @palindrome6(i8* %3)
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %19)
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%23 = call i32 @palindrome8(i8* %3, i8* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
ret i32 0
}