#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 radius_from_curvature(double, double, double);
double radius_from_max_dimension(double, double, double);
double radius_from_min_dimension(double, double, double);
double radius_from_volume(double, double, double);
double radius_effective(int mode, double radius_equat_minor,
                        double radius_equat_major, double radius_polar) {
  switch (mode) {
  default:
  case 1:
    return radius_from_curvature(radius_equat_minor, radius_equat_major,
                                 radius_polar);
  case 2:
    return radius_from_volume(radius_equat_minor, radius_equat_major,
                              radius_polar);
  case 3:
    return radius_from_min_dimension(radius_equat_minor, radius_equat_major,
                                     radius_polar);
  case 4:
    return radius_from_max_dimension(radius_equat_minor, radius_equat_major,
                                     radius_polar);
  }
}


x86 assembly (clang, -O0):
<radius_effective>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x3,%eax
ja     1183 <radius_effective+0x43>
mov    -0x30(%rbp),%rax
lea    0xe86(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1188 <radius_effective+0x48>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1030 <radius_from_curvature@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11fb <radius_effective+0xbb>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1060 <radius_from_volume@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11fb <radius_effective+0xbb>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1050 <radius_from_min_dimension@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11fb <radius_effective+0xbb>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1040 <radius_from_max_dimension@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radius_effective>:
cmp    $0x2,%edi
je     1154 <radius_effective+0x14>
cmp    $0x3,%edi
je     1159 <radius_effective+0x19>
cmp    $0x4,%edi
jne    115e <radius_effective+0x1e>
jmp    1040 <radius_from_max_dimension@plt>
jmp    1060 <radius_from_volume@plt>
jmp    1050 <radius_from_min_dimension@plt>
jmp    1030 <radius_from_curvature@plt>

LLVM IR (-O0):
define double @radius_effective(i32 %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
%10 = load i32, i32* %6
switch i32 %10, label %11 [
i32 1, label %12
i32 2, label %17
i32 3, label %22
i32 4, label %27
]
11: ; preds = %4
br label %12
12: ; preds = %4, %11
%13 = load double, double* %7
%14 = load double, double* %8
%15 = load double, double* %9
%16 = call double @radius_from_curvature(double %13, double %14, double %15)
store double %16, double* %5
br label %32
17: ; preds = %4
%18 = load double, double* %7
%19 = load double, double* %8
%20 = load double, double* %9
%21 = call double @radius_from_volume(double %18, double %19, double %20)
store double %21, double* %5
br label %32
22: ; preds = %4
%23 = load double, double* %7
%24 = load double, double* %8
%25 = load double, double* %9
%26 = call double @radius_from_min_dimension(double %23, double %24, double %25)
store double %26, double* %5
br label %32
27: ; preds = %4
%28 = load double, double* %7
%29 = load double, double* %8
%30 = load double, double* %9
%31 = call double @radius_from_max_dimension(double %28, double %29, double %30)
store double %31, double* %5
br label %32
32: ; preds = %27, %22, %17, %12
%33 = load double, double* %5
ret double %33
}

LLVM IR (-O2):
define double @radius_effective(i32 %0, double %1, double %2, double %3) {
switch i32 %0, label %5 [
i32 4, label %11
i32 2, label %7
i32 3, label %9
]
5: ; preds = %4
%6 = tail call double @radius_from_curvature(double %1, double %2, double %3)
br label %13
7: ; preds = %4
%8 = tail call double @radius_from_volume(double %1, double %2, double %3)
br label %13
9: ; preds = %4
%10 = tail call double @radius_from_min_dimension(double %1, double %2, double %3)
br label %13
11: ; preds = %4
%12 = tail call double @radius_from_max_dimension(double %1, double %2, double %3)
br label %13
13: ; preds = %11, %9, %7, %5
%14 = phi double [ %6, %5 ], [ %10, %9 ], [ %8, %7 ], [ %12, %11 ]
ret double %14
}