#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_MT9V111(unsigned char val) {
  VIM_SIF_I2cWriteWord(0x01, 0x01);
  switch (val) {
  case 1:
    VIM_SIF_I2cWriteWord(0x53, 0x1e14);
    VIM_SIF_I2cWriteWord(0x54, 0x462e);
    VIM_SIF_I2cWriteWord(0x55, 0x876a);
    VIM_SIF_I2cWriteWord(0x56, 0xb7a0);
    VIM_SIF_I2cWriteWord(0x57, 0xe0cc);
    VIM_SIF_I2cWriteWord(0x58, 0x0000);
    break;
  case 2:
    VIM_SIF_I2cWriteWord(0x53, 0x160d);
    VIM_SIF_I2cWriteWord(0x54, 0x3923);
    VIM_SIF_I2cWriteWord(0x55, 0x7c5d);
    VIM_SIF_I2cWriteWord(0x56, 0xb197);
    VIM_SIF_I2cWriteWord(0x57, 0xe0c9);
    VIM_SIF_I2cWriteWord(0x58, 0x0000);
    break;
  case 3:
    VIM_SIF_I2cWriteWord(0x53, 0x1009);
    VIM_SIF_I2cWriteWord(0x54, 0x2f1b);
    VIM_SIF_I2cWriteWord(0x55, 0x7252);
    VIM_SIF_I2cWriteWord(0x56, 0xab8f);
    VIM_SIF_I2cWriteWord(0x57, 0xe0c6);
    VIM_SIF_I2cWriteWord(0x58, 0x0000);
    break;
  case 4:
    VIM_SIF_I2cWriteWord(0x53, 0x0d07);
    VIM_SIF_I2cWriteWord(0x54, 0x2b18);
    VIM_SIF_I2cWriteWord(0x55, 0x6d4d);
    VIM_SIF_I2cWriteWord(0x56, 0xa88b);
    VIM_SIF_I2cWriteWord(0x57, 0xe0c4);
    VIM_SIF_I2cWriteWord(0x58, 0x0000);
    break;
  case 5:
    VIM_SIF_I2cWriteWord(0x53, 0x0b06);
    VIM_SIF_I2cWriteWord(0x54, 0x2715);
    VIM_SIF_I2cWriteWord(0x55, 0x6849);
    VIM_SIF_I2cWriteWord(0x56, 0xa587);
    VIM_SIF_I2cWriteWord(0x57, 0xe0c3);
    VIM_SIF_I2cWriteWord(0x58, 0x0000);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetContrast_MT9V111>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <VIM_SIF_I2cWriteWord@plt>
movzbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     1320 <SensorSetContrast_MT9V111+0x210>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x53,%edi
mov    $0x1e14,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x54,%edi
mov    $0x462e,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x55,%edi
mov    $0x876a,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x56,%edi
mov    $0xb7a0,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x57,%edi
mov    $0xe0cc,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x58,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1325 <SensorSetContrast_MT9V111+0x215>
mov    $0x53,%edi
mov    $0x160d,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x54,%edi
mov    $0x3923,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x55,%edi
mov    $0x7c5d,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x56,%edi
mov    $0xb197,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x57,%edi
mov    $0xe0c9,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x58,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1325 <SensorSetContrast_MT9V111+0x215>
mov    $0x53,%edi
mov    $0x1009,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x54,%edi
mov    $0x2f1b,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x55,%edi
mov    $0x7252,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x56,%edi
mov    $0xab8f,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x57,%edi
mov    $0xe0c6,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x58,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1325 <SensorSetContrast_MT9V111+0x215>
mov    $0x53,%edi
mov    $0xd07,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x54,%edi
mov    $0x2b18,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x55,%edi
mov    $0x6d4d,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x56,%edi
mov    $0xa88b,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x57,%edi
mov    $0xe0c4,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x58,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1325 <SensorSetContrast_MT9V111+0x215>
mov    $0x53,%edi
mov    $0xb06,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x54,%edi
mov    $0x2715,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x55,%edi
mov    $0x6849,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x56,%edi
mov    $0xa587,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x57,%edi
mov    $0xe0c3,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x58,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1325 <SensorSetContrast_MT9V111+0x215>
jmp    1325 <SensorSetContrast_MT9V111+0x215>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetContrast_MT9V111>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
add    $0xff,%bl
cmp    $0x4,%bl
ja     11be <SensorSetContrast_MT9V111+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    $0x53,%edi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x54,%edi
mov    %ebx,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x55,%edi
mov    %ebp,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x56,%edi
mov    %r14d,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x57,%edi
mov    %r15d,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x58,%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_MT9V111(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @VIM_SIF_I2cWriteWord(i32 1, 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 83, i32 7700)
%8 = call i32 @VIM_SIF_I2cWriteWord(i32 84, i32 17966)
%9 = call i32 @VIM_SIF_I2cWriteWord(i32 85, i32 34666)
%10 = call i32 @VIM_SIF_I2cWriteWord(i32 86, i32 47008)
%11 = call i32 @VIM_SIF_I2cWriteWord(i32 87, i32 57548)
%12 = call i32 @VIM_SIF_I2cWriteWord(i32 88, i32 0)
br label %42
13: ; preds = %1
%14 = call i32 @VIM_SIF_I2cWriteWord(i32 83, i32 5645)
%15 = call i32 @VIM_SIF_I2cWriteWord(i32 84, i32 14627)
%16 = call i32 @VIM_SIF_I2cWriteWord(i32 85, i32 31837)
%17 = call i32 @VIM_SIF_I2cWriteWord(i32 86, i32 45463)
%18 = call i32 @VIM_SIF_I2cWriteWord(i32 87, i32 57545)
%19 = call i32 @VIM_SIF_I2cWriteWord(i32 88, i32 0)
br label %42
20: ; preds = %1
%21 = call i32 @VIM_SIF_I2cWriteWord(i32 83, i32 4105)
%22 = call i32 @VIM_SIF_I2cWriteWord(i32 84, i32 12059)
%23 = call i32 @VIM_SIF_I2cWriteWord(i32 85, i32 29266)
%24 = call i32 @VIM_SIF_I2cWriteWord(i32 86, i32 43919)
%25 = call i32 @VIM_SIF_I2cWriteWord(i32 87, i32 57542)
%26 = call i32 @VIM_SIF_I2cWriteWord(i32 88, i32 0)
br label %42
27: ; preds = %1
%28 = call i32 @VIM_SIF_I2cWriteWord(i32 83, i32 3335)
%29 = call i32 @VIM_SIF_I2cWriteWord(i32 84, i32 11032)
%30 = call i32 @VIM_SIF_I2cWriteWord(i32 85, i32 27981)
%31 = call i32 @VIM_SIF_I2cWriteWord(i32 86, i32 43147)
%32 = call i32 @VIM_SIF_I2cWriteWord(i32 87, i32 57540)
%33 = call i32 @VIM_SIF_I2cWriteWord(i32 88, i32 0)
br label %42
34: ; preds = %1
%35 = call i32 @VIM_SIF_I2cWriteWord(i32 83, i32 2822)
%36 = call i32 @VIM_SIF_I2cWriteWord(i32 84, i32 10005)
%37 = call i32 @VIM_SIF_I2cWriteWord(i32 85, i32 26697)
%38 = call i32 @VIM_SIF_I2cWriteWord(i32 86, i32 42375)
%39 = call i32 @VIM_SIF_I2cWriteWord(i32 87, i32 57539)
%40 = call i32 @VIM_SIF_I2cWriteWord(i32 88, 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_MT9V111 = [5 x i32] [i32 7700, i32 5645, i32 4105, i32 3335, i32 2822]
@switch.table.SensorSetContrast_MT9V111.1 = [5 x i32] [i32 17966, i32 14627, i32 12059, i32 11032, i32 10005]
@switch.table.SensorSetContrast_MT9V111.2 = [5 x i32] [i32 34666, i32 31837, i32 29266, i32 27981, i32 26697]
@switch.table.SensorSetContrast_MT9V111.3 = [5 x i32] [i32 47008, i32 45463, i32 43919, i32 43147, i32 42375]
@switch.table.SensorSetContrast_MT9V111.4 = [5 x i32] [i32 57548, i32 57545, i32 57542, i32 57540, i32 57539]
define void @SensorSetContrast_MT9V111(i8 zeroext %0) {
%2 = tail call i32 @VIM_SIF_I2cWriteWord(i32 1, 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_MT9V111, 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_MT9V111.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_MT9V111.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_MT9V111.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_MT9V111.4, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 @VIM_SIF_I2cWriteWord(i32 83, i32 %8)
%22 = tail call i32 @VIM_SIF_I2cWriteWord(i32 84, i32 %11)
%23 = tail call i32 @VIM_SIF_I2cWriteWord(i32 85, i32 %14)
%24 = tail call i32 @VIM_SIF_I2cWriteWord(i32 86, i32 %17)
%25 = tail call i32 @VIM_SIF_I2cWriteWord(i32 87, i32 %20)
%26 = tail call i32 @VIM_SIF_I2cWriteWord(i32 88, i32 0)
br label %27
27: ; preds = %1, %5
ret void
}