#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 palindrom[100];
  printf("vuvedete string \n");
  scanf("%s", palindrom);
  int StringLenght = strlen(palindrom);
  int counter = 0;
  int flag = 1;
  for (; counter < StringLenght / 2; counter++) {
    if (palindrom[StringLenght - counter - 1] != palindrom[counter]) {
      flag = 0;
      break;
    }
  }
  if (flag) {
    printf("1 \n");
  } else {
    printf("0 \n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
movl   $0x1,-0x7c(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x80(%rbp),%eax
cmp    %ecx,%eax
jge    11d6 <main+0xa6>
mov    -0x74(%rbp),%eax
sub    -0x78(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x78(%rbp),%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11c3 <main+0x93>
movl   $0x0,-0x7c(%rbp)
jmp    11d6 <main+0xa6>
jmp    11c8 <main+0x98>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1178 <main+0x48>
cmpl   $0x0,-0x7c(%rbp)
je     11f1 <main+0xc1>
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
jmp    11fd <main+0xcd>
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xeb5(%rip),%rdi
cmp    $0x2,%eax
jl     119d <main+0x6d>
mov    %eax,%ecx
shr    %ecx
add    $0xffffffff,%eax
xor    %edx,%edx
lea    0xe9d(%rip),%rsi
nopw   0x0(%rax,%rax,1)
movslq %eax,%rbx
movzbl (%rsp,%rbx,1),%ebx
cmp    (%rsp,%rdx,1),%bl
jne    119a <main+0x6a>
add    $0x1,%rdx
add    $0xffffffff,%eax
cmp    %rdx,%rcx
jne    1180 <main+0x50>
jmp    119d <main+0x6d>
mov    %rsi,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [17 x i8] c"vuvedete string \00"
@str.4 = [3 x i8] c"0 \00"
@str.5 = [3 x i8] c"1 \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 ([17 x i8], [17 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 i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %24
7: ; preds = %0
%8 = lshr i32 %5, 1
%9 = zext i32 %8 to i64
br label %12
10: ; preds = %12
%11 = icmp eq i64 %23, %9
br i1 %11, label %24, label %12
12: ; preds = %7, %10
%13 = phi i64 [ 0, %7 ], [ %23, %10 ]
%14 = trunc i64 %13 to i32
%15 = xor i32 %14, -1
%16 = add i32 %5, %15
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %13
%21 = load i8, i8* %20
%22 = icmp eq i8 %19, %21
%23 = add nuw nsw i64 %13, 1
br i1 %22, label %10, label %24
24: ; preds = %12, %10, %0
%25 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0), %0 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.5, i64 0, i64 0), %10 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0), %12 ]
%26 = call i32 @puts(i8* dereferenceable(1) %25)
ret i32 0
}