#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 BsplnDDWght0(long, double);
double BsplnDDWght1(long, double);
double BsplnDDWght2(long, double);
double BsplnDDWght3(long, double);
double BsplnDDWght4(long, double);
double BsplnDDWght5(long, double);
double BsplnDDWght6(long, double);
double BsplnDDWght7(long, double);
double BsplnDDWght(int degree, long i, double x) {
  switch (degree) {
  case 0:
    return (BsplnDDWght0(i, x));
  case 1:
    return (BsplnDDWght1(i, x));
  case 2:
    return (BsplnDDWght2(i, x));
  case 3:
    return (BsplnDDWght3(i, x));
  case 4:
    return (BsplnDDWght4(i, x));
  case 5:
    return (BsplnDDWght5(i, x));
  case 6:
    return (BsplnDDWght6(i, x));
  case 7:
    return (BsplnDDWght7(i, x));
  default:
    return (0.0);
  }
}


x86 assembly (clang, -O0):
<BsplnDDWght>:
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 <BsplnDDWght+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 <BsplnDDWght0@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnDDWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1030 <BsplnDDWght1@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnDDWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1070 <BsplnDDWght2@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnDDWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1040 <BsplnDDWght3@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnDDWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1080 <BsplnDDWght4@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnDDWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1060 <BsplnDDWght5@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnDDWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1090 <BsplnDDWght6@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnDDWght+0x101>
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1050 <BsplnDDWght7@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1281 <BsplnDDWght+0x101>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BsplnDDWght>:
cmp    $0x7,%edi
ja     119f <BsplnDDWght+0x1f>
mov    %edi,%eax
lea    0xe72(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rsi,%rdi
jmp    10a0 <BsplnDDWght0@plt>
xorps  %xmm0,%xmm0
ret
mov    %rsi,%rdi
jmp    1030 <BsplnDDWght1@plt>
mov    %rsi,%rdi
jmp    1070 <BsplnDDWght2@plt>
mov    %rsi,%rdi
jmp    1040 <BsplnDDWght3@plt>
mov    %rsi,%rdi
jmp    1080 <BsplnDDWght4@plt>
mov    %rsi,%rdi
jmp    1060 <BsplnDDWght5@plt>
mov    %rsi,%rdi
jmp    1090 <BsplnDDWght6@plt>
mov    %rsi,%rdi
jmp    1050 <BsplnDDWght7@plt>

LLVM IR (-O0):
define double @BsplnDDWght(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 @BsplnDDWght0(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 @BsplnDDWght1(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 @BsplnDDWght2(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 @BsplnDDWght3(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 @BsplnDDWght4(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 @BsplnDDWght5(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 @BsplnDDWght6(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 @BsplnDDWght7(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 @BsplnDDWght(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 @BsplnDDWght0(i64 %1, double %2)
br label %20
6: ; preds = %3
%7 = tail call double @BsplnDDWght1(i64 %1, double %2)
br label %20
8: ; preds = %3
%9 = tail call double @BsplnDDWght2(i64 %1, double %2)
br label %20
10: ; preds = %3
%11 = tail call double @BsplnDDWght3(i64 %1, double %2)
br label %20
12: ; preds = %3
%13 = tail call double @BsplnDDWght4(i64 %1, double %2)
br label %20
14: ; preds = %3
%15 = tail call double @BsplnDDWght5(i64 %1, double %2)
br label %20
16: ; preds = %3
%17 = tail call double @BsplnDDWght6(i64 %1, double %2)
br label %20
18: ; preds = %3
%19 = tail call double @BsplnDDWght7(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
}