#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 */
double pow(double, float);
int /*<<< orphan*/ printf(char *, int, double);
int /*<<< orphan*/ puts(char *);
int main() {
  double two;
  int exponent;
  puts("Power of 2's table:\n");
  for (exponent = 0; exponent <= 10; exponent++) {
    two = pow(2.0, (float)exponent);
    printf("2 to the %2d power is %.f\n", exponent, two);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jg     1195 <main+0x65>
cvtsi2ssl -0x14(%rbp),%xmm1
movsd  0xe97(%rip),%xmm0
call   1050 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <main+0x22>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
movsd  0xebb(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1050 <pow@plt>
lea    0xef1(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
movss  0xea2(%rip),%xmm1
movsd  0xe92(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
movss  0xe84(%rip),%xmm1
movsd  0xe70(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
movss  0xe66(%rip),%xmm1
movsd  0xe4e(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
movss  0xe48(%rip),%xmm1
movsd  0xe2c(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
movss  0xe2a(%rip),%xmm1
movsd  0xe0a(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
movss  0xe0c(%rip),%xmm1
movsd  0xde8(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
movss  0xdee(%rip),%xmm1
movsd  0xdc6(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
movss  0xdd0(%rip),%xmm1
movsd  0xda4(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <printf@plt>
movss  0xdb2(%rip),%xmm1
movsd  0xd82(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <printf@plt>
movss  0xd94(%rip),%xmm1
movsd  0xd60(%rip),%xmm0
call   1050 <pow@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Power of 2's table:\0A\00"
@.str.1 = [27 x i8] c"2 to the %2d power is %.f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 10
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to float
%11 = call double @pow(double 2.000000e+00, float %10)
store double %11, double* %2
%12 = load i32, i32* %3
%13 = load double, double* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %12, double %13)
br label %15
15: ; preds = %8
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %5
18: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Power of 2's table:\0A\00"
@.str.1 = [27 x i8] c"2 to the %2d power is %.f\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call double @pow(double 2.000000e+00, float 0.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 0, double %2)
%4 = tail call double @pow(double 2.000000e+00, float 1.000000e+00)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 1, double %4)
%6 = tail call double @pow(double 2.000000e+00, float 2.000000e+00)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 2, double %6)
%8 = tail call double @pow(double 2.000000e+00, float 3.000000e+00)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 3, double %8)
%10 = tail call double @pow(double 2.000000e+00, float 4.000000e+00)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 4, double %10)
%12 = tail call double @pow(double 2.000000e+00, float 5.000000e+00)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 5, double %12)
%14 = tail call double @pow(double 2.000000e+00, float 6.000000e+00)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 6, double %14)
%16 = tail call double @pow(double 2.000000e+00, float 7.000000e+00)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 7, double %16)
%18 = tail call double @pow(double 2.000000e+00, float 8.000000e+00)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 8, double %18)
%20 = tail call double @pow(double 2.000000e+00, float 9.000000e+00)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 9, double %20)
%22 = tail call double @pow(double 2.000000e+00, float 1.000000e+01)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 10, double %22)
ret i32 0
}