unsigned int mit_hrtf_availability(int azimuth, int elevation,
                                   unsigned int samplerate,
                                   unsigned int diffused) {
  if (elevation > 90 || elevation < -40)
    return 0;
  if (azimuth > 180 || azimuth < -180)
    return 0;
  if (diffused > 1)
    return 0;
  if (samplerate == 44100)
    return 128;
  else if (samplerate == 48000)
    return 140;
  else if (samplerate == 88200)
    return 256;
  else if (samplerate == 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   $0x5a,-0xc(%rbp)
jg     1124 <mit_hrtf_availability+0x24>
cmpl   $0xffffffd8,-0xc(%rbp)
jge    1130 <mit_hrtf_availability+0x30>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <mit_hrtf_availability+0xe6>
cmpl   $0xb4,-0x8(%rbp)
jg     114a <mit_hrtf_availability+0x4a>
cmpl   $0xffffff4c,-0x8(%rbp)
jge    1156 <mit_hrtf_availability+0x56>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <mit_hrtf_availability+0xe6>
cmpl   $0x1,-0x14(%rbp)
jbe    116c <mit_hrtf_availability+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <mit_hrtf_availability+0xe6>
cmpl   $0xac44,-0x10(%rbp)
jne    1185 <mit_hrtf_availability+0x85>
movl   $0x80,-0x4(%rbp)
jmp    11e6 <mit_hrtf_availability+0xe6>
cmpl   $0xbb80,-0x10(%rbp)
jne    119e <mit_hrtf_availability+0x9e>
movl   $0x8c,-0x4(%rbp)
jmp    11e6 <mit_hrtf_availability+0xe6>
cmpl   $0x15888,-0x10(%rbp)
jne    11b7 <mit_hrtf_availability+0xb7>
movl   $0x100,-0x4(%rbp)
jmp    11e6 <mit_hrtf_availability+0xe6>
cmpl   $0x17700,-0x10(%rbp)
jne    11d0 <mit_hrtf_availability+0xd0>
movl   $0x117,-0x4(%rbp)
jmp    11e6 <mit_hrtf_availability+0xe6>
jmp    11d5 <mit_hrtf_availability+0xd5>
jmp    11da <mit_hrtf_availability+0xda>
jmp    11df <mit_hrtf_availability+0xdf>
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* %7
%11 = icmp sgt i32 %10, 90
br i1 %11, label %15, label %12
12: ; preds = %4
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, -40
br i1 %14, label %15, label %16
15: ; preds = %12, %4
store i32 0, i32* %5
br label %47
16: ; preds = %12
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 180
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, -180
br i1 %21, label %22, label %23
22: ; preds = %19, %16
store i32 0, i32* %5
br label %47
23: ; preds = %19
%24 = load i32, i32* %9
%25 = icmp ugt i32 %24, 1
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 0, i32* %5
br label %47
27: ; preds = %23
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 44100
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 128, i32* %5
br label %47
31: ; preds = %27
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, 48000
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 140, i32* %5
br label %47
35: ; preds = %31
%36 = load i32, i32* %8
%37 = icmp eq i32 %36, 88200
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 256, i32* %5
br label %47
39: ; preds = %35
%40 = load i32, i32* %8
%41 = icmp eq i32 %40, 96000
br i1 %41, label %42, label %43
42: ; preds = %39
store i32 279, i32* %5
br label %47
43: ; preds = %39
br label %44
44: ; preds = %43
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45
store i32 0, i32* %5
br label %47
47: ; preds = %46, %42, %38, %34, %30, %26, %22, %15
%48 = load i32, i32* %5
ret i32 %48
}

LLVM IR (-O2):
define i32 @mit_hrtf_availability(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %1, -91
%6 = icmp ult i32 %5, -131
%7 = add i32 %0, -181
%8 = icmp ult i32 %7, -361
%9 = or i1 %8, %6
%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 [ 140, %13 ], [ 256, %14 ], [ 279, %15 ], [ 0, %16 ], [ 0, %4 ], [ 128, %12 ]
ret i32 %18
}