#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char **);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int main() {
  char str[10];
  char strInversa[10];
  int tamanhoStr, tamanhoCompara, i;
  printf("texto: \n");
  fflush(stdin);
  scanf("%s", &str);
  tamanhoStr = strlen(str);
  tamanhoCompara = tamanhoStr;
  for (i = 0; i < tamanhoStr; i++) {
    strInversa[i] = str[tamanhoCompara - 1];
    tamanhoCompara--;
  }
  strcmp(str, strInversa) == 0 ? printf("É palíndromo")
                               : printf("Não é palíndromo");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
lea    -0xe(%rbp),%rsi
lea    0xe85(%rip),%rdi
call   1070 <scanf@plt>
lea    -0xe(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d9 <main+0x89>
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0xe(%rbp,%rax,1),%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0x18(%rbp,%rax,1)
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a2 <main+0x52>
lea    -0xe(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1201 <main+0xb1>
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
jmp    120d <main+0xbd>
lea    0xe13(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
lea    0xe7a(%rip),%rdi
lea    0x16(%rsp),%rbx
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    12f4 <main+0x194>
mov    %eax,%ecx
cmp    $0x8,%eax
jae    11b4 <main+0x54>
xor    %eax,%eax
mov    %rcx,%rdx
jmp    12cb <main+0x16b>
cmp    $0x20,%eax
jae    11c0 <main+0x60>
xor    %eax,%eax
jmp    126c <main+0x10c>
mov    %ecx,%eax
and    $0xffffffe0,%eax
lea    (%rcx,%rbx,1),%rdx
add    $0xfffffffffffffff0,%rdx
xor    %esi,%esi
pxor   %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqu -0x10(%rdx),%xmm1
movdqu (%rdx),%xmm2
movdqa %xmm2,%xmm3
punpcklbw %xmm0,%xmm3
pshufd $0x4e,%xmm3,%xmm3
pshuflw $0x1b,%xmm3,%xmm3
pshufhw $0x1b,%xmm3,%xmm3
punpckhbw %xmm0,%xmm2
pshufd $0x4e,%xmm2,%xmm2
pshuflw $0x1b,%xmm2,%xmm2
pshufhw $0x1b,%xmm2,%xmm2
packuswb %xmm3,%xmm2
movdqa %xmm1,%xmm3
punpcklbw %xmm0,%xmm3
pshufd $0x4e,%xmm3,%xmm3
pshuflw $0x1b,%xmm3,%xmm3
pshufhw $0x1b,%xmm3,%xmm3
punpckhbw %xmm0,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm3,%xmm1
movdqu %xmm2,0xc(%rsp,%rsi,1)
movdqu %xmm1,0x1c(%rsp,%rsi,1)
add    $0x20,%rsi
add    $0xffffffffffffffe0,%rdx
cmp    %rsi,%rax
jne    11e0 <main+0x80>
cmp    %rcx,%rax
je     12f4 <main+0x194>
test   $0x18,%cl
je     12c5 <main+0x165>
mov    %rax,%rsi
mov    %ecx,%eax
and    $0xfffffff8,%eax
mov    %rcx,%rdx
sub    %rax,%rdx
mov    %rcx,%rdi
sub    %rsi,%rdi
add    %rsp,%rdi
add    $0xe,%rdi
pxor   %xmm0,%xmm0
nopl   0x0(%rax,%rax,1)
movq   (%rdi),%xmm1
punpcklbw %xmm0,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm1,%xmm1
movq   %xmm1,0xc(%rsp,%rsi,1)
add    $0x8,%rsi
add    $0xfffffffffffffff8,%rdi
cmp    %rsi,%rax
jne    1290 <main+0x130>
cmp    %rcx,%rax
jne    12cb <main+0x16b>
jmp    12f4 <main+0x194>
mov    %rcx,%rdx
sub    %rax,%rdx
add    %rbx,%rdx
add    $0xffffffffffffffff,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdx),%ebx
mov    %bl,0xc(%rsp,%rax,1)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
cmp    %rax,%rcx
jne    12e0 <main+0x180>
lea    0x16(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
lea    0xcf6(%rip),%rax
lea    0xcfe(%rip),%rdi
cmove  %rax,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"texto: \0A\00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [15 x i8] c"\C3\89 pal\C3\ADndromo\00"
@.str.3 = [20 x i8] c"N\C3\A3o \C3\A9 pal\C3\ADndromo\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fflush(i32 %8)
%10 = bitcast [10 x i8]* %2 to i8**
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %10)
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
store i32 %14, i32* %5
store i32 0, i32* %6
br label %15
15: ; preds = %30, %0
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %26
store i8 %24, i8* %27
%28 = load i32, i32* %5
%29 = add nsw i32 %28, -1
store i32 %29, i32* %5
br label %30
30: ; preds = %19
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %15
33: ; preds = %15
%34 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%36 = call i64 @strcmp(i8* %34, i8* %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %42
40: ; preds = %33
%41 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
%43 = phi i32 [ %39, %38 ], [ %41, %40 ]
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [15 x i8] c"\C3\89 pal\C3\ADndromo\00"
@.str.3 = [20 x i8] c"N\C3\A3o \C3\A9 pal\C3\ADndromo\00"
@str = [8 x i8] c"texto: \00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = tail call i32 @fflush(i32 %6)
%8 = bitcast [10 x i8]* %1 to i8**
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %8)
%10 = call i32 @strlen(i8* %3)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %76
12: ; preds = %0
%13 = zext i32 %10 to i64
%14 = zext i32 %10 to i64
%15 = icmp ult i32 %10, 8
br i1 %15, label %64, label %16
16: ; preds = %12
%17 = icmp ult i32 %10, 32
br i1 %17, label %45, label %18
18: ; preds = %16
%19 = and i64 %14, 4294967264
br label %20
20: ; preds = %20, %18
%21 = phi i64 [ 0, %18 ], [ %37, %20 ]
%22 = xor i64 %21, -1
%23 = add i64 %22, %13
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %23
%25 = getelementptr inbounds i8, i8* %24, i64 -15
%26 = bitcast i8* %25 to <16 x i8>*
%27 = load <16 x i8>, <16 x i8>* %26
%28 = shufflevector <16 x i8> %27, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%29 = getelementptr inbounds i8, i8* %24, i64 -31
%30 = bitcast i8* %29 to <16 x i8>*
%31 = load <16 x i8>, <16 x i8>* %30
%32 = shufflevector <16 x i8> %31, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %21
%34 = bitcast i8* %33 to <16 x i8>*
store <16 x i8> %28, <16 x i8>* %34
%35 = getelementptr inbounds i8, i8* %33, i64 16
%36 = bitcast i8* %35 to <16 x i8>*
store <16 x i8> %32, <16 x i8>* %36
%37 = add nuw i64 %21, 32
%38 = icmp eq i64 %37, %19
br i1 %38, label %39, label %20
39: ; preds = %20
%40 = icmp eq i64 %19, %14
br i1 %40, label %76, label %41
41: ; preds = %39
%42 = sub nsw i64 %13, %19
%43 = and i64 %14, 24
%44 = icmp eq i64 %43, 0
br i1 %44, label %64, label %45
45: ; preds = %16, %41
%46 = phi i64 [ %19, %41 ], [ 0, %16 ]
%47 = and i64 %14, 4294967288
%48 = sub nsw i64 %13, %47
br label %49
49: ; preds = %49, %45
%50 = phi i64 [ %46, %45 ], [ %60, %49 ]
%51 = xor i64 %50, -1
%52 = add i64 %51, %13
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %52
%54 = getelementptr inbounds i8, i8* %53, i64 -7
%55 = bitcast i8* %54 to <8 x i8>*
%56 = load <8 x i8>, <8 x i8>* %55
%57 = shufflevector <8 x i8> %56, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%58 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %50
%59 = bitcast i8* %58 to <8 x i8>*
store <8 x i8> %57, <8 x i8>* %59
%60 = add nuw i64 %50, 8
%61 = icmp eq i64 %60, %47
br i1 %61, label %62, label %49
62: ; preds = %49
%63 = icmp eq i64 %47, %14
br i1 %63, label %76, label %64
64: ; preds = %12, %41, %62
%65 = phi i64 [ %13, %12 ], [ %42, %41 ], [ %48, %62 ]
%66 = phi i64 [ 0, %12 ], [ %19, %41 ], [ %47, %62 ]
br label %67
67: ; preds = %64, %67
%68 = phi i64 [ %70, %67 ], [ %65, %64 ]
%69 = phi i64 [ %74, %67 ], [ %66, %64 ]
%70 = add nsw i64 %68, -1
%71 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %69
store i8 %72, i8* %73
%74 = add nuw nsw i64 %69, 1
%75 = icmp eq i64 %74, %14
br i1 %75, label %76, label %67
76: ; preds = %67, %39, %62, %0
%77 = call i64 @strcmp(i8* %3, i8* %4)
%78 = icmp eq i64 %77, 0
%79 = select i1 %78, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0)
%80 = call i32 @printf(i8* dereferenceable(1) %79)
ret i32 0
}