#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);
int strlen(char *);
int main() {
  char text[] = "ShanghaiZiLaiShuiuhSiaLiZiahgnahS";
  char True[] = "True! '%s' is a palindrome.%c";
  char False[] = "False! '%s' is not a palindrome.%c";
  int i;
  int l = strlen(text);
  int lh = l / 2;
  int rst = 1;
  for (i = 0; i < lh; i += 1) {
    if (text[i] != text[l - 1 - i]) {
      rst = 0;
      break;
    }
  }
  if (rst == 1) {
    printf(True, text, 10);
  } else {
    printf(False, text, 10);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x22,%edx
call   1050 <memcpy@plt>
mov    0xed2(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xecf(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xecc(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeca(%rip),%eax
mov    %eax,-0x38(%rbp)
mov    0xec4(%rip),%ax
mov    %ax,-0x34(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x23,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8c(%rbp)
movl   $0x1,-0x90(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jge    123d <main+0x10d>
movslq -0x84(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x84(%rbp),%ecx
movslq %ecx,%rcx
movsbl -0x30(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1224 <main+0xf4>
movl   $0x0,-0x90(%rbp)
jmp    123d <main+0x10d>
jmp    1229 <main+0xf9>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11d8 <main+0xa8>
cmpl   $0x1,-0x90(%rbp)
jne    1261 <main+0x131>
lea    -0x50(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1040 <printf@plt>
jmp    1273 <main+0x143>
lea    -0x80(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x53,0x20(%rsp)
lea    0x60(%rsp),%r14
movups 0xeea(%rip),%xmm0
movups %xmm0,0x6e(%rsp)
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xef4(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movl   $0x63252e,0x4f(%rsp)
mov    %rsp,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11bd <main+0x9d>
mov    %eax,%ecx
shr    %ecx
add    $0xffffffff,%eax
xor    %edx,%edx
lea    0x30(%rsp),%rsi
movzbl (%rsp,%rdx,1),%ebx
movslq %eax,%rdi
cmp    (%rsp,%rdi,1),%bl
jne    11ba <main+0x9a>
add    $0x1,%rdx
add    $0xffffffff,%eax
cmp    %rdx,%rcx
jne    11a0 <main+0x80>
jmp    11bd <main+0x9d>
mov    %rsi,%r14
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0xa,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@__const.main.text = [34 x i8] c"ShanghaiZiLaiShuiuhSiaLiZiahgnahS\00"
@__const.main.True = [30 x i8] c"True! '%s' is a palindrome.%c\00"
@__const.main.False = [35 x i8] c"False! '%s' is not a palindrome.%c\00"
define i32 @main() {
%1 = alloca [34 x i8]
%2 = alloca [30 x i8]
%3 = alloca [35 x i8]
%4 = getelementptr inbounds [34 x i8], [34 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [35 x i8], [35 x i8]* %3, i64 0, i64 0
%7 = call i32 @strlen(i8* %4)
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %26
9: ; preds = %0
%10 = lshr i32 %7, 1
%11 = zext i32 %10 to i64
br label %14
12: ; preds = %14
%13 = icmp eq i64 %25, %11
br i1 %13, label %26, label %14
14: ; preds = %9, %12
%15 = phi i64 [ 0, %9 ], [ %25, %12 ]
%16 = getelementptr inbounds [34 x i8], [34 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = trunc i64 %15 to i32
%19 = xor i32 %18, -1
%20 = add i32 %7, %19
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [34 x i8], [34 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %17, %23
%25 = add nuw nsw i64 %15, 1
br i1 %24, label %12, label %26
26: ; preds = %14, %12, %0
%27 = phi i8* [ %5, %0 ], [ %5, %12 ], [ %6, %14 ]
%28 = call i32 @printf(i8* %27, i8* %4, i32 10)
ret i32 0
}