#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 strlen(char *);
void check(char word[], int index) {
  int len = strlen(word) - (index + 1);
  if (word[index] == word[len]) {
    if (index + 1 == len || index == len) {
      printf("The entered word is a palindrome\n");
      return;
    }
    check(word, index + 1);
  } else
    printf("The entered word is not a palindrome\n");
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    11b3 <check+0x83>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cmp    -0x10(%rbp),%eax
je     118e <check+0x5e>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    119f <check+0x6f>
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
jmp    11bf <check+0x8f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1050 <check@plt>
jmp    11bf <check+0x8f>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
movabs $0x100000000,%r15
movslq %esi,%rbx
mov    %rbx,%rbp
shl    $0x20,%rbp
lea    (%rdi,%rbx,1),%r13
not    %rbx
lea    0xeb0(%rip),%r14
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
movzbl 0x0(%r13),%ecx
lea    (%r12,%rax,1),%rdx
cmp    (%rbx,%rdx,1),%cl
jne    1196 <check+0x76>
add    %rbx,%rax
lea    (%r15,%rbp,1),%rcx
mov    %rcx,%rdx
sar    $0x20,%rdx
cmp    %rdx,%rax
je     118f <check+0x6f>
sar    $0x20,%rbp
add    $0x1,%r13
add    $0xffffffffffffffff,%rbx
cmp    %rbp,%rax
mov    %rcx,%rbp
jne    1150 <check+0x30>
lea    0xe8f(%rip),%r14
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"The entered word is a palindrome\0A\00"
@.str.1 = [38 x i8] c"The entered word is not a palindrome\0A\00"
define void @check(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
%10 = sub nsw i32 %7, %9
store i32 %10, i32* %5
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i8*, i8** %3
%18 = load i32, i32* %5
%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 = icmp eq i32 %16, %22
br i1 %23, label %24, label %39
24: ; preds = %2
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
%27 = load i32, i32* %5
%28 = icmp eq i32 %26, %27
br i1 %28, label %33, label %29
29: ; preds = %24
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %29, %24
%34 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %41
35: ; preds = %29
%36 = load i8*, i8** %3
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
br label %41
39: ; preds = %2
%40 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %33, %39, %35
ret void
}

LLVM IR (-O2):
@str = [37 x i8] c"The entered word is not a palindrome\00"
@str.2 = [33 x i8] c"The entered word is a palindrome\00"
define void @check(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
br label %4
4: ; preds = %15, %2
%5 = phi i64 [ %7, %15 ], [ %3, %2 ]
%6 = tail call i32 @strlen(i8* %0)
%7 = add i64 %5, 1
%8 = sext i32 %6 to i64
%9 = sub nsw i64 %8, %7
%10 = getelementptr inbounds i8, i8* %0, i64 %5
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8, i8* %0, i64 %9
%13 = load i8, i8* %12
%14 = icmp eq i8 %11, %13
br i1 %14, label %15, label %23
15: ; preds = %4
%16 = shl i64 %7, 32
%17 = ashr exact i64 %16, 32
%18 = icmp eq i64 %17, %9
%19 = shl i64 %5, 32
%20 = ashr exact i64 %19, 32
%21 = icmp eq i64 %9, %20
%22 = or i1 %18, %21
br i1 %22, label %23, label %4
23: ; preds = %4, %15
%24 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.2, i64 0, i64 0), %15 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0), %4 ]
%25 = tail call i32 @puts(i8* dereferenceable(1) %24)
ret void
}