#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 SensorSetContrast_MT9V112(unsigned char val) {
  VIM_SIF_I2cWriteWord(0xf0, 0x01);
  switch (val) {
  case 1:
    VIM_SIF_I2cWriteWord(0xdc, 0x1307);
    VIM_SIF_I2cWriteWord(0xdd, 0x4528);
    VIM_SIF_I2cWriteWord(0xde, 0x9a73);
    VIM_SIF_I2cWriteWord(0xdf, 0xd3b9);
    VIM_SIF_I2cWriteWord(0xe0, 0xffeb);
    VIM_SIF_I2cWriteWord(0xe1, 0x0000);
    break;
  case 2:
    VIM_SIF_I2cWriteWord(0xdc, 0x0b04);
    VIM_SIF_I2cWriteWord(0xdd, 0x331b);
    VIM_SIF_I2cWriteWord(0xde, 0x8d61);
    VIM_SIF_I2cWriteWord(0xdf, 0xd0b2);
    VIM_SIF_I2cWriteWord(0xe0, 0xffea);
    VIM_SIF_I2cWriteWord(0xe1, 0x0000);
    break;
  case 3:
    VIM_SIF_I2cWriteWord(0xdc, 0x0703);
    VIM_SIF_I2cWriteWord(0xdd, 0x2712);
    VIM_SIF_I2cWriteWord(0xde, 0x7e50);
    VIM_SIF_I2cWriteWord(0xdf, 0xccaa);
    VIM_SIF_I2cWriteWord(0xe0, 0xffe8);
    VIM_SIF_I2cWriteWord(0xe1, 0x0000);
    break;
  case 4:
    VIM_SIF_I2cWriteWord(0xdc, 0x0502);
    VIM_SIF_I2cWriteWord(0xdd, 0x210f);
    VIM_SIF_I2cWriteWord(0xde, 0x7648);
    VIM_SIF_I2cWriteWord(0xdf, 0xcca7);
    VIM_SIF_I2cWriteWord(0xe0, 0xffe8);
    VIM_SIF_I2cWriteWord(0xe1, 0x0000);
    break;
  case 5:
    VIM_SIF_I2cWriteWord(0xdc, 0x0402);
    VIM_SIF_I2cWriteWord(0xdd, 0x1b0c);
    VIM_SIF_I2cWriteWord(0xde, 0x6e3f);
    VIM_SIF_I2cWriteWord(0xdf, 0xcba3);
    VIM_SIF_I2cWriteWord(0xe0, 0xffe8);
    VIM_SIF_I2cWriteWord(0xe1, 0x0000);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetContrast_MT9V112>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xf0,%edi
mov    $0x1,%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     1323 <SensorSetContrast_MT9V112+0x213>
mov    -0x10(%rbp),%rax
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0xdc,%edi
mov    $0x1307,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdd,%edi
mov    $0x4528,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xde,%edi
mov    $0x9a73,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdf,%edi
mov    $0xd3b9,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe0,%edi
mov    $0xffeb,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe1,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1328 <SensorSetContrast_MT9V112+0x218>
mov    $0xdc,%edi
mov    $0xb04,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdd,%edi
mov    $0x331b,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xde,%edi
mov    $0x8d61,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdf,%edi
mov    $0xd0b2,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe0,%edi
mov    $0xffea,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe1,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1328 <SensorSetContrast_MT9V112+0x218>
mov    $0xdc,%edi
mov    $0x703,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdd,%edi
mov    $0x2712,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xde,%edi
mov    $0x7e50,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdf,%edi
mov    $0xccaa,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe0,%edi
mov    $0xffe8,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe1,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1328 <SensorSetContrast_MT9V112+0x218>
mov    $0xdc,%edi
mov    $0x502,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdd,%edi
mov    $0x210f,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xde,%edi
mov    $0x7648,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdf,%edi
mov    $0xcca7,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe0,%edi
mov    $0xffe8,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe1,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1328 <SensorSetContrast_MT9V112+0x218>
mov    $0xdc,%edi
mov    $0x402,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdd,%edi
mov    $0x1b0c,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xde,%edi
mov    $0x6e3f,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdf,%edi
mov    $0xcba3,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe0,%edi
mov    $0xffe8,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe1,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1328 <SensorSetContrast_MT9V112+0x218>
jmp    1328 <SensorSetContrast_MT9V112+0x218>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetContrast_MT9V112>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xf0,%edi
mov    $0x1,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
add    $0xff,%bl
cmp    $0x4,%bl
ja     11be <SensorSetContrast_MT9V112+0xae>
movsbq %bl,%rax
lea    0xec1(%rip),%rcx
mov    (%rcx,%rax,4),%esi
lea    0xecb(%rip),%rcx
mov    (%rcx,%rax,4),%ebx
lea    0xed5(%rip),%rcx
mov    (%rcx,%rax,4),%ebp
lea    0xedf(%rip),%rcx
mov    (%rcx,%rax,4),%r14d
lea    0xee8(%rip),%rcx
mov    (%rcx,%rax,4),%r15d
mov    $0xdc,%edi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdd,%edi
mov    %ebx,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xde,%edi
mov    %ebp,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xdf,%edi
mov    %r14d,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe0,%edi
mov    %r15d,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xe1,%edi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <VIM_SIF_I2cWriteWord@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @SensorSetContrast_MT9V112(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @VIM_SIF_I2cWriteWord(i32 240, i32 1)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
switch i32 %5, label %41 [
i32 1, label %6
i32 2, label %13
i32 3, label %20
i32 4, label %27
i32 5, label %34
]
6: ; preds = %1
%7 = call i32 @VIM_SIF_I2cWriteWord(i32 220, i32 4871)
%8 = call i32 @VIM_SIF_I2cWriteWord(i32 221, i32 17704)
%9 = call i32 @VIM_SIF_I2cWriteWord(i32 222, i32 39539)
%10 = call i32 @VIM_SIF_I2cWriteWord(i32 223, i32 54201)
%11 = call i32 @VIM_SIF_I2cWriteWord(i32 224, i32 65515)
%12 = call i32 @VIM_SIF_I2cWriteWord(i32 225, i32 0)
br label %42
13: ; preds = %1
%14 = call i32 @VIM_SIF_I2cWriteWord(i32 220, i32 2820)
%15 = call i32 @VIM_SIF_I2cWriteWord(i32 221, i32 13083)
%16 = call i32 @VIM_SIF_I2cWriteWord(i32 222, i32 36193)
%17 = call i32 @VIM_SIF_I2cWriteWord(i32 223, i32 53426)
%18 = call i32 @VIM_SIF_I2cWriteWord(i32 224, i32 65514)
%19 = call i32 @VIM_SIF_I2cWriteWord(i32 225, i32 0)
br label %42
20: ; preds = %1
%21 = call i32 @VIM_SIF_I2cWriteWord(i32 220, i32 1795)
%22 = call i32 @VIM_SIF_I2cWriteWord(i32 221, i32 10002)
%23 = call i32 @VIM_SIF_I2cWriteWord(i32 222, i32 32336)
%24 = call i32 @VIM_SIF_I2cWriteWord(i32 223, i32 52394)
%25 = call i32 @VIM_SIF_I2cWriteWord(i32 224, i32 65512)
%26 = call i32 @VIM_SIF_I2cWriteWord(i32 225, i32 0)
br label %42
27: ; preds = %1
%28 = call i32 @VIM_SIF_I2cWriteWord(i32 220, i32 1282)
%29 = call i32 @VIM_SIF_I2cWriteWord(i32 221, i32 8463)
%30 = call i32 @VIM_SIF_I2cWriteWord(i32 222, i32 30280)
%31 = call i32 @VIM_SIF_I2cWriteWord(i32 223, i32 52391)
%32 = call i32 @VIM_SIF_I2cWriteWord(i32 224, i32 65512)
%33 = call i32 @VIM_SIF_I2cWriteWord(i32 225, i32 0)
br label %42
34: ; preds = %1
%35 = call i32 @VIM_SIF_I2cWriteWord(i32 220, i32 1026)
%36 = call i32 @VIM_SIF_I2cWriteWord(i32 221, i32 6924)
%37 = call i32 @VIM_SIF_I2cWriteWord(i32 222, i32 28223)
%38 = call i32 @VIM_SIF_I2cWriteWord(i32 223, i32 52131)
%39 = call i32 @VIM_SIF_I2cWriteWord(i32 224, i32 65512)
%40 = call i32 @VIM_SIF_I2cWriteWord(i32 225, i32 0)
br label %42
41: ; preds = %1
br label %42
42: ; preds = %41, %34, %27, %20, %13, %6
ret void
}

LLVM IR (-O2):
@switch.table.SensorSetContrast_MT9V112 = [5 x i32] [i32 4871, i32 2820, i32 1795, i32 1282, i32 1026]
@switch.table.SensorSetContrast_MT9V112.1 = [5 x i32] [i32 17704, i32 13083, i32 10002, i32 8463, i32 6924]
@switch.table.SensorSetContrast_MT9V112.2 = [5 x i32] [i32 39539, i32 36193, i32 32336, i32 30280, i32 28223]
@switch.table.SensorSetContrast_MT9V112.3 = [5 x i32] [i32 54201, i32 53426, i32 52394, i32 52391, i32 52131]
@switch.table.SensorSetContrast_MT9V112.4 = [5 x i32] [i32 65515, i32 65514, i32 65512, i32 65512, i32 65512]
define void @SensorSetContrast_MT9V112(i8 zeroext %0) {
%2 = tail call i32 @VIM_SIF_I2cWriteWord(i32 240, i32 1)
%3 = add i8 %0, -1
%4 = icmp ult i8 %3, 5
br i1 %4, label %5, label %27
5: ; preds = %1
%6 = sext i8 %3 to i64
%7 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table.SensorSetContrast_MT9V112, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = sext i8 %3 to i64
%10 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table.SensorSetContrast_MT9V112.1, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = sext i8 %3 to i64
%13 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table.SensorSetContrast_MT9V112.2, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = sext i8 %3 to i64
%16 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table.SensorSetContrast_MT9V112.3, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = sext i8 %3 to i64
%19 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table.SensorSetContrast_MT9V112.4, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 @VIM_SIF_I2cWriteWord(i32 220, i32 %8)
%22 = tail call i32 @VIM_SIF_I2cWriteWord(i32 221, i32 %11)
%23 = tail call i32 @VIM_SIF_I2cWriteWord(i32 222, i32 %14)
%24 = tail call i32 @VIM_SIF_I2cWriteWord(i32 223, i32 %17)
%25 = tail call i32 @VIM_SIF_I2cWriteWord(i32 224, i32 %20)
%26 = tail call i32 @VIM_SIF_I2cWriteWord(i32 225, i32 0)
br label %27
27: ; preds = %1, %5
ret void
}