#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_excluded_volume(double, double, double);
double radius_from_totallength(double, double, double);
double radius_from_volume(double, double, double);
double radius_effective(int mode, double radius, double radius_cap,
                        double length) {
  switch (mode) {
  default:
  case 1:
    return radius_from_excluded_volume(radius, radius_cap, length);
  case 2:
    return radius_from_volume(radius, radius_cap, length);
  case 3:
    return radius;
  case 4:
    return 0.5 * length;
  case 5:
    return radius_from_totallength(radius, radius_cap, length);
  }
}


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    $0x4,%eax
ja     1173 <radius_effective+0x43>
mov    -0x30(%rbp),%rax
lea    0xe9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1178 <radius_effective+0x48>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1030 <radius_from_excluded_volume@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11f3 <radius_effective+0xc3>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1050 <radius_from_volume@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11f3 <radius_effective+0xc3>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f3 <radius_effective+0xc3>
movsd  0xe35(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f3 <radius_effective+0xc3>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1040 <radius_from_totallength@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radius_effective>:
add    $0xfffffffe,%edi
cmp    $0x3,%edi
ja     114d <radius_effective+0x1d>
lea    0xec9(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
jmp    1050 <radius_from_volume@plt>
jmp    1030 <radius_from_excluded_volume@plt>
mulsd  0xea6(%rip),%xmm2
movapd %xmm2,%xmm0
ret
jmp    1040 <radius_from_totallength@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 %24
i32 5, 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_excluded_volume(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
store double %23, double* %5
br label %32
24: ; preds = %4
%25 = load double, double* %9
%26 = fmul double 5.000000e-01, %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_totallength(double %28, double %29, double %30)
store double %31, double* %5
br label %32
32: ; preds = %27, %24, %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 5, label %11
i32 2, label %7
i32 3, label %13
i32 4, label %9
]
5: ; preds = %4
%6 = tail call double @radius_from_excluded_volume(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 = fmul double %3, 5.000000e-01
br label %13
11: ; preds = %4
%12 = tail call double @radius_from_totallength(double %1, double %2, double %3)
br label %13
13: ; preds = %4, %11, %9, %7, %5
%14 = phi double [ %6, %5 ], [ %10, %9 ], [ %8, %7 ], [ %12, %11 ], [ %1, %4 ]
ret double %14
}