#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, char *, char *);
char reverse(char);
scalar_t__ scanf(char *, char *);
int strlen(char *);
int main() {
  char s[20],
      *message[4] = {"is not a palindrome", "is a regular palindrome",
                     "is a mirrored string", "is a mirrored palindrome"};
  int i, len, ismirrored, ispalindrome;
  while (scanf("%s", s) != EOF) {
    len = strlen(s);
    for (i = 0, ispalindrome = ismirrored = 1; i < (len + 1) / 2; i++) {
      if (s[i] != s[len - 1 - i])
        ispalindrome = 0;
      if (reverse(s[i]) != s[len - 1 - i])
        ismirrored = 0;
      if (ismirrored == 0 && ispalindrome == 0)
        break;
    }
    printf("%s -- %s.\n\n", s, message[ismirrored * 2 + ispalindrome]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2c9a(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c97(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2c94(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c91(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xed4(%rip),%rdi
call   1060 <scanf@plt>
mov    0x2e4e(%rip),%rcx
cmp    (%rcx),%rax
je     1288 <main+0x148>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x48(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x1,-0x4c(%rbp)
movl   $0x1,-0x50(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
jge    1263 <main+0x123>
movslq -0x44(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsbl -0x20(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1206 <main+0xc6>
movl   $0x0,-0x50(%rbp)
movslq -0x44(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%edi
call   1030 <reverse@plt>
movsbl %al,%eax
mov    -0x48(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsbl -0x20(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1237 <main+0xf7>
movl   $0x0,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jne    1250 <main+0x110>
cmpl   $0x0,-0x50(%rbp)
jne    1250 <main+0x110>
jmp    1263 <main+0x123>
jmp    1255 <main+0x115>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11bc <main+0x7c>
lea    -0x20(%rbp),%rsi
mov    -0x4c(%rbp),%eax
shl    $0x1,%eax
add    -0x50(%rbp),%eax
cltq
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xddf(%rip),%rdi
call   1050 <printf@plt>
jmp    117b <main+0x3b>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xf05(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    0x2e84(%rip),%rcx
cmp    (%rcx),%rax
jne    117a <main+0x3a>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%rbx
jmp    11ca <main+0x8a>
nop
mov    $0x1,%r12d
mov    $0x1,%eax
lea    (%rax,%r12,2),%eax
lea    0xed6(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
lea    0xeb9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <printf@plt>
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0x2e23(%rip),%rcx
cmp    (%rcx),%rax
je     1169 <main+0x29>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1180 <main+0x40>
mov    %eax,%ebx
lea    0x1(%rbx),%eax
shr    %eax
mov    %rax,0x20(%rsp)
add    $0xffffffff,%ebx
mov    $0x1,%r15d
xor    %r13d,%r13d
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rsp,%r13,1),%edi
movslq %ebx,%r14
xor    %r12d,%r12d
cmp    (%rsp,%r14,1),%dil
cmovne %r12d,%r15d
call   1030 <reverse@plt>
cmp    (%rsp,%r14,1),%al
cmovne %r12d,%ebp
mov    %ebp,%eax
or     %r15d,%eax
mov    $0x0,%eax
je     118b <main+0x4b>
add    $0x1,%r13
add    $0xffffffff,%ebx
mov    %ebp,%r12d
mov    %r15d,%eax
cmp    %r13,0x20(%rsp)
jne    1200 <main+0xc0>
jmp    118b <main+0x4b>

LLVM IR (-O0):
@.str = [20 x i8] c"is not a palindrome\00"
@.str.1 = [24 x i8] c"is a regular palindrome\00"
@.str.2 = [21 x i8] c"is a mirrored string\00"
@.str.3 = [25 x i8] c"is a mirrored palindrome\00"
@__const.main.message = [4 x i8*] [i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.5 = [12 x i8] c"%s -- %s.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [4 x i8*]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [4 x i8*]* %3 to i8*
br label %9
9: ; preds = %67, %0
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %77
14: ; preds = %9
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %5
store i32 0, i32* %4
store i32 1, i32* %6
store i32 1, i32* %7
br label %17
17: ; preds = %64, %14
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = sdiv i32 %20, 2
%22 = icmp slt i32 %18, %21
br i1 %22, label %23, label %67
23: ; preds = %17
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = load i32, i32* %5
%30 = sub nsw i32 %29, 1
%31 = load i32, i32* %4
%32 = sub nsw i32 %30, %31
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %28, %36
br i1 %37, label %38, label %39
38: ; preds = %23
store i32 0, i32* %7
br label %39
39: ; preds = %38, %23
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = call signext i8 @reverse(i8 signext %43)
%45 = sext i8 %44 to i32
%46 = load i32, i32* %5
%47 = sub nsw i32 %46, 1
%48 = load i32, i32* %4
%49 = sub nsw i32 %47, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp ne i32 %45, %53
br i1 %54, label %55, label %56
55: ; preds = %39
store i32 0, i32* %6
br label %56
56: ; preds = %55, %39
%57 = load i32, i32* %6
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %56
%60 = load i32, i32* %7
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %59
br label %67
63: ; preds = %59, %56
br label %64
64: ; preds = %63
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 1
store i32 %66, i32* %4
br label %17
67: ; preds = %62, %17
%68 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%69 = load i32, i32* %6
%70 = mul nsw i32 %69, 2
%71 = load i32, i32* %7
%72 = add nsw i32 %70, %71
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 %73
%75 = load i8*, i8** %74
%76 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %68, i8* %75)
br label %9
77: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"is not a palindrome\00"
@.str.1 = [24 x i8] c"is a regular palindrome\00"
@.str.2 = [21 x i8] c"is a mirrored string\00"
@.str.3 = [25 x i8] c"is a mirrored palindrome\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
@.str.4 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.5 = [12 x i8] c"%s -- %s.\0A\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %49, label %6
6: ; preds = %0, %37
%7 = call i32 @strlen(i8* %2)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %37
9: ; preds = %6
%10 = add nuw nsw i32 %7, 1
%11 = lshr i32 %10, 1
%12 = zext i32 %11 to i64
br label %15
13: ; preds = %15
%14 = icmp eq i64 %36, %12
br i1 %14, label %37, label %15
15: ; preds = %9, %13
%16 = phi i64 [ 0, %9 ], [ %36, %13 ]
%17 = phi i32 [ 1, %9 ], [ %28, %13 ]
%18 = phi i32 [ 1, %9 ], [ %32, %13 ]
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %16
%20 = load i8, i8* %19
%21 = trunc i64 %16 to i32
%22 = xor i32 %21, -1
%23 = add i32 %7, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = icmp eq i8 %20, %26
%28 = select i1 %27, i32 %17, i32 0
%29 = call signext i8 @reverse(i8 signext %20)
%30 = load i8, i8* %25
%31 = icmp eq i8 %29, %30
%32 = select i1 %31, i32 %18, i32 0
%33 = icmp eq i32 %32, 0
%34 = icmp eq i32 %28, 0
%35 = select i1 %33, i1 %34, i1 false
%36 = add nuw nsw i64 %16, 1
br i1 %35, label %37, label %13
37: ; preds = %13, %15, %6
%38 = phi i32 [ 1, %6 ], [ 0, %15 ], [ %32, %13 ]
%39 = phi i32 [ 1, %6 ], [ 0, %15 ], [ %28, %13 ]
%40 = shl nsw i32 %38, 1
%41 = add nsw i32 %40, %39
%42 = zext i32 %41 to i64
%43 = shl i64 %42, 2
%44 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %43)
%45 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %2, i8* %44)
%46 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%47 = load i64, i64* @EOF
%48 = icmp eq i64 %46, %47
br i1 %48, label %49, label %6
49: ; preds = %37, %0
ret i32 0
}