#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 *);
void pal(char str1[100], int length) {
  int i, flag = 0;
  for (i = 0; i < length; i++) {
    if (str1[i] != str1[length - i - 1]) {
      flag = 1;
      break;
    }
  }
  if (flag)
    printf("\nIt is not a palindrome");
  else
    printf("\nIt is a palindrome");
}


x86 assembly (clang, -O0):
<pal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1180 <pal+0x70>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
sub    -0x10(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     116d <pal+0x5d>
movl   $0x1,-0x14(%rbp)
jmp    1180 <pal+0x70>
jmp    1172 <pal+0x62>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <pal+0x1d>
cmpl   $0x0,-0x14(%rbp)
je     119b <pal+0x8b>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
jmp    11a7 <pal+0x97>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pal>:
mov    %rdi,%r10
lea    0xefe(%rip),%rdi
test   %esi,%esi
jle    114a <pal+0x3a>
mov    %esi,%r9d
add    $0xffffffff,%esi
xor    %edx,%edx
lea    0xed3(%rip),%r8
nopl   (%rax)
movzbl (%r10,%rdx,1),%ecx
movslq %esi,%rax
cmp    (%r10,%rax,1),%cl
jne    114f <pal+0x3f>
add    $0x1,%rdx
add    $0xffffffff,%esi
cmp    %rdx,%r9
jne    1130 <pal+0x20>
jmp    1030 <printf@plt>
mov    %r8,%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [24 x i8] c"\0AIt is not a palindrome\00"
@.str.1 = [20 x i8] c"\0AIt is a palindrome\00"
define void @pal(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %19, %5
br i1 %7, label %20, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %19, %6 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = trunc i64 %9 to i32
%13 = xor i32 %12, -1
%14 = add i32 %13, %1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %11, %17
%19 = add nuw nsw i64 %9, 1
br i1 %18, label %6, label %20
20: ; preds = %6, %8, %2
%21 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), %8 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), %6 ]
%22 = tail call i32 @printf(i8* dereferenceable(1) %21)
ret void
}