#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, double);
void boost_power_high(double *phi, unsigned long nvox, double limit,
                      double lexpo) {
  unsigned long m;
  double lnorm, lconst;
  if (limit == 0)
    for (m = 0; m < nvox; m++)
      if (*(phi + m) > limit)
        *(phi + m) = pow(*(phi + m), lexpo);
      else {
        lnorm = 1.0 / (lexpo * pow(limit, (lexpo - 1.0)));
        lconst = (1.0 - 1.0 / lexpo) * limit;
        for (m = 0; m < nvox; m++)
          if (*(phi + m) > limit)
            *(phi + m) = lconst + pow(*(phi + m), lexpo) * lnorm;
      }
}


x86 assembly (clang, -O0):
<boost_power_high>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    129f <boost_power_high+0x18f>
jp     129f <boost_power_high+0x18f>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    129a <boost_power_high+0x18a>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1199 <boost_power_high+0x89>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <pow@plt>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1284 <boost_power_high+0x174>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe4b(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1030 <pow@plt>
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe31(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe20(%rip),%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  0xe13(%rip),%xmm0
subsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    127f <boost_power_high+0x16f>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1269 <boost_power_high+0x159>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <pow@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    126e <boost_power_high+0x15e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1203 <boost_power_high+0xf3>
jmp    1284 <boost_power_high+0x174>
jmp    1289 <boost_power_high+0x179>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    114a <boost_power_high+0x3a>
jmp    129f <boost_power_high+0x18f>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boost_power_high>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
movsd  %xmm1,0x10(%rsp)
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    12bb <boost_power_high+0x1ab>
jp     12bb <boost_power_high+0x1ab>
mov    %rsi,%r14
test   %rsi,%rsi
je     12bb <boost_power_high+0x1ab>
mov    %rdi,%r12
movsd  0xeae(%rip),%xmm2
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,0x28(%rsp)
divsd  %xmm0,%xmm2
addsd  0xe96(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
mov    %r14,%r15
and    $0xfffffffffffffffe,%r15
xor    %r13d,%r13d
movsd  %xmm1,0x8(%rsp)
jmp    11b4 <boost_power_high+0xa4>
xchg   %ax,%ax
movsd  0x10(%rsp),%xmm1
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm0,(%r12,%r13,8)
add    $0x1,%r13
cmp    %r14,%r13
jae    12bb <boost_power_high+0x1ab>
movsd  (%r12,%r13,8),%xmm0
ucomisd %xmm1,%xmm0
ja     1190 <boost_power_high+0x80>
movapd %xmm1,%xmm0
movsd  0x28(%rsp),%xmm1
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0xe2b(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
xor    %ebx,%ebx
cmp    $0x1,%r14
jne    1240 <boost_power_high+0x130>
movsd  0x8(%rsp),%xmm1
mov    %r14,%r13
test   $0x1,%r14b
je     11a7 <boost_power_high+0x97>
movsd  (%r12,%rbx,8),%xmm0
ucomisd %xmm1,%xmm0
mov    %r14,%r13
jbe    11a7 <boost_power_high+0x97>
movsd  0x10(%rsp),%xmm1
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
mov    %r14,%r13
jmp    11a7 <boost_power_high+0x97>
nopl   0x0(%rax,%rax,1)
movsd  0x8(%rsp),%xmm1
jmp    1259 <boost_power_high+0x149>
nopl   0x0(%rax,%rax,1)
add    $0x2,%rbx
cmp    %rbx,%r15
je     11f5 <boost_power_high+0xe5>
movsd  (%r12,%rbx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1288 <boost_power_high+0x178>
movsd  0x10(%rsp),%xmm1
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
movsd  0x8(%r12,%rbx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1250 <boost_power_high+0x140>
movsd  0x10(%rsp),%xmm1
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x8(%r12,%rbx,8)
jmp    1250 <boost_power_high+0x140>
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @boost_power_high(double* %0, i64 %1, double %2, double %3) {
%5 = alloca double*
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca i64
%10 = alloca double
%11 = alloca double
store double* %0, double** %5
store i64 %1, i64* %6
store double %2, double* %7
store double %3, double* %8
%12 = load double, double* %7
%13 = fcmp oeq double %12, 0.000000e+00
br i1 %13, label %14, label %83
14: ; preds = %4
store i64 0, i64* %9
br label %15
15: ; preds = %79, %14
%16 = load i64, i64* %9
%17 = load i64, i64* %6
%18 = icmp ult i64 %16, %17
br i1 %18, label %19, label %82
19: ; preds = %15
%20 = load double*, double** %5
%21 = load i64, i64* %9
%22 = getelementptr inbounds double, double* %20, i64 %21
%23 = load double, double* %22
%24 = load double, double* %7
%25 = fcmp ogt double %23, %24
br i1 %25, label %26, label %36
26: ; preds = %19
%27 = load double*, double** %5
%28 = load i64, i64* %9
%29 = getelementptr inbounds double, double* %27, i64 %28
%30 = load double, double* %29
%31 = load double, double* %8
%32 = call double @pow(double %30, double %31)
%33 = load double*, double** %5
%34 = load i64, i64* %9
%35 = getelementptr inbounds double, double* %33, i64 %34
store double %32, double* %35
br label %78
36: ; preds = %19
%37 = load double, double* %8
%38 = load double, double* %7
%39 = load double, double* %8
%40 = fsub double %39, 1.000000e+00
%41 = call double @pow(double %38, double %40)
%42 = fmul double %37, %41
%43 = fdiv double 1.000000e+00, %42
store double %43, double* %10
%44 = load double, double* %8
%45 = fdiv double 1.000000e+00, %44
%46 = fsub double 1.000000e+00, %45
%47 = load double, double* %7
%48 = fmul double %46, %47
store double %48, double* %11
store i64 0, i64* %9
br label %49
49: ; preds = %74, %36
%50 = load i64, i64* %9
%51 = load i64, i64* %6
%52 = icmp ult i64 %50, %51
br i1 %52, label %53, label %77
53: ; preds = %49
%54 = load double*, double** %5
%55 = load i64, i64* %9
%56 = getelementptr inbounds double, double* %54, i64 %55
%57 = load double, double* %56
%58 = load double, double* %7
%59 = fcmp ogt double %57, %58
br i1 %59, label %60, label %73
60: ; preds = %53
%61 = load double, double* %11
%62 = load double*, double** %5
%63 = load i64, i64* %9
%64 = getelementptr inbounds double, double* %62, i64 %63
%65 = load double, double* %64
%66 = load double, double* %8
%67 = call double @pow(double %65, double %66)
%68 = load double, double* %10
%69 = call double @llvm.fmuladd.f64(double %67, double %68, double %61)
%70 = load double*, double** %5
%71 = load i64, i64* %9
%72 = getelementptr inbounds double, double* %70, i64 %71
store double %69, double* %72
br label %73
73: ; preds = %60, %53
br label %74
74: ; preds = %73
%75 = load i64, i64* %9
%76 = add i64 %75, 1
store i64 %76, i64* %9
br label %49
77: ; preds = %49
br label %78
78: ; preds = %77, %26
br label %79
79: ; preds = %78
%80 = load i64, i64* %9
%81 = add i64 %80, 1
store i64 %81, i64* %9
br label %15
82: ; preds = %15
br label %83
83: ; preds = %82, %4
ret void
}

LLVM IR (-O2):
define void @boost_power_high(double* nocapture %0, i64 %1, double %2, double %3) {
%5 = fcmp oeq double %2, 0.000000e+00
%6 = icmp ne i64 %1, 0
%7 = and i1 %5, %6
br i1 %7, label %8, label %62
8: ; preds = %4
%9 = fadd double %3, -1.000000e+00
%10 = fdiv double 1.000000e+00, %3
%11 = fsub double 1.000000e+00, %10
%12 = fmul double %11, %2
%13 = and i64 %1, 1
%14 = icmp eq i64 %1, 1
%15 = and i64 %1, -2
%16 = icmp eq i64 %13, 0
br label %17
17: ; preds = %8, %58
%18 = phi i64 [ 0, %8 ], [ %60, %58 ]
%19 = getelementptr inbounds double, double* %0, i64 %18
%20 = load double, double* %19
%21 = fcmp ogt double %20, %2
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = tail call double @pow(double %20, double %3)
store double %23, double* %19
br label %58
24: ; preds = %17
%25 = tail call double @pow(double %2, double %9)
%26 = fmul double %25, %3
%27 = fdiv double 1.000000e+00, %26
br i1 %14, label %49, label %28
28: ; preds = %24, %45
%29 = phi i64 [ %46, %45 ], [ 0, %24 ]
%30 = phi i64 [ %47, %45 ], [ 0, %24 ]
%31 = getelementptr inbounds double, double* %0, i64 %29
%32 = load double, double* %31
%33 = fcmp ogt double %32, %2
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = tail call double @pow(double %32, double %3)
%36 = tail call double @llvm.fmuladd.f64(double %35, double %27, double %12)
store double %36, double* %31
br label %37
37: ; preds = %28, %34
%38 = or i64 %29, 1
%39 = getelementptr inbounds double, double* %0, i64 %38
%40 = load double, double* %39
%41 = fcmp ogt double %40, %2
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = tail call double @pow(double %40, double %3)
%44 = tail call double @llvm.fmuladd.f64(double %43, double %27, double %12)
store double %44, double* %39
br label %45
45: ; preds = %42, %37
%46 = add nuw i64 %29, 2
%47 = add i64 %30, 2
%48 = icmp eq i64 %47, %15
br i1 %48, label %49, label %28
49: ; preds = %45, %24
%50 = phi i64 [ 0, %24 ], [ %46, %45 ]
br i1 %16, label %58, label %51
51: ; preds = %49
%52 = getelementptr inbounds double, double* %0, i64 %50
%53 = load double, double* %52
%54 = fcmp ogt double %53, %2
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = tail call double @pow(double %53, double %3)
%57 = tail call double @llvm.fmuladd.f64(double %56, double %27, double %12)
store double %57, double* %52
br label %58
58: ; preds = %49, %55, %51, %22
%59 = phi i64 [ %18, %22 ], [ %1, %51 ], [ %1, %55 ], [ %1, %49 ]
%60 = add i64 %59, 1
%61 = icmp ult i64 %60, %1
br i1 %61, label %17, label %62
62: ; preds = %58, %4
ret void
}