#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 e_palindromo(char *, int);
int get_palavra(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char buffer[80];
  int length, a;
  length = get_palavra(buffer, 80);
  a = e_palindromo(buffer, length);
  if (a)
    printf("A palavra %s é um palíndromo\n", buffer);
  else
    printf("A palavra %s não é um palíndromo\n", buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1050 <get_palavra@plt>
mov    %eax,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x64(%rbp),%esi
call   1040 <e_palindromo@plt>
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x68(%rbp)
je     117e <main+0x4e>
lea    -0x60(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
jmp    118e <main+0x5e>
lea    -0x60(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <get_palavra@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <e_palindromo@plt>
test   %eax,%eax
lea    0xec8(%rip),%rax
lea    0xea1(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"A palavra %s \C3\A9 um pal\C3\ADndromo\0A\00"
@.str.1 = [37 x i8] c"A palavra %s n\C3\A3o \C3\A9 um pal\C3\ADndromo\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = call i32 @get_palavra(i8* %5, i32 80)
store i32 %6, i32* %3
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call i32 @e_palindromo(i8* %7, i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %18
15: ; preds = %0
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %15, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"A palavra %s \C3\A9 um pal\C3\ADndromo\0A\00"
@.str.1 = [37 x i8] c"A palavra %s n\C3\A3o \C3\A9 um pal\C3\ADndromo\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = call i32 @get_palavra(i8* %2, i32 80)
%4 = call i32 @e_palindromo(i8* %2, i32 %3)
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0)
%7 = call i32 @printf(i8* %6, i8* %2)
ret i32 0
}