#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 EXIT_SUCCESS;
int /*<<< orphan*/ gets(char *);
scalar_t__ isPalindromeIter(char *);
scalar_t__ isPalindromeRecInit(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char str[25];
  printf("Please input a word for palindrome checking: ");
  gets(str);
  printf("Iterative function returns that string: %s, is%s a palindrome\n", str,
         isPalindromeIter(str) ? "" : " not");
  printf("Recursive function returns that string: %s, is%s a palindrome\n", str,
         isPalindromeRecInit(str) ? "" : " not");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <isPalindromeIter@plt>
mov    -0x30(%rbp),%rsi
mov    %rax,%rcx
lea    0xee8(%rip),%rdx
lea    0xf24(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <isPalindromeRecInit@plt>
mov    -0x28(%rbp),%rsi
mov    %rax,%rcx
lea    0xeac(%rip),%rdx
lea    0xee8(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
call   1050 <isPalindromeIter@plt>
test   %rax,%rax
lea    0xef9(%rip),%r15
lea    0xf35(%rip),%rbx
mov    %rbx,%rdx
cmove  %r15,%rdx
lea    0xea5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <isPalindromeRecInit@plt>
test   %rax,%rax
cmove  %r15,%rbx
lea    0xec9(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Please input a word for palindrome checking: \00"
@.str.1 = [63 x i8] c"Iterative function returns that string: %s, is%s a palindrome\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c" not\00"
@.str.4 = [63 x i8] c"Recursive function returns that string: %s, is%s a palindrome\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [25 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%8 = call i64 @isPalindromeIter(i8* %7)
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %11)
%13 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%15 = call i64 @isPalindromeRecInit(i8* %14)
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0), i8* %13, i8* %18)
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}

LLVM IR (-O2):
@.str = [46 x i8] c"Please input a word for palindrome checking: \00"
@.str.1 = [63 x i8] c"Iterative function returns that string: %s, is%s a palindrome\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [5 x i8] c" not\00"
@.str.4 = [63 x i8] c"Recursive function returns that string: %s, is%s a palindrome\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [25 x i8]
%2 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i64 @isPalindromeIter(i8* %2)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %7)
%9 = call i64 @isPalindromeRecInit(i8* %2)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* %11)
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}