#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 calculaExpo(int, int);
int /*<<< orphan*/ printf(char *, ...);
main() {
  int numPerfect[4];
  int num[4] = {2, 3, 5, 7};
  int n = 0;
  printf("\nOs quatros primeiros números perfeitos são:\n");
  for (n = 0; n < 4; n++) {
    numPerfect[n] = calculaExpo(2, num[n] - 1) * (calculaExpo(2, num[n]) - 1);
    printf("%d\n", numPerfect[n]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    11ca <main+0xaa>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
sub    $0x1,%esi
mov    $0x2,%edi
call   1040 <calculaExpo@plt>
mov    %eax,-0x38(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
mov    $0x2,%edi
call   1040 <calculaExpo@plt>
mov    -0x38(%rbp),%ecx
sub    $0x1,%eax
imul   %eax,%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
movslq -0x34(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1161 <main+0x41>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1050 <calculaExpo@plt>
mov    %eax,%ebx
mov    $0x2,%edi
mov    $0x2,%esi
call   1050 <calculaExpo@plt>
lea    -0x1(%rax),%esi
imul   %ebx,%esi
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1050 <calculaExpo@plt>
mov    %eax,%ebp
mov    $0x2,%edi
mov    $0x3,%esi
call   1050 <calculaExpo@plt>
lea    -0x1(%rax),%esi
imul   %ebp,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1050 <calculaExpo@plt>
mov    %eax,%ebp
mov    $0x2,%edi
mov    $0x5,%esi
call   1050 <calculaExpo@plt>
lea    -0x1(%rax),%esi
imul   %ebp,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x6,%esi
call   1050 <calculaExpo@plt>
mov    %eax,%ebp
mov    $0x2,%edi
mov    $0x7,%esi
call   1050 <calculaExpo@plt>
lea    -0x1(%rax),%esi
imul   %ebp,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.num = [4 x i32] [i32 2, i32 3, i32 5, i32 7]
@.str = [48 x i8] c"\0AOs quatros primeiros n\C3\BAmeros perfeitos s\C3\A3o:\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca [4 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x i32]* %3 to i8*
store i32 0, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %7
7: ; preds = %32, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %35
10: ; preds = %7
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = sub nsw i32 %14, 1
%16 = call i32 @calculaExpo(i32 2, i32 %15)
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i32 @calculaExpo(i32 2, i32 %20)
%22 = sub nsw i32 %21, 1
%23 = mul nsw i32 %16, %22
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %25
store i32 %23, i32* %26
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %10
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %7
35: ; preds = %7
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [47 x i8] c"\0AOs quatros primeiros n\C3\BAmeros perfeitos s\C3\A3o:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @calculaExpo(i32 2, i32 1)
%3 = tail call i32 @calculaExpo(i32 2, i32 2)
%4 = add nsw i32 %3, -1
%5 = mul nsw i32 %4, %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 @calculaExpo(i32 2, i32 2)
%8 = tail call i32 @calculaExpo(i32 2, i32 3)
%9 = add nsw i32 %8, -1
%10 = mul nsw i32 %9, %7
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = tail call i32 @calculaExpo(i32 2, i32 4)
%13 = tail call i32 @calculaExpo(i32 2, i32 5)
%14 = add nsw i32 %13, -1
%15 = mul nsw i32 %14, %12
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = tail call i32 @calculaExpo(i32 2, i32 6)
%18 = tail call i32 @calculaExpo(i32 2, i32 7)
%19 = add nsw i32 %18, -1
%20 = mul nsw i32 %19, %17
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}