#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 fabs(double);
double sqrt(double);
double carlson_elliptic_rf(double x, double y, double z) {
  double alamb, ave, delx, dely, delz, e2, e3, sqrtx, sqrty, sqrtz, xt, yt, zt;
  xt = x;
  yt = y;
  zt = z;
  do {
    sqrtx = sqrt(xt);
    sqrty = sqrt(yt);
    sqrtz = sqrt(zt);
    alamb = sqrtx * (sqrty + sqrtz) + sqrty * sqrtz;
    xt = 0.25 * (xt + alamb);
    yt = 0.25 * (yt + alamb);
    zt = 0.25 * (zt + alamb);
    ave = (1.0 / 3.0) * (xt + yt + zt);
    delx = (ave - xt) / ave;
    dely = (ave - yt) / ave;
    delz = (ave - zt) / ave;
  } while (fabs(delx) > 0.0025 || fabs(dely) > 0.0025 || fabs(delz) > 0.0025);
  e2 = delx * dely - delz * delz;
  e3 = delx * dely * delz;
  return ((1.0 + ((1.0 / 24.0) * e2 - (0.1) - (3.0 / 44.0) * e3) * e2 +
           (1.0 / 14.0) * e3) /
          sqrt(ave));
}


x86 assembly (clang, -O0):
<carlson_elliptic_rf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x78(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x80(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
addsd  -0x68(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x70(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  0xe5b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x78(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  0xe40(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x80(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  0xe25(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm1
addsd  -0x78(%rbp),%xmm1
addsd  -0x80(%rbp),%xmm1
movsd  0xdfd(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x80(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movaps 0xdec(%rip),%xmm1
pand   %xmm1,%xmm0
mov    $0x1,%al
movsd  0xdae(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x81(%rbp)
ja     12c1 <carlson_elliptic_rf+0x1b1>
movsd  -0x38(%rbp),%xmm0
movaps 0xdc2(%rip),%xmm1
pand   %xmm1,%xmm0
mov    $0x1,%al
movsd  0xd84(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x81(%rbp)
ja     12c1 <carlson_elliptic_rf+0x1b1>
movsd  -0x40(%rbp),%xmm0
movaps 0xd98(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd5c(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    1148 <carlson_elliptic_rf+0x38>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  0xd08(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd04(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  0xce3(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xcc2(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  0xca9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<carlson_elliptic_rf>:
sub    $0x38,%rsp
movapd %xmm2,%xmm5
movapd %xmm0,%xmm6
unpcklpd %xmm1,%xmm5
xorpd  %xmm8,%xmm8
cs nopw 0x0(%rax,%rax,1)
nop
ucomisd %xmm8,%xmm6
movapd %xmm5,(%rsp)
movsd  %xmm6,0x18(%rsp)
jb     1150 <carlson_elliptic_rf+0x40>
xorps  %xmm0,%xmm0
sqrtsd %xmm6,%xmm0
jmp    1163 <carlson_elliptic_rf+0x53>
nopl   0x0(%rax,%rax,1)
movapd %xmm6,%xmm0
call   1030 <sqrt@plt>
xorpd  %xmm8,%xmm8
movapd (%rsp),%xmm5
movsd  %xmm0,0x10(%rsp)
movapd %xmm5,%xmm0
unpckhpd %xmm5,%xmm0
ucomisd %xmm8,%xmm0
jb     11b0 <carlson_elliptic_rf+0xa0>
xorps  %xmm3,%xmm3
sqrtsd %xmm0,%xmm3
ucomisd %xmm8,%xmm5
jae    11ca <carlson_elliptic_rf+0xba>
movapd %xmm5,%xmm0
movapd %xmm3,0x20(%rsp)
call   1030 <sqrt@plt>
movapd 0x20(%rsp),%xmm3
xorpd  %xmm8,%xmm8
movapd (%rsp),%xmm5
jmp    11d1 <carlson_elliptic_rf+0xc1>
nopw   0x0(%rax,%rax,1)
call   1030 <sqrt@plt>
xorpd  %xmm8,%xmm8
movapd (%rsp),%xmm5
movapd %xmm0,%xmm3
ucomisd %xmm8,%xmm5
jb     1186 <carlson_elliptic_rf+0x76>
xorps  %xmm0,%xmm0
sqrtsd %xmm5,%xmm0
movsd  0x18(%rsp),%xmm6
movapd %xmm3,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
addsd  %xmm3,%xmm6
mulsd  0xe03(%rip),%xmm6
unpcklpd %xmm3,%xmm3
addpd  %xmm3,%xmm5
mulpd  0xe33(%rip),%xmm5
movapd %xmm5,%xmm0
unpckhpd %xmm5,%xmm0
addsd  %xmm6,%xmm0
addsd  %xmm5,%xmm0
mulsd  0xde3(%rip),%xmm0
movapd %xmm0,%xmm1
subsd  %xmm6,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
movapd %xmm2,%xmm7
subpd  %xmm5,%xmm7
divpd  %xmm2,%xmm7
movapd %xmm1,%xmm2
movapd 0xdff(%rip),%xmm4
andpd  %xmm4,%xmm2
movapd %xmm7,%xmm3
andpd  %xmm4,%xmm3
movapd 0xdfb(%rip),%xmm4
cmpltpd %xmm3,%xmm4
movmskpd %xmm4,%eax
mov    %eax,%ecx
shr    %cl
ucomisd 0xd96(%rip),%xmm2
ja     1130 <carlson_elliptic_rf+0x20>
test   %cl,%cl
jne    1130 <carlson_elliptic_rf+0x20>
test   $0x1,%al
jne    1130 <carlson_elliptic_rf+0x20>
movapd %xmm7,%xmm2
mulsd  %xmm7,%xmm2
movapd %xmm7,%xmm3
unpckhpd %xmm7,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm7
subsd  %xmm2,%xmm1
movsd  0xd64(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xd60(%rip),%xmm2
movsd  0xd60(%rip),%xmm3
mulsd  %xmm7,%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
addsd  0xd54(%rip),%xmm3
mulsd  0xd54(%rip),%xmm7
addsd  %xmm3,%xmm7
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12f8 <carlson_elliptic_rf+0x1e8>
sqrtsd %xmm0,%xmm0
jmp    1307 <carlson_elliptic_rf+0x1f7>
movapd %xmm7,(%rsp)
call   1030 <sqrt@plt>
movapd (%rsp),%xmm7
divsd  %xmm0,%xmm7
movapd %xmm7,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @carlson_elliptic_rf(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%20 = load double, double* %4
store double %20, double* %17
%21 = load double, double* %5
store double %21, double* %18
%22 = load double, double* %6
store double %22, double* %19
br label %23
23: ; preds = %83, %3
%24 = load double, double* %17
%25 = call double @sqrt(double %24)
store double %25, double* %14
%26 = load double, double* %18
%27 = call double @sqrt(double %26)
store double %27, double* %15
%28 = load double, double* %19
%29 = call double @sqrt(double %28)
store double %29, double* %16
%30 = load double, double* %14
%31 = load double, double* %15
%32 = load double, double* %16
%33 = fadd double %31, %32
%34 = load double, double* %15
%35 = load double, double* %16
%36 = fmul double %34, %35
%37 = call double @llvm.fmuladd.f64(double %30, double %33, double %36)
store double %37, double* %7
%38 = load double, double* %17
%39 = load double, double* %7
%40 = fadd double %38, %39
%41 = fmul double 2.500000e-01, %40
store double %41, double* %17
%42 = load double, double* %18
%43 = load double, double* %7
%44 = fadd double %42, %43
%45 = fmul double 2.500000e-01, %44
store double %45, double* %18
%46 = load double, double* %19
%47 = load double, double* %7
%48 = fadd double %46, %47
%49 = fmul double 2.500000e-01, %48
store double %49, double* %19
%50 = load double, double* %17
%51 = load double, double* %18
%52 = fadd double %50, %51
%53 = load double, double* %19
%54 = fadd double %52, %53
%55 = fmul double 0x3FD5555555555555, %54
store double %55, double* %8
%56 = load double, double* %8
%57 = load double, double* %17
%58 = fsub double %56, %57
%59 = load double, double* %8
%60 = fdiv double %58, %59
store double %60, double* %9
%61 = load double, double* %8
%62 = load double, double* %18
%63 = fsub double %61, %62
%64 = load double, double* %8
%65 = fdiv double %63, %64
store double %65, double* %10
%66 = load double, double* %8
%67 = load double, double* %19
%68 = fsub double %66, %67
%69 = load double, double* %8
%70 = fdiv double %68, %69
store double %70, double* %11
br label %71
71: ; preds = %23
%72 = load double, double* %9
%73 = call double @llvm.fabs.f64(double %72)
%74 = fcmp ogt double %73, 2.500000e-03
br i1 %74, label %83, label %75
75: ; preds = %71
%76 = load double, double* %10
%77 = call double @llvm.fabs.f64(double %76)
%78 = fcmp ogt double %77, 2.500000e-03
br i1 %78, label %83, label %79
79: ; preds = %75
%80 = load double, double* %11
%81 = call double @llvm.fabs.f64(double %80)
%82 = fcmp ogt double %81, 2.500000e-03
br label %83
83: ; preds = %79, %75, %71
%84 = phi i1 [ true, %75 ], [ true, %71 ], [ %82, %79 ]
br i1 %84, label %23, label %85
85: ; preds = %83
%86 = load double, double* %9
%87 = load double, double* %10
%88 = load double, double* %11
%89 = load double, double* %11
%90 = fmul double %88, %89
%91 = fneg double %90
%92 = call double @llvm.fmuladd.f64(double %86, double %87, double %91)
store double %92, double* %12
%93 = load double, double* %9
%94 = load double, double* %10
%95 = fmul double %93, %94
%96 = load double, double* %11
%97 = fmul double %95, %96
store double %97, double* %13
%98 = load double, double* %12
%99 = call double @llvm.fmuladd.f64(double 0x3FA5555555555555, double %98, double -1.000000e-01)
%100 = load double, double* %13
%101 = call double @llvm.fmuladd.f64(double 0xBFB1745D1745D174, double %100, double %99)
%102 = load double, double* %12
%103 = call double @llvm.fmuladd.f64(double %101, double %102, double 1.000000e+00)
%104 = load double, double* %13
%105 = call double @llvm.fmuladd.f64(double 0x3FB2492492492492, double %104, double %103)
%106 = load double, double* %8
%107 = call double @sqrt(double %106)
%108 = fdiv double %105, %107
ret double %108
}

LLVM IR (-O2):
define double @carlson_elliptic_rf(double %0, double %1, double %2) {
%4 = insertelement <2 x double> poison, double %2, i64 0
%5 = insertelement <2 x double> %4, double %1, i64 1
br label %6
6: ; preds = %6, %3
%7 = phi double [ %0, %3 ], [ %18, %6 ]
%8 = phi <2 x double> [ %5, %3 ], [ %22, %6 ]
%9 = tail call double @sqrt(double %7)
%10 = extractelement <2 x double> %8, i64 1
%11 = tail call double @sqrt(double %10)
%12 = extractelement <2 x double> %8, i64 0
%13 = tail call double @sqrt(double %12)
%14 = fadd double %11, %13
%15 = fmul double %11, %13
%16 = tail call double @llvm.fmuladd.f64(double %9, double %14, double %15)
%17 = fadd double %7, %16
%18 = fmul double %17, 2.500000e-01
%19 = insertelement <2 x double> poison, double %16, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = fadd <2 x double> %8, %20
%22 = fmul <2 x double> %21, <double 2.500000e-01, double 2.500000e-01>
%23 = extractelement <2 x double> %22, i64 1
%24 = fadd double %18, %23
%25 = extractelement <2 x double> %22, i64 0
%26 = fadd double %25, %24
%27 = fmul double %26, 0x3FD5555555555555
%28 = fsub double %27, %18
%29 = fdiv double %28, %27
%30 = insertelement <2 x double> poison, double %27, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
%32 = fsub <2 x double> %31, %22
%33 = fdiv <2 x double> %32, %31
%34 = tail call double @llvm.fabs.f64(double %29)
%35 = fcmp ogt double %34, 2.500000e-03
%36 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %33)
%37 = fcmp ogt <2 x double> %36, <double 2.500000e-03, double 2.500000e-03>
%38 = extractelement <2 x i1> %37, i64 1
%39 = select i1 %35, i1 true, i1 %38
%40 = extractelement <2 x i1> %37, i64 0
%41 = select i1 %39, i1 true, i1 %40
br i1 %41, label %6, label %42
42: ; preds = %6
%43 = extractelement <2 x double> %33, i64 0
%44 = fneg double %43
%45 = fmul double %43, %44
%46 = extractelement <2 x double> %33, i64 1
%47 = tail call double @llvm.fmuladd.f64(double %29, double %46, double %45)
%48 = fmul double %29, %46
%49 = fmul double %43, %48
%50 = tail call double @llvm.fmuladd.f64(double %47, double 0x3FA5555555555555, double -1.000000e-01)
%51 = tail call double @llvm.fmuladd.f64(double %49, double 0xBFB1745D1745D174, double %50)
%52 = tail call double @llvm.fmuladd.f64(double %51, double %47, double 1.000000e+00)
%53 = tail call double @llvm.fmuladd.f64(double %49, double 0x3FB2492492492492, double %52)
%54 = tail call double @sqrt(double %27)
%55 = fdiv double %53, %54
ret double %55
}