#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_palindrome_iter(char *);
scalar_t__ is_palindrome_rec(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char str[] = "regninger";
  printf("Checking if %s is a palindrome..\n", str);
  if (is_palindrome_iter(str))
    printf("Iterative function: TRUE\n");
  else
    printf("Iterative function: FALSE\n");
  if (is_palindrome_rec(str))
    printf("Recursive function: TRUE\n");
  else
    printf("Recursive function: FALSE\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1040 <is_palindrome_iter@plt>
cmp    $0x0,%rax
je     118d <main+0x5d>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119b <main+0x6b>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1050 <is_palindrome_rec@plt>
cmp    $0x0,%rax
je     11c1 <main+0x91>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cf <main+0x9f>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x65676e696e676572,%rax
6e 67 65
mov    %rax,(%rsp)
movw   $0x72,0x8(%rsp)
lea    0xea9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <is_palindrome_iter@plt>
test   %rax,%rax
lea    0xeac(%rip),%rax
lea    0xef2(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1060 <is_palindrome_rec@plt>
test   %rax,%rax
lea    0xea4(%rip),%rax
lea    0xeb7(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [10 x i8] c"regninger\00"
@.str = [34 x i8] c"Checking if %s is a palindrome..\0A\00"
@.str.1 = [26 x i8] c"Iterative function: TRUE\0A\00"
@.str.2 = [27 x i8] c"Iterative function: FALSE\0A\00"
@.str.3 = [26 x i8] c"Recursive function: TRUE\0A\00"
@.str.4 = [27 x i8] c"Recursive function: FALSE\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = bitcast [10 x i8]* %2 to i8*
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = call i64 @is_palindrome_iter(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%15 = call i64 @is_palindrome_rec(i8* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %21
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [10 x i8] c"regninger\00"
@.str = [34 x i8] c"Checking if %s is a palindrome..\0A\00"
@str = [26 x i8] c"Iterative function: FALSE\00"
@str.5 = [26 x i8] c"Recursive function: FALSE\00"
@str.6 = [25 x i8] c"Recursive function: TRUE\00"
@str.7 = [25 x i8] c"Iterative function: TRUE\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i64 @is_palindrome_iter(i8* %2)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0)
%7 = call i32 @puts(i8* dereferenceable(1) %6)
%8 = call i64 @is_palindrome_rec(i8* %2)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0)
%11 = call i32 @puts(i8* dereferenceable(1) %10)
ret i32 0
}