#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, long);
int /*<<< orphan*/ stderr;
int SmpFrqIndex(long sRate, int *version) {
  if (sRate == 44100L) {
    *version = 1;
    return (0);
  } else if (sRate == 48000L) {
    *version = 1;
    return (1);
  } else if (sRate == 32000L) {
    *version = 1;
    return (2);
  } else if (sRate == 24000L) {
    *version = 0;
    return (1);
  } else if (sRate == 22050L) {
    *version = 0;
    return (0);
  } else if (sRate == 16000L) {
    *version = 0;
    return (2);
  } else {
    fprintf(stderr, "SmpFrqIndex: %ld is not a legal sample rate\n", sRate);
    return (-1);
  }
}


x86 assembly (clang, -O0):
<SmpFrqIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0xac44,-0x10(%rbp)
jne    1144 <SmpFrqIndex+0x34>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1218 <SmpFrqIndex+0x108>
cmpq   $0xbb80,-0x10(%rbp)
jne    1168 <SmpFrqIndex+0x58>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1218 <SmpFrqIndex+0x108>
cmpq   $0x7d00,-0x10(%rbp)
jne    118c <SmpFrqIndex+0x7c>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movl   $0x2,-0x4(%rbp)
jmp    1218 <SmpFrqIndex+0x108>
cmpq   $0x5dc0,-0x10(%rbp)
jne    11b0 <SmpFrqIndex+0xa0>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1218 <SmpFrqIndex+0x108>
cmpq   $0x5622,-0x10(%rbp)
jne    11d4 <SmpFrqIndex+0xc4>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1218 <SmpFrqIndex+0x108>
cmpq   $0x3e80,-0x10(%rbp)
jne    11f8 <SmpFrqIndex+0xe8>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x2,-0x4(%rbp)
jmp    1218 <SmpFrqIndex+0x108>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xdf4(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SmpFrqIndex>:
push   %rax
mov    %rdi,%rdx
cmp    $0x7cff,%rdi
jg     1140 <SmpFrqIndex+0x30>
cmp    $0x3e80,%rdx
je     1163 <SmpFrqIndex+0x53>
cmp    $0x5622,%rdx
je     116b <SmpFrqIndex+0x5b>
cmp    $0x5dc0,%rdx
jne    118f <SmpFrqIndex+0x7f>
movl   $0x0,(%rsi)
jmp    1188 <SmpFrqIndex+0x78>
cmp    $0x7d00,%rdx
je     1175 <SmpFrqIndex+0x65>
cmp    $0xbb80,%rdx
je     1182 <SmpFrqIndex+0x72>
cmp    $0xac44,%rdx
jne    118f <SmpFrqIndex+0x7f>
movl   $0x1,(%rsi)
jmp    1171 <SmpFrqIndex+0x61>
movl   $0x0,(%rsi)
jmp    117b <SmpFrqIndex+0x6b>
movl   $0x0,(%rsi)
xor    %eax,%eax
pop    %rcx
ret
movl   $0x1,(%rsi)
mov    $0x2,%eax
pop    %rcx
ret
movl   $0x1,(%rsi)
mov    $0x1,%eax
pop    %rcx
ret
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"SmpFrqIndex: %ld is not a legal sample rate\0A\00"
define i32 @SmpFrqIndex(i64 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32*
store i64 %0, i64* %4
store i32* %1, i32** %5
%6 = load i64, i64* %4
%7 = icmp eq i64 %6, 44100
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32*, i32** %5
store i32 1, i32* %9
store i32 0, i32* %3
br label %39
10: ; preds = %2
%11 = load i64, i64* %4
%12 = icmp eq i64 %11, 48000
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i32*, i32** %5
store i32 1, i32* %14
store i32 1, i32* %3
br label %39
15: ; preds = %10
%16 = load i64, i64* %4
%17 = icmp eq i64 %16, 32000
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = load i32*, i32** %5
store i32 1, i32* %19
store i32 2, i32* %3
br label %39
20: ; preds = %15
%21 = load i64, i64* %4
%22 = icmp eq i64 %21, 24000
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i32*, i32** %5
store i32 0, i32* %24
store i32 1, i32* %3
br label %39
25: ; preds = %20
%26 = load i64, i64* %4
%27 = icmp eq i64 %26, 22050
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = load i32*, i32** %5
store i32 0, i32* %29
store i32 0, i32* %3
br label %39
30: ; preds = %25
%31 = load i64, i64* %4
%32 = icmp eq i64 %31, 16000
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = load i32*, i32** %5
store i32 0, i32* %34
store i32 2, i32* %3
br label %39
35: ; preds = %30
%36 = load i32, i32* @stderr
%37 = load i64, i64* %4
%38 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 %37)
store i32 -1, i32* %3
br label %39
39: ; preds = %35, %33, %28, %23, %18, %13, %8
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"SmpFrqIndex: %ld is not a legal sample rate\0A\00"
define i32 @SmpFrqIndex(i64 %0, i32* nocapture writeonly %1) {
switch i64 %0, label %9 [
i64 44100, label %3
i64 48000, label %4
i64 32000, label %5
i64 24000, label %6
i64 22050, label %7
i64 16000, label %8
]
3: ; preds = %2
store i32 1, i32* %1
br label %12
4: ; preds = %2
store i32 1, i32* %1
br label %12
5: ; preds = %2
store i32 1, i32* %1
br label %12
6: ; preds = %2
store i32 0, i32* %1
br label %12
7: ; preds = %2
store i32 0, i32* %1
br label %12
8: ; preds = %2
store i32 0, i32* %1
br label %12
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %12
12: ; preds = %9, %8, %7, %6, %5, %4, %3
%13 = phi i32 [ 0, %3 ], [ 1, %4 ], [ 2, %5 ], [ 1, %6 ], [ 0, %7 ], [ 2, %8 ], [ -1, %9 ]
ret i32 %13
}