#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int num;
  printf("Informe um número: ");
  scanf("%d", &num);
  if (num % 2 == 0) {
    if (num % 4 == 0)
      printf("Quadrado perfeito\n");
    else
      printf("Não é quadrado perfeito\n");
  } else {
    if (num % 8 == 1)
      printf("Quadrado perfeito\n");
    else
      printf("Não é quadrado perfeito\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1195 <main+0x75>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1184 <main+0x64>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1190 <main+0x70>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    11cb <main+0xab>
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11ba <main+0x9a>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
jmp    11c6 <main+0xa6>
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
jmp    11cb <main+0xab>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   $0x1,%al
jne    115a <main+0x2a>
test   $0x3,%al
jmp    116a <main+0x3a>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
cmp    $0x1,%eax
lea    0xec1(%rip),%rax
lea    0xea0(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Informe um n\C3\BAmero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Quadrado perfeito\0A\00"
@.str.3 = [27 x i8] c"N\C3\A3o \C3\A9 quadrado perfeito\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 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* %2)
%5 = load i32, i32* %2
%6 = srem i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %0
%9 = load i32, i32* %2
%10 = srem i32 %9, 4
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %16
14: ; preds = %8
%15 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
br label %26
17: ; preds = %0
%18 = load i32, i32* %2
%19 = srem i32 %18, 8
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %25
23: ; preds = %17
%24 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
br label %26
26: ; preds = %25, %16
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Informe um n\C3\BAmero: \00"
@.str.1 = [3 x i8] c"%d\00"
@str.5 = [26 x i8] c"N\C3\A3o \C3\A9 quadrado perfeito\00"
@str.6 = [18 x i8] c"Quadrado perfeito\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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 = and i32 %5, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = and i32 %5, 3
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0)
br label %16
12: ; preds = %0
%13 = srem i32 %5, 8
%14 = icmp eq i32 %13, 1
%15 = select i1 %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0)
br label %16
16: ; preds = %12, %8
%17 = phi i8* [ %11, %8 ], [ %15, %12 ]
%18 = call i32 @puts(i8* dereferenceable(1) %17)
ret i32 0
}