#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 */
typedef int /*<<< orphan*/ exps;
typedef int /*<<< orphan*/ bases;

/* Variables and functions */
double power(float, int);
int /*<<< orphan*/ printf(char *, float, int, double);
void testPower() {
  int i, j;
  float bases[] = {0.0, 0.5, 2.0, 3.0, 4.0, 5.0};
  int exps[] = {0, 1, 2, 3};
  int lenBas = sizeof(bases) / sizeof(int);
  int lenExp = sizeof(exps) / sizeof(int);
  for (i = 0; i < lenBas; i++)
    for (j = 0; j < lenExp; j++)
      printf("power(%.1f, %d):  %f\n", bases[i], exps[j],
             power(bases[i], exps[j]));
}


x86 assembly (clang, -O0):
<testPower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x6,-0x34(%rbp)
movl   $0x4,-0x38(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11fc <testPower+0xdc>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11e9 <testPower+0xc9>
movslq -0x4(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x3c(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x40(%rbp)
movslq -0x4(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1030 <power@plt>
mov    -0x40(%rbp),%esi
movaps %xmm0,%xmm1
movss  -0x3c(%rbp),%xmm0
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1187 <testPower+0x67>
jmp    11ee <testPower+0xce>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <testPower+0x54>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testPower>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
lea    0xece(%rip),%r15
lea    0xedf(%rip),%r14
nopl   0x0(%rax)
movss  (%rbx,%r15,1),%xmm0
movss  %xmm0,0xc(%rsp)
xor    %edi,%edi
call   1030 <power@plt>
movaps %xmm0,%xmm1
mov    %r14,%rdi
movss  0xc(%rsp),%xmm0
xor    %esi,%esi
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
mov    $0x1,%edi
call   1030 <power@plt>
movaps %xmm0,%xmm1
mov    %r14,%rdi
movss  0xc(%rsp),%xmm0
mov    $0x1,%esi
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <power@plt>
movaps %xmm0,%xmm1
mov    %r14,%rdi
movss  0xc(%rsp),%xmm0
mov    $0x2,%esi
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
mov    $0x3,%edi
call   1030 <power@plt>
movaps %xmm0,%xmm1
mov    %r14,%rdi
movss  0xc(%rsp),%xmm0
mov    $0x3,%esi
call   1040 <printf@plt>
add    $0x4,%rbx
cmp    $0x18,%rbx
jne    1140 <testPower+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.testPower.bases = [6 x float] [float 0.000000e+00, float 5.000000e-01, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00]
@__const.testPower.exps = [4 x i32] [i32 0, i32 1, i32 2, i32 3]
@.str = [22 x i8] c"power(%.1f, %d): %f\0A\00"
define void @testPower() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [6 x float]
%4 = alloca [4 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [6 x float]* %3 to i8*
%8 = bitcast [4 x i32]* %4 to i8*
store i32 6, i32* %5
store i32 4, i32* %6
store i32 0, i32* %1
br label %9
9: ; preds = %41, %0
%10 = load i32, i32* %1
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %44
13: ; preds = %9
store i32 0, i32* %2
br label %14
14: ; preds = %37, %13
%15 = load i32, i32* %2
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %40
18: ; preds = %14
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [6 x float], [6 x float]* %3, i64 0, i64 %20
%22 = load float, float* %21
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = load i32, i32* %1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [6 x float], [6 x float]* %3, i64 0, i64 %28
%30 = load float, float* %29
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call double @power(float %30, i32 %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %22, i32 %26, double %35)
br label %37
37: ; preds = %18
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %14
40: ; preds = %14
br label %41
41: ; preds = %40
%42 = load i32, i32* %1
%43 = add nsw i32 %42, 1
store i32 %43, i32* %1
br label %9
44: ; preds = %9
ret void
}

LLVM IR (-O2):
@__const.testPower.bases = [6 x float] [float 0.000000e+00, float 5.000000e-01, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00]
@.str = [22 x i8] c"power(%.1f, %d): %f\0A\00"
define void @testPower() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 0, %0 ], [ %13, %1 ]
%3 = getelementptr inbounds [6 x float], [6 x float]* @__const.testPower.bases, i64 0, i64 %2
%4 = load float, float* %3
%5 = tail call double @power(float %4, i32 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %4, i32 0, double %5)
%7 = tail call double @power(float %4, i32 1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %4, i32 1, double %7)
%9 = tail call double @power(float %4, i32 2)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %4, i32 2, double %9)
%11 = tail call double @power(float %4, i32 3)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %4, i32 3, double %11)
%13 = add nuw nsw i64 %2, 1
%14 = icmp eq i64 %13, 6
br i1 %14, label %15, label %1
15: ; preds = %1
ret void
}