#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__ gets(char *);
scalar_t__ ispalindrome(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcasecmp(char *, char *);
int strlen(char *);
char tolower(char);
int main() {
  char in[10000], a[10000];
  int i, j, len;
  while (gets(in)) {
    len = strlen(in);
    j = 0;
    for (i = 0; i < len; i++) {
      if (in[i] >= 'A' && in[i] <= 'Z' || in[i] >= 'a' && in[i] <= 'z') {
        a[j] = tolower(in[i]);
        j++;
      }
    }
    a[j] = '\0';
    if (strcasecmp(in, "DONE") == 0)
      break;
    else if (ispalindrome(a))
      printf("You won't be eaten!\n");
    else
      printf("Uh oh..\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2720(%rbp),%rdi
call   1070 <gets@plt>
cmp    $0x0,%rax
je     12da <main+0x17a>
lea    -0x2720(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x4e3c(%rbp)
movl   $0x0,-0x4e38(%rbp)
movl   $0x0,-0x4e34(%rbp)
mov    -0x4e34(%rbp),%eax
cmp    -0x4e3c(%rbp),%eax
jge    126c <main+0x10c>
movslq -0x4e34(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
cmp    $0x41,%eax
jl     11f0 <main+0x90>
movslq -0x4e34(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
cmp    $0x5a,%eax
jle    1220 <main+0xc0>
movslq -0x4e34(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
cmp    $0x61,%eax
jl     1253 <main+0xf3>
movslq -0x4e34(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
cmp    $0x7a,%eax
jg     1253 <main+0xf3>
movslq -0x4e34(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%edi
ff
call   1080 <tolower@plt>
mov    %al,%cl
movslq -0x4e38(%rbp),%rax
mov    %cl,-0x4e30(%rbp,%rax,1)
mov    -0x4e38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e38(%rbp)
jmp    1258 <main+0xf8>
mov    -0x4e34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4e34(%rbp)
jmp    11ae <main+0x4e>
movslq -0x4e38(%rbp),%rax
movb   $0x0,-0x4e30(%rbp,%rax,1)
lea    -0x2720(%rbp),%rdi
lea    0xd77(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    129d <main+0x13d>
jmp    12da <main+0x17a>
lea    -0x4e30(%rbp),%rdi
call   1060 <ispalindrome@plt>
cmp    $0x0,%rax
je     12c4 <main+0x164>
lea    0xd4b(%rip),%rdi
call   1050 <printf@plt>
jmp    12d0 <main+0x170>
lea    0xd4f(%rip),%rdi
call   1050 <printf@plt>
jmp    12d5 <main+0x175>
jmp    1172 <main+0x12>
xor    %eax,%eax
add    $0x4e40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4e28,%rsp
lea    0x2710(%rsp),%rdi
call   1070 <gets@plt>
test   %rax,%rax
je     1249 <main+0xe9>
lea    0x2710(%rsp),%rbx
lea    0xe6a(%rip),%r14
lea    0xe70(%rip),%r13
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1200 <main+0xa0>
mov    %eax,%ebp
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    11c9 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    %r15,%rbp
je     1203 <main+0xa3>
movzbl 0x2710(%rsp,%r15,1),%eax
mov    %eax,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x19,%cl
ja     11c0 <main+0x60>
movsbl %al,%edi
call   1080 <tolower@plt>
movslq %r12d,%r12
mov    %al,(%rsp,%r12,1)
add    $0x1,%r12d
jmp    11c0 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %r12d,%r12d
movslq %r12d,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1249 <main+0xe9>
mov    %rsp,%rdi
call   1060 <ispalindrome@plt>
test   %rax,%rax
mov    %r13,%rdi
lea    0xdd6(%rip),%rax
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1070 <gets@plt>
test   %rax,%rax
jne    11a0 <main+0x40>
xor    %eax,%eax
add    $0x4e28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"DONE\00"
@.str.1 = [21 x i8] c"You won't be eaten!\0A\00"
@.str.2 = [9 x i8] c"Uh oh..\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10000 x i8]
%3 = alloca [10000 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
br label %7
7: ; preds = %78, %0
%8 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%9 = call i64 @gets(i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %79
11: ; preds = %7
%12 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
br label %14
14: ; preds = %58, %11
%15 = load i32, i32* %4
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %61
18: ; preds = %14
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 65
br i1 %24, label %25, label %32
25: ; preds = %18
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 90
br i1 %31, label %46, label %32
32: ; preds = %25, %18
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp sge i32 %37, 97
br i1 %38, label %39, label %57
39: ; preds = %32
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp sle i32 %44, 122
br i1 %45, label %46, label %57
46: ; preds = %39, %25
%47 = load i32, i32* %4
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = call signext i8 @tolower(i8 signext %50)
%52 = load i32, i32* %5
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %53
store i8 %51, i8* %54
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
br label %57
57: ; preds = %46, %39, %32
br label %58
58: ; preds = %57
%59 = load i32, i32* %4
%60 = add nsw i32 %59, 1
store i32 %60, i32* %4
br label %14
61: ; preds = %14
%62 = load i32, i32* %5
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %63
store i8 0, i8* %64
%65 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%66 = call i64 @strcasecmp(i8* %65, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %61
br label %79
69: ; preds = %61
%70 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%71 = call i64 @ispalindrome(i8* %70)
%72 = icmp ne i64 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %77
75: ; preds = %69
%76 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %77
77: ; preds = %75, %73
br label %78
78: ; preds = %77
br label %7
79: ; preds = %68, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"DONE\00"
@str = [8 x i8] c"Uh oh..\00"
@str.3 = [20 x i8] c"You won't be eaten!\00"
define i32 @main() {
%1 = alloca [10000 x i8]
%2 = alloca [10000 x i8]
%3 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%5 = call i64 @gets(i8* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %42, label %7
7: ; preds = %0, %35
%8 = call i32 @strlen(i8* %3)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %7
%11 = zext i32 %8 to i64
br label %12
12: ; preds = %10, %25
%13 = phi i64 [ 0, %10 ], [ %27, %25 ]
%14 = phi i32 [ 0, %10 ], [ %26, %25 ]
%15 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %13
%16 = load i8, i8* %15
%17 = and i8 %16, -33
%18 = add i8 %17, -65
%19 = icmp ult i8 %18, 26
br i1 %19, label %20, label %25
20: ; preds = %12
%21 = call signext i8 @tolower(i8 signext %16)
%22 = sext i32 %14 to i64
%23 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %22
store i8 %21, i8* %23
%24 = add nsw i32 %14, 1
br label %25
25: ; preds = %12, %20
%26 = phi i32 [ %24, %20 ], [ %14, %12 ]
%27 = add nuw nsw i64 %13, 1
%28 = icmp eq i64 %27, %11
br i1 %28, label %29, label %12
29: ; preds = %25, %7
%30 = phi i32 [ 0, %7 ], [ %26, %25 ]
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 %31
store i8 0, i8* %32
%33 = call i64 @strcasecmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %42, label %35
35: ; preds = %29
%36 = call i64 @ispalindrome(i8* %4)
%37 = icmp eq i64 %36, 0
%38 = select i1 %37, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0)
%39 = call i32 @puts(i8* dereferenceable(1) %38)
%40 = call i64 @gets(i8* %3)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %7
42: ; preds = %35, %29, %0
ret i32 0
}