#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int strlen(char *);
int main() {
  char frase[256 + 1];
  int i;
  int len;
  printf("Inserisci una frase\n");
  gets(frase);
  len = strlen(frase);
  for (i = 0; i < len / 2 && frase[i] == frase[len - i - 1]; i++) {
  }
  if (i < len / 2)
    printf("non ");
  printf("palindroma\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x110(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x118(%rbp)
movl   $0x0,-0x114(%rbp)
mov    -0x114(%rbp),%ecx
mov    -0x118(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x119(%rbp)
jge    11d0 <main+0xa0>
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
mov    -0x118(%rbp),%ecx
sub    -0x114(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x110(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
sete   %al
mov    %al,-0x119(%rbp)
mov    -0x119(%rbp),%al
test   $0x1,%al
jne    11e3 <main+0xb3>
jmp    11fc <main+0xcc>
jmp    11e8 <main+0xb8>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1176 <main+0x46>
mov    -0x114(%rbp),%eax
mov    %eax,-0x120(%rbp)
mov    -0x118(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x120(%rbp),%eax
cmp    %ecx,%eax
jge    1232 <main+0x102>
lea    0xde8(%rip),%rdi
call   1040 <printf@plt>
lea    0xde1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x110,%rsp
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11a6 <main+0x66>
mov    %eax,%ecx
shr    %ecx
add    $0xffffffff,%eax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsp,%rdx,1),%ebx
movslq %eax,%rsi
cmp    (%rsp,%rsi,1),%bl
jne    119a <main+0x5a>
add    $0x1,%rdx
add    $0xffffffff,%eax
cmp    %rdx,%rcx
jne    1180 <main+0x40>
jmp    11a6 <main+0x66>
lea    0xe5f(%rip),%rdi
call   1050 <printf@plt>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Inserisci una frase\0A\00"
@.str.1 = [5 x i8] c"non \00"
@.str.2 = [12 x i8] c"palindroma\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [257 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %4
store i32 0, i32* %3
br label %10
10: ; preds = %33, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = sdiv i32 %12, 2
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %30
15: ; preds = %10
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = load i32, i32* %4
%22 = load i32, i32* %3
%23 = sub nsw i32 %21, %22
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %20, %28
br label %30
30: ; preds = %15, %10
%31 = phi i1 [ false, %10 ], [ %29, %15 ]
br i1 %31, label %32, label %36
32: ; preds = %30
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %10
36: ; preds = %30
%37 = load i32, i32* %3
%38 = load i32, i32* %4
%39 = sdiv i32 %38, 2
%40 = icmp slt i32 %37, %39
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %41, %36
%44 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"non \00"
@str = [20 x i8] c"Inserisci una frase\00"
@str.3 = [11 x i8] c"palindroma\00"
define i32 @main() {
%1 = alloca [257 x i8]
%2 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %26
7: ; preds = %0
%8 = lshr i32 %5, 1
%9 = zext i32 %8 to i64
br label %12
10: ; preds = %12
%11 = icmp eq i64 %23, %9
br i1 %11, label %26, label %12
12: ; preds = %7, %10
%13 = phi i64 [ 0, %7 ], [ %23, %10 ]
%14 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = trunc i64 %13 to i32
%17 = xor i32 %16, -1
%18 = add i32 %5, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %15, %21
%23 = add nuw nsw i64 %13, 1
br i1 %22, label %10, label %24
24: ; preds = %12
%25 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %10, %0, %24
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}