#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 pow_logn(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main_Pow() {
  int base = 2;
  int power = 0;
  for (power = 0; power < 5; power++) {
    printf("%d^%d=%d\n", base, power, pow_logn(base, power));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main_Pow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1180 <main_Pow+0x60>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <pow_logn@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main_Pow+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_Pow>:
push   %rbx
mov    $0x2,%edi
xor    %esi,%esi
call   1040 <pow_logn@plt>
lea    0xecc(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <pow_logn@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1040 <pow_logn@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x3,%esi
call   1040 <pow_logn@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1040 <pow_logn@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x4,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d^%d=%d\0A\00"
define i32 @main_Pow() {
%1 = alloca i32
%2 = alloca i32
store i32 2, i32* %1
store i32 0, i32* %2
store i32 0, i32* %2
br label %3
3: ; preds = %13, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32 @pow_logn(i32 %9, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %11)
br label %13
13: ; preds = %6
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %3
16: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d^%d=%d\0A\00"
define i32 @main_Pow() {
%1 = tail call i32 @pow_logn(i32 2, i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2, i32 0, i32 %1)
%3 = tail call i32 @pow_logn(i32 2, i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2, i32 1, i32 %3)
%5 = tail call i32 @pow_logn(i32 2, i32 2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2, i32 2, i32 %5)
%7 = tail call i32 @pow_logn(i32 2, i32 3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2, i32 3, i32 %7)
%9 = tail call i32 @pow_logn(i32 2, i32 4)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2, i32 4, i32 %9)
ret i32 0
}