#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 *, char *);
int isPalindrome(char *string1, char *string2) {
  int i;
  for (i = 0; i < string1[i] != '\0' && string2[i] != '\0'; i++) {
    if (string1[i] != string2[i]) {
      printf("%s is not a palindrome\n", string1);
      return 0;
    }
  }
  printf("%s is a palindrome\n", string1);
  return 1;
}


x86 assembly (clang, -O0):
<isPalindrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
setl   %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
je     1163 <isPalindrome+0x53>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1173 <isPalindrome+0x63>
jmp    11c2 <isPalindrome+0xb2>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11af <isPalindrome+0x9f>
mov    -0x10(%rbp),%rsi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d9 <isPalindrome+0xc9>
jmp    11b4 <isPalindrome+0xa4>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <isPalindrome+0x17>
mov    -0x10(%rbp),%rsi
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPalindrome>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rax
mov    (%rdi),%dl
mov    $0x1,%ebp
lea    0xef4(%rip),%r8
test   %dl,%dl
jle    115b <isPalindrome+0x4b>
xor    %ecx,%ecx
lea    0xecf(%rip),%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rcx,1),%ebx
test   %bl,%bl
je     115b <isPalindrome+0x4b>
cmp    %bl,%dl
jne    1160 <isPalindrome+0x50>
movsbq 0x1(%rax,%rcx,1),%rdx
add    $0x1,%rcx
cmp    %rdx,%rcx
jl     1140 <isPalindrome+0x30>
mov    %r8,%rdi
jmp    1162 <isPalindrome+0x52>
xor    %ebp,%ebp
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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