#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 eh_palindroma(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  char palavra[20];
  printf("Digite uma palavra: ");
  scanf("%s", palavra);
  int res = eh_palindroma(strlen(palavra), palavra);
  printf((res) ? "É palíndroma.\n" : "Não é palíndroma.\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%edi
lea    -0x30(%rbp),%rsi
call   1050 <eh_palindroma@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
lea    0xe96(%rip),%rdi
lea    0xe7e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1040 <printf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <eh_palindroma@plt>
test   %eax,%eax
lea    0xeab(%rip),%rax
lea    0xe93(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Digite uma palavra: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [17 x i8] c"\C3\89 pal\C3\ADndroma.\0A\00"
@.str.3 = [22 x i8] c"N\C3\A3o \C3\A9 pal\C3\ADndroma.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%14 = call i32 @eh_palindroma(i32 %12, i8* %13)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0)
%19 = call i32 @printf(i8* %18)
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}

LLVM IR (-O2):
@.str = [21 x i8] c"Digite uma palavra: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [17 x i8] c"\C3\89 pal\C3\ADndroma.\0A\00"
@.str.3 = [22 x i8] c"N\C3\A3o \C3\A9 pal\C3\ADndroma.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @strlen(i8* %4)
%8 = call i32 @eh_palindroma(i32 %7, i8* %4)
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 @printf(i8* dereferenceable(1) %10)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}