#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  char buffer[1 << 6] = {};
  printf("Insira um número: ");
  fgets(buffer, 1 << 6, stdin);
  int isPalindrome = 1;
  for (int i = 0, j = strlen(buffer) - 2; i < j; ++i, --j) {
    if (buffer[i] != buffer[j]) {
      isPalindrome = 0;
      break;
    }
  }
  if (isPalindrome) {
    puts("O número é capicua.");
  } else {
    puts("O número não é capicua.");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1060 <memset@plt>
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
mov    $0x40,%esi
call   1070 <fgets@plt>
movl   $0x1,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x2,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jge    11fd <main+0xad>
movslq -0x58(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%eax
movslq -0x5c(%rbp),%rcx
movsbl -0x50(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11e1 <main+0x91>
movl   $0x0,-0x54(%rbp)
jmp    11fd <main+0xad>
jmp    11e6 <main+0x96>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x5c(%rbp)
jmp    11af <main+0x5f>
cmpl   $0x0,-0x54(%rbp)
je     1218 <main+0xc8>
lea    0xe06(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <main+0xd4>
lea    0xe0b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe9e(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe85(%rip),%rdi
cmp    $0x3,%eax
jl     11cf <main+0x8f>
add    $0xfffffffe,%eax
add    $0xffffffffffffffff,%rax
xor    %ecx,%ecx
lea    0xe86(%rip),%rdx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rsp,%rcx,1),%ebx
cmp    0x1(%rsp,%rax,1),%bl
jne    11cc <main+0x8c>
add    $0x1,%rcx
lea    -0x1(%rax),%rsi
cmp    %rax,%rcx
mov    %rsi,%rax
jl     11b0 <main+0x70>
jmp    11cf <main+0x8f>
mov    %rdx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"Insira um n\C3\BAmero: \00"
@stdin = global i32 0
@.str.1 = [22 x i8] c"O n\C3\BAmero \C3\A9 capicua.\00"
@.str.2 = [27 x i8] c"O n\C3\BAmero n\C3\A3o \C3\A9 capicua.\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 64, i32 %4)
%6 = call i32 @strlen(i8* %2)
%7 = icmp sgt i32 %6, 2
br i1 %7, label %8, label %23
8: ; preds = %0
%9 = add nsw i32 %6, -2
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %8, %19
%12 = phi i64 [ 0, %8 ], [ %20, %19 ]
%13 = phi i64 [ %10, %8 ], [ %21, %19 ]
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 %12
%15 = load i8, i8* %14
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 %13
%17 = load i8, i8* %16
%18 = icmp eq i8 %15, %17
br i1 %18, label %19, label %23
19: ; preds = %11
%20 = add nuw nsw i64 %12, 1
%21 = add nsw i64 %13, -1
%22 = icmp slt i64 %20, %21
br i1 %22, label %11, label %23
23: ; preds = %11, %19, %0
%24 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), %19 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), %11 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
ret i32 0
}