#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_crosssection(double, double, double, double);
double radius_from_excluded_volume(double, double, double, double, double,
                                   double);
double radius_from_volume(double, double, double, double, double, double);
double sqrt(scalar_t__);
scalar_t__ square(double);
double radius_effective(int mode, double length_a, double length_b,
                        double length_c, double thick_rim_a, double thick_rim_b,
                        double thick_rim_c) {
  switch (mode) {
  default:
  case 1:
    return radius_from_excluded_volume(length_a, length_b, length_c,
                                       thick_rim_a, thick_rim_b, thick_rim_c);
  case 2:
    return radius_from_volume(length_a, length_b, length_c, thick_rim_a,
                              thick_rim_b, thick_rim_c);
  case 3:
    return 0.5 * length_a + thick_rim_a;
  case 4:
    return 0.5 * length_b + thick_rim_b;
  case 5:
    return 0.5 * length_c + thick_rim_c;
  case 6:
    return radius_from_crosssection(length_a, length_b, thick_rim_a,
                                    thick_rim_b);
  case 7:
    return 0.5 * sqrt(square(length_a + 2.0 * thick_rim_a) +
                      square(length_b + 2.0 * thick_rim_b));
  case 8:
    return 0.5 * sqrt(square(length_a + 2.0 * thick_rim_a) +
                      square(length_b + 2.0 * thick_rim_b) +
                      square(length_c + 2.0 * thick_rim_c));
  }
}


x86 assembly (clang, -O0):
<radius_effective>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
movsd  %xmm5,-0x40(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x7,%eax
ja     11a2 <radius_effective+0x52>
mov    -0x48(%rbp),%rax
lea    0xe6f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    11a7 <radius_effective+0x57>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm5
call   1050 <radius_from_excluded_volume@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    135e <radius_effective+0x20e>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  -0x40(%rbp),%xmm5
call   1070 <radius_from_volume@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    135e <radius_effective+0x20e>
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  0xded(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    135e <radius_effective+0x20e>
movsd  -0x20(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  0xdc9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    135e <radius_effective+0x20e>
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  0xda5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    135e <radius_effective+0x20e>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
call   1030 <radius_from_crosssection@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    135e <radius_effective+0x20e>
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1040 <square@plt>
mov    %rax,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1040 <square@plt>
mov    -0x50(%rbp),%rdi
add    %rax,%rdi
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xd27(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    135e <radius_effective+0x20e>
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1040 <square@plt>
mov    %rax,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1040 <square@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1040 <square@plt>
mov    -0x58(%rbp),%rdi
add    %rax,%rdi
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xcab(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radius_effective>:
push   %rbx
sub    $0x20,%rsp
add    $0xfffffffe,%edi
cmp    $0x6,%edi
ja     1177 <radius_effective+0x27>
lea    0xea4(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
add    $0x20,%rsp
pop    %rbx
jmp    1070 <radius_from_volume@plt>
add    $0x20,%rsp
pop    %rbx
jmp    1050 <radius_from_excluded_volume@plt>
mulsd  0xe77(%rip),%xmm0
addsd  %xmm3,%xmm0
jmp    1266 <radius_effective+0x116>
mulsd  0xe66(%rip),%xmm1
addsd  %xmm4,%xmm1
movapd %xmm1,%xmm0
jmp    1266 <radius_effective+0x116>
mulsd  0xe51(%rip),%xmm2
addsd  %xmm5,%xmm2
movapd %xmm2,%xmm0
jmp    1266 <radius_effective+0x116>
movaps %xmm3,%xmm2
movaps %xmm4,%xmm3
add    $0x20,%rsp
pop    %rbx
jmp    1030 <radius_from_crosssection@plt>
addsd  %xmm3,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
movsd  %xmm4,(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1040 <square@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0x8(%rsp),%xmm0
jmp    124e <radius_effective+0xfe>
addsd  %xmm3,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
movsd  %xmm4,(%rsp)
movsd  %xmm5,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm2,0x18(%rsp)
call   1040 <square@plt>
mov    %rax,%rbx
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0x8(%rsp),%xmm0
call   1040 <square@plt>
add    %rax,%rbx
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0x18(%rsp),%xmm0
call   1040 <square@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1060 <sqrt@plt>
mulsd  0xd9a(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @radius_effective(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca double
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store i32 %0, i32* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
%16 = load i32, i32* %9
switch i32 %16, label %17 [
i32 1, label %18
i32 2, label %26
i32 3, label %34
i32 4, label %38
i32 5, label %42
i32 6, label %46
i32 7, label %52
i32 8, label %64
]
17: ; preds = %7
br label %18
18: ; preds = %7, %17
%19 = load double, double* %10
%20 = load double, double* %11
%21 = load double, double* %12
%22 = load double, double* %13
%23 = load double, double* %14
%24 = load double, double* %15
%25 = call double @radius_from_excluded_volume(double %19, double %20, double %21, double %22, double %23, double %24)
store double %25, double* %8
br label %81
26: ; preds = %7
%27 = load double, double* %10
%28 = load double, double* %11
%29 = load double, double* %12
%30 = load double, double* %13
%31 = load double, double* %14
%32 = load double, double* %15
%33 = call double @radius_from_volume(double %27, double %28, double %29, double %30, double %31, double %32)
store double %33, double* %8
br label %81
34: ; preds = %7
%35 = load double, double* %10
%36 = load double, double* %13
%37 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %35, double %36)
store double %37, double* %8
br label %81
38: ; preds = %7
%39 = load double, double* %11
%40 = load double, double* %14
%41 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %39, double %40)
store double %41, double* %8
br label %81
42: ; preds = %7
%43 = load double, double* %12
%44 = load double, double* %15
%45 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %43, double %44)
store double %45, double* %8
br label %81
46: ; preds = %7
%47 = load double, double* %10
%48 = load double, double* %11
%49 = load double, double* %13
%50 = load double, double* %14
%51 = call double @radius_from_crosssection(double %47, double %48, double %49, double %50)
store double %51, double* %8
br label %81
52: ; preds = %7
%53 = load double, double* %10
%54 = load double, double* %13
%55 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %54, double %53)
%56 = call i64 @square(double %55)
%57 = load double, double* %11
%58 = load double, double* %14
%59 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %58, double %57)
%60 = call i64 @square(double %59)
%61 = add nsw i64 %56, %60
%62 = call double @sqrt(i64 %61)
%63 = fmul double 5.000000e-01, %62
store double %63, double* %8
br label %81
64: ; preds = %7
%65 = load double, double* %10
%66 = load double, double* %13
%67 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %66, double %65)
%68 = call i64 @square(double %67)
%69 = load double, double* %11
%70 = load double, double* %14
%71 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %70, double %69)
%72 = call i64 @square(double %71)
%73 = add nsw i64 %68, %72
%74 = load double, double* %12
%75 = load double, double* %15
%76 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %75, double %74)
%77 = call i64 @square(double %76)
%78 = add nsw i64 %73, %77
%79 = call double @sqrt(i64 %78)
%80 = fmul double 5.000000e-01, %79
store double %80, double* %8
br label %81
81: ; preds = %64, %52, %46, %42, %38, %34, %26, %18
%82 = load double, double* %8
ret double %82
}

