#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*/ CodecRegWrite(unsigned int, int, unsigned char);
void AIC31DataConfig(unsigned int baseAddr, unsigned char dataType,
                     unsigned char slotWidth, unsigned char dataOff) {
  unsigned char slot;
  switch (slotWidth) {
  case 16:
    slot = (0u << 4u);
    break;
  case 20:
    slot = (1u << 4u);
    break;
  case 24:
    slot = (2u << 4u);
    break;
  case 32:
    slot = (3u << 4u);
    break;
  default:
    slot = (0u << 4u);
    break;
  }
  CodecRegWrite(baseAddr, (9), (dataType | slot));
  CodecRegWrite(baseAddr, (10), dataOff);
}


x86 assembly (clang, -O0):
<AIC31DataConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %edi,-0x4(%rbp)
mov    %dl,-0x5(%rbp)
mov    %cl,-0x6(%rbp)
mov    %al,-0x7(%rbp)
movzbl -0x6(%rbp),%eax
add    $0xfffffff0,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x10,%eax
ja     1179 <AIC31DataConfig+0x69>
mov    -0x10(%rbp),%rax
lea    0xeb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x0,-0x8(%rbp)
jmp    117d <AIC31DataConfig+0x6d>
movb   $0x10,-0x8(%rbp)
jmp    117d <AIC31DataConfig+0x6d>
movb   $0x20,-0x8(%rbp)
jmp    117d <AIC31DataConfig+0x6d>
movb   $0x30,-0x8(%rbp)
jmp    117d <AIC31DataConfig+0x6d>
movb   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
movzbl -0x5(%rbp),%eax
movzbl -0x8(%rbp),%ecx
or     %ecx,%eax
mov    $0x9,%esi
movzbl %al,%edx
call   1030 <CodecRegWrite@plt>
mov    -0x4(%rbp),%edi
mov    $0xa,%esi
movzbl -0x7(%rbp),%edx
call   1030 <CodecRegWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AIC31DataConfig>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
add    $0xfffffff0,%edx
rol    $0x1e,%edx
lea    -0x8(,%rdx,8),%ecx
mov    $0x30002010,%eax
shr    %cl,%eax
mov    %edi,%ebp
mov    %edx,%ecx
add    $0xffffffff,%ecx
xor    %edx,%edx
cmp    $0x4,%ecx
cmovb  %eax,%edx
or     %esi,%edx
movzbl %dl,%edx
mov    $0x9,%esi
call   1030 <CodecRegWrite@plt>
mov    %ebp,%edi
mov    $0xa,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <CodecRegWrite@plt>

LLVM IR (-O0):
define void @AIC31DataConfig(i32 %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i32 %0, i32* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%10 = load i8, i8* %7
%11 = zext i8 %10 to i32
switch i32 %11, label %16 [
i32 16, label %12
i32 20, label %13
i32 24, label %14
i32 32, label %15
]
12: ; preds = %4
store i8 0, i8* %9
br label %17
13: ; preds = %4
store i8 16, i8* %9
br label %17
14: ; preds = %4
store i8 32, i8* %9
br label %17
15: ; preds = %4
store i8 48, i8* %9
br label %17
16: ; preds = %4
store i8 0, i8* %9
br label %17
17: ; preds = %16, %15, %14, %13, %12
%18 = load i32, i32* %5
%19 = load i8, i8* %6
%20 = zext i8 %19 to i32
%21 = load i8, i8* %9
%22 = zext i8 %21 to i32
%23 = or i32 %20, %22
%24 = trunc i32 %23 to i8
%25 = call i32 @CodecRegWrite(i32 %18, i32 9, i8 zeroext %24)
%26 = load i32, i32* %5
%27 = load i8, i8* %8
%28 = call i32 @CodecRegWrite(i32 %26, i32 10, i8 zeroext %27)
ret void
}

LLVM IR (-O2):
define void @AIC31DataConfig(i32 %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = zext i8 %2 to i32
%6 = add nsw i32 %5, -16
%7 = tail call i32 @llvm.fshl.i32(i32 %6, i32 %6, i32 30)
%8 = add i32 %7, -1
%9 = icmp ult i32 %8, 4
%10 = shl i32 %8, 3
%11 = lshr i32 805314576, %10
%12 = trunc i32 %11 to i8
%13 = select i1 %9, i8 %12, i8 0
%14 = or i8 %13, %1
%15 = tail call i32 @CodecRegWrite(i32 %0, i32 9, i8 zeroext %14)
%16 = tail call i32 @CodecRegWrite(i32 %0, i32 10, i8 zeroext %3)
ret void
}