#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 SensorSetMode_MT9V112(unsigned char val) {
  VIM_SIF_I2cWriteWord(0xf0, 0x0002);
  switch (val) {
  case 1:
    VIM_SIF_I2cWriteWord(0x5b, 0x0001);
    VIM_SIF_I2cWriteWord(0x37, 0x00a0);
    VIM_SIF_I2cWriteWord(0x67, 0x1010);
    break;
  case 2:
    VIM_SIF_I2cWriteWord(0x5b, 0x0003);
    VIM_SIF_I2cWriteWord(0x37, 0x00c0);
    VIM_SIF_I2cWriteWord(0x67, 0x1010);
    break;
  case 4:
    VIM_SIF_I2cWriteWord(0xf0, 0x0002);
    VIM_SIF_I2cWriteWord(0x37, 0x0300);
    VIM_SIF_I2cWriteWord(0x67, 0x4010);
    break;
  case 3:
    VIM_SIF_I2cWriteWord(0x37, 0x0080);
    VIM_SIF_I2cWriteWord(0x67, 0x1010);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetMode_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    $0x3,%eax
ja     1210 <SensorSetMode_MT9V112+0x100>
mov    -0x10(%rbp),%rax
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x5b,%edi
mov    $0x1,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x37,%edi
mov    $0xa0,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x67,%edi
mov    $0x1010,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1215 <SensorSetMode_MT9V112+0x105>
mov    $0x5b,%edi
mov    $0x3,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x37,%edi
mov    $0xc0,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x67,%edi
mov    $0x1010,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1215 <SensorSetMode_MT9V112+0x105>
mov    $0xf0,%edi
mov    $0x2,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x37,%edi
mov    $0x300,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x67,%edi
mov    $0x4010,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1215 <SensorSetMode_MT9V112+0x105>
mov    $0x37,%edi
mov    $0x80,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x67,%edi
mov    $0x1010,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
jmp    1215 <SensorSetMode_MT9V112+0x105>
jmp    1215 <SensorSetMode_MT9V112+0x105>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetMode_MT9V112>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0xf0,%edi
mov    $0x2,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
add    $0xff,%bpl
cmp    $0x3,%bpl
ja     1162 <SensorSetMode_MT9V112+0x52>
mov    $0x1010,%ebx
mov    $0x80,%esi
movzbl %bpl,%eax
lea    0xebd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x5b,%edi
mov    $0x1,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xa0,%esi
jmp    1198 <SensorSetMode_MT9V112+0x88>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x5b,%edi
mov    $0x3,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0xc0,%esi
jmp    1198 <SensorSetMode_MT9V112+0x88>
mov    $0xf0,%edi
mov    $0x2,%esi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x4010,%ebx
mov    $0x300,%esi
mov    $0x37,%edi
call   1030 <VIM_SIF_I2cWriteWord@plt>
mov    $0x67,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <VIM_SIF_I2cWriteWord@plt>

LLVM IR (-O0):
define void @SensorSetMode_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 %21 [
i32 1, label %6
i32 2, label %10
i32 4, label %14
i32 3, label %18
]
6: ; preds = %1
%7 = call i32 @VIM_SIF_I2cWriteWord(i32 91, i32 1)
%8 = call i32 @VIM_SIF_I2cWriteWord(i32 55, i32 160)
%9 = call i32 @VIM_SIF_I2cWriteWord(i32 103, i32 4112)
br label %22
10: ; preds = %1
%11 = call i32 @VIM_SIF_I2cWriteWord(i32 91, i32 3)
%12 = call i32 @VIM_SIF_I2cWriteWord(i32 55, i32 192)
%13 = call i32 @VIM_SIF_I2cWriteWord(i32 103, i32 4112)
br label %22
14: ; preds = %1
%15 = call i32 @VIM_SIF_I2cWriteWord(i32 240, i32 2)
%16 = call i32 @VIM_SIF_I2cWriteWord(i32 55, i32 768)
%17 = call i32 @VIM_SIF_I2cWriteWord(i32 103, i32 16400)
br label %22
18: ; preds = %1
%19 = call i32 @VIM_SIF_I2cWriteWord(i32 55, i32 128)
%20 = call i32 @VIM_SIF_I2cWriteWord(i32 103, i32 4112)
br label %22
21: ; preds = %1
br label %22
22: ; preds = %21, %18, %14, %10, %6
ret void
}

LLVM IR (-O2):
define void @SensorSetMode_MT9V112(i8 zeroext %0) {
%2 = tail call i32 @VIM_SIF_I2cWriteWord(i32 240, i32 2)
switch i8 %0, label %14 [
i8 1, label %3
i8 2, label %5
i8 4, label %7
i8 3, label %9
]
3: ; preds = %1
%4 = tail call i32 @VIM_SIF_I2cWriteWord(i32 91, i32 1)
br label %9
5: ; preds = %1
%6 = tail call i32 @VIM_SIF_I2cWriteWord(i32 91, i32 3)
br label %9
7: ; preds = %1
%8 = tail call i32 @VIM_SIF_I2cWriteWord(i32 240, i32 2)
br label %9
9: ; preds = %1, %3, %5, %7
%10 = phi i32 [ 768, %7 ], [ 192, %5 ], [ 160, %3 ], [ 128, %1 ]
%11 = phi i32 [ 16400, %7 ], [ 4112, %5 ], [ 4112, %3 ], [ 4112, %1 ]
%12 = tail call i32 @VIM_SIF_I2cWriteWord(i32 55, i32 %10)
%13 = tail call i32 @VIM_SIF_I2cWriteWord(i32 103, i32 %11)
br label %14
14: ; preds = %9, %1
ret void
}