#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main(void) {
  char palabra[80];
  int x, y, z;
  printf("\n\nEscribe una palabra: ");
  scanf(" %s", palabra);
  x = strlen(palabra);
  printf("%d\n", x);
  int aux = (x / 2);
  printf("%d\n", aux);
  int p = 0;
  for (int i = 0; i <= aux; i++) {
    printf("uno %hhd\n", palabra[i]);
    printf("dos %hhd\n", palabra[x - 1]);
    char uno = palabra[i];
    char dos = palabra[x - 1];
    if (palabra[i] == palabra[x - 1]) {
      p++;
      printf("p %d\n", p);
    }
    x--;
  }
  p--;
  printf("%d\n", p);
  if (p == aux) {
    printf("%s\n", "palindromo");
  } else
    printf("%s\n", "no es palindromo");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x70(%rbp),%eax
jg     1252 <main+0x122>
movslq -0x78(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x60(%rbp,%rax,1),%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x78(%rbp),%rax
mov    -0x60(%rbp,%rax,1),%al
mov    %al,-0x79(%rbp)
mov    -0x64(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x60(%rbp,%rax,1),%al
mov    %al,-0x7a(%rbp)
movslq -0x78(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
mov    -0x64(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x60(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    123b <main+0x10b>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11aa <main+0x7a>
mov    -0x74(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%esi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x74(%rbp),%eax
cmp    -0x70(%rbp),%eax
jne    1292 <main+0x162>
lea    0xdb7(%rip),%rdi
lea    0xdba(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a7 <main+0x177>
lea    0xd9d(%rip),%rdi
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xeab(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    0xeae(%rip),%r12
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%esi
shr    $0x1f,%esi
add    %r15d,%esi
sar    %esi
mov    %r12,%rdi
mov    %rsi,0x8(%rsp)
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xffffffff,%r15d
jge    11ef <main+0xaf>
add    $0xffffffff,%ebp
lea    0xe78(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    0x8(%rsp),%ebp
lea    0xe6e(%rip),%rax
lea    0xe61(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movslq %r15d,%rax
mov    0x8(%rsp),%rcx
lea    0x1(%rcx),%r13d
neg    %r13
lea    (%rax,%rbx,1),%r14
add    $0xffffffffffffffff,%r14
lea    0xe19(%rip),%r12
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    122d <main+0xed>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
add    $0xffffffffffffffff,%r15
cmp    %r15,%r13
je     11b0 <main+0x70>
movsbl (%rbx),%esi
lea    0xde5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl (%r14,%r15,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl (%rbx),%eax
cmp    (%r14,%r15,1),%al
jne    1220 <main+0xe0>
add    $0x1,%ebp
lea    0xdd0(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1220 <main+0xe0>

LLVM IR (-O0):
@.str = [24 x i8] c"\0A\0AEscribe una palabra: \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [10 x i8] c"uno %hhd\0A\00"
@.str.4 = [10 x i8] c"dos %hhd\0A\00"
@.str.5 = [6 x i8] c"p %d\0A\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [11 x i8] c"palindromo\00"
@.str.8 = [17 x i8] c"no es palindromo\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %3
%19 = sdiv i32 %18, 2
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
store i32 0, i32* %7
store i32 0, i32* %8
br label %22
22: ; preds = %69, %0
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %72
26: ; preds = %22
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %3
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %8
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
store i8 %43, i8* %9
%44 = load i32, i32* %3
%45 = sub nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %46
%48 = load i8, i8* %47
store i8 %48, i8* %10
%49 = load i32, i32* %8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = load i32, i32* %3
%55 = sub nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %53, %59
br i1 %60, label %61, label %66
61: ; preds = %26
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
%64 = load i32, i32* %7
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %61, %26
%67 = load i32, i32* %3
%68 = add nsw i32 %67, -1
store i32 %68, i32* %3
br label %69
69: ; preds = %66
%70 = load i32, i32* %8
%71 = add nsw i32 %70, 1
store i32 %71, i32* %8
br label %22
72: ; preds = %22
%73 = load i32, i32* %7
%74 = add nsw i32 %73, -1
store i32 %74, i32* %7
%75 = load i32, i32* %7
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %7
%78 = load i32, i32* %6
%79 = icmp eq i32 %77, %78
br i1 %79, label %80, label %82
80: ; preds = %72
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %84
82: ; preds = %72
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
br label %84
84: ; preds = %82, %80
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0A\0AEscribe una palabra: \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [10 x i8] c"uno %hhd\0A\00"
@.str.4 = [10 x i8] c"dos %hhd\0A\00"
@.str.5 = [6 x i8] c"p %d\0A\00"
@.str.7 = [11 x i8] c"palindromo\00"
@.str.8 = [17 x i8] c"no es palindromo\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @strlen(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = sdiv i32 %5, 2
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = icmp slt i32 %5, -1
br i1 %9, label %14, label %10
10: ; preds = %0
%11 = sext i32 %5 to i64
%12 = add nsw i32 %7, 1
%13 = zext i32 %12 to i64
br label %21
14: ; preds = %40, %0
%15 = phi i32 [ 0, %0 ], [ %41, %40 ]
%16 = add nsw i32 %15, -1
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = icmp eq i32 %16, %7
%19 = select i1 %18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0)
%20 = call i32 @puts(i8* dereferenceable(1) %19)
ret i32 0
21: ; preds = %10, %40
%22 = phi i64 [ 0, %10 ], [ %42, %40 ]
%23 = phi i64 [ %11, %10 ], [ %29, %40 ]
%24 = phi i32 [ 0, %10 ], [ %41, %40 ]
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %22
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = add nsw i64 %23, -1
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%34 = load i8, i8* %25
%35 = load i8, i8* %30
%36 = icmp eq i8 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %21
%38 = add nsw i32 %24, 1
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %38)
br label %40
40: ; preds = %37, %21
%41 = phi i32 [ %38, %37 ], [ %24, %21 ]
%42 = add nuw nsw i64 %22, 1
%43 = icmp eq i64 %42, %13
br i1 %43, label %14, label %21
}