#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 */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t rtp_3551_get_clock_rate(uint8_t i_type) {
  struct {
    uint8_t i_type;
    uint32_t i_rate;
  } profiles[] = {{33, 90000}, {14, 90000}, {32, 90000},   {10, 44100},
                  {11, 44100}, {3, 8000},   {0xff, 0xffff}};
  int i = 0;
  while (profiles[i].i_type != 0xff) {
    if (i_type == profiles[i].i_type) {
      return profiles[i].i_rate;
    }
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<rtp_3551_get_clock_rate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeda(%rip),%rsi
mov    $0x38,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
cmpl   $0xff,-0x40(%rbp,%rax,8)
je     1178 <rtp_3551_get_clock_rate+0x68>
mov    -0x8(%rbp),%eax
movslq -0x44(%rbp),%rcx
cmp    -0x40(%rbp,%rcx,8),%eax
jne    116a <rtp_3551_get_clock_rate+0x5a>
movslq -0x44(%rbp),%rax
mov    -0x3c(%rbp,%rax,8),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <rtp_3551_get_clock_rate+0x6f>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1137 <rtp_3551_get_clock_rate+0x27>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp_3551_get_clock_rate>:
xor    %eax,%eax
add    $0xfffffffd,%edi
cmp    $0x1e,%edi
ja     1146 <rtp_3551_get_clock_rate+0x46>
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x5,%eax
jmp    113b <rtp_3551_get_clock_rate+0x3b>
mov    $0x3,%eax
jmp    113b <rtp_3551_get_clock_rate+0x3b>
mov    $0x4,%eax
jmp    113b <rtp_3551_get_clock_rate+0x3b>
mov    $0x1,%eax
jmp    113b <rtp_3551_get_clock_rate+0x3b>
mov    $0x2,%eax
lea    0xf3e(%rip),%rcx
mov    0x4(%rcx,%rax,8),%eax
ret

LLVM IR (-O0):
%struct.anon = type { i32, i32 }
@__const.rtp_3551_get_clock_rate.profiles = [7 x %struct.anon] [%struct.anon { i32 33, i32 90000 }, %struct.anon { i32 14, i32 90000 }, %struct.anon { i32 32, i32 90000 }, %struct.anon { i32 10, i32 44100 }, %struct.anon { i32 11, i32 44100 }, %struct.anon { i32 3, i32 8000 }, %struct.anon { i32 255, i32 65535 }]
define i32 @rtp_3551_get_clock_rate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [7 x %struct.anon]
%5 = alloca i32
store i32 %0, i32* %3
%6 = bitcast [7 x %struct.anon]* %4 to i8*
store i32 0, i32* %5
br label %7
7: ; preds = %28, %1
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [7 x %struct.anon], [7 x %struct.anon]* %4, i64 0, i64 %9
%11 = getelementptr inbounds %struct.anon, %struct.anon* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = icmp ne i32 %12, 255
br i1 %13, label %14, label %31
14: ; preds = %7
%15 = load i32, i32* %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [7 x %struct.anon], [7 x %struct.anon]* %4, i64 0, i64 %17
%19 = getelementptr inbounds %struct.anon, %struct.anon* %18, i32 0, i32 0
%20 = load i32, i32* %19
%21 = icmp eq i32 %15, %20
br i1 %21, label %22, label %28
22: ; preds = %14
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [7 x %struct.anon], [7 x %struct.anon]* %4, i64 0, i64 %24
%26 = getelementptr inbounds %struct.anon, %struct.anon* %25, i32 0, i32 1
%27 = load i32, i32* %26
store i32 %27, i32* %2
br label %32
28: ; preds = %14
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %7
31: ; preds = %7
store i32 0, i32* %2
br label %32
32: ; preds = %31, %22
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
%struct.anon = type { i32, i32 }
@__const.rtp_3551_get_clock_rate.profiles = [7 x %struct.anon] [%struct.anon { i32 33, i32 90000 }, %struct.anon { i32 14, i32 90000 }, %struct.anon { i32 32, i32 90000 }, %struct.anon { i32 10, i32 44100 }, %struct.anon { i32 11, i32 44100 }, %struct.anon { i32 3, i32 8000 }, %struct.anon { i32 255, i32 65535 }]
define i32 @rtp_3551_get_clock_rate(i32 %0) {
switch i32 %0, label %11 [
i32 33, label %7
i32 14, label %2
i32 32, label %3
i32 10, label %4
i32 11, label %5
i32 3, label %6
]
2: ; preds = %1
br label %7
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %5, %4, %3, %2
%8 = phi i64 [ 0, %1 ], [ 1, %2 ], [ 2, %3 ], [ 3, %4 ], [ 4, %5 ], [ 5, %6 ]
%9 = getelementptr inbounds [7 x %struct.anon], [7 x %struct.anon]* @__const.rtp_3551_get_clock_rate.profiles, i64 0, i64 %8, i32 1
%10 = load i32, i32* %9
br label %11
11: ; preds = %1, %7
%12 = phi i32 [ %10, %7 ], [ 0, %1 ]
ret i32 %12
}