#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 medio;
  int I;
  int cont;
  int palindromo;
  char parola[100];
  printf("\n          Programma per il nome palindromo");
  printf("\n");
  printf("\n inserire un nome:      ");
  scanf("%d", &parola);
  cont = 0;
  while (parola[cont] != '\0') {
    cont = cont + 1;
  }
  I = 0;
  palindromo = 1;
  medio = cont / 2;
  while ((I < medio) && (palindromo == 1)) {
    if (parola[cont - 1] != parola[I]) {
      palindromo = 0;
    }
    I = I + 1;
    cont--;
  }
  if (palindromo == 1) {
    printf("\n il nome e' palindromo");
  } else {
    printf("\n 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    0xee7(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xee7(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     118d <main+0x6d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116d <main+0x4d>
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x81(%rbp)
jge    11ca <main+0xaa>
cmpl   $0x1,-0x14(%rbp)
sete   %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    11dd <main+0xbd>
jmp    1219 <main+0xf9>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x80(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x80(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1202 <main+0xe2>
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    11a9 <main+0x89>
cmpl   $0x1,-0x14(%rbp)
jne    1234 <main+0x114>
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
jmp    1240 <main+0x120>
lea    0xe28(%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    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xedb(%rip),%rdi
call   1040 <printf@plt>
lea    0xee9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    $0xffffffffffffffff,%rcx
movabs $0xffffffff00000000,%rax
ff ff ff
movabs $0x100000000,%rdx
add    %rdx,%rax
cmpb   $0x0,0x1(%rsp,%rcx,1)
lea    0x1(%rcx),%rcx
jne    1180 <main+0x50>
test   $0xfffffffe,%ecx
je     11e3 <main+0xb3>
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    11cc <main+0x9c>
add    $0xffffffffffffffff,%rax
add    $0x1,%rdx
cmp    %dil,%sil
je     11b0 <main+0x80>
cmp    %dil,%sil
lea    0xe73(%rip),%rax
lea    0xe84(%rip),%rdi
cmove  %rax,%rdi
jmp    11ea <main+0xba>
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

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

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