#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 EXIT_SUCCESS;
int /*<<< orphan*/ gets(char *);
scalar_t__ is_palindrome(char *, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ parse_string(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
scalar_t__ strlen(char *);
int main(int argc, char **argv) {
  char word[81];
  for (printf("\nEnter a string: "); strcmp(gets(word), "done") != 0;
       printf("Enter a string: ")) {
    parse_string(word);
    is_palindrome(word, 0, strlen(word) - 1)
        ? printf("\nIt is a palindrome\n\n")
        : printf("\nIt is not a palindrome\n\n");
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe80(%rip),%rdi
call   1060 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1080 <gets@plt>
mov    %eax,%edi
lea    0xe7b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     120a <main+0xaa>
lea    -0x70(%rbp),%rdi
call   1030 <parse_string@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x78(%rbp),%rdi
mov    %rax,%rdx
sub    $0x1,%rdx
xor    %esi,%esi
call   1040 <is_palindrome@plt>
cmp    $0x0,%rax
je     11ed <main+0x8d>
lea    0xe34(%rip),%rdi
call   1060 <printf@plt>
jmp    11f9 <main+0x99>
lea    0xe39(%rip),%rdi
call   1060 <printf@plt>
lea    0xe01(%rip),%rdi
call   1060 <printf@plt>
jmp    1185 <main+0x25>
mov    0x2dcf(%rip),%rax
mov    (%rax),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
lea    0xe7c(%rip),%rdi
call   1070 <printf@plt>
mov    %rsp,%rdi
call   1090 <gets@plt>
lea    0xe7a(%rip),%rsi
mov    %eax,%edi
call   1080 <strcmp@plt>
test   %rax,%rax
je     121c <main+0xac>
mov    %rsp,%rbx
lea    0xe69(%rip),%r12
lea    0xe7b(%rip),%r13
lea    0xe45(%rip),%r14
lea    0xe4f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <parse_string@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    -0x1(%rax),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <is_palindrome@plt>
test   %rax,%rax
mov    %r13,%rdi
cmove  %r12,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1090 <gets@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    11d0 <main+0x60>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\0AEnter a string: \00"
@.str.1 = [5 x i8] c"done\00"
@.str.2 = [22 x i8] c"\0AIt is a palindrome\0A\0A\00"
@.str.3 = [26 x i8] c"\0AIt is not a palindrome\0A\0A\00"
@.str.4 = [17 x i8] c"Enter a string: \00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [81 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %28, %2
%9 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
%11 = call i64 @strcmp(i32 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %8
%14 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%15 = call i32 @parse_string(i8* %14)
%16 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [81 x i8], [81 x i8]* %6, i64 0, i64 0
%18 = call i64 @strlen(i8* %17)
%19 = sub nsw i64 %18, 1
%20 = call i64 @is_palindrome(i8* %16, i32 0, i64 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %26
24: ; preds = %13
%25 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = phi i32 [ %23, %22 ], [ %25, %24 ]
br label %28
28: ; preds = %26
%29 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %8
30: ; preds = %8
%31 = load i32, i32* @EXIT_SUCCESS
ret i32 %31
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0AEnter a string: \00"
@.str.1 = [5 x i8] c"done\00"
@.str.4 = [17 x i8] c"Enter a string: \00"
@EXIT_SUCCESS = global i32 0
@str = [25 x i8] c"\0AIt is not a palindrome\0A\00"
@str.5 = [21 x i8] c"\0AIt is a palindrome\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [81 x i8]
%4 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %4)
%7 = call i64 @strcmp(i32 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %2, %9
%10 = call i32 @parse_string(i8* %4)
%11 = call i64 @strlen(i8* %4)
%12 = add nsw i64 %11, -1
%13 = call i64 @is_palindrome(i8* %4, i32 0, i64 %12)
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.5, i64 0, i64 0)
%16 = call i32 @puts(i8* dereferenceable(1) %15)
%17 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @gets(i8* %4)
%19 = call i64 @strcmp(i32 %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %9
21: ; preds = %9, %2
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}