#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*/ gets(char *);
scalar_t__ isPalindrome(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char line[800000 + 1];
  while (1) {
    gets(line);
    if (strcmp(line, "DONE") == 0)
      break;
    if (isPalindrome(line))
      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    $0xc3510,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc3510(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xc3510(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1180 <main+0x40>
jmp    11b8 <main+0x78>
lea    -0xc3510(%rbp),%rdi
call   1060 <isPalindrome@plt>
cmp    $0x0,%rax
je     11a7 <main+0x67>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
jmp    11b3 <main+0x73>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0xc3510,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc3508,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11bf <main+0x7f>
mov    %rsp,%rbx
lea    0xe8e(%rip),%r15
lea    0xe8f(%rip),%r12
lea    0xe7b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1060 <isPalindrome@plt>
test   %rax,%rax
mov    %r12,%rdi
cmove  %r15,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1190 <main+0x50>
xor    %eax,%eax
add    $0xc3508,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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 [800001 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %0, %18
%4 = getelementptr inbounds [800001 x i8], [800001 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [800001 x i8], [800001 x i8]* %2, i64 0, i64 0
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %3
br label %19
10: ; preds = %3
%11 = getelementptr inbounds [800001 x i8], [800001 x i8]* %2, i64 0, i64 0
%12 = call i64 @isPalindrome(i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
br label %3
19: ; preds = %9
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 [800001 x i8]
%2 = getelementptr inbounds [800001 x i8], [800001 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %0, %6
%7 = call i64 @isPalindrome(i8* %2)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, 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)
%10 = call i32 @puts(i8* dereferenceable(1) %9)
%11 = call i32 @gets(i8* %2)
%12 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %0
ret i32 0
}