#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 */
float quad_easeIn(float, float, float, float);
float quad_easeInOut(float, float, float, float);
float quad_easeOut(float, float, float, float);
float sine_easeIn(float, float, float, float);
float sine_easeInOut(float, float, float, float);
float sine_easeOut(float, float, float, float);
float generic_ease(char ease_id, float t, float b, float c, float d) {
  switch (ease_id) {
  case 0:
    return quad_easeIn(t, b, c, d);
  case 1:
    return quad_easeOut(t, b, c, d);
  case 2:
    return quad_easeInOut(t, b, c, d);
  case 3:
    return sine_easeIn(t, b, c, d);
  case 4:
    return sine_easeOut(t, b, c, d);
  case 5:
    return sine_easeInOut(t, b, c, d);
  }
  return 0.0f;
}


x86 assembly (clang, -O0):
<generic_ease>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x5,%eax
ja     127b <generic_ease+0x11b>
mov    -0x20(%rbp),%rax
lea    0xe60(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1050 <quad_easeIn@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1283 <generic_ease+0x123>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1070 <quad_easeOut@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1283 <generic_ease+0x123>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1030 <quad_easeInOut@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1283 <generic_ease+0x123>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1040 <sine_easeIn@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1283 <generic_ease+0x123>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1080 <sine_easeOut@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1283 <generic_ease+0x123>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1060 <sine_easeInOut@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1283 <generic_ease+0x123>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generic_ease>:
cmp    $0x5,%edi
ja     117c <generic_ease+0x1c>
mov    %edi,%eax
lea    0xe92(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1050 <quad_easeIn@plt>
xorps  %xmm0,%xmm0
ret
jmp    1070 <quad_easeOut@plt>
jmp    1030 <quad_easeInOut@plt>
jmp    1040 <sine_easeIn@plt>
jmp    1080 <sine_easeOut@plt>
jmp    1060 <sine_easeInOut@plt>

LLVM IR (-O0):
define float @generic_ease(i8 signext %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca i8
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store i8 %0, i8* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
%12 = load i8, i8* %7
%13 = sext i8 %12 to i32
switch i32 %13, label %50 [
i32 0, label %14
i32 1, label %20
i32 2, label %26
i32 3, label %32
i32 4, label %38
i32 5, label %44
]
14: ; preds = %5
%15 = load float, float* %8
%16 = load float, float* %9
%17 = load float, float* %10
%18 = load float, float* %11
%19 = call float @quad_easeIn(float %15, float %16, float %17, float %18)
store float %19, float* %6
br label %51
20: ; preds = %5
%21 = load float, float* %8
%22 = load float, float* %9
%23 = load float, float* %10
%24 = load float, float* %11
%25 = call float @quad_easeOut(float %21, float %22, float %23, float %24)
store float %25, float* %6
br label %51
26: ; preds = %5
%27 = load float, float* %8
%28 = load float, float* %9
%29 = load float, float* %10
%30 = load float, float* %11
%31 = call float @quad_easeInOut(float %27, float %28, float %29, float %30)
store float %31, float* %6
br label %51
32: ; preds = %5
%33 = load float, float* %8
%34 = load float, float* %9
%35 = load float, float* %10
%36 = load float, float* %11
%37 = call float @sine_easeIn(float %33, float %34, float %35, float %36)
store float %37, float* %6
br label %51
38: ; preds = %5
%39 = load float, float* %8
%40 = load float, float* %9
%41 = load float, float* %10
%42 = load float, float* %11
%43 = call float @sine_easeOut(float %39, float %40, float %41, float %42)
store float %43, float* %6
br label %51
44: ; preds = %5
%45 = load float, float* %8
%46 = load float, float* %9
%47 = load float, float* %10
%48 = load float, float* %11
%49 = call float @sine_easeInOut(float %45, float %46, float %47, float %48)
store float %49, float* %6
br label %51
50: ; preds = %5
store float 0.000000e+00, float* %6
br label %51
51: ; preds = %50, %44, %38, %32, %26, %20, %14
%52 = load float, float* %6
ret float %52
}

LLVM IR (-O2):
define float @generic_ease(i8 signext %0, float %1, float %2, float %3, float %4) {
%6 = sext i8 %0 to i32
switch i32 %6, label %19 [
i32 0, label %7
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
]
7: ; preds = %5
%8 = tail call float @quad_easeIn(float %1, float %2, float %3, float %4)
br label %19
9: ; preds = %5
%10 = tail call float @quad_easeOut(float %1, float %2, float %3, float %4)
br label %19
11: ; preds = %5
%12 = tail call float @quad_easeInOut(float %1, float %2, float %3, float %4)
br label %19
13: ; preds = %5
%14 = tail call float @sine_easeIn(float %1, float %2, float %3, float %4)
br label %19
15: ; preds = %5
%16 = tail call float @sine_easeOut(float %1, float %2, float %3, float %4)
br label %19
17: ; preds = %5
%18 = tail call float @sine_easeInOut(float %1, float %2, float %3, float %4)
br label %19
19: ; preds = %5, %17, %15, %13, %11, %9, %7
%20 = phi float [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ 0.000000e+00, %5 ]
ret float %20
}