#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_rd(double, double, double);
double carlson_elliptic_rf(double, double, double);
double elliptic_incomplete_second(double sx, 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) -
          k2 * sx * s2x * carlson_elliptic_rd(c2x, 1.0 - p2, 1.0) / 3.0);
}


x86 assembly (clang, -O0):
<elliptic_incomplete_second>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb0(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe80(%rip),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xe73(%rip),%xmm2
call   1040 <carlson_elliptic_rf@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe48(%rip),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xe3b(%rip),%xmm2
call   1030 <carlson_elliptic_rd@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movsd  0xe10(%rip),%xmm3
divsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elliptic_incomplete_second>:
sub    $0x38,%rsp
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm4
mulsd  %xmm0,%xmm4
movsd  %xmm4,0x28(%rsp)
movsd  0xeb6(%rip),%xmm2
movapd %xmm2,%xmm0
subsd  %xmm4,%xmm0
movsd  %xmm0,0x20(%rsp)
mulsd  %xmm1,%xmm4
movapd %xmm2,%xmm1
subsd  %xmm4,%xmm1
movsd  %xmm1,0x18(%rsp)
call   1040 <carlson_elliptic_rf@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0xe5f(%rip),%xmm2
call   1030 <carlson_elliptic_rd@plt>
mulsd  0x8(%rsp),%xmm0
divsd  0xe54(%rip),%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @elliptic_incomplete_second(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %3
store double %1, double* %4
%9 = load double, double* %4
%10 = load double, double* %4
%11 = fmul double %9, %10
store double %11, double* %7
%12 = load double, double* %3
%13 = load double, double* %3
%14 = fmul double %12, %13
store double %14, double* %5
%15 = load double, double* %5
%16 = fsub double 1.000000e+00, %15
store double %16, double* %6
%17 = load double, double* %7
%18 = load double, double* %5
%19 = fmul double %17, %18
store double %19, double* %8
%20 = load double, double* %3
%21 = load double, double* %6
%22 = load double, double* %8
%23 = fsub double 1.000000e+00, %22
%24 = call double @carlson_elliptic_rf(double %21, double %23, double 1.000000e+00)
%25 = load double, double* %7
%26 = load double, double* %3
%27 = fmul double %25, %26
%28 = load double, double* %5
%29 = fmul double %27, %28
%30 = load double, double* %6
%31 = load double, double* %8
%32 = fsub double 1.000000e+00, %31
%33 = call double @carlson_elliptic_rd(double %30, double %32, double 1.000000e+00)
%34 = fmul double %29, %33
%35 = fdiv double %34, 3.000000e+00
%36 = fneg double %35
%37 = call double @llvm.fmuladd.f64(double %20, double %24, double %36)
ret double %37
}

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