#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 strlen(char *);
int main() {
  char a[500];
  int i, o, m = 0;
  printf("\n");
  printf("\n\t Enter String: \n");
  scanf("%s", a);
  i = strlen(a);
  for (o = 0; o <= i; o++) {
    if (a[o] != a[i - o - 1]) {
      m = 1;
      break;
    }
  }
  if (m > 0)
    printf("\n\t 1 \n");
  else
    printf("\n\t 0 \n");
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20c(%rbp)
lea    0xecf(%rip),%rdi
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
lea    -0x200(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x200(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x204(%rbp)
movl   $0x0,-0x208(%rbp)
mov    -0x208(%rbp),%eax
cmp    -0x204(%rbp),%eax
jg     11fe <main+0xce>
movslq -0x208(%rbp),%rax
movsbl -0x200(%rbp,%rax,1),%eax
ff
mov    -0x204(%rbp),%ecx
sub    -0x208(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x200(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     11e5 <main+0xb5>
movl   $0x1,-0x20c(%rbp)
jmp    11fe <main+0xce>
jmp    11ea <main+0xba>
mov    -0x208(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x208(%rbp)
jmp    1193 <main+0x63>
cmpl   $0x0,-0x20c(%rbp)
jle    121c <main+0xec>
lea    0xe04(%rip),%rdi
call   1040 <printf@plt>
jmp    1228 <main+0xf8>
lea    0xdfa(%rip),%rdi
call   1040 <printf@plt>
lea    0xdf3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x200,%rsp
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xe96(%rip),%rdi
test   %eax,%eax
js     11bd <main+0x7d>
lea    0x1(%rax),%ecx
add    $0xffffffff,%eax
xor    %edx,%edx
lea    0xe89(%rip),%r8
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsp,%rdx,1),%ebx
movslq %eax,%rsi
cmp    (%rsp,%rsi,1),%bl
jne    11ba <main+0x7a>
add    $0x1,%rdx
add    $0xffffffff,%eax
cmp    %rdx,%rcx
jne    11a0 <main+0x60>
jmp    11bd <main+0x7d>
mov    %r8,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [19 x i8] c"\0A\09 Enter String: \0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [7 x i8] c"\0A\09 1 \0A\00"
@.str.4 = [7 x i8] c"\0A\09 0 \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [500 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %3
store i32 0, i32* %4
br label %12
12: ; preds = %33, %0
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %36
16: ; preds = %12
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = sub nsw i32 %22, %23
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %21, %29
br i1 %30, label %31, label %32
31: ; preds = %16
store i32 1, i32* %5
br label %36
32: ; preds = %16
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %12
36: ; preds = %31, %12
%37 = load i32, i32* %5
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %43
41: ; preds = %36
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
%44 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%s\00"
@str = [18 x i8] c"\0A\09 Enter String: \00"
@str.5 = [6 x i8] c"\0A\09 0 \00"
@str.6 = [6 x i8] c"\0A\09 1 \00"
define i32 @main() {
%1 = alloca [500 x i8]
%2 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%6 = call i32 @strlen(i8* %2)
%7 = icmp slt i32 %6, 0
br i1 %7, label %25, label %8
8: ; preds = %0
%9 = add nuw i32 %6, 1
%10 = zext i32 %9 to i64
br label %14
11: ; preds = %14
%12 = add nuw nsw i64 %15, 1
%13 = icmp eq i64 %12, %10
br i1 %13, label %25, label %14
14: ; preds = %8, %11
%15 = phi i64 [ 0, %8 ], [ %12, %11 ]
%16 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = trunc i64 %15 to i32
%19 = xor i32 %18, -1
%20 = add i32 %6, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %17, %23
br i1 %24, label %11, label %25
25: ; preds = %11, %14, %0
%26 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0), %0 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0), %14 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0), %11 ]
%27 = call i32 @puts(i8* dereferenceable(1) %26)
%28 = call i32 @putchar(i32 10)
ret i32 0
}