#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 isPalindrom(char word[]) {
  int i, j;
  for (i = 0, j = strlen(word) - 1; i < (strlen(word) - 1) / 2; i++, j--) {
    if (word[i] != word[j]) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<isPalindrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jge    11a1 <isPalindrom+0x91>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1185 <isPalindrom+0x75>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <isPalindrom+0x98>
jmp    118a <isPalindrom+0x7a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1132 <isPalindrom+0x22>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPalindrom>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    $0x1,%r14d
cmp    $0x3,%eax
jl     1176 <isPalindrom+0x66>
movslq %ebp,%rbp
add    $0xffffffffffffffff,%rbp
xor    %ebx,%ebx
nopl   (%rax)
movzbl (%r15,%rbx,1),%eax
cmp    (%r15,%rbp,1),%al
jne    1173 <isPalindrom+0x63>
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
add    $0xffffffff,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
add    $0xffffffff,%eax
sar    %eax
cltq
add    $0xffffffffffffffff,%rbp
cmp    %rax,%rbx
jl     1140 <isPalindrom+0x30>
jmp    1176 <isPalindrom+0x66>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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