#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 BsplnWght0(long, double);
double BsplnWght1(long, double);
double BsplnWght2(long, double);
double BsplnWght3(long, double);
double BsplnWght4(long, double);
double BsplnWght5(long, double);
double BsplnWght6(long, double);
double BsplnWght7(long, double);
double BsplnWght(int degree, long i, double x) {
  switch (degree) {
  case 0:
    return (BsplnWght0(i, x));
  case 1:
    return (BsplnWght1(i, x));
  case 2:
    return (BsplnWght2(i, x));
  case 3:
    return (BsplnWght3(i, x));
  case 4:
    return (BsplnWght4(i, x));
  case 5:
    return (BsplnWght5(i, x));
  case 6:
    return (BsplnWght6(i, x));
  case 7:
    return (BsplnWght7(i, x));
  default:
    return (0.0);
  }
}


x86 assembly (clang, -O0):
<BsplnWght>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0x7,%rax
ja     1279 <BsplnWght+0xf9>
mov    -0x28(%rbp),%rax
lea    0xe50(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   10a0 <BsplnWght0@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1060 <BsplnWght1@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1070 <BsplnWght2@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1030 <BsplnWght3@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1080 <BsplnWght4@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1040 <BsplnWght5@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1090 <BsplnWght6@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1050 <BsplnWght7@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnWght+0x101>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BsplnWght>:
cmp    $0x7,%edi
ja     119f <BsplnWght+0x1f>
mov    %edi,%eax
lea    0xe72(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rsi,%rdi
jmp    10a0 <BsplnWght0@plt>
xorps  %xmm0,%xmm0
ret
mov    %rsi,%rdi
jmp    1060 <BsplnWght1@plt>
mov    %rsi,%rdi
jmp    1070 <BsplnWght2@plt>
mov    %rsi,%rdi
jmp    1030 <BsplnWght3@plt>
mov    %rsi,%rdi
jmp    1080 <BsplnWght4@plt>
mov    %rsi,%rdi
jmp    1040 <BsplnWght5@plt>
mov    %rsi,%rdi
jmp    1090 <BsplnWght6@plt>
mov    %rsi,%rdi
jmp    1050 <BsplnWght7@plt>

LLVM IR (-O0):
define double @BsplnWght(i32 %0, i64 %1, double %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i64
%7 = alloca double
store i32 %0, i32* %5
store i64 %1, i64* %6
store double %2, double* %7
%8 = load i32, i32* %5
switch i32 %8, label %41 [
i32 0, label %9
i32 1, label %13
i32 2, label %17
i32 3, label %21
i32 4, label %25
i32 5, label %29
i32 6, label %33
i32 7, label %37
]
9: ; preds = %3
%10 = load i64, i64* %6
%11 = load double, double* %7
%12 = call double @BsplnWght0(i64 %10, double %11)
store double %12, double* %4
br label %42
13: ; preds = %3
%14 = load i64, i64* %6
%15 = load double, double* %7
%16 = call double @BsplnWght1(i64 %14, double %15)
store double %16, double* %4
br label %42
17: ; preds = %3
%18 = load i64, i64* %6
%19 = load double, double* %7
%20 = call double @BsplnWght2(i64 %18, double %19)
store double %20, double* %4
br label %42
21: ; preds = %3
%22 = load i64, i64* %6
%23 = load double, double* %7
%24 = call double @BsplnWght3(i64 %22, double %23)
store double %24, double* %4
br label %42
25: ; preds = %3
%26 = load i64, i64* %6
%27 = load double, double* %7
%28 = call double @BsplnWght4(i64 %26, double %27)
store double %28, double* %4
br label %42
29: ; preds = %3
%30 = load i64, i64* %6
%31 = load double, double* %7
%32 = call double @BsplnWght5(i64 %30, double %31)
store double %32, double* %4
br label %42
33: ; preds = %3
%34 = load i64, i64* %6
%35 = load double, double* %7
%36 = call double @BsplnWght6(i64 %34, double %35)
store double %36, double* %4
br label %42
37: ; preds = %3
%38 = load i64, i64* %6
%39 = load double, double* %7
%40 = call double @BsplnWght7(i64 %38, double %39)
store double %40, double* %4
br label %42
41: ; preds = %3
store double 0.000000e+00, double* %4
br label %42
42: ; preds = %41, %37, %33, %29, %25, %21, %17, %13, %9
%43 = load double, double* %4
ret double %43
}

LLVM IR (-O2):
define double @BsplnWght(i32 %0, i64 %1, double %2) {
switch i32 %0, label %20 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %16
i32 7, label %18
]
4: ; preds = %3
%5 = tail call double @BsplnWght0(i64 %1, double %2)
br label %20
6: ; preds = %3
%7 = tail call double @BsplnWght1(i64 %1, double %2)
br label %20
8: ; preds = %3
%9 = tail call double @BsplnWght2(i64 %1, double %2)
br label %20
10: ; preds = %3
%11 = tail call double @BsplnWght3(i64 %1, double %2)
br label %20
12: ; preds = %3
%13 = tail call double @BsplnWght4(i64 %1, double %2)
br label %20
14: ; preds = %3
%15 = tail call double @BsplnWght5(i64 %1, double %2)
br label %20
16: ; preds = %3
%17 = tail call double @BsplnWght6(i64 %1, double %2)
br label %20
18: ; preds = %3
%19 = tail call double @BsplnWght7(i64 %1, double %2)
br label %20
20: ; preds = %3, %18, %16, %14, %12, %10, %8, %6, %4
%21 = phi double [ %19, %18 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ 0.000000e+00, %3 ]
ret double %21
}