#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char **);
int strcmp(int, int);
int strrev(char *);
int main() {
  char a[100], b[100];
  int s1, s2, k;
  printf("Enter a string\n");
  scanf("%s", &a);
  s2 = a[100];
  s1 = strrev(a);
  k = strcmp(s2, s1);
  if (k == 0)
    printf("The string is PALLINDROME");
  else
    printf("NOT PALLINDROME");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xea7(%rip),%rdi
call   1050 <scanf@plt>
movsbl -0xc(%rbp),%eax
mov    %eax,-0xe8(%rbp)
lea    -0x70(%rbp),%rdi
call   1060 <strrev@plt>
mov    %eax,-0xe4(%rbp)
mov    -0xe8(%rbp),%edi
mov    -0xe4(%rbp),%esi
call   1040 <strcmp@plt>
mov    %eax,-0xec(%rbp)
cmpl   $0x0,-0xec(%rbp)
jne    11bc <main+0x7c>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
jmp    11c8 <main+0x88>
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xe97(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
movsbl 0x64(%rsp),%ebp
mov    %rbx,%rdi
call   1070 <strrev@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <strcmp@plt>
test   %eax,%eax
lea    0xe70(%rip),%rax
lea    0xe83(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter a string\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [26 x i8] c"The string is PALLINDROME\00"
@.str.3 = [16 x i8] c"NOT PALLINDROME\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = bitcast [100 x i8]* %2 to i8**
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %8)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 100
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
store i32 %12, i32* %5
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%14 = call i32 @strrev(i8* %13)
store i32 %14, i32* %4
%15 = load i32, i32* %5
%16 = load i32, i32* %4
%17 = call i32 @strcmp(i32 %15, i32 %16)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %24
22: ; preds = %0
%23 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [26 x i8] c"The string is PALLINDROME\00"
@.str.3 = [16 x i8] c"NOT PALLINDROME\00"
@str = [15 x i8] c"Enter a string\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = bitcast [100 x i8]* %1 to i8**
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 100
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 @strrev(i8* %2)
%10 = call i32 @strcmp(i32 %8, i32 %9)
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0)
%13 = call i32 @printf(i8* dereferenceable(1) %12)
ret i32 0
}