#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__ palindrome(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char string[255];
  printf("Enter a string (max 255 chars): ");
  scanf("%s", string);
  if (palindrome(string)) {
    printf("%s is a palindrome\n", string);
  } else {
    printf("%s is not a palindrome\n", string);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xec3(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <palindrome@plt>
cmp    $0x0,%rax
je     1193 <main+0x63>
lea    -0x110(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a8 <main+0x78>
lea    -0x110(%rbp),%rsi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <palindrome@plt>
test   %rax,%rax
lea    0xece(%rip),%rax
lea    0xeb3(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Enter a string (max 255 chars): \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [20 x i8] c"%s is a palindrome\0A\00"
@.str.3 = [24 x i8] c"%s is not a palindrome\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%7 = call i64 @palindrome(i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %15
12: ; preds = %0
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %12, %9
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [33 x i8] c"Enter a string (max 255 chars): \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [20 x i8] c"%s is a palindrome\0A\00"
@.str.3 = [24 x i8] c"%s is not a palindrome\0A\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i64 @palindrome(i8* %2)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %7, i8* %2)
ret i32 0
}