#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 */
char getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  char text[100];
  char g;
  int a, b, c, i = 0;
  printf("Enter word:\n");
  while ((g = getchar()) != '\n') {
    text[i] = g;
    i++;
  }
  c = i - 1;
  b = i / 2;
  for (a = 0; a < b; a++) {
    if (text[a] != text[c]) {
      printf("0\n");
      break;
    }
    c--;
  }
  if (a == b)
    printf("1\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x84(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x71(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     1180 <main+0x60>
mov    -0x71(%rbp),%cl
movslq -0x84(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1148 <main+0x28>
mov    -0x84(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x80(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jge    11f2 <main+0xd2>
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x80(%rbp),%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11db <main+0xbb>
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
jmp    11f2 <main+0xd2>
mov    -0x80(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x80(%rbp)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11a4 <main+0x84>
mov    -0x78(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jne    120a <main+0xea>
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     11ba <main+0x9a>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1150 <main+0x30>
mov    %ebx,%r14d
shr    %r14d
xor    %esi,%esi
cmp    $0x2,%ebx
jb     11b5 <main+0x95>
cmp    $0x2,%r14d
mov    $0x1,%ecx
mov    $0x1,%esi
cmovae %r14d,%esi
movslq %ebx,%rdx
shr    %ebx
cmp    $0x2,%ebx
cmovb  %ecx,%ebx
neg    %rbx
lea    (%rsp,%rdx,1),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rsp,%rdx
xor    %ebp,%ebp
nopl   0x0(%rax)
movzbl (%rdx),%eax
cmp    (%rcx,%rbp,1),%al
jne    11d1 <main+0xb1>
add    $0xffffffffffffffff,%rbp
add    $0x1,%rdx
cmp    %rbp,%rbx
jne    11a0 <main+0x80>
cmp    %r14d,%esi
jne    11c6 <main+0xa6>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
neg    %ebp
lea    0xe34(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%esi
cmp    %r14d,%esi
je     11ba <main+0x9a>
jmp    11c6 <main+0xa6>

LLVM IR (-O0):
@.str = [13 x i8] c"Enter word:\0A\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [3 x i8] c"1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %13, %0
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %20
13: ; preds = %9
%14 = load i8, i8* %3
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %16
store i8 %14, i8* %17
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %9
20: ; preds = %9
%21 = load i32, i32* %7
%22 = sub nsw i32 %21, 1
store i32 %22, i32* %6
%23 = load i32, i32* %7
%24 = sdiv i32 %23, 2
store i32 %24, i32* %5
store i32 0, i32* %4
br label %25
25: ; preds = %46, %20
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %49
29: ; preds = %25
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %34, %39
br i1 %40, label %41, label %43
41: ; preds = %29
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %49
43: ; preds = %29
%44 = load i32, i32* %6
%45 = add nsw i32 %44, -1
store i32 %45, i32* %6
br label %46
46: ; preds = %43
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %25
49: ; preds = %41, %25
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = icmp eq i32 %50, %51
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %55
55: ; preds = %53, %49
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Enter word:\00"
@str.3 = [2 x i8] c"1\00"
@str.4 = [2 x i8] c"0\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 ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
br i1 %5, label %40, label %6
6: ; preds = %0, %6
%7 = phi i64 [ %10, %6 ], [ 0, %0 ]
%8 = phi i8 [ %11, %6 ], [ %4, %0 ]
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %7
store i8 %8, i8* %9
%10 = add nuw i64 %7, 1
%11 = tail call signext i8 (...) @getchar()
%12 = icmp eq i8 %11, 10
br i1 %12, label %13, label %6
13: ; preds = %6
%14 = trunc i64 %10 to i32
%15 = lshr i32 %14, 1
%16 = icmp ult i32 %14, 2
br i1 %16, label %37, label %17
17: ; preds = %13
%18 = shl i64 %10, 32
%19 = ashr exact i64 %18, 32
%20 = call i32 @llvm.umax.i32(i32 %15, i32 1)
%21 = zext i32 %20 to i64
br label %22
22: ; preds = %17, %34
%23 = phi i64 [ 0, %17 ], [ %35, %34 ]
%24 = phi i64 [ %19, %17 ], [ %25, %34 ]
%25 = add nsw i64 %24, -1
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %23
%27 = load i8, i8* %26
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %25
%29 = load i8, i8* %28
%30 = icmp eq i8 %27, %29
br i1 %30, label %34, label %31
31: ; preds = %22
%32 = trunc i64 %23 to i32
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
br label %37
34: ; preds = %22
%35 = add nuw nsw i64 %23, 1
%36 = icmp eq i64 %35, %21
br i1 %36, label %37, label %22
37: ; preds = %34, %13, %31
%38 = phi i32 [ %32, %31 ], [ 0, %13 ], [ %20, %34 ]
%39 = icmp eq i32 %38, %15
br i1 %39, label %40, label %42
40: ; preds = %0, %37
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
br label %42
42: ; preds = %40, %37
ret i32 0
}