#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 is_palindrome(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_input(char *);
int main(void) {
  char text[81] = {0};
  printf("Enter a message: ");
  read_input(text);
  if (is_palindrome(text) == true) {
    printf("Palindrome\n");
  } else {
    printf("Not a palindrome\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x51,%edx
call   1050 <memset@plt>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1060 <read_input@plt>
lea    -0x60(%rbp),%rdi
call   1030 <is_palindrome@plt>
cmp    $0x1,%eax
jne    1197 <main+0x57>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
jmp    11a3 <main+0x63>
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movb   $0x0,0x50(%rsp)
lea    0xe94(%rip),%rdi
call   1050 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <read_input@plt>
mov    %rbx,%rdi
call   1040 <is_palindrome@plt>
cmp    $0x1,%eax
lea    0xe95(%rip),%rax
lea    0xe7d(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter a message: \00"
@.str.1 = [12 x i8] c"Palindrome\0A\00"
@.str.2 = [18 x i8] c"Not a palindrome\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
store i32 0, i32* %1
%3 = bitcast [81 x i8]* %2 to i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%6 = call i32 @read_input(i8* %5)
%7 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%8 = call i32 @is_palindrome(i8* %7)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter a message: \00"
@str = [17 x i8] c"Not a palindrome\00"
@str.3 = [11 x i8] c"Palindrome\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @read_input(i8* %2)
%5 = call i32 @is_palindrome(i8* %2)
%6 = icmp eq i32 %5, 1
%7 = select i1 %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}