#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 getline(int *, int);
int palindrome(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int len, x, txt[500];
  while ((len = getline(txt, 500)) > 0) {
    printf("%s\n", txt);
    x = palindrome(txt, len - 1);
    if (x)
      printf("Si es palindrome\n\n");
    else
      printf("No es palindrome\n\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x7e0(%rbp),%rdi
mov    $0x1f4,%esi
call   1050 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11b9 <main+0x89>
lea    -0x7e0(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7e0(%rbp),%rdi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1040 <palindrome@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11a6 <main+0x76>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <main+0x84>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x7d8,%rsp
mov    %rsp,%rdi
mov    $0x1f4,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    11a6 <main+0x76>
mov    %eax,%ebp
mov    %rsp,%rbx
lea    0xea6(%rip),%r14
lea    0xeb1(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0xffffffff,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <palindrome@plt>
test   %eax,%eax
mov    %r15,%rdi
cmove  %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x1f4,%esi
call   1050 <getline@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     1170 <main+0x40>
xor    %eax,%eax
add    $0x7d8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [19 x i8] c"Si es palindrome\0A\0A\00"
@.str.2 = [19 x i8] c"No es palindrome\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [500 x i32]
store i32 0, i32* %1
br label %5
5: ; preds = %22, %0
%6 = getelementptr inbounds [500 x i32], [500 x i32]* %4, i64 0, i64 0
%7 = call i32 @getline(i32* %6, i32 500)
store i32 %7, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = getelementptr inbounds [500 x i32], [500 x i32]* %4, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [500 x i32], [500 x i32]* %4, i64 0, i64 0
%13 = load i32, i32* %2
%14 = sub nsw i32 %13, 1
%15 = call i32 @palindrome(i32* %12, i32 %14)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %9
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %22
20: ; preds = %9
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
br label %5
23: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"No es palindrome\0A\00"
@str.3 = [18 x i8] c"Si es palindrome\0A\00"
define i32 @main() {
%1 = alloca [500 x i32]
%2 = bitcast [500 x i32]* %1 to i8*
%3 = getelementptr inbounds [500 x i32], [500 x i32]* %1, i64 0, i64 0
%4 = call i32 @getline(i32* %3, i32 500)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %0, %6
%7 = phi i32 [ %14, %6 ], [ %4, %0 ]
%8 = call i32 @puts(i8* %2)
%9 = add nsw i32 %7, -1
%10 = call i32 @palindrome(i32* %3, i32 %9)
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.3, i64 0, i64 0)
%13 = call i32 @puts(i8* dereferenceable(1) %12)
%14 = call i32 @getline(i32* %3, i32 500)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %6, label %16
16: ; preds = %6, %0
ret i32 0
}