#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*/ FlattenString(char *);
int /*<<< orphan*/ SqueezeString(char *);
int strlen(char *);
int Palindromep(char *sz) {
  if (sz == NULL)
    return 1;
  if (strlen(sz) < 2)
    return 1;
  FlattenString(sz);
  SqueezeString(sz);
  if (sz[0] == sz[strlen(sz) - 1]) {
    sz[strlen(sz) - 1] = 0;
    return Palindromep(sz + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<Palindromep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1163 <Palindromep+0x23>
movl   $0x1,-0x4(%rbp)
jmp    1206 <Palindromep+0xc6>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jge    1181 <Palindromep+0x41>
movl   $0x1,-0x4(%rbp)
jmp    1206 <Palindromep+0xc6>
mov    -0x10(%rbp),%rdi
call   1030 <FlattenString@plt>
mov    -0x10(%rbp),%rdi
call   1060 <SqueezeString@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rcx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
sub    $0x1,%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    11ff <Palindromep+0xbf>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1050 <Palindromep@plt>
mov    %eax,-0x4(%rbp)
jmp    1206 <Palindromep+0xc6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Palindromep>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebp
test   %rdi,%rdi
je     1199 <Palindromep+0x69>
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     1199 <Palindromep+0x69>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <FlattenString@plt>
mov    %rbx,%rdi
call   1050 <SqueezeString@plt>
movzbl (%rbx),%r14d
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    -0x1(%rax,%rbx,1),%r14b
jne    1197 <Palindromep+0x67>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
add    $0x1,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x1,%eax
jg     1150 <Palindromep+0x20>
jmp    1199 <Palindromep+0x69>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Palindromep(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %41
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %41
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = call i32 @FlattenString(i8* %13)
%15 = load i8*, i8** %3
%16 = call i32 @SqueezeString(i8* %15)
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = load i8*, i8** %3
%22 = load i8*, i8** %3
%23 = call i32 @strlen(i8* %22)
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %21, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %20, %28
br i1 %29, label %30, label %40
30: ; preds = %12
%31 = load i8*, i8** %3
%32 = load i8*, i8** %3
%33 = call i32 @strlen(i8* %32)
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %31, i64 %35
store i8 0, i8* %36
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i64 1
%39 = call i32 @Palindromep(i8* %38)
store i32 %39, i32* %2
br label %41
40: ; preds = %12
store i32 0, i32* %2
br label %41
41: ; preds = %40, %30, %11, %6
%42 = load i32, i32* %2
ret i32 %42
}

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