unsigned int mit_hrtf_availability(int azimuth, int elevation,
                                   unsigned int samplerate,
                                   unsigned int diffused) {
  if (azimuth > 180 || azimuth < -180 || elevation > 90 || elevation < -40 ||
      diffused > 1) {
    return 0;
  }
  switch (samplerate) {
  case 44100:
    return 128;
  case 48000:
    return 140;
  case 88200:
    return 256;
  case 96000:
    return 279;
  }
  return 0;
}


x86 assembly (clang, -O0):
<mit_hrtf_availability>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0xb4,-0x8(%rbp)
jg     1148 <mit_hrtf_availability+0x48>
cmpl   $0xffffff4c,-0x8(%rbp)
jl     1148 <mit_hrtf_availability+0x48>
cmpl   $0x5a,-0xc(%rbp)
jg     1148 <mit_hrtf_availability+0x48>
cmpl   $0xffffffd8,-0xc(%rbp)
jl     1148 <mit_hrtf_availability+0x48>
cmpl   $0x1,-0x14(%rbp)
jbe    1154 <mit_hrtf_availability+0x54>
movl   $0x0,-0x4(%rbp)
jmp    11da <mit_hrtf_availability+0xda>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0xac44,%eax
je     11a3 <mit_hrtf_availability+0xa3>
jmp    116a <mit_hrtf_availability+0x6a>
mov    -0x18(%rbp),%eax
sub    $0xbb80,%eax
je     11af <mit_hrtf_availability+0xaf>
jmp    117d <mit_hrtf_availability+0x7d>
mov    -0x18(%rbp),%eax
sub    $0x15888,%eax
je     11bb <mit_hrtf_availability+0xbb>
jmp    1190 <mit_hrtf_availability+0x90>
mov    -0x18(%rbp),%eax
sub    $0x17700,%eax
je     11c7 <mit_hrtf_availability+0xc7>
jmp    11d3 <mit_hrtf_availability+0xd3>
movl   $0x80,-0x4(%rbp)
jmp    11da <mit_hrtf_availability+0xda>
movl   $0x8c,-0x4(%rbp)
jmp    11da <mit_hrtf_availability+0xda>
movl   $0x100,-0x4(%rbp)
jmp    11da <mit_hrtf_availability+0xda>
movl   $0x117,-0x4(%rbp)
jmp    11da <mit_hrtf_availability+0xda>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mit_hrtf_availability>:
add    $0xffffff4b,%edi
xor    %eax,%eax
cmp    $0xfffffe97,%edi
jb     1153 <mit_hrtf_availability+0x53>
add    $0xffffffa5,%esi
cmp    $0xffffff7d,%esi
jb     1153 <mit_hrtf_availability+0x53>
cmp    $0x1,%ecx
ja     1153 <mit_hrtf_availability+0x53>
cmp    $0x15887,%edx
jg     113e <mit_hrtf_availability+0x3e>
cmp    $0xac44,%edx
je     1154 <mit_hrtf_availability+0x54>
cmp    $0xbb80,%edx
jne    1153 <mit_hrtf_availability+0x53>
mov    $0x8c,%eax
ret
cmp    $0x15888,%edx
je     115a <mit_hrtf_availability+0x5a>
cmp    $0x17700,%edx
jne    1153 <mit_hrtf_availability+0x53>
mov    $0x117,%eax
ret
mov    $0x80,%eax
ret
mov    $0x100,%eax
ret

LLVM IR (-O0):
define i32 @mit_hrtf_availability(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%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
%11 = icmp sgt i32 %10, 180
br i1 %11, label %24, label %12
12: ; preds = %4
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, -180
br i1 %14, label %24, label %15
15: ; preds = %12
%16 = load i32, i32* %7
%17 = icmp sgt i32 %16, 90
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, -40
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* %9
%23 = icmp ugt i32 %22, 1
br i1 %23, label %24, label %25
24: ; preds = %21, %18, %15, %12, %4
store i32 0, i32* %5
br label %32
25: ; preds = %21
%26 = load i32, i32* %8
switch i32 %26, label %31 [
i32 44100, label %27
i32 48000, label %28
i32 88200, label %29
i32 96000, label %30
]
27: ; preds = %25
store i32 128, i32* %5
br label %32
28: ; preds = %25
store i32 140, i32* %5
br label %32
29: ; preds = %25
store i32 256, i32* %5
br label %32
30: ; preds = %25
store i32 279, i32* %5
br label %32
31: ; preds = %25
store i32 0, i32* %5
br label %32
32: ; preds = %31, %30, %29, %28, %27, %24
%33 = load i32, i32* %5
ret i32 %33
}

LLVM IR (-O2):
define i32 @mit_hrtf_availability(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %0, -181
%6 = icmp ult i32 %5, -361
%7 = add i32 %1, -91
%8 = icmp ult i32 %7, -131
%9 = or i1 %6, %8
%10 = icmp ugt i32 %3, 1
%11 = or i1 %9, %10
br i1 %11, label %17, label %12
12: ; preds = %4
switch i32 %2, label %16 [
i32 44100, label %17
i32 48000, label %13
i32 88200, label %14
i32 96000, label %15
]
13: ; preds = %12
br label %17
14: ; preds = %12
br label %17
15: ; preds = %12
br label %17
16: ; preds = %12
br label %17
17: ; preds = %12, %4, %16, %15, %14, %13
%18 = phi i32 [ 0, %16 ], [ 279, %15 ], [ 256, %14 ], [ 140, %13 ], [ 0, %4 ], [ 128, %12 ]
ret i32 %18
}