#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__ isPalindrome(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i;
  char *testStrings[4];
  testStrings[0] = "redder";
  testStrings[1] = "tacocat";
  testStrings[2] = "drabasafoolaloofasabard";
  testStrings[3] = "i'mnotapalindrome";
  for (i = 0; i < 4; i++) {
    printf("Checking \"%s\"... ", testStrings[i]);
    if (isPalindrome(testStrings[i])) {
      printf("it's a palindrome!\n");
    } else {
      printf("nope, not a palindrome.\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xec6(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xed0(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11cf <main+0xaf>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1040 <isPalindrome@plt>
cmp    $0x0,%rax
je     11ae <main+0x8e>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bc <main+0x9c>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c1 <main+0xa1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <main+0x42>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xefa(%rip),%r14
lea    0xeba(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <isPalindrome@plt>
test   %rax,%rax
lea    0xee6(%rip),%r12
lea    0xef7(%rip),%rbx
mov    %rbx,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
lea    0xe88(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1050 <isPalindrome@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
lea    0xe65(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1050 <isPalindrome@plt>
test   %rax,%rax
mov    %rbx,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
lea    0xe52(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1050 <isPalindrome@plt>
test   %rax,%rax
cmove  %r12,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"redder\00"
@.str.1 = [8 x i8] c"tacocat\00"
@.str.2 = [24 x i8] c"drabasafoolaloofasabard\00"
@.str.3 = [18 x i8] c"i'mnotapalindrome\00"
@.str.4 = [18 x i8] c"Checking \22%s\22... \00"
@.str.5 = [20 x i8] c"it's a palindrome!\0A\00"
@.str.6 = [25 x i8] c"nope, not a palindrome.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x i8*]
store i32 0, i32* %1
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 3
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8** %7
store i32 0, i32* %2
br label %8
8: ; preds = %28, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %31
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @isPalindrome(i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %11
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %27
25: ; preds = %11
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %8
31: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"redder\00"
@.str.1 = [8 x i8] c"tacocat\00"
@.str.2 = [24 x i8] c"drabasafoolaloofasabard\00"
@.str.3 = [18 x i8] c"i'mnotapalindrome\00"
@.str.4 = [18 x i8] c"Checking \22%s\22... \00"
@str = [24 x i8] c"nope, not a palindrome.\00"
@str.7 = [19 x i8] c"it's a palindrome!\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @isPalindrome(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0)
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i64 @isPalindrome(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0)
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i64 @isPalindrome(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0)
%15 = tail call i32 @puts(i8* dereferenceable(1) %14)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%17 = tail call i64 @isPalindrome(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0)
%20 = tail call i32 @puts(i8* dereferenceable(1) %19)
ret i32 0
}