int adau1761_check_sample_rate(unsigned long sample_rate) {
  const unsigned long adau1761_sampling_rates[] = {
      8000, 12000, 16000, 24000, 32000, 48000, 96000,
      7350, 11025, 14700, 22050, 29400, 44100, 88200};
  int i, size;
  size = sizeof(adau1761_sampling_rates) / sizeof(adau1761_sampling_rates[0]);
  for (i = 0; i < size; i++)
    if (sample_rate == adau1761_sampling_rates[i])
      return 0;
  return -1;
}


x86 assembly (clang, -O0):
<adau1761_check_sample_rate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0x70,%edx
call   1030 <memcpy@plt>
movl   $0xe,-0x88(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    1195 <adau1761_check_sample_rate+0x85>
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
cmp    -0x80(%rbp,%rcx,8),%rax
jne    117c <adau1761_check_sample_rate+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    119c <adau1761_check_sample_rate+0x8c>
jmp    1181 <adau1761_check_sample_rate+0x71>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1148 <adau1761_check_sample_rate+0x38>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adau1761_check_sample_rate>:
xor    %eax,%eax
cmp    $0x5dbf,%rdi
jg     1134 <adau1761_check_sample_rate+0x34>
cmp    $0x2edf,%rdi
jle    115a <adau1761_check_sample_rate+0x5a>
cmp    $0x3e7f,%rdi
jg     1194 <adau1761_check_sample_rate+0x94>
cmp    $0x2ee0,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
cmp    $0x396c,%rdi
jne    11be <adau1761_check_sample_rate+0xbe>
ret
cmp    $0xac43,%rdi
jle    1177 <adau1761_check_sample_rate+0x77>
cmp    $0x15887,%rdi
jg     11a8 <adau1761_check_sample_rate+0xa8>
cmp    $0xac44,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
cmp    $0xbb80,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
jmp    11be <adau1761_check_sample_rate+0xbe>
cmp    $0x1cb6,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
cmp    $0x1f40,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
cmp    $0x2b11,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
jmp    11be <adau1761_check_sample_rate+0xbe>
cmp    $0x5dc0,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
cmp    $0x72d8,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
cmp    $0x7d00,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
jmp    11be <adau1761_check_sample_rate+0xbe>
cmp    $0x3e80,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
cmp    $0x5622,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
jmp    11be <adau1761_check_sample_rate+0xbe>
cmp    $0x15888,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
cmp    $0x17700,%rdi
je     1133 <adau1761_check_sample_rate+0x33>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@__const.adau1761_check_sample_rate.adau1761_sampling_rates = [14 x i64] [i64 8000, i64 12000, i64 16000, i64 24000, i64 32000, i64 48000, i64 96000, i64 7350, i64 11025, i64 14700, i64 22050, i64 29400, i64 44100, i64 88200]
define i32 @adau1761_check_sample_rate(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca [14 x i64]
%5 = alloca i32
%6 = alloca i32
store i64 %0, i64* %3
%7 = bitcast [14 x i64]* %4 to i8*
store i32 14, i32* %6
store i32 0, i32* %5
br label %8
8: ; preds = %21, %1
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i64, i64* %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [14 x i64], [14 x i64]* %4, i64 0, i64 %15
%17 = load i64, i64* %16
%18 = icmp eq i64 %13, %17
br i1 %18, label %19, label %20
19: ; preds = %12
store i32 0, i32* %2
br label %25
20: ; preds = %12
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %8
24: ; preds = %8
store i32 -1, i32* %2
br label %25
25: ; preds = %24, %19
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @adau1761_check_sample_rate(i64 %0) {
switch i64 %0, label %2 [
i64 8000, label %3
i64 12000, label %3
i64 16000, label %3
i64 24000, label %3
i64 32000, label %3
i64 48000, label %3
i64 96000, label %3
i64 7350, label %3
i64 11025, label %3
i64 14700, label %3
i64 22050, label %3
i64 29400, label %3
i64 44100, label %3
i64 88200, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %1 ], [ -1, %2 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %4
}