#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 carlson_elliptic_rf(double, double, double);
double carlson_elliptic_rj(double, double, double, double);
double elliptic_incomplete_third(double sx, double en, double ak) {
  double s2x, c2x, k2, p2;
  k2 = ak * ak;
  s2x = sx * sx;
  c2x = 1.0 - s2x;
  p2 = k2 * s2x;
  return (sx * carlson_elliptic_rf(c2x, 1.0 - p2, 1.0) +
          en * sx * s2x *
              carlson_elliptic_rj(c2x, 1.0 - p2, 1.0, 1.0 - en * s2x) / 3.0);
}


x86 assembly (clang, -O0):
<elliptic_incomplete_third>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeab(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe7b(%rip),%xmm1
subsd  -0x38(%rbp),%xmm1
movsd  0xe6e(%rip),%xmm2
call   1030 <carlson_elliptic_rf@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe43(%rip),%xmm1
subsd  -0x38(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm2
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm2,%xmm3
movsd  0xe11(%rip),%xmm2
addsd  %xmm2,%xmm3
movsd  0xe05(%rip),%xmm2
call   1040 <carlson_elliptic_rj@plt>
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movsd  0xdda(%rip),%xmm3
divsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elliptic_incomplete_third>:
sub    $0x38,%rsp
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,(%rsp)
mulsd  %xmm2,%xmm2
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xebb(%rip),%xmm3
movapd %xmm3,%xmm4
subsd  %xmm0,%xmm4
movsd  %xmm4,0x20(%rsp)
mulsd  %xmm0,%xmm2
movapd %xmm3,%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,0x18(%rsp)
movapd %xmm4,%xmm0
movapd %xmm3,%xmm2
call   1030 <carlson_elliptic_rf@plt>
movsd  %xmm0,0x30(%rsp)
movsd  (%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
mulsd  %xmm0,%xmm2
movsd  0xe5d(%rip),%xmm4
movapd %xmm4,%xmm3
subsd  %xmm2,%xmm3
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movapd %xmm4,%xmm2
call   1040 <carlson_elliptic_rj@plt>
mulsd  0x10(%rsp),%xmm0
divsd  0xe3a(%rip),%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  (%rsp),%xmm1
addsd  %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @elliptic_incomplete_third(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
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%11 = load double, double* %6
%12 = load double, double* %6
%13 = fmul double %11, %12
store double %13, double* %9
%14 = load double, double* %4
%15 = load double, double* %4
%16 = fmul double %14, %15
store double %16, double* %7
%17 = load double, double* %7
%18 = fsub double 1.000000e+00, %17
store double %18, double* %8
%19 = load double, double* %9
%20 = load double, double* %7
%21 = fmul double %19, %20
store double %21, double* %10
%22 = load double, double* %4
%23 = load double, double* %8
%24 = load double, double* %10
%25 = fsub double 1.000000e+00, %24
%26 = call double @carlson_elliptic_rf(double %23, double %25, double 1.000000e+00)
%27 = load double, double* %5
%28 = load double, double* %4
%29 = fmul double %27, %28
%30 = load double, double* %7
%31 = fmul double %29, %30
%32 = load double, double* %8
%33 = load double, double* %10
%34 = fsub double 1.000000e+00, %33
%35 = load double, double* %5
%36 = load double, double* %7
%37 = fneg double %35
%38 = call double @llvm.fmuladd.f64(double %37, double %36, double 1.000000e+00)
%39 = call double @carlson_elliptic_rj(double %32, double %34, double 1.000000e+00, double %38)
%40 = fmul double %31, %39
%41 = fdiv double %40, 3.000000e+00
%42 = call double @llvm.fmuladd.f64(double %22, double %26, double %41)
ret double %42
}

LLVM IR (-O2):
define double @elliptic_incomplete_third(double %0, double %1, double %2) {
%4 = fmul double %2, %2
%5 = fmul double %0, %0
%6 = fsub double 1.000000e+00, %5
%7 = fmul double %5, %4
%8 = fsub double 1.000000e+00, %7
%9 = tail call double @carlson_elliptic_rf(double %6, double %8, double 1.000000e+00)
%10 = fmul double %0, %1
%11 = fmul double %5, %10
%12 = fneg double %1
%13 = tail call double @llvm.fmuladd.f64(double %12, double %5, double 1.000000e+00)
%14 = tail call double @carlson_elliptic_rj(double %6, double %8, double 1.000000e+00, double %13)
%15 = fmul double %11, %14
%16 = fdiv double %15, 3.000000e+00
%17 = tail call double @llvm.fmuladd.f64(double %0, double %9, double %16)
ret double %17
}