#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 /*<<< orphan*/ system(char *);
int main() {
  int cont;
  int i;
  char parola[100];
  printf("Inserire la parola ");
  scanf("%s", parola);
  cont = 0;
  while (parola[cont] != '\0') {
    cont++;
  }
  cont--;
  i = 0;
  while (parola[cont] == parola[i] && cont > i) {
    i++;
    cont--;
  }
  if (cont > i) {
    printf("La parola non e' palindroma");
  } else {
    printf("La parola e' palindroma");
  }
  printf("\n");
  system("PAUSE");
}


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    0xebb(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1185 <main+0x55>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1165 <main+0x35>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%ecx
movslq -0xc(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x71(%rbp)
jne    11c0 <main+0x90>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setg   %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
test   $0x1,%al
jne    11d0 <main+0xa0>
jmp    11e7 <main+0xb7>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1195 <main+0x65>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1204 <main+0xd4>
lea    0xe1d(%rip),%rdi
call   1040 <printf@plt>
jmp    1210 <main+0xe0>
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
lea    0xe2a(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
call   1050 <printf@plt>
lea    0xebc(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    $0xffffffff,%eax
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1170 <main+0x30>
movslq %eax,%rcx
add    $0xffffffffffffffff,%rcx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rsi,%rax
mov    %rcx,%rdx
movzbl (%rsp,%rcx,1),%ecx
cmp    (%rsp,%rsi,1),%cl
jne    11ac <main+0x6c>
lea    0x1(%rax),%rsi
lea    -0x1(%rdx),%rcx
cmp    %rax,%rdx
jg     1190 <main+0x50>
cmp    %rax,%rdx
lea    0xe61(%rip),%rax
lea    0xe76(%rip),%rdi
cmovg  %rax,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe74(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"Inserire la parola \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [28 x i8] c"La parola non e' palindroma\00"
@.str.3 = [24 x i8] c"La parola e' palindroma\00"
@.str.5 = [6 x i8] c"PAUSE\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 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 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)
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ %10, %5 ], [ 0, %0 ]
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
%10 = add nuw i64 %6, 1
br i1 %9, label %11, label %5
11: ; preds = %5
%12 = shl i64 %6, 32
%13 = ashr exact i64 %12, 32
br label %14
14: ; preds = %11, %14
%15 = phi i64 [ 0, %11 ], [ %25, %14 ]
%16 = phi i64 [ %13, %11 ], [ %17, %14 ]
%17 = add nsw i64 %16, -1
%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 %15
%21 = load i8, i8* %20
%22 = icmp eq i8 %19, %21
%23 = icmp sgt i64 %17, %15
%24 = select i1 %22, i1 %23, i1 false
%25 = add nuw i64 %15, 1
br i1 %24, label %14, label %26
26: ; preds = %14
%27 = select i1 %23, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0)
%28 = call i32 @printf(i8* dereferenceable(1) %27)
%29 = call i32 @putchar(i32 10)
%30 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}