#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 const asin(double const);
double cbrt(double const);
double log(double const);
double sqrt(double);
double radius_from_curvature(double radius_equat_core, double x_core,
                             double thick_shell, double x_polar_shell) {
  if (1.0 == x_core && 1.0 == x_polar_shell)
    return radius_equat_core + thick_shell;
  if ((radius_equat_core + thick_shell) *
          (radius_equat_core * x_core + thick_shell * x_polar_shell) ==
      0.)
    return 0.;
  const double radius_equat_tot = radius_equat_core + thick_shell;
  const double radius_polar_tot =
      radius_equat_core * x_core + thick_shell * x_polar_shell;
  const double ratio = (radius_polar_tot < radius_equat_tot
                            ? radius_polar_tot / radius_equat_tot
                            : radius_equat_tot / radius_polar_tot);
  const double e1 = sqrt(1.0 - ratio * ratio);
  const double b1 = 1.0 + asin(e1) / (e1 * ratio);
  const double bL = (1.0 + e1) / (1.0 - e1);
  const double b2 = 1.0 + 0.5 * ratio * ratio / e1 * log(bL);
  const double delta = 0.75 * b1 * b2;
  const double ddd = 2.0 * (delta + 1.0) * radius_polar_tot * radius_equat_tot *
                     radius_equat_tot;
  return 0.5 * cbrt(ddd);
}


x86 assembly (clang, -O0):
<radius_from_curvature>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  0xe99(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    11a5 <radius_from_curvature+0x65>
jp     11a5 <radius_from_curvature+0x65>
movsd  0xe80(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    11a5 <radius_from_curvature+0x65>
jp     11a5 <radius_from_curvature+0x65>
movsd  -0x10(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    138f <radius_from_curvature+0x24f>
movsd  -0x10(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm2
mulsd  -0x28(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11ef <radius_from_curvature+0xaf>
jp     11ef <radius_from_curvature+0xaf>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    138f <radius_from_curvature+0x24f>
movsd  -0x10(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1247 <radius_from_curvature+0x107>
movsd  -0x38(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1256 <radius_from_curvature+0x116>
movsd  -0x30(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd73(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1030 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd42(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd31(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  0xd24(%rip),%xmm1
subsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xd16(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xcdc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xce3(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xcb4(%rip),%xmm1
addsd  -0x68(%rbp),%xmm1
movsd  0xcb7(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
call   1040 <cbrt@plt>
movaps %xmm0,%xmm1
movsd  0xc82(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radius_from_curvature>:
sub    $0x28,%rsp
movapd %xmm0,%xmm5
ucomisd 0xeb0(%rip),%xmm1
movapd %xmm0,%xmm4
addsd  %xmm2,%xmm4
jne    1171 <radius_from_curvature+0x31>
jp     1171 <radius_from_curvature+0x31>
ucomisd 0xe9c(%rip),%xmm3
jne    1171 <radius_from_curvature+0x31>
jp     1171 <radius_from_curvature+0x31>
movapd %xmm4,%xmm0
add    $0x28,%rsp
ret
mulsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm5
addsd  %xmm2,%xmm5
movapd %xmm4,%xmm1
mulsd  %xmm5,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1196 <radius_from_curvature+0x56>
jp     1196 <radius_from_curvature+0x56>
add    $0x28,%rsp
ret
ucomisd %xmm5,%xmm4
jbe    11a6 <radius_from_curvature+0x66>
movapd %xmm5,%xmm1
divsd  %xmm4,%xmm1
jmp    11ae <radius_from_curvature+0x6e>
movapd %xmm4,%xmm1
divsd  %xmm5,%xmm1
movsd  %xmm5,0x18(%rsp)
movsd  %xmm4,0x20(%rsp)
movsd  %xmm1,(%rsp)
mulsd  %xmm1,%xmm1
movsd  0xe35(%rip),%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11df <radius_from_curvature+0x9f>
sqrtsd %xmm0,%xmm0
jmp    11e4 <radius_from_curvature+0xa4>
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
call   1030 <asin@plt>
movapd %xmm0,%xmm1
movsd  (%rsp),%xmm2
movapd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm4
mulsd  %xmm4,%xmm0
divsd  %xmm0,%xmm1
movsd  0xdee(%rip),%xmm3
addsd  %xmm3,%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm4,%xmm0
addsd  %xmm3,%xmm0
movapd %xmm3,%xmm1
subsd  %xmm4,%xmm1
divsd  %xmm1,%xmm0
movapd %xmm2,%xmm1
mulsd  0xdcc(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm4,%xmm1
movsd  %xmm1,(%rsp)
call   1050 <log@plt>
mulsd  (%rsp),%xmm0
movsd  0xda5(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  0xda3(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm0
mulsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
call   1040 <cbrt@plt>
mulsd  0xd6e(%rip),%xmm0
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
define double @radius_from_curvature(double %0, double %1, double %2, double %3) {
%5 = fcmp oeq double %1, 1.000000e+00
%6 = fcmp oeq double %3, 1.000000e+00
%7 = and i1 %5, %6
%8 = fadd double %0, %2
br i1 %7, label %46, label %9
9: ; preds = %4
%10 = fmul double %2, %3
%11 = tail call double @llvm.fmuladd.f64(double %0, double %1, double %10)
%12 = fmul double %8, %11
%13 = fcmp oeq double %12, 0.000000e+00
br i1 %13, label %46, label %14
14: ; preds = %9
%15 = fcmp olt double %11, %8
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = fdiv double %11, %8
br label %20
18: ; preds = %14
%19 = fdiv double %8, %11
br label %20
20: ; preds = %18, %16
%21 = phi double [ %17, %16 ], [ %19, %18 ]
%22 = fneg double %21
%23 = tail call double @llvm.fmuladd.f64(double %22, double %21, double 1.000000e+00)
%24 = tail call double @sqrt(double %23)
%25 = tail call double @asin(double %24)
%26 = fmul double %21, %24
%27 = fdiv double %25, %26
%28 = fadd double %27, 1.000000e+00
%29 = fadd double %24, 1.000000e+00
%30 = fsub double 1.000000e+00, %24
%31 = fdiv double %29, %30
%32 = fmul double %21, 5.000000e-01
%33 = fmul double %21, %32
%34 = fdiv double %33, %24
%35 = tail call double @log(double %31)
%36 = tail call double @llvm.fmuladd.f64(double %34, double %35, double 1.000000e+00)
%37 = fmul double %28, 7.500000e-01
%38 = fmul double %36, %37
%39 = fadd double %38, 1.000000e+00
%40 = fmul double %39, 2.000000e+00
%41 = fmul double %11, %40
%42 = fmul double %8, %41
%43 = fmul double %8, %42
%44 = tail call double @cbrt(double %43)
%45 = fmul double %44, 5.000000e-01
br label %46
46: ; preds = %4, %9, %20
%47 = phi double [ %45, %20 ], [ 0.000000e+00, %9 ], [ %8, %4 ]
ret double %47
}