#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() {
  char parola[100];
  int cont;
  int I;
  int pal;
  int medio;
  printf(" inserire un nome: ");
  scanf("%s", parola);
  cont = 0;
  while (parola[cont] != '\0') {
    cont++;
  }
  I = 0;
  pal = 1;
  medio = cont / 2;
  while ((I < medio) && (pal == 1)) {
    if (parola[cont - 1] != parola[I]) {
      pal = 0;
    }
    cont--;
    I++;
  }
  if (pal == 1) {
    printf(" il nome e' palindromo");
  } else {
    printf(" il nome non e' palindromo");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xecb(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x74(%rbp)
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1175 <main+0x55>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1155 <main+0x35>
movl   $0x0,-0x78(%rbp)
movl   $0x1,-0x7c(%rbp)
mov    -0x74(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x80(%rbp)
mov    -0x78(%rbp),%ecx
xor    %eax,%eax
cmp    -0x80(%rbp),%ecx
mov    %al,-0x81(%rbp)
jge    11b2 <main+0x92>
cmpl   $0x1,-0x7c(%rbp)
sete   %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    11c5 <main+0xa5>
jmp    1201 <main+0xe1>
mov    -0x74(%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     11ea <main+0xca>
movl   $0x0,-0x7c(%rbp)
mov    -0x74(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x74(%rbp)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1191 <main+0x71>
cmpl   $0x1,-0x7c(%rbp)
jne    121c <main+0xfc>
lea    0xe05(%rip),%rdi
call   1030 <printf@plt>
jmp    1228 <main+0x108>
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    $0xffffffffffffffff,%rcx
movabs $0xffffffff00000000,%rax
ff ff ff
movabs $0x100000000,%rdx
nopw   0x0(%rax,%rax,1)
add    %rdx,%rax
cmpb   $0x0,0x1(%rsp,%rcx,1)
lea    0x1(%rcx),%rcx
jne    1160 <main+0x40>
test   $0xfffffffe,%ecx
je     11c3 <main+0xa3>
shr    %ecx
sar    $0x20,%rax
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl -0x1(%rsp,%rax,1),%esi
movzbl -0x1(%rsp,%rdx,1),%edi
cmp    %rcx,%rdx
jae    11ac <main+0x8c>
add    $0xffffffffffffffff,%rax
add    $0x1,%rdx
cmp    %dil,%sil
je     1190 <main+0x70>
cmp    %dil,%sil
lea    0xe61(%rip),%rax
lea    0xe71(%rip),%rdi
cmove  %rax,%rdi
jmp    11ca <main+0xaa>
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c" inserire un nome: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [23 x i8] c" il nome e' palindromo\00"
@.str.3 = [27 x i8] c" il nome non 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 = and i64 %6, 4294967294
%13 = icmp eq i64 %12, 0
br i1 %13, label %33, label %14
14: ; preds = %11
%15 = lshr i64 %6, 1
%16 = shl i64 %6, 32
%17 = ashr exact i64 %16, 32
%18 = and i64 %15, 2147483647
br label %19
19: ; preds = %14, %19
%20 = phi i64 [ 0, %14 ], [ %28, %19 ]
%21 = phi i64 [ %17, %14 ], [ %22, %19 ]
%22 = add nsw i64 %21, -1
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %20
%26 = load i8, i8* %25
%27 = icmp eq i8 %24, %26
%28 = add nuw nsw i64 %20, 1
%29 = icmp ult i64 %28, %18
%30 = and i1 %29, %27
br i1 %30, label %19, label %31
31: ; preds = %19
%32 = select i1 %27, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0)
br label %33
33: ; preds = %31, %11
%34 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), %11 ], [ %32, %31 ]
%35 = call i32 @printf(i8* dereferenceable(1) %34)
ret i32 0
}