#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 ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf) {
  int ch_bitrate, table;
  ch_bitrate = bitrate / nb_channels;
  if (!lsf) {
    if ((freq == 48000 && ch_bitrate >= 56) ||
        (ch_bitrate >= 56 && ch_bitrate <= 80))
      table = 0;
    else if (freq != 48000 && ch_bitrate >= 96)
      table = 1;
    else if (freq != 32000 && ch_bitrate <= 48)
      table = 2;
    else
      table = 3;
  } else {
    table = 4;
  }
  return table;
}


x86 assembly (clang, -O0):
<ff_mpa_l2_select_table>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11b7 <ff_mpa_l2_select_table+0xb7>
cmpl   $0xbb80,-0xc(%rbp)
jne    113b <ff_mpa_l2_select_table+0x3b>
cmpl   $0x38,-0x14(%rbp)
jge    114f <ff_mpa_l2_select_table+0x4f>
cmpl   $0x38,-0x14(%rbp)
jl     115b <ff_mpa_l2_select_table+0x5b>
cmpl   $0x50,-0x14(%rbp)
jg     115b <ff_mpa_l2_select_table+0x5b>
movl   $0x0,-0x18(%rbp)
jmp    11b2 <ff_mpa_l2_select_table+0xb2>
cmpl   $0xbb80,-0xc(%rbp)
je     117e <ff_mpa_l2_select_table+0x7e>
cmpl   $0x60,-0x14(%rbp)
jl     117e <ff_mpa_l2_select_table+0x7e>
movl   $0x1,-0x18(%rbp)
jmp    11ad <ff_mpa_l2_select_table+0xad>
cmpl   $0x7d00,-0xc(%rbp)
je     11a1 <ff_mpa_l2_select_table+0xa1>
cmpl   $0x30,-0x14(%rbp)
jg     11a1 <ff_mpa_l2_select_table+0xa1>
movl   $0x2,-0x18(%rbp)
jmp    11a8 <ff_mpa_l2_select_table+0xa8>
movl   $0x3,-0x18(%rbp)
jmp    11ad <ff_mpa_l2_select_table+0xad>
jmp    11b2 <ff_mpa_l2_select_table+0xb2>
jmp    11be <ff_mpa_l2_select_table+0xbe>
movl   $0x4,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff_mpa_l2_select_table>:
mov    %edx,%r8d
mov    %edi,%eax
cltd
idiv   %esi
mov    $0x4,%edx
test   %ecx,%ecx
je     1114 <ff_mpa_l2_select_table+0x14>
mov    %edx,%eax
ret
cmp    $0xbb80,%r8d
sete   %sil
cmp    $0x38,%eax
setge  %cl
xor    %edx,%edx
test   %cl,%sil
jne    1111 <ff_mpa_l2_select_table+0x11>
lea    -0x38(%rax),%ecx
cmp    $0x19,%ecx
jb     1111 <ff_mpa_l2_select_table+0x11>
cmp    $0xbb80,%r8d
je     1147 <ff_mpa_l2_select_table+0x47>
mov    $0x1,%edx
cmp    $0x5f,%eax
jg     1111 <ff_mpa_l2_select_table+0x11>
cmp    $0x7d00,%r8d
setne  %cl
cmp    $0x31,%eax
setl   %al
and    %cl,%al
movzbl %al,%edx
xor    $0x3,%edx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @ff_mpa_l2_select_table(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = sdiv i32 %11, %12
store i32 %13, i32* %9
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 0
br i1 %15, label %47, label %16
16: ; preds = %4
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 48000
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %9
%21 = icmp sge i32 %20, 56
br i1 %21, label %28, label %22
22: ; preds = %19, %16
%23 = load i32, i32* %9
%24 = icmp sge i32 %23, 56
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load i32, i32* %9
%27 = icmp sle i32 %26, 80
br i1 %27, label %28, label %29
28: ; preds = %25, %19
store i32 0, i32* %10
br label %46
29: ; preds = %25, %22
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 48000
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i32, i32* %9
%34 = icmp sge i32 %33, 96
br i1 %34, label %35, label %36
35: ; preds = %32
store i32 1, i32* %10
br label %45
36: ; preds = %32, %29
%37 = load i32, i32* %7
%38 = icmp ne i32 %37, 32000
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* %9
%41 = icmp sle i32 %40, 48
br i1 %41, label %42, label %43
42: ; preds = %39
store i32 2, i32* %10
br label %44
43: ; preds = %39, %36
store i32 3, i32* %10
br label %44
44: ; preds = %43, %42
br label %45
45: ; preds = %44, %35
br label %46
46: ; preds = %45, %28
br label %48
47: ; preds = %4
store i32 4, i32* %10
br label %48
48: ; preds = %47, %46
%49 = load i32, i32* %10
ret i32 %49
}

LLVM IR (-O2):
define i32 @ff_mpa_l2_select_table(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sdiv i32 %0, %1
%6 = icmp eq i32 %3, 0
br i1 %6, label %7, label %23
7: ; preds = %4
%8 = icmp eq i32 %2, 48000
%9 = icmp sgt i32 %5, 55
%10 = and i1 %8, %9
%11 = add i32 %5, -56
%12 = icmp ult i32 %11, 25
%13 = or i1 %10, %12
br i1 %13, label %23, label %14
14: ; preds = %7
%15 = icmp ne i32 %2, 48000
%16 = icmp sgt i32 %5, 95
%17 = and i1 %15, %16
br i1 %17, label %23, label %18
18: ; preds = %14
%19 = icmp ne i32 %2, 32000
%20 = icmp slt i32 %5, 49
%21 = and i1 %19, %20
%22 = select i1 %21, i32 2, i32 3
br label %23
23: ; preds = %4, %18, %14, %7
%24 = phi i32 [ 0, %7 ], [ 1, %14 ], [ %22, %18 ], [ 4, %4 ]
ret i32 %24
}