#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 exp(double);
double init_newton(double, int, double, double, double);
double log(double);
double sqrt(double);
double babl_pow_1_24(double x) {
  double y;
  int i;
  double z;
  if (x > 1024.0) {
    return exp(log(x) * (1.0 / 2.4));
  }
  y = init_newton(x, -1. / 12, 0.9976800269, 0.9885126933, 0.5908575383);
  x = sqrt(x);
  z = (1. / 6.) * x;
  for (i = 0; i < 3; i++)
    y = (7. / 6.) * y - z * ((y * y) * (y * y) * (y * y * y));
  return x * y;
}


x86 assembly (clang, -O0):
<babl_pow_1_24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xea6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1189 <babl_pow_1_24+0x49>
movsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movsd  0xeba(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1266 <babl_pow_1_24+0x126>
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
movsd  0xe78(%rip),%xmm1
movsd  0xe78(%rip),%xmm2
movsd  0xe78(%rip),%xmm3
call   1030 <init_newton@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xe3f(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1257 <babl_pow_1_24+0x117>
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
mulsd  -0x18(%rbp),%xmm3
mulsd  %xmm3,%xmm2
movsd  -0x18(%rbp),%xmm3
mulsd  -0x18(%rbp),%xmm3
mulsd  -0x18(%rbp),%xmm3
mulsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xdec(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11da <babl_pow_1_24+0x9a>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<babl_pow_1_24>:
push   %rax
ucomisd 0xeb7(%rip),%xmm0
jbe    115e <babl_pow_1_24+0x1e>
call   1050 <log@plt>
mulsd  0xed8(%rip),%xmm0
pop    %rax
jmp    1040 <exp@plt>
movsd  0xea2(%rip),%xmm1
movsd  0xea2(%rip),%xmm2
movsd  0xea2(%rip),%xmm3
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1030 <init_newton@plt>
movapd %xmm0,%xmm5
xorpd  %xmm0,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
movsd  (%rsp),%xmm0
jb     11a5 <babl_pow_1_24+0x65>
sqrtsd %xmm0,%xmm0
jmp    11b4 <babl_pow_1_24+0x74>
movsd  %xmm5,(%rsp)
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm5
movsd  0xe64(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm5,%xmm2
mulsd  %xmm5,%xmm2
movapd %xmm5,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm2
mulsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm2
movsd  0xe44(%rip),%xmm3
mulsd  %xmm3,%xmm5
addsd  %xmm2,%xmm5
movapd %xmm5,%xmm2
mulsd  %xmm5,%xmm2
movapd %xmm5,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm2,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm3,%xmm5
addsd  %xmm2,%xmm5
movapd %xmm5,%xmm2
mulsd  %xmm5,%xmm2
movapd %xmm5,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm2,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm3,%xmm5
addsd  %xmm2,%xmm5
mulsd  %xmm0,%xmm5
movapd %xmm5,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @babl_pow_1_24(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
store double %0, double* %3
%7 = load double, double* %3
%8 = fcmp ogt double %7, 1.024000e+03
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load double, double* %3
%11 = call double @log(double %10)
%12 = fmul double %11, 0x3FDAAAAAAAAAAAAB
%13 = call double @exp(double %12)
store double %13, double* %2
br label %50
14: ; preds = %1
%15 = load double, double* %3
%16 = call double @init_newton(double %15, i32 0, double 0x3FEFECFEA9ED0D85, double 0x3FEFA1E55F2CF0AB, double 0x3FE2E84E1172FE81)
store double %16, double* %4
%17 = load double, double* %3
%18 = call double @sqrt(double %17)
store double %18, double* %3
%19 = load double, double* %3
%20 = fmul double 0x3FC5555555555555, %19
store double %20, double* %6
store i32 0, i32* %5
br label %21
21: ; preds = %43, %14
%22 = load i32, i32* %5
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %46
24: ; preds = %21
%25 = load double, double* %4
%26 = load double, double* %6
%27 = load double, double* %4
%28 = load double, double* %4
%29 = fmul double %27, %28
%30 = load double, double* %4
%31 = load double, double* %4
%32 = fmul double %30, %31
%33 = fmul double %29, %32
%34 = load double, double* %4
%35 = load double, double* %4
%36 = fmul double %34, %35
%37 = load double, double* %4
%38 = fmul double %36, %37
%39 = fmul double %33, %38
%40 = fmul double %26, %39
%41 = fneg double %40
%42 = call double @llvm.fmuladd.f64(double 0x3FF2AAAAAAAAAAAB, double %25, double %41)
store double %42, double* %4
br label %43
43: ; preds = %24
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %21
46: ; preds = %21
%47 = load double, double* %3
%48 = load double, double* %4
%49 = fmul double %47, %48
store double %49, double* %2
br label %50
50: ; preds = %46, %9
%51 = load double, double* %2
ret double %51
}

LLVM IR (-O2):
define double @babl_pow_1_24(double %0) {
%2 = fcmp ogt double %0, 1.024000e+03
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call double @log(double %0)
%5 = fmul double %4, 0x3FDAAAAAAAAAAAAB
%6 = tail call double @exp(double %5)
br label %30
7: ; preds = %1
%8 = tail call double @init_newton(double %0, i32 0, double 0x3FEFECFEA9ED0D85, double 0x3FEFA1E55F2CF0AB, double 0x3FE2E84E1172FE81)
%9 = tail call double @sqrt(double %0)
%10 = fmul double %9, 0xBFC5555555555555
%11 = fmul double %8, %8
%12 = fmul double %11, %11
%13 = fmul double %8, %11
%14 = fmul double %12, %13
%15 = fmul double %10, %14
%16 = tail call double @llvm.fmuladd.f64(double %8, double 0x3FF2AAAAAAAAAAAB, double %15)
%17 = fmul double %16, %16
%18 = fmul double %17, %17
%19 = fmul double %16, %17
%20 = fmul double %18, %19
%21 = fmul double %10, %20
%22 = tail call double @llvm.fmuladd.f64(double %16, double 0x3FF2AAAAAAAAAAAB, double %21)
%23 = fmul double %22, %22
%24 = fmul double %23, %23
%25 = fmul double %22, %23
%26 = fmul double %24, %25
%27 = fmul double %10, %26
%28 = tail call double @llvm.fmuladd.f64(double %22, double 0x3FF2AAAAAAAAAAAB, double %27)
%29 = fmul double %9, %28
br label %30
30: ; preds = %7, %3
%31 = phi double [ %6, %3 ], [ %29, %7 ]
ret double %31
}