#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 bingham_dF1_table_get(int, int, int);
double bingham_dF2_table_get(int, int, int);
double bingham_dF3_table_get(int, int, int);
double bingham_dF_table_get(int a, int i, int j, int k) {
  switch (a) {
  case 0:
    return bingham_dF1_table_get(i, j, k);
  case 1:
    return bingham_dF2_table_get(i, j, k);
  }
  return bingham_dF3_table_get(i, j, k);
}


x86 assembly (clang, -O0):
<bingham_dF_table_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     1168 <bingham_dF_table_get+0x38>
jmp    1157 <bingham_dF_table_get+0x27>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
je     1180 <bingham_dF_table_get+0x50>
jmp    1198 <bingham_dF_table_get+0x68>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <bingham_dF1_table_get@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11ab <bingham_dF_table_get+0x7b>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <bingham_dF2_table_get@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11ab <bingham_dF_table_get+0x7b>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <bingham_dF3_table_get@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bingham_dF_table_get>:
cmp    $0x1,%edi
je     1144 <bingham_dF_table_get+0x14>
test   %edi,%edi
jne    114f <bingham_dF_table_get+0x1f>
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
jmp    1040 <bingham_dF1_table_get@plt>
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
jmp    1050 <bingham_dF2_table_get@plt>
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
jmp    1030 <bingham_dF3_table_get@plt>

LLVM IR (-O0):
define double @bingham_dF_table_get(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %6
switch i32 %10, label %21 [
i32 0, label %11
i32 1, label %16
]
11: ; preds = %4
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = call double @bingham_dF1_table_get(i32 %12, i32 %13, i32 %14)
store double %15, double* %5
br label %26
16: ; preds = %4
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = call double @bingham_dF2_table_get(i32 %17, i32 %18, i32 %19)
store double %20, double* %5
br label %26
21: ; preds = %4
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = load i32, i32* %9
%25 = call double @bingham_dF3_table_get(i32 %22, i32 %23, i32 %24)
store double %25, double* %5
br label %26
26: ; preds = %21, %16, %11
%27 = load double, double* %5
ret double %27
}

LLVM IR (-O2):
define double @bingham_dF_table_get(i32 %0, i32 %1, i32 %2, i32 %3) {
switch i32 %0, label %9 [
i32 0, label %5
i32 1, label %7
]
5: ; preds = %4
%6 = tail call double @bingham_dF1_table_get(i32 %1, i32 %2, i32 %3)
br label %11
7: ; preds = %4
%8 = tail call double @bingham_dF2_table_get(i32 %1, i32 %2, i32 %3)
br label %11
9: ; preds = %4
%10 = tail call double @bingham_dF3_table_get(i32 %1, i32 %2, i32 %3)
br label %11
11: ; preds = %9, %7, %5
%12 = phi double [ %10, %9 ], [ %8, %7 ], [ %6, %5 ]
ret double %12
}