#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_SIF_I2cWriteWord(int, int);
void SensorSetBrightness_MT9V112(unsigned char val) {
  VIM_SIF_I2cWriteWord(0xf0, 0x02);
  switch (val) {
  case 1:
    VIM_SIF_I2cWriteWord(0x2e, 0x092c);
    break;
  case 2:
    VIM_SIF_I2cWriteWord(0x2e, 0x094c);
    break;
  case 3:
    VIM_SIF_I2cWriteWord(0x2e, 0x096c);
    break;
  case 4:
    VIM_SIF_I2cWriteWord(0x2e, 0x098c);
    break;
  case 5:
    VIM_SIF_I2cWriteWord(0x2e, 0x09ac);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetBrightness_MT9V112>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xf0,%edi
mov    $0x2,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
movzbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     11bb <SensorSetBrightness_MT9V112+0xab>
mov    -0x10(%rbp),%rax
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x2e,%edi
mov    $0x92c,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    11c0 <SensorSetBrightness_MT9V112+0xb0>
mov    $0x2e,%edi
mov    $0x94c,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    11c0 <SensorSetBrightness_MT9V112+0xb0>
mov    $0x2e,%edi
mov    $0x96c,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    11c0 <SensorSetBrightness_MT9V112+0xb0>
mov    $0x2e,%edi
mov    $0x98c,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    11c0 <SensorSetBrightness_MT9V112+0xb0>
mov    $0x2e,%edi
mov    $0x9ac,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    11c0 <SensorSetBrightness_MT9V112+0xb0>
jmp    11c0 <SensorSetBrightness_MT9V112+0xb0>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetBrightness_MT9V112>:
push   %rbx
mov    %edi,%ebx
mov    $0xf0,%edi
mov    $0x2,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
add    $0xff,%bl
cmp    $0x4,%bl
ja     1141 <SensorSetBrightness_MT9V112+0x31>
movzbl %bl,%esi
shl    $0x5,%esi
add    $0x92c,%esi
mov    $0x2e,%edi
pop    %rbx
jmp    1030 <VIM_SIF_I2cWriteWord@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @SensorSetBrightness_MT9V112(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @VIM_SIF_I2cWriteWord(i32 240, i32 2)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
switch i32 %5, label %16 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
]
6: ; preds = %1
%7 = call i32 @VIM_SIF_I2cWriteWord(i32 46, i32 2348)
br label %17
8: ; preds = %1
%9 = call i32 @VIM_SIF_I2cWriteWord(i32 46, i32 2380)
br label %17
10: ; preds = %1
%11 = call i32 @VIM_SIF_I2cWriteWord(i32 46, i32 2412)
br label %17
12: ; preds = %1
%13 = call i32 @VIM_SIF_I2cWriteWord(i32 46, i32 2444)
br label %17
14: ; preds = %1
%15 = call i32 @VIM_SIF_I2cWriteWord(i32 46, i32 2476)
br label %17
16: ; preds = %1
br label %17
17: ; preds = %16, %14, %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
define void @SensorSetBrightness_MT9V112(i8 zeroext %0) {
%2 = tail call i32 @VIM_SIF_I2cWriteWord(i32 240, i32 2)
%3 = add i8 %0, -1
%4 = icmp ult i8 %3, 5
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = zext i8 %3 to i32
%7 = shl nuw nsw i32 %6, 5
%8 = add nuw nsw i32 %7, 2348
%9 = tail call i32 @VIM_SIF_I2cWriteWord(i32 46, i32 %8)
br label %10
10: ; preds = %1, %5
ret void
}