#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() {
  int num, res, x, i;
  x = 2;
  res = 1;
  printf("Calcular 2 elevado a: ");
  scanf("%d", &num);
  for (i = 0; i < num; ++i)
    res = res * x;
  printf("%d", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1186 <main+0x66>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x42>
mov    -0xc(%rbp),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    115c <main+0x3c>
lea    -0x1(%rcx),%edx
mov    %ecx,%eax
and    $0x7,%eax
cmp    $0x7,%edx
jae    1163 <main+0x43>
mov    $0x1,%esi
jmp    1178 <main+0x58>
mov    $0x1,%esi
jmp    1187 <main+0x67>
and    $0xfffffff8,%ecx
mov    $0x1,%esi
nopl   0x0(%rax,%rax,1)
shl    $0x8,%esi
add    $0xfffffff8,%ecx
jne    1170 <main+0x50>
test   %eax,%eax
je     1187 <main+0x67>
nopl   0x0(%rax)
add    %esi,%esi
add    $0xffffffff,%eax
jne    1180 <main+0x60>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Calcular 2 elevado a: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %4
store i32 1, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
br label %8
8: ; preds = %16, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
store i32 %15, i32* %3
br label %16
16: ; preds = %12
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %8
19: ; preds = %8
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Calcular 2 elevado a: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %29
7: ; preds = %0
%8 = add i32 %5, -1
%9 = and i32 %5, 7
%10 = icmp ult i32 %8, 7
br i1 %10, label %19, label %11
11: ; preds = %7
%12 = and i32 %5, -8
br label %13
13: ; preds = %13, %11
%14 = phi i32 [ 1, %11 ], [ %16, %13 ]
%15 = phi i32 [ 0, %11 ], [ %17, %13 ]
%16 = shl i32 %14, 8
%17 = add i32 %15, 8
%18 = icmp eq i32 %17, %12
br i1 %18, label %19, label %13
19: ; preds = %13, %7
%20 = phi i32 [ undef, %7 ], [ %16, %13 ]
%21 = phi i32 [ 1, %7 ], [ %16, %13 ]
%22 = icmp eq i32 %9, 0
br i1 %22, label %29, label %23
23: ; preds = %19, %23
%24 = phi i32 [ %26, %23 ], [ %21, %19 ]
%25 = phi i32 [ %27, %23 ], [ 0, %19 ]
%26 = shl nsw i32 %24, 1
%27 = add i32 %25, 1
%28 = icmp eq i32 %27, %9
br i1 %28, label %29, label %23
29: ; preds = %19, %23, %0
%30 = phi i32 [ 1, %0 ], [ %20, %19 ], [ %26, %23 ]
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %30)
ret i32 0
}