double _power(base, pownr)
double pownr, base;
{
  double temp;
  long l;
  if (pownr <= 0.0) {
    if (pownr == 0.0) {
      if (base <= 0.0)
        error(3);
      return (0.0);
    }
    l = base;
    if (l != base)
      error(3);
    temp = _exp(base * _log(-pownr));
    if (l & 1)
      temp = -temp;
    return (temp);
  }
  return (_exp(base * _log(pownr)));
}


x86 assembly (clang, -O0):
<_power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     124d <_power+0x11d>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    118f <_power+0x5f>
jp     118f <_power+0x5f>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1182 <_power+0x52>
mov    $0x3,%edi
mov    $0x0,%al
call   1050 <error@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1280 <_power+0x150>
cvttsd2si -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cvtsi2sdq -0x28(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    11b5 <_power+0x85>
jp     11b5 <_power+0x85>
jmp    11c1 <_power+0x91>
mov    $0x3,%edi
mov    $0x0,%al
call   1050 <error@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    $0x1,%al
call   1030 <_log@plt>
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <_exp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x28(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     123e <_power+0x10e>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1280 <_power+0x150>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%al
call   1030 <_log@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <_exp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_power>:
push   %rbx
sub    $0x20,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jae    1174 <_power+0x44>
movapd %xmm1,%xmm0
mov    $0x1,%al
movsd  %xmm2,0x8(%rsp)
call   1030 <_log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <_exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
jmp    120a <_power+0xda>
ucomisd %xmm0,%xmm1
jne    119c <_power+0x6c>
jp     119c <_power+0x6c>
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jb     120a <_power+0xda>
mov    $0x3,%edi
xor    %eax,%eax
call   1050 <error@plt>
xorpd  %xmm0,%xmm0
jmp    120a <_power+0xda>
cvttsd2si %xmm2,%rbx
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  %xmm2,0x8(%rsp)
ucomisd %xmm2,%xmm0
jne    11b7 <_power+0x87>
jnp    11cf <_power+0x9f>
mov    $0x3,%edi
xor    %eax,%eax
movapd %xmm1,0x10(%rsp)
call   1050 <error@plt>
movapd 0x10(%rsp),%xmm1
xorpd  0xe29(%rip),%xmm1
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1030 <_log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <_exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
test   $0x1,%bl
je     120a <_power+0xda>
xorpd  0xdf6(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @_power(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i64
store double %0, double* %4
store double %1, double* %5
%8 = load double, double* %5
%9 = fcmp ole double %8, 0.000000e+00
br i1 %9, label %10, label %45
10: ; preds = %2
%11 = load double, double* %5
%12 = fcmp oeq double %11, 0.000000e+00
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = load double, double* %4
%15 = fcmp ole double %14, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 3)
br label %18
18: ; preds = %16, %13
store double 0.000000e+00, double* %3
br label %53
19: ; preds = %10
%20 = load double, double* %4
%21 = fptosi double %20 to i64
store i64 %21, i64* %7
%22 = load i64, i64* %7
%23 = sitofp i64 %22 to double
%24 = load double, double* %4
%25 = fcmp une double %23, %24
br i1 %25, label %26, label %28
26: ; preds = %19
%27 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 3)
br label %28
28: ; preds = %26, %19
%29 = load double, double* %4
%30 = load double, double* %5
%31 = fneg double %30
%32 = call i32 (double, ...) bitcast (i32 (...)* @_log to i32 (double, ...)*)(double %31)
%33 = sitofp i32 %32 to double
%34 = fmul double %29, %33
%35 = call i32 (double, ...) bitcast (i32 (...)* @_exp to i32 (double, ...)*)(double %34)
%36 = sitofp i32 %35 to double
store double %36, double* %6
%37 = load i64, i64* %7
%38 = and i64 %37, 1
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %28
%41 = load double, double* %6
%42 = fneg double %41
store double %42, double* %6
br label %43
43: ; preds = %40, %28
%44 = load double, double* %6
store double %44, double* %3
br label %53
45: ; preds = %2
%46 = load double, double* %4
%47 = load double, double* %5
%48 = call i32 (double, ...) bitcast (i32 (...)* @_log to i32 (double, ...)*)(double %47)
%49 = sitofp i32 %48 to double
%50 = fmul double %46, %49
%51 = call i32 (double, ...) bitcast (i32 (...)* @_exp to i32 (double, ...)*)(double %50)
%52 = sitofp i32 %51 to double
store double %52, double* %3
br label %53
53: ; preds = %45, %43, %18
%54 = load double, double* %3
ret double %54
}

LLVM IR (-O2):
define double @_power(double %0, double %1) {
%3 = fcmp ugt double %1, 0.000000e+00
br i1 %3, label %27, label %4
4: ; preds = %2
%5 = fcmp oeq double %1, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = fcmp ugt double %0, 0.000000e+00
br i1 %7, label %33, label %8
8: ; preds = %6
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 3)
br label %33
10: ; preds = %4
%11 = fptosi double %0 to i64
%12 = sitofp i64 %11 to double
%13 = fcmp une double %12, %0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 3)
br label %16
16: ; preds = %14, %10
%17 = fneg double %1
%18 = tail call i32 (double, ...) bitcast (i32 (...)* @_log to i32 (double, ...)*)(double %17)
%19 = sitofp i32 %18 to double
%20 = fmul double %19, %0
%21 = tail call i32 (double, ...) bitcast (i32 (...)* @_exp to i32 (double, ...)*)(double %20)
%22 = sitofp i32 %21 to double
%23 = and i64 %11, 1
%24 = icmp eq i64 %23, 0
%25 = fneg double %22
%26 = select i1 %24, double %22, double %25
br label %33
27: ; preds = %2
%28 = tail call i32 (double, ...) bitcast (i32 (...)* @_log to i32 (double, ...)*)(double %1)
%29 = sitofp i32 %28 to double
%30 = fmul double %29, %0
%31 = tail call i32 (double, ...) bitcast (i32 (...)* @_exp to i32 (double, ...)*)(double %30)
%32 = sitofp i32 %31 to double
br label %33
33: ; preds = %6, %8, %27, %16
%34 = phi double [ %26, %16 ], [ %32, %27 ], [ 0.000000e+00, %8 ], [ 0.000000e+00, %6 ]
ret double %34
}