#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 main() {
  int pal;
  int drom;
  int l;
  int opa = 1;
  char word[15];
  printf("Vuvedete dyma : ");
  scanf("%[^\n]s", word);
  l = -1;
  while (word[++l] != '\0')
    ;
  printf("%d", l);
  for (pal = 0, drom = l - 1; drom > (l / 2) - 1; pal++, drom--) {
    if (word[pal] != word[drom]) {
      printf("NE e palindrom.");
      opa = 0;
      break;
    }
  }
  if (opa) {
    printf("Palindrom");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x23(%rbp),%rsi
lea    0xec2(%rip),%rdi
call   1040 <scanf@plt>
movl   $0xffffffff,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cltq
movsbl -0x23(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1179 <main+0x59>
jmp    115b <main+0x3b>
mov    -0x10(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    120b <main+0xeb>
movslq -0x8(%rbp),%rax
movsbl -0x23(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x23(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11ef <main+0xcf>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    120b <main+0xeb>
jmp    11f4 <main+0xd4>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    119a <main+0x7a>
cmpl   $0x0,-0x14(%rbp)
je     1223 <main+0x103>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x9(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    $0xffffffff,%r14d
nop
add    $0x1,%r14d
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1150 <main+0x30>
lea    -0x1(%r14),%ebx
lea    0xeb0(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%eax
shr    $0x1f,%eax
add    %r14d,%eax
sar    %eax
lea    0xea7(%rip),%rdi
cmp    %ebx,%eax
jg     11ca <main+0xaa>
sub    %eax,%r14d
neg    %r14
movslq %ebx,%rax
add    %rsp,%rax
add    $0x9,%rax
lea    0x9(%rsp),%rcx
xor    %edx,%edx
lea    0xe75(%rip),%rsi
cs nopw 0x0(%rax,%rax,1)
movzbl (%rcx),%ebx
cmp    (%rax,%rdx,1),%bl
jne    11c7 <main+0xa7>
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdx
cmp    %rdx,%r14
jne    11b0 <main+0x90>
jmp    11ca <main+0xaa>
mov    %rsi,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"Vuvedete dyma : \00"
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [16 x i8] c"NE e palindrom.\00"
@.str.4 = [10 x i8] c"Palindrom\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ %7, %5 ], [ -1, %0 ]
%7 = add nsw i64 %6, 1
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %5
11: ; preds = %5
%12 = trunc i64 %6 to i32
%13 = trunc i64 %7 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = sdiv i32 %13, 2
%16 = icmp sgt i32 %15, %12
br i1 %16, label %35, label %17
17: ; preds = %11
%18 = shl i64 %6, 32
%19 = ashr exact i64 %18, 32
%20 = add i32 %12, 1
%21 = sub i32 %20, %15
%22 = zext i32 %21 to i64
br label %23
23: ; preds = %17, %31
%24 = phi i64 [ 0, %17 ], [ %32, %31 ]
%25 = phi i64 [ %19, %17 ], [ %33, %31 ]
%26 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 %24
%27 = load i8, i8* %26
%28 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 %25
%29 = load i8, i8* %28
%30 = icmp eq i8 %27, %29
br i1 %30, label %31, label %35
31: ; preds = %23
%32 = add nuw nsw i64 %24, 1
%33 = add nsw i64 %25, -1
%34 = icmp eq i64 %32, %22
br i1 %34, label %35, label %23
35: ; preds = %31, %23, %11
%36 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %11 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %23 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %31 ]
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %36)
ret i32 0
}