#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 filter_butter(float, float, float);
float filter_gauss(float, float, float);
float filter_hann(float, float, float);
float filter_norm(float, float, float);
float filter_rect(float, float, float);
float filter_tri(float, float, float);
float filter(int op, float k, float r, float w) {
  switch (op) {
  case 'R':
    return filter_rect(k, r, w);
  case 'T':
    return filter_tri(k, r, w);
  case 'H':
    return filter_hann(k, r, w);
  case 'g':
    return filter_norm(k, r, w);
  case 'G':
    return filter_gauss(k, r, w);
  case 'B':
    return filter_butter(k, r, w);
  }
  return 1.f;
}


x86 assembly (clang, -O0):
<filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffbe,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x25,%eax
ja     1257 <filter+0xf7>
mov    -0x20(%rbp),%rax
lea    0xe6a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1050 <filter_rect@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <filter+0x104>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1040 <filter_tri@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <filter+0x104>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1070 <filter_hann@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <filter+0x104>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1080 <filter_norm@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <filter+0x104>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1060 <filter_gauss@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <filter+0x104>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1030 <filter_butter@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1264 <filter+0x104>
movss  0xda1(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter>:
add    $0xffffffbe,%edi
cmp    $0x25,%edi
ja     117d <filter+0x1d>
lea    0xe95(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
jmp    1030 <filter_butter@plt>
movss  0xe7b(%rip),%xmm0
ret
jmp    1060 <filter_gauss@plt>
jmp    1070 <filter_hann@plt>
jmp    1050 <filter_rect@plt>
jmp    1040 <filter_tri@plt>
jmp    1080 <filter_norm@plt>

LLVM IR (-O0):
define float @filter(i32 %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca float
store i32 %0, i32* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
%10 = load i32, i32* %6
switch i32 %10, label %41 [
i32 82, label %11
i32 84, label %16
i32 72, label %21
i32 103, label %26
i32 71, label %31
i32 66, label %36
]
11: ; preds = %4
%12 = load float, float* %7
%13 = load float, float* %8
%14 = load float, float* %9
%15 = call float @filter_rect(float %12, float %13, float %14)
store float %15, float* %5
br label %42
16: ; preds = %4
%17 = load float, float* %7
%18 = load float, float* %8
%19 = load float, float* %9
%20 = call float @filter_tri(float %17, float %18, float %19)
store float %20, float* %5
br label %42
21: ; preds = %4
%22 = load float, float* %7
%23 = load float, float* %8
%24 = load float, float* %9
%25 = call float @filter_hann(float %22, float %23, float %24)
store float %25, float* %5
br label %42
26: ; preds = %4
%27 = load float, float* %7
%28 = load float, float* %8
%29 = load float, float* %9
%30 = call float @filter_norm(float %27, float %28, float %29)
store float %30, float* %5
br label %42
31: ; preds = %4
%32 = load float, float* %7
%33 = load float, float* %8
%34 = load float, float* %9
%35 = call float @filter_gauss(float %32, float %33, float %34)
store float %35, float* %5
br label %42
36: ; preds = %4
%37 = load float, float* %7
%38 = load float, float* %8
%39 = load float, float* %9
%40 = call float @filter_butter(float %37, float %38, float %39)
store float %40, float* %5
br label %42
41: ; preds = %4
store float 1.000000e+00, float* %5
br label %42
42: ; preds = %41, %36, %31, %26, %21, %16, %11
%43 = load float, float* %5
ret float %43
}

LLVM IR (-O2):
define float @filter(i32 %0, float %1, float %2, float %3) {
switch i32 %0, label %17 [
i32 82, label %5
i32 84, label %7
i32 72, label %9
i32 103, label %11
i32 71, label %13
i32 66, label %15
]
5: ; preds = %4
%6 = tail call float @filter_rect(float %1, float %2, float %3)
br label %17
7: ; preds = %4
%8 = tail call float @filter_tri(float %1, float %2, float %3)
br label %17
9: ; preds = %4
%10 = tail call float @filter_hann(float %1, float %2, float %3)
br label %17
11: ; preds = %4
%12 = tail call float @filter_norm(float %1, float %2, float %3)
br label %17
13: ; preds = %4
%14 = tail call float @filter_gauss(float %1, float %2, float %3)
br label %17
15: ; preds = %4
%16 = tail call float @filter_butter(float %1, float %2, float %3)
br label %17
17: ; preds = %4, %15, %13, %11, %9, %7, %5
%18 = phi float [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ 1.000000e+00, %4 ]
ret float %18
}