#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_rc(double x, double y) {
  double alamb, ave, s, w, xt, yt, ans;
  if (y > 0.0) {
    xt = x;
    yt = y;
    w = 1.0;
  } else {
    xt = x - y;
    yt = -y;
    w = sqrt(x) / sqrt(xt);
  }
  do {
    alamb = 2.0 * sqrt(xt) * sqrt(yt) + yt;
    xt = 0.25 * (xt + alamb);
    yt = 0.25 * (yt + alamb);
    ave = (1.0 / 3.0) * (xt + yt + yt);
    s = (yt - ave) / ave;
  } while (fabs(s) > 0.0012);
  ans = w *
        (1.0 +
         s * s * (0.3 + s * ((1.0 / 7.0) + s * (0.375 + s * (9.0 / 22.0))))) /
        sqrt(ave);
  return (ans);
}


x86 assembly (clang, -O0):
<carlson_elliptic_rc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115a <carlson_elliptic_rc+0x4a>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11b4 <carlson_elliptic_rc+0xa4>
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11b9 <carlson_elliptic_rc+0xa9>
movsd  -0x38(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe4a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x38(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xe03(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x40(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xde8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
addsd  -0x40(%rbp),%xmm1
addsd  -0x40(%rbp),%xmm1
movsd  0xdc0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movaps 0xddf(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xda3(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     11b9 <carlson_elliptic_rc+0xa9>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
movsd  0xd8b(%rip),%xmm5
mulsd  %xmm5,%xmm4
movsd  0xd87(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xd67(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd4f(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd17(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<carlson_elliptic_rc>:
sub    $0x28,%rsp
movapd %xmm1,%xmm2
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm1
jbe    1130 <carlson_elliptic_rc+0x20>
movsd  0xed6(%rip),%xmm1
movapd %xmm0,%xmm4
jmp    11a4 <carlson_elliptic_rc+0x94>
movapd %xmm0,%xmm4
subsd  %xmm2,%xmm4
xorpd  0xf00(%rip),%xmm2
ucomisd %xmm3,%xmm0
movsd  %xmm4,0x8(%rsp)
movapd %xmm2,0x10(%rsp)
jb     115b <carlson_elliptic_rc+0x4b>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    116a <carlson_elliptic_rc+0x5a>
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm4
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jb     117d <carlson_elliptic_rc+0x6d>
xorps  %xmm0,%xmm0
sqrtsd %xmm4,%xmm0
jmp    1196 <carlson_elliptic_rc+0x86>
movapd %xmm4,%xmm0
movsd  %xmm1,(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm4
movsd  (%rsp),%xmm1
xorpd  %xmm3,%xmm3
movapd 0x10(%rsp),%xmm2
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
jmp    1233 <carlson_elliptic_rc+0x123>
xchg   %ax,%ax
movapd %xmm2,%xmm0
movsd  %xmm5,0x20(%rsp)
call   1030 <sqrt@plt>
movsd  0x20(%rsp),%xmm5
movapd 0x10(%rsp),%xmm2
xorpd  %xmm3,%xmm3
movsd  0x8(%rsp),%xmm4
addsd  %xmm5,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm2,%xmm5
addsd  %xmm5,%xmm4
movsd  0xe1b(%rip),%xmm0
mulsd  %xmm0,%xmm4
addsd  %xmm2,%xmm5
mulsd  %xmm0,%xmm5
movapd %xmm4,%xmm0
addsd  %xmm5,%xmm0
addsd  %xmm5,%xmm0
mulsd  0xe03(%rip),%xmm0
movapd %xmm5,%xmm1
subsd  %xmm0,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
andpd  0xe2b(%rip),%xmm2
ucomisd 0xdeb(%rip),%xmm2
movapd %xmm5,%xmm2
jbe    128d <carlson_elliptic_rc+0x17d>
ucomisd %xmm3,%xmm4
movsd  %xmm4,0x8(%rsp)
movapd %xmm2,0x10(%rsp)
jb     1260 <carlson_elliptic_rc+0x150>
xorps  %xmm5,%xmm5
sqrtsd %xmm4,%xmm5
ucomisd %xmm3,%xmm2
jb     11b0 <carlson_elliptic_rc+0xa0>
jmp    1281 <carlson_elliptic_rc+0x171>
nopl   0x0(%rax,%rax,1)
movapd %xmm4,%xmm0
call   1030 <sqrt@plt>
movapd 0x10(%rsp),%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm5
ucomisd %xmm3,%xmm2
jb     11b0 <carlson_elliptic_rc+0xa0>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    11cf <carlson_elliptic_rc+0xbf>
movsd  0xd8b(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xd87(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xd83(%rip),%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm2
addsd  0xd7b(%rip),%xmm2
mulsd  %xmm1,%xmm3
mulsd  %xmm3,%xmm2
addsd  0xd33(%rip),%xmm2
movsd  (%rsp),%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm1,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12ea <carlson_elliptic_rc+0x1da>
sqrtsd %xmm0,%xmm0
jmp    12f9 <carlson_elliptic_rc+0x1e9>
movsd  %xmm2,(%rsp)
call   1030 <sqrt@plt>
movsd  (%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @carlson_elliptic_rc(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store double %0, double* %3
store double %1, double* %4
%12 = load double, double* %4
%13 = fcmp ogt double %12, 0.000000e+00
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load double, double* %3
store double %15, double* %9
%16 = load double, double* %4
store double %16, double* %10
store double 1.000000e+00, double* %8
br label %28
17: ; preds = %2
%18 = load double, double* %3
%19 = load double, double* %4
%20 = fsub double %18, %19
store double %20, double* %9
%21 = load double, double* %4
%22 = fneg double %21
store double %22, double* %10
%23 = load double, double* %3
%24 = call double @sqrt(double %23)
%25 = load double, double* %9
%26 = call double @sqrt(double %25)
%27 = fdiv double %24, %26
store double %27, double* %8
br label %28
28: ; preds = %17, %14
br label %29
29: ; preds = %56, %28
%30 = load double, double* %9
%31 = call double @sqrt(double %30)
%32 = fmul double 2.000000e+00, %31
%33 = load double, double* %10
%34 = call double @sqrt(double %33)
%35 = load double, double* %10
%36 = call double @llvm.fmuladd.f64(double %32, double %34, double %35)
store double %36, double* %5
%37 = load double, double* %9
%38 = load double, double* %5
%39 = fadd double %37, %38
%40 = fmul double 2.500000e-01, %39
store double %40, double* %9
%41 = load double, double* %10
%42 = load double, double* %5
%43 = fadd double %41, %42
%44 = fmul double 2.500000e-01, %43
store double %44, double* %10
%45 = load double, double* %9
%46 = load double, double* %10
%47 = fadd double %45, %46
%48 = load double, double* %10
%49 = fadd double %47, %48
%50 = fmul double 0x3FD5555555555555, %49
store double %50, double* %6
%51 = load double, double* %10
%52 = load double, double* %6
%53 = fsub double %51, %52
%54 = load double, double* %6
%55 = fdiv double %53, %54
store double %55, double* %7
br label %56
56: ; preds = %29
%57 = load double, double* %7
%58 = call double @llvm.fabs.f64(double %57)
%59 = fcmp ogt double %58, 1.200000e-03
br i1 %59, label %29, label %60
60: ; preds = %56
%61 = load double, double* %8
%62 = load double, double* %7
%63 = load double, double* %7
%64 = fmul double %62, %63
%65 = load double, double* %7
%66 = load double, double* %7
%67 = load double, double* %7
%68 = call double @llvm.fmuladd.f64(double %67, double 0x3FDA2E8BA2E8BA2F, double 3.750000e-01)
%69 = call double @llvm.fmuladd.f64(double %66, double %68, double 0x3FC2492492492492)
%70 = call double @llvm.fmuladd.f64(double %65, double %69, double 3.000000e-01)
%71 = call double @llvm.fmuladd.f64(double %64, double %70, double 1.000000e+00)
%72 = fmul double %61, %71
%73 = load double, double* %6
%74 = call double @sqrt(double %73)
%75 = fdiv double %72, %74
store double %75, double* %11
%76 = load double, double* %11
ret double %76
}

LLVM IR (-O2):
define double @carlson_elliptic_rc(double %0, double %1) {
%3 = fcmp ogt double %1, 0.000000e+00
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = fsub double %0, %1
%6 = fneg double %1
%7 = tail call double @sqrt(double %0)
%8 = tail call double @sqrt(double %5)
%9 = fdiv double %7, %8
br label %10
10: ; preds = %2, %4
%11 = phi double [ %5, %4 ], [ %0, %2 ]
%12 = phi double [ %6, %4 ], [ %1, %2 ]
%13 = phi double [ %9, %4 ], [ 1.000000e+00, %2 ]
br label %14
14: ; preds = %14, %10
%15 = phi double [ %11, %10 ], [ %22, %14 ]
%16 = phi double [ %12, %10 ], [ %24, %14 ]
%17 = tail call double @sqrt(double %15)
%18 = fmul double %17, 2.000000e+00
%19 = tail call double @sqrt(double %16)
%20 = tail call double @llvm.fmuladd.f64(double %18, double %19, double %16)
%21 = fadd double %15, %20
%22 = fmul double %21, 2.500000e-01
%23 = fadd double %16, %20
%24 = fmul double %23, 2.500000e-01
%25 = fadd double %22, %24
%26 = fadd double %24, %25
%27 = fmul double %26, 0x3FD5555555555555
%28 = fsub double %24, %27
%29 = fdiv double %28, %27
%30 = tail call double @llvm.fabs.f64(double %29)
%31 = fcmp ogt double %30, 1.200000e-03
br i1 %31, label %14, label %32
32: ; preds = %14
%33 = fmul double %29, %29
%34 = tail call double @llvm.fmuladd.f64(double %29, double 0x3FDA2E8BA2E8BA2F, double 3.750000e-01)
%35 = tail call double @llvm.fmuladd.f64(double %29, double %34, double 0x3FC2492492492492)
%36 = tail call double @llvm.fmuladd.f64(double %29, double %35, double 3.000000e-01)
%37 = tail call double @llvm.fmuladd.f64(double %33, double %36, double 1.000000e+00)
%38 = fmul double %13, %37
%39 = tail call double @sqrt(double %27)
%40 = fdiv double %38, %39
ret double %40
}