#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 p[100];
  int palindromo;
  float medio;
  printf("Inserisci un nome: ");
  scanf("%s", p);
  cont = 0;
  while (p[cont] != '\0') {
    cont++;
  }
  cont--;
  i = 0;
  while (p[cont] == p[i] && cont > i) {
    i++;
    cont--;
  }
  if (cont > i) {
    printf("Non palindromo");
  } else {
    printf("E' palindromo");
  }
  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,-0x79(%rbp)
jne    11c0 <main+0x90>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setg   %al
mov    %al,-0x79(%rbp)
mov    -0x79(%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    0xe1b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe1d(%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    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    $0xffffffff,%eax
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1160 <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    119c <main+0x6c>
lea    0x1(%rax),%rsi
lea    -0x1(%rdx),%rcx
cmp    %rax,%rdx
jg     1180 <main+0x50>
cmp    %rax,%rdx
lea    0xe71(%rip),%rax
lea    0xe79(%rip),%rdi
cmovg  %rax,%rdi
call   1040 <printf@plt>
lea    0xe77(%rip),%rdi
call   1030 <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 = [15 x i8] c"Non palindromo\00"
@.str.3 = [14 x i8] c"E' palindromo\00"
@.str.4 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i8]
%5 = alloca i32
%6 = alloca float
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]* %4, 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* %2
br label %10
10: ; preds = %17, %0
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, 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* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %10
20: ; preds = %10
%21 = load i32, i32* %2
%22 = add nsw i32 %21, -1
store i32 %22, i32* %2
store i32 0, i32* %3
br label %23
23: ; preds = %41, %20
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %28, %33
br i1 %34, label %35, label %39
35: ; preds = %23
%36 = load i32, i32* %2
%37 = load i32, i32* %3
%38 = icmp sgt i32 %36, %37
br label %39
39: ; preds = %35, %23
%40 = phi i1 [ false, %23 ], [ %38, %35 ]
br i1 %40, label %41, label %46
41: ; preds = %39
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
%44 = load i32, i32* %2
%45 = add nsw i32 %44, -1
store i32 %45, i32* %2
br label %23
46: ; preds = %39
%47 = load i32, i32* %2
%48 = load i32, i32* %3
%49 = icmp sgt i32 %47, %48
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %54
52: ; preds = %46
%53 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
%55 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%56 = load i32, i32* %1
ret i32 %56
}

LLVM IR (-O2):
@.str = [20 x i8] c"Inserisci un nome: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [15 x i8] c"Non palindromo\00"
@.str.3 = [14 x i8] c"E' palindromo\00"
@.str.4 = [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 [ %13, %11 ], [ %17, %14 ]
%16 = phi i64 [ 0, %11 ], [ %25, %14 ]
%17 = add nsw i64 %15, -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 %16
%21 = load i8, i8* %20
%22 = icmp eq i8 %19, %21
%23 = icmp sgt i64 %17, %16
%24 = select i1 %22, i1 %23, i1 false
%25 = add nuw i64 %16, 1
br i1 %24, label %14, label %26
26: ; preds = %14
%27 = select i1 %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0)
%28 = call i32 @printf(i8* dereferenceable(1) %27)
%29 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}