#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() {
  char Parola[100];
  int Palindromo;
  int Medio;
  int I;
  int Cont;
  printf("inserisci un nome: ");
  scanf("%s", Parola);
  Cont = 0;
  while (Parola[Cont] != '\0') {
    Cont++;
  }
  Cont--;
  I = 0;
  Palindromo = 1;
  Medio = Cont / 2;
  while ((I < Medio) && (Palindromo == 1)) {
    if (Parola[Cont] != Parola[I]) {
      Palindromo = 0;
    }
    Cont--;
    I++;
  }
  if (Palindromo == 1) {
    printf("\nil nome e' palindromo\n");
  } else {
    printf("\nil nome non e' palindromo\n");
  }
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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,-0x80(%rbp)
movslq -0x80(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1185 <main+0x55>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1165 <main+0x35>
mov    -0x80(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x80(%rbp)
movl   $0x0,-0x7c(%rbp)
movl   $0x1,-0x74(%rbp)
mov    -0x80(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x78(%rbp)
mov    -0x7c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x78(%rbp),%ecx
mov    %al,-0x81(%rbp)
jge    11cb <main+0x9b>
cmpl   $0x1,-0x74(%rbp)
sete   %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    11de <main+0xae>
jmp    1216 <main+0xe6>
movslq -0x80(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x7c(%rbp),%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11ff <main+0xcf>
movl   $0x0,-0x74(%rbp)
mov    -0x80(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x80(%rbp)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11aa <main+0x7a>
cmpl   $0x1,-0x74(%rbp)
jne    1231 <main+0x101>
lea    0xdf0(%rip),%rdi
call   1040 <printf@plt>
jmp    123d <main+0x10d>
lea    0xdf7(%rip),%rdi
call   1040 <printf@plt>
lea    0xe07(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%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>
cmp    $0x3,%eax
jb     11d3 <main+0x93>
add    $0xffffffff,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
cltq
movslq %ecx,%rsi
mov    $0x1,%edx
nopw   0x0(%rax,%rax,1)
movzbl (%rsp,%rax,1),%ebx
movzbl -0x1(%rsp,%rdx,1),%ecx
cmp    %cl,%bl
jne    11bd <main+0x7d>
add    $0xffffffffffffffff,%rax
lea    0x1(%rdx),%rdi
cmp    %rsi,%rdx
mov    %rdi,%rdx
jl     11a0 <main+0x60>
cmp    %cl,%bl
lea    0xe72(%rip),%rax
lea    0xe50(%rip),%rdi
cmove  %rax,%rdi
jmp    11da <main+0x9a>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe31(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"inserisci un nome: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [24 x i8] c"\0Ail nome e' palindromo\0A\00"
@.str.3 = [28 x i8] c"\0Ail nome non e' palindromo\0A\00"
@.str.4 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
store i32 0, i32* %6
br label %10
10: ; preds = %17, %0
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %10
20: ; preds = %10
%21 = load i32, i32* %6
%22 = add nsw i32 %21, -1
store i32 %22, i32* %6
store i32 0, i32* %5
store i32 1, i32* %3
%23 = load i32, i32* %6
%24 = sdiv i32 %23, 2
store i32 %24, i32* %4
br label %25
25: ; preds = %47, %20
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 1
br label %32
32: ; preds = %29, %25
%33 = phi i1 [ false, %25 ], [ %31, %29 ]
br i1 %33, label %34, label %52
34: ; preds = %32
%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 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %39, %44
br i1 %45, label %46, label %47
46: ; preds = %34
store i32 0, i32* %3
br label %47
47: ; preds = %46, %34
%48 = load i32, i32* %6
%49 = add nsw i32 %48, -1
store i32 %49, i32* %6
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %25
52: ; preds = %32
%53 = load i32, i32* %3
%54 = icmp eq i32 %53, 1
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %59
57: ; preds = %52
%58 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57, %55
%60 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@.str = [20 x i8] c"inserisci un nome: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.4 = [6 x i8] c"PAUSE\00"
@str = [27 x i8] c"\0Ail nome non e' palindromo\00"
@str.5 = [23 x i8] c"\0Ail nome e' palindromo\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 = trunc i64 %6 to i32
%13 = add i32 %12, -1
%14 = icmp ugt i32 %12, 2
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = sdiv i32 %13, 2
%17 = sext i32 %13 to i64
%18 = sext i32 %16 to i64
br label %19
19: ; preds = %15, %19
%20 = phi i64 [ 0, %15 ], [ %28, %19 ]
%21 = phi i64 [ %17, %15 ], [ %27, %19 ]
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %20
%25 = load i8, i8* %24
%26 = icmp eq i8 %23, %25
%27 = add nsw i64 %21, -1
%28 = add nuw nsw i64 %20, 1
%29 = icmp slt i64 %28, %18
%30 = and i1 %26, %29
br i1 %30, label %19, label %31
31: ; preds = %19
%32 = select i1 %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0)
br label %33
33: ; preds = %31, %11
%34 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.5, i64 0, i64 0), %11 ], [ %32, %31 ]
%35 = call i32 @puts(i8* dereferenceable(1) %34)
%36 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}