#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 is_palindrome1(char const *, int);
int is_palindrome2(char const *, int);
int /*<<< orphan*/ print_array(char const *, int);
int /*<<< orphan*/ printf(char *);
void test_palindrome(const char sentence[], int length, int which_one) {
  int pal;
  if (which_one == 1) {
    printf("Testing #1: ");
    pal = is_palindrome1(sentence, length);
  } else {
    printf("Testing #2: ");
    pal = is_palindrome2(sentence, length);
  }
  print_array(sentence, length);
  if (pal == 1)
    printf(" is a palindrome\n");
  else
    printf(" is not a palindrome\n");
}


x86 assembly (clang, -O0):
<test_palindrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    117c <test_palindrome+0x3c>
lea    0xe9d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <is_palindrome1@plt>
mov    %eax,-0x14(%rbp)
jmp    1197 <test_palindrome+0x57>
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <is_palindrome2@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <print_array@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11be <test_palindrome+0x7e>
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
jmp    11ca <test_palindrome+0x8a>
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_palindrome>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
cmp    $0x1,%edx
jne    1178 <test_palindrome+0x28>
lea    0xe9a(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1070 <is_palindrome1@plt>
jmp    118f <test_palindrome+0x3f>
lea    0xe8e(%rip),%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <is_palindrome2@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <print_array@plt>
cmp    $0x1,%ebp
lea    0xe89(%rip),%rax
lea    0xe6d(%rip),%rdi
cmove  %rax,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Testing: \00"
@.str.1 = [13 x i8] c"Testing: \00"
@.str.2 = [18 x i8] c" is a palindrome\0A\00"
@.str.3 = [22 x i8] c" is not a palindrome\0A\00"
define void @test_palindrome(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = call i32 @is_palindrome1(i8* %12, i32 %13)
store i32 %14, i32* %7
br label %20
15: ; preds = %3
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = call i32 @is_palindrome2(i8* %17, i32 %18)
store i32 %19, i32* %7
br label %20
20: ; preds = %15, %10
%21 = load i8*, i8** %4
%22 = load i32, i32* %5
%23 = call i32 @print_array(i8* %21, i32 %22)
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %30
28: ; preds = %20
%29 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Testing: \00"
@.str.1 = [13 x i8] c"Testing: \00"
@str = [21 x i8] c" is not a palindrome\00"
@str.4 = [17 x i8] c" is a palindrome\00"
define void @test_palindrome(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 1
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @is_palindrome1(i8* %0, i32 %1)
br label %11
8: ; preds = %3
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @is_palindrome2(i8* %0, i32 %1)
br label %11
11: ; preds = %8, %5
%12 = phi i32 [ %7, %5 ], [ %10, %8 ]
%13 = tail call i32 @print_array(i8* %0, i32 %1)
%14 = icmp eq i32 %12, 1
%15 = select i1 %14, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0)
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
ret void
}