#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 strlen(char *);
int Palindroma(char *buff) {
  unsigned int i;
  int ok = 1;
  for (i = 0; i < strlen(buff) / 2 && ok; i++)
    if (buff[i] != buff[strlen(buff) - 1 - i])
      ok = 0;
  return ok;
}


x86 assembly (clang, -O0):
<Palindroma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%ecx
mov    $0x2,%esi
cltd
idiv   %esi
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
jae    115d <Palindroma+0x4d>
cmpl   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    116d <Palindroma+0x5d>
jmp    11c3 <Palindroma+0xb3>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rcx
mov    %eax,%edx
mov    -0x1c(%rbp),%eax
sub    $0x1,%edx
sub    -0xc(%rbp),%edx
mov    %edx,%edx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11b0 <Palindroma+0xa0>
movl   $0x0,-0x10(%rbp)
jmp    11b5 <Palindroma+0xa5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <Palindroma+0x1a>
mov    -0x10(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Palindroma>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0x1,%eax
cmp    $0x3,%ecx
jb     1182 <Palindroma+0x72>
mov    $0xffffffff,%ebp
mov    $0x1,%ebx
nopl   0x0(%rax)
movzbl -0x1(%r14,%rbx,1),%r15d
mov    %r14,%rdi
call   1030 <strlen@plt>
add    %ebp,%eax
movzbl (%r14,%rax,1),%r12d
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %r12b,%r15b
jne    117a <Palindroma+0x6a>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0xffffffff,%ebp
lea    0x1(%rbx),%rax
cmp    %rcx,%rbx
mov    %rax,%rbx
jb     1140 <Palindroma+0x30>
xor    %eax,%eax
cmp    %r12b,%r15b
sete   %al
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Palindroma(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %36, %1
%6 = load i32, i32* %3
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = sdiv i32 %8, 2
%10 = icmp ult i32 %6, %9
br i1 %10, label %11, label %14
11: ; preds = %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br label %14
14: ; preds = %11, %5
%15 = phi i1 [ false, %5 ], [ %13, %11 ]
br i1 %15, label %16, label %39
16: ; preds = %14
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = load i8*, i8** %2
%24 = load i8*, i8** %2
%25 = call i32 @strlen(i8* %24)
%26 = sub nsw i32 %25, 1
%27 = load i32, i32* %3
%28 = sub i32 %26, %27
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %23, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %22, %32
br i1 %33, label %34, label %35
34: ; preds = %16
store i32 0, i32* %4
br label %35
35: ; preds = %34, %16
br label %36
36: ; preds = %35
%37 = load i32, i32* %3
%38 = add i32 %37, 1
store i32 %38, i32* %3
br label %5
39: ; preds = %14
%40 = load i32, i32* %4
ret i32 %40
}

LLVM IR (-O2):
define i32 @Palindroma(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add i32 %2, 1
%4 = icmp ult i32 %3, 3
br i1 %4, label %25, label %5
5: ; preds = %1, %5
%6 = phi i64 [ %17, %5 ], [ 0, %1 ]
%7 = trunc i64 %6 to i32
%8 = getelementptr inbounds i8, i8* %0, i64 %6
%9 = load i8, i8* %8
%10 = tail call i32 @strlen(i8* %0)
%11 = xor i32 %7, -1
%12 = add i32 %10, %11
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %9, %15
%17 = add nuw nsw i64 %6, 1
%18 = tail call i32 @strlen(i8* %0)
%19 = sdiv i32 %18, 2
%20 = zext i32 %19 to i64
%21 = icmp ult i64 %17, %20
%22 = and i1 %16, %21
br i1 %22, label %5, label %23
23: ; preds = %5
%24 = zext i1 %16 to i32
br label %25
25: ; preds = %23, %1
%26 = phi i32 [ 1, %1 ], [ %24, %23 ]
ret i32 %26
}