#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 */
size_t get_sr_index(unsigned int);
unsigned char qmf_stop_channel(unsigned char bs_stop_freq,
                               unsigned int sample_rate, unsigned char k0) {
  if (bs_stop_freq == 15) {
    return (((64) < (k0 * 3)) ? (64) : (k0 * 3));
  } else if (bs_stop_freq == 14) {
    return (((64) < (k0 * 2)) ? (64) : (k0 * 2));
  } else {
    static const unsigned char stopMinTable[12] = {13, 15, 20, 21, 23, 32,
                                                   32, 35, 48, 64, 70, 96};
    static const signed char offset[12][14] = {
        {0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51},
        {0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49},
        {0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44},
        {0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43},
        {0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41},
        {0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32},
        {0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32},
        {0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29},
        {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16},
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
        {0, -1, -2, -3, -4, -5, -6, -6, -6, -6, -6, -6, -6, -6},
        {0, -3, -6, -9, -12, -15, -18, -20, -22, -24, -26, -28, -30, -32}};
    unsigned char stopMin = stopMinTable[get_sr_index(sample_rate)];
    return (((64) < (stopMin +
                     offset[get_sr_index(sample_rate)]
                           [(((bs_stop_freq) < (13)) ? (bs_stop_freq) : (13))]))
                ? (64)
                : (stopMin +
                   offset[get_sr_index(sample_rate)]
                         [(((bs_stop_freq) < (13)) ? (bs_stop_freq) : (13))]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<qmf_stop_channel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %dl,%al
mov    %dil,%cl
mov    %cl,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0xf,%eax
jne    1169 <qmf_stop_channel+0x59>
movzbl -0x9(%rbp),%eax
imul   $0x3,%eax,%ecx
mov    $0x40,%eax
cmp    %ecx,%eax
jge    1154 <qmf_stop_channel+0x44>
mov    $0x40,%eax
mov    %eax,-0x10(%rbp)
jmp    115e <qmf_stop_channel+0x4e>
movzbl -0x9(%rbp),%eax
imul   $0x3,%eax,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %al,-0x1(%rbp)
jmp    12a1 <qmf_stop_channel+0x191>
movzbl -0x2(%rbp),%eax
cmp    $0xe,%eax
jne    11ac <qmf_stop_channel+0x9c>
movzbl -0x9(%rbp),%ecx
shl    $0x1,%ecx
mov    $0x40,%eax
cmp    %ecx,%eax
jge    1197 <qmf_stop_channel+0x87>
mov    $0x40,%eax
mov    %eax,-0x14(%rbp)
jmp    11a1 <qmf_stop_channel+0x91>
movzbl -0x9(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %al,-0x1(%rbp)
jmp    12a1 <qmf_stop_channel+0x191>
mov    -0x8(%rbp),%edi
call   1030 <get_sr_index@plt>
mov    %rax,%rcx
lea    0xe42(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <get_sr_index@plt>
mov    %rax,%rcx
lea    0xe33(%rip),%rax
imul   $0xe,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0xd,%eax
jge    1201 <qmf_stop_channel+0xf1>
movzbl -0x2(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    120e <qmf_stop_channel+0xfe>
mov    $0xd,%eax
mov    %eax,-0x28(%rbp)
jmp    120e <qmf_stop_channel+0xfe>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%edx
movslq %edx,%rdx
movsbl (%rax,%rdx,1),%eax
add    %eax,%ecx
mov    $0x40,%eax
cmp    %ecx,%eax
jge    123b <qmf_stop_channel+0x12b>
mov    $0x40,%eax
mov    %eax,-0x2c(%rbp)
jmp    129b <qmf_stop_channel+0x18b>
movzbl -0xa(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <get_sr_index@plt>
mov    %rax,%rcx
lea    0xdbc(%rip),%rax
imul   $0xe,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0xd,%eax
jge    1278 <qmf_stop_channel+0x168>
movzbl -0x2(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    1285 <qmf_stop_channel+0x175>
mov    $0xd,%eax
mov    %eax,-0x40(%rbp)
jmp    1285 <qmf_stop_channel+0x175>
mov    -0x3c(%rbp),%eax
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qmf_stop_channel>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
cmp    $0xe,%bpl
je     112d <qmf_stop_channel+0x1d>
cmp    $0xf,%bpl
jne    113f <qmf_stop_channel+0x2f>
movzbl %dl,%eax
lea    (%rax,%rax,2),%ecx
jmp    1132 <qmf_stop_channel+0x22>
movzbl %dl,%ecx
add    %ecx,%ecx
cmp    $0x40,%ecx
mov    $0x40,%eax
cmovb  %ecx,%eax
jmp    11ac <qmf_stop_channel+0x9c>
mov    %esi,%ebx
mov    %esi,%edi
call   1030 <get_sr_index@plt>
lea    0xeb1(%rip),%rcx
movzbl (%rax,%rcx,1),%r14d
mov    %ebx,%edi
call   1030 <get_sr_index@plt>
cmp    $0xd,%ebp
mov    $0xd,%r15d
cmovb  %ebp,%r15d
mov    %rax,%rcx
shl    $0x4,%rcx
sub    %rax,%rcx
sub    %rax,%rcx
lea    0xe94(%rip),%rbp
add    %rbp,%rcx
movsbl (%r15,%rcx,1),%ecx
add    %r14d,%ecx
mov    $0x40,%al
cmp    $0x40,%ecx
jg     11ac <qmf_stop_channel+0x9c>
mov    %ebx,%edi
call   1030 <get_sr_index@plt>
mov    %rax,%rcx
shl    $0x4,%rcx
sub    %rax,%rcx
sub    %rax,%rcx
add    %rcx,%rbp
add    (%r15,%rbp,1),%r14b
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@qmf_stop_channel.stopMinTable = internal constant [12 x i8] c"\0D\0F\14\15\17@F`"
@qmf_stop_channel.offset = internal constant [12 x [14 x i8]] [[14 x i8] c"\00\02\04\06\08\0B\0E\12\16\1A\1F%,3", [14 x i8] c"\00\02\04\06\08\0B\0E\12\16\1A\1F$*1", [14 x i8] c"\00\02\04\06\08\0B\0E\11\15\19\1D\22',", [14 x i8] c"\00\02\04\06\08\0B\0E\11\14\18\1C!&+", [14 x i8] c"\00\02\04\06\08\0B\0E\11\14\18\1C $)", [14 x i8] c"\00\02\04\06\08\0A\0C\0E\11\14\17\1A\1D ", [14 x i8] c"\00\02\04\06\08\0A\0C\0E\11\14\17\1A\1D ", [14 x i8] c"\00\01\03\05\07\09\0B\0D\0F\11\14\17\1A\1D", [14 x i8] c"\00\01\02\03\04\05\06\07\08\09\0A\0C\0E\10", [14 x i8] zeroinitializer, [14 x i8] c"\00\FF\FE\FD\FC\FB\FA\FA\FA\FA\FA\FA\FA\FA", [14 x i8] c"\00\FD\FA\F7\F4\F1\EE\EC\EA\E8\E6\E4\E2\E0"]
define zeroext i8 @qmf_stop_channel(i8 zeroext %0, i32 %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store i8 %0, i8* %5
store i32 %1, i32* %6
store i8 %2, i8* %7
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 15
br i1 %11, label %12, label %25
12: ; preds = %3
%13 = load i8, i8* %7
%14 = zext i8 %13 to i32
%15 = mul nsw i32 %14, 3
%16 = icmp slt i32 64, %15
br i1 %16, label %17, label %18
17: ; preds = %12
br label %22
18: ; preds = %12
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = mul nsw i32 %20, 3
br label %22
22: ; preds = %18, %17
%23 = phi i32 [ 64, %17 ], [ %21, %18 ]
%24 = trunc i32 %23 to i8
store i8 %24, i8* %4
br label %91
25: ; preds = %3
%26 = load i8, i8* %5
%27 = zext i8 %26 to i32
%28 = icmp eq i32 %27, 14
br i1 %28, label %29, label %42
29: ; preds = %25
%30 = load i8, i8* %7
%31 = zext i8 %30 to i32
%32 = mul nsw i32 %31, 2
%33 = icmp slt i32 64, %32
br i1 %33, label %34, label %35
34: ; preds = %29
br label %39
35: ; preds = %29
%36 = load i8, i8* %7
%37 = zext i8 %36 to i32
%38 = mul nsw i32 %37, 2
br label %39
39: ; preds = %35, %34
%40 = phi i32 [ 64, %34 ], [ %38, %35 ]
%41 = trunc i32 %40 to i8
store i8 %41, i8* %4
br label %91
42: ; preds = %25
%43 = load i32, i32* %6
%44 = call i64 @get_sr_index(i32 %43)
%45 = getelementptr inbounds [12 x i8], [12 x i8]* @qmf_stop_channel.stopMinTable, i64 0, i64 %44
%46 = load i8, i8* %45
store i8 %46, i8* %8
%47 = load i8, i8* %8
%48 = zext i8 %47 to i32
%49 = load i32, i32* %6
%50 = call i64 @get_sr_index(i32 %49)
%51 = getelementptr inbounds [12 x [14 x i8]], [12 x [14 x i8]]* @qmf_stop_channel.offset, i64 0, i64 %50
%52 = load i8, i8* %5
%53 = zext i8 %52 to i32
%54 = icmp slt i32 %53, 13
br i1 %54, label %55, label %58
55: ; preds = %42
%56 = load i8, i8* %5
%57 = zext i8 %56 to i32
br label %59
58: ; preds = %42
br label %59
59: ; preds = %58, %55
%60 = phi i32 [ %57, %55 ], [ 13, %58 ]
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [14 x i8], [14 x i8]* %51, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = add nsw i32 %48, %64
%66 = icmp slt i32 64, %65
br i1 %66, label %67, label %68
67: ; preds = %59
br label %88
68: ; preds = %59
%69 = load i8, i8* %8
%70 = zext i8 %69 to i32
%71 = load i32, i32* %6
%72 = call i64 @get_sr_index(i32 %71)
%73 = getelementptr inbounds [12 x [14 x i8]], [12 x [14 x i8]]* @qmf_stop_channel.offset, i64 0, i64 %72
%74 = load i8, i8* %5
%75 = zext i8 %74 to i32
%76 = icmp slt i32 %75, 13
br i1 %76, label %77, label %80
77: ; preds = %68
%78 = load i8, i8* %5
%79 = zext i8 %78 to i32
br label %81
80: ; preds = %68
br label %81
81: ; preds = %80, %77
%82 = phi i32 [ %79, %77 ], [ 13, %80 ]
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [14 x i8], [14 x i8]* %73, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = add nsw i32 %70, %86
br label %88
88: ; preds = %81, %67
%89 = phi i32 [ 64, %67 ], [ %87, %81 ]
%90 = trunc i32 %89 to i8
store i8 %90, i8* %4
br label %91
91: ; preds = %88, %39, %22
%92 = load i8, i8* %4
ret i8 %92
}

LLVM IR (-O2):
@qmf_stop_channel.stopMinTable = internal unnamed_addr constant [12 x i8] c"\0D\0F\14\15\17@F`"
@qmf_stop_channel.offset = internal unnamed_addr constant [12 x [14 x i8]] [[14 x i8] c"\00\02\04\06\08\0B\0E\12\16\1A\1F%,3", [14 x i8] c"\00\02\04\06\08\0B\0E\12\16\1A\1F$*1", [14 x i8] c"\00\02\04\06\08\0B\0E\11\15\19\1D\22',", [14 x i8] c"\00\02\04\06\08\0B\0E\11\14\18\1C!&+", [14 x i8] c"\00\02\04\06\08\0B\0E\11\14\18\1C $)", [14 x i8] c"\00\02\04\06\08\0A\0C\0E\11\14\17\1A\1D ", [14 x i8] c"\00\02\04\06\08\0A\0C\0E\11\14\17\1A\1D ", [14 x i8] c"\00\01\03\05\07\09\0B\0D\0F\11\14\17\1A\1D", [14 x i8] c"\00\01\02\03\04\05\06\07\08\09\0A\0C\0E\10", [14 x i8] zeroinitializer, [14 x i8] c"\00\FF\FE\FD\FC\FB\FA\FA\FA\FA\FA\FA\FA\FA", [14 x i8] c"\00\FD\FA\F7\F4\F1\EE\EC\EA\E8\E6\E4\E2\E0"]
define zeroext i8 @qmf_stop_channel(i8 zeroext %0, i32 %1, i8 zeroext %2) {
%4 = zext i8 %0 to i32
switch i8 %0, label %17 [
i8 15, label %5
i8 14, label %11
]
5: ; preds = %3
%6 = zext i8 %2 to i32
%7 = mul nuw nsw i32 %6, 3
%8 = icmp ult i32 %7, 64
%9 = select i1 %8, i32 %7, i32 64
%10 = trunc i32 %9 to i8
br label %36
11: ; preds = %3
%12 = zext i8 %2 to i32
%13 = shl nuw nsw i32 %12, 1
%14 = icmp ult i32 %13, 64
%15 = select i1 %14, i32 %13, i32 64
%16 = trunc i32 %15 to i8
br label %36
17: ; preds = %3
%18 = tail call i64 @get_sr_index(i32 %1)
%19 = getelementptr inbounds [12 x i8], [12 x i8]* @qmf_stop_channel.stopMinTable, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = tail call i64 @get_sr_index(i32 %1)
%23 = icmp ult i32 %4, 13
%24 = select i1 %23, i32 %4, i32 13
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds [12 x [14 x i8]], [12 x [14 x i8]]* @qmf_stop_channel.offset, i64 0, i64 %22, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = add nsw i32 %28, %21
%30 = icmp sgt i32 %29, 64
br i1 %30, label %36, label %31
31: ; preds = %17
%32 = tail call i64 @get_sr_index(i32 %1)
%33 = getelementptr inbounds [12 x [14 x i8]], [12 x [14 x i8]]* @qmf_stop_channel.offset, i64 0, i64 %32, i64 %25
%34 = load i8, i8* %33
%35 = add i8 %34, %20
br label %36
36: ; preds = %31, %17, %11, %5
%37 = phi i8 [ %10, %5 ], [ %16, %11 ], [ %35, %31 ], [ 64, %17 ]
ret i8 %37
}