#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int sqrt(int);
main() {
  int n, raiz, comparacao;
  printf("Digite um numero inteiro: ");
  scanf("%i", &n);
  raiz = sqrt(n);
  comparacao = raiz * raiz;
  if (n == comparacao) {
    printf("\nO inteiro %i e´ quadrado perfeito de %i", raiz, n);
  } else
    printf("\nO Inteiro %i não e´ um quadrado perfeito", n);
  getchar();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1060 <sqrt@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11a7 <main+0x67>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b8 <main+0x78>
mov    -0x8(%rbp),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1060 <sqrt@plt>
mov    %eax,%edx
imul   %eax,%edx
mov    0x4(%rsp),%esi
cmp    %edx,%esi
jne    1188 <main+0x48>
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1196 <main+0x56>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Digite um numero inteiro: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [42 x i8] c"\0AO inteiro %i e\C2\B4 quadrado perfeito de %i\00"
@.str.3 = [44 x i8] c"\0AO Inteiro %i n\C3\A3o e\C2\B4 um quadrado perfeito\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 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), i32* %2)
%7 = load i32, i32* %2
%8 = call i32 @sqrt(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %3
%11 = mul nsw i32 %9, %10
store i32 %11, i32* %4
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %19
15: ; preds = %0
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17)
br label %22
19: ; preds = %0
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19, %15
%23 = call i32 (...) @getchar()
%24 = call i32 (...) @getchar()
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [27 x i8] c"Digite um numero inteiro: \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [42 x i8] c"\0AO inteiro %i e\C2\B4 quadrado perfeito de %i\00"
@.str.3 = [44 x i8] c"\0AO Inteiro %i n\C3\A3o e\C2\B4 um quadrado perfeito\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @sqrt(i32 %5)
%7 = mul nsw i32 %6, %6
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, %7
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7)
br label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %8)
br label %14
14: ; preds = %12, %10
%15 = call i32 (...) @getchar()
%16 = call i32 (...) @getchar()
ret i32 0
}