#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*/ VIM_HIF_SetReg8(int, unsigned char);
void VIM_JPEG_SetComponentParm(unsigned char byIndex, unsigned short wValue) {
  switch (byIndex) {
  case 0:
    VIM_HIF_SetReg8((0x0000 + 0x021), (unsigned char)wValue);
    VIM_HIF_SetReg8((0x0000 + 0x020), (unsigned char)(wValue >> 8));
    break;
  case 1:
    VIM_HIF_SetReg8((0x0000 + 0x023), (unsigned char)wValue);
    VIM_HIF_SetReg8((0x0000 + 0x022), (unsigned char)(wValue >> 8));
    break;
  case 2:
    VIM_HIF_SetReg8((0x0000 + 0x025), (unsigned char)wValue);
    VIM_HIF_SetReg8((0x0000 + 0x024), (unsigned char)(wValue >> 8));
    break;
  case 3:
    VIM_HIF_SetReg8((0x0000 + 0x027), (unsigned char)wValue);
    VIM_HIF_SetReg8((0x0000 + 0x026), (unsigned char)(wValue >> 8));
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<VIM_JPEG_SetComponentParm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
movzbl -0x1(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     11f3 <VIM_JPEG_SetComponentParm+0xe3>
mov    -0x10(%rbp),%rax
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%ax
mov    $0x21,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
mov    $0x20,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
jmp    11f8 <VIM_JPEG_SetComponentParm+0xe8>
mov    -0x4(%rbp),%ax
mov    $0x23,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
mov    $0x22,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
jmp    11f8 <VIM_JPEG_SetComponentParm+0xe8>
mov    -0x4(%rbp),%ax
mov    $0x25,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
mov    $0x24,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
jmp    11f8 <VIM_JPEG_SetComponentParm+0xe8>
mov    -0x4(%rbp),%ax
mov    $0x27,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
movzwl -0x4(%rbp),%eax
sar    $0x8,%eax
mov    $0x26,%edi
movzbl %al,%esi
call   1030 <VIM_HIF_SetReg8@plt>
jmp    11f8 <VIM_JPEG_SetComponentParm+0xe8>
jmp    11f8 <VIM_JPEG_SetComponentParm+0xe8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIM_JPEG_SetComponentParm>:
cmp    $0x3,%dil
ja     1145 <VIM_JPEG_SetComponentParm+0x35>
push   %rbp
push   %rbx
push   %rax
movzbl %dil,%eax
lea    0x21(%rax,%rax,1),%edi
lea    (%rax,%rax,1),%ebx
add    $0x20,%ebx
movzwl %si,%ebp
movzbl %bpl,%esi
call   1030 <VIM_HIF_SetReg8@plt>
shr    $0x8,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <VIM_HIF_SetReg8@plt>
ret

LLVM IR (-O0):
define void @VIM_JPEG_SetComponentParm(i8 zeroext %0, i16 zeroext %1) {
%3 = alloca i8
%4 = alloca i16
store i8 %0, i8* %3
store i16 %1, i16* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
switch i32 %6, label %43 [
i32 0, label %7
i32 1, label %16
i32 2, label %25
i32 3, label %34
]
7: ; preds = %2
%8 = load i16, i16* %4
%9 = trunc i16 %8 to i8
%10 = call i32 @VIM_HIF_SetReg8(i32 33, i8 zeroext %9)
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 8
%14 = trunc i32 %13 to i8
%15 = call i32 @VIM_HIF_SetReg8(i32 32, i8 zeroext %14)
br label %44
16: ; preds = %2
%17 = load i16, i16* %4
%18 = trunc i16 %17 to i8
%19 = call i32 @VIM_HIF_SetReg8(i32 35, i8 zeroext %18)
%20 = load i16, i16* %4
%21 = zext i16 %20 to i32
%22 = ashr i32 %21, 8
%23 = trunc i32 %22 to i8
%24 = call i32 @VIM_HIF_SetReg8(i32 34, i8 zeroext %23)
br label %44
25: ; preds = %2
%26 = load i16, i16* %4
%27 = trunc i16 %26 to i8
%28 = call i32 @VIM_HIF_SetReg8(i32 37, i8 zeroext %27)
%29 = load i16, i16* %4
%30 = zext i16 %29 to i32
%31 = ashr i32 %30, 8
%32 = trunc i32 %31 to i8
%33 = call i32 @VIM_HIF_SetReg8(i32 36, i8 zeroext %32)
br label %44
34: ; preds = %2
%35 = load i16, i16* %4
%36 = trunc i16 %35 to i8
%37 = call i32 @VIM_HIF_SetReg8(i32 39, i8 zeroext %36)
%38 = load i16, i16* %4
%39 = zext i16 %38 to i32
%40 = ashr i32 %39, 8
%41 = trunc i32 %40 to i8
%42 = call i32 @VIM_HIF_SetReg8(i32 38, i8 zeroext %41)
br label %44
43: ; preds = %2
br label %44
44: ; preds = %43, %34, %25, %16, %7
ret void
}

LLVM IR (-O2):
define void @VIM_JPEG_SetComponentParm(i8 zeroext %0, i16 zeroext %1) {
%3 = icmp ult i8 %0, 4
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i8 %0 to i32
%6 = shl nuw nsw i32 %5, 1
%7 = add nuw nsw i32 %6, 33
%8 = zext i8 %0 to i32
%9 = shl nuw nsw i32 %8, 1
%10 = add nuw nsw i32 %9, 32
%11 = trunc i16 %1 to i8
%12 = tail call i32 @VIM_HIF_SetReg8(i32 %7, i8 zeroext %11)
%13 = lshr i16 %1, 8
%14 = trunc i16 %13 to i8
%15 = tail call i32 @VIM_HIF_SetReg8(i32 %10, i8 zeroext %14)
br label %16
16: ; preds = %2, %4
ret void
}