LLVM IR (-O2):
define double @radius_effective(i32 %0, double %1, double %2, double %3, double %4, double %5, double %6) {
switch i32 %0, label %8 [
i32 8, label %28
i32 2, label %10
i32 3, label %12
i32 4, label %14
i32 5, label %16
i32 6, label %18
i32 7, label %20
]
8: ; preds = %7
%9 = tail call double @radius_from_excluded_volume(double %1, double %2, double %3, double %4, double %5, double %6)
br label %39
10: ; preds = %7
%11 = tail call double @radius_from_volume(double %1, double %2, double %3, double %4, double %5, double %6)
br label %39
12: ; preds = %7
%13 = tail call double @llvm.fmuladd.f64(double %1, double 5.000000e-01, double %4)
br label %39
14: ; preds = %7
%15 = tail call double @llvm.fmuladd.f64(double %2, double 5.000000e-01, double %5)
br label %39
16: ; preds = %7
%17 = tail call double @llvm.fmuladd.f64(double %3, double 5.000000e-01, double %6)
br label %39
18: ; preds = %7
%19 = tail call double @radius_from_crosssection(double %1, double %2, double %4, double %5)
br label %39
20: ; preds = %7
%21 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double %1)
%22 = tail call i64 @square(double %21)
%23 = tail call double @llvm.fmuladd.f64(double %5, double 2.000000e+00, double %2)
%24 = tail call i64 @square(double %23)
%25 = add nsw i64 %24, %22
%26 = tail call double @sqrt(i64 %25)
%27 = fmul double %26, 5.000000e-01
br label %39
28: ; preds = %7
%29 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double %1)
%30 = tail call i64 @square(double %29)
%31 = tail call double @llvm.fmuladd.f64(double %5, double 2.000000e+00, double %2)
%32 = tail call i64 @square(double %31)
%33 = add nsw i64 %32, %30
%34 = tail call double @llvm.fmuladd.f64(double %6, double 2.000000e+00, double %3)
%35 = tail call i64 @square(double %34)
%36 = add nsw i64 %33, %35
%37 = tail call double @sqrt(i64 %36)
%38 = fmul double %37, 5.000000e-01
br label %39
39: ; preds = %28, %20, %18, %16, %14, %12, %10, %8
%40 = phi double [ %9, %8 ], [ %27, %20 ], [ %19, %18 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ], [ %38, %28 ]
ret double %40
}