#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_I2cReadByte(int, unsigned char *);
int /*<<< orphan*/ VIM_SIF_I2cWriteByte(int, int);
void SensorSetMode_OV7670(unsigned char val) {
  unsigned char uTemp;
  switch (val) {
  case 1:
    VIM_SIF_I2cWriteByte(0x3b, 0x0a);
    VIM_SIF_I2cWriteByte(0x92, 0x19);
    VIM_SIF_I2cWriteByte(0x13, 0xe2);
    VIM_SIF_I2cWriteByte(0x2d, 0x00);
    VIM_SIF_I2cWriteByte(0x2e, 0x00);
    VIM_SIF_I2cWriteByte(0x9d, 0x4c);
    VIM_SIF_I2cWriteByte(0x9e, 0x3f);
    VIM_SIF_I2cWriteByte(0x13, 0xe7);
    break;
  case 2:
    VIM_SIF_I2cWriteByte(0x3b, 0x02);
    VIM_SIF_I2cWriteByte(0x92, 0x00);
    VIM_SIF_I2cWriteByte(0x93, 0x00);
    VIM_SIF_I2cWriteByte(0x13, 0xe2);
    VIM_SIF_I2cWriteByte(0x2d, 0x00);
    VIM_SIF_I2cWriteByte(0x2e, 0x00);
    VIM_SIF_I2cWriteByte(0x9d, 0x4c);
    VIM_SIF_I2cWriteByte(0x9e, 0x3f);
    VIM_SIF_I2cWriteByte(0x13, 0xe7);
    break;
  case 4:
    VIM_SIF_I2cReadByte(0x3b, &uTemp);
    VIM_SIF_I2cWriteByte(0x3b, (unsigned char)((0xa0) | (uTemp & 0x08)));
    VIM_SIF_I2cWriteByte(0x92, 0x10);
    VIM_SIF_I2cWriteByte(0x92, 0x10);
    break;
  case 3:
    VIM_SIF_I2cReadByte(0x3b, &uTemp);
    VIM_SIF_I2cWriteByte(0x3b, (unsigned char)((0x02) | (uTemp & 0x08)));
    VIM_SIF_I2cWriteByte(0x13, 0xe2);
    VIM_SIF_I2cWriteByte(0x2d, 0x00);
    VIM_SIF_I2cWriteByte(0x2e, 0x00);
    VIM_SIF_I2cWriteByte(0x13, 0xe7);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetMode_OV7670>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     12f9 <SensorSetMode_OV7670+0x1d9>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x3b,%edi
mov    $0xa,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x92,%edi
mov    $0x19,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe2,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2d,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2e,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9d,%edi
mov    $0x4c,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9e,%edi
mov    $0x3f,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe7,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    12fe <SensorSetMode_OV7670+0x1de>
mov    $0x3b,%edi
mov    $0x2,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x92,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x93,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe2,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2d,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2e,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9d,%edi
mov    $0x4c,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9e,%edi
mov    $0x3f,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe7,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    12fe <SensorSetMode_OV7670+0x1de>
mov    $0x3b,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
and    $0x8,%eax
or     $0xa0,%eax
movzbl %al,%esi
mov    $0x3b,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x92,%edi
mov    $0x10,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x92,%edi
mov    $0x10,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    12fe <SensorSetMode_OV7670+0x1de>
mov    $0x3b,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
and    $0x8,%eax
or     $0x2,%eax
movzbl %al,%esi
mov    $0x3b,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe2,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2d,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2e,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe7,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    12fe <SensorSetMode_OV7670+0x1de>
jmp    12fe <SensorSetMode_OV7670+0x1de>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetMode_OV7670>:
push   %rax
add    $0xff,%dil
cmp    $0x3,%dil
ja     1276 <SensorSetMode_OV7670+0x156>
movzbl %dil,%eax
lea    0xec6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x3b,%edi
mov    $0xa,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x92,%edi
mov    $0x19,%esi
jmp    1180 <SensorSetMode_OV7670+0x60>
mov    $0x3b,%edi
mov    $0x2,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x92,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x93,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe2,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2d,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2e,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9d,%edi
mov    $0x4c,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9e,%edi
mov    $0x3f,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe7,%esi
pop    %rax
jmp    1040 <VIM_SIF_I2cWriteByte@plt>
lea    0x7(%rsp),%rsi
mov    $0x3b,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl 0x7(%rsp),%esi
and    $0x8,%esi
or     $0x2,%esi
mov    $0x3b,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe2,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2d,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x2e,%edi
xor    %esi,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x13,%edi
mov    $0xe7,%esi
jmp    1271 <SensorSetMode_OV7670+0x151>
lea    0x7(%rsp),%rsi
mov    $0x3b,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl 0x7(%rsp),%esi
and    $0x8,%esi
or     $0xa0,%esi
mov    $0x3b,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x92,%edi
mov    $0x10,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x92,%edi
mov    $0x10,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @SensorSetMode_OV7670(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
switch i32 %5, label %49 [
i32 1, label %6
i32 2, label %15
i32 4, label %25
i32 3, label %36
]
6: ; preds = %1
%7 = call i32 @VIM_SIF_I2cWriteByte(i32 59, i32 10)
%8 = call i32 @VIM_SIF_I2cWriteByte(i32 146, i32 25)
%9 = call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 226)
%10 = call i32 @VIM_SIF_I2cWriteByte(i32 45, i32 0)
%11 = call i32 @VIM_SIF_I2cWriteByte(i32 46, i32 0)
%12 = call i32 @VIM_SIF_I2cWriteByte(i32 157, i32 76)
%13 = call i32 @VIM_SIF_I2cWriteByte(i32 158, i32 63)
%14 = call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 231)
br label %50
15: ; preds = %1
%16 = call i32 @VIM_SIF_I2cWriteByte(i32 59, i32 2)
%17 = call i32 @VIM_SIF_I2cWriteByte(i32 146, i32 0)
%18 = call i32 @VIM_SIF_I2cWriteByte(i32 147, i32 0)
%19 = call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 226)
%20 = call i32 @VIM_SIF_I2cWriteByte(i32 45, i32 0)
%21 = call i32 @VIM_SIF_I2cWriteByte(i32 46, i32 0)
%22 = call i32 @VIM_SIF_I2cWriteByte(i32 157, i32 76)
%23 = call i32 @VIM_SIF_I2cWriteByte(i32 158, i32 63)
%24 = call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 231)
br label %50
25: ; preds = %1
%26 = call i32 @VIM_SIF_I2cReadByte(i32 59, i8* %3)
%27 = load i8, i8* %3
%28 = zext i8 %27 to i32
%29 = and i32 %28, 8
%30 = or i32 160, %29
%31 = trunc i32 %30 to i8
%32 = zext i8 %31 to i32
%33 = call i32 @VIM_SIF_I2cWriteByte(i32 59, i32 %32)
%34 = call i32 @VIM_SIF_I2cWriteByte(i32 146, i32 16)
%35 = call i32 @VIM_SIF_I2cWriteByte(i32 146, i32 16)
br label %50
36: ; preds = %1
%37 = call i32 @VIM_SIF_I2cReadByte(i32 59, i8* %3)
%38 = load i8, i8* %3
%39 = zext i8 %38 to i32
%40 = and i32 %39, 8
%41 = or i32 2, %40
%42 = trunc i32 %41 to i8
%43 = zext i8 %42 to i32
%44 = call i32 @VIM_SIF_I2cWriteByte(i32 59, i32 %43)
%45 = call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 226)
%46 = call i32 @VIM_SIF_I2cWriteByte(i32 45, i32 0)
%47 = call i32 @VIM_SIF_I2cWriteByte(i32 46, i32 0)
%48 = call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 231)
br label %50
49: ; preds = %1
br label %50
50: ; preds = %49, %36, %25, %15, %6
ret void
}

LLVM IR (-O2):
define void @SensorSetMode_OV7670(i8 zeroext %0) {
%2 = alloca i8
switch i8 %0, label %42 [
i8 1, label %3
i8 2, label %12
i8 4, label %22
i8 3, label %31
]
3: ; preds = %1
%4 = tail call i32 @VIM_SIF_I2cWriteByte(i32 59, i32 10)
%5 = tail call i32 @VIM_SIF_I2cWriteByte(i32 146, i32 25)
%6 = tail call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 226)
%7 = tail call i32 @VIM_SIF_I2cWriteByte(i32 45, i32 0)
%8 = tail call i32 @VIM_SIF_I2cWriteByte(i32 46, i32 0)
%9 = tail call i32 @VIM_SIF_I2cWriteByte(i32 157, i32 76)
%10 = tail call i32 @VIM_SIF_I2cWriteByte(i32 158, i32 63)
%11 = tail call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 231)
br label %42
12: ; preds = %1
%13 = tail call i32 @VIM_SIF_I2cWriteByte(i32 59, i32 2)
%14 = tail call i32 @VIM_SIF_I2cWriteByte(i32 146, i32 0)
%15 = tail call i32 @VIM_SIF_I2cWriteByte(i32 147, i32 0)
%16 = tail call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 226)
%17 = tail call i32 @VIM_SIF_I2cWriteByte(i32 45, i32 0)
%18 = tail call i32 @VIM_SIF_I2cWriteByte(i32 46, i32 0)
%19 = tail call i32 @VIM_SIF_I2cWriteByte(i32 157, i32 76)
%20 = tail call i32 @VIM_SIF_I2cWriteByte(i32 158, i32 63)
%21 = tail call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 231)
br label %42
22: ; preds = %1
%23 = call i32 @VIM_SIF_I2cReadByte(i32 59, i8* %2)
%24 = load i8, i8* %2
%25 = and i8 %24, 8
%26 = or i8 %25, -96
%27 = zext i8 %26 to i32
%28 = call i32 @VIM_SIF_I2cWriteByte(i32 59, i32 %27)
%29 = call i32 @VIM_SIF_I2cWriteByte(i32 146, i32 16)
%30 = call i32 @VIM_SIF_I2cWriteByte(i32 146, i32 16)
br label %42
31: ; preds = %1
%32 = call i32 @VIM_SIF_I2cReadByte(i32 59, i8* %2)
%33 = load i8, i8* %2
%34 = and i8 %33, 8
%35 = or i8 %34, 2
%36 = zext i8 %35 to i32
%37 = call i32 @VIM_SIF_I2cWriteByte(i32 59, i32 %36)
%38 = call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 226)
%39 = call i32 @VIM_SIF_I2cWriteByte(i32 45, i32 0)
%40 = call i32 @VIM_SIF_I2cWriteByte(i32 46, i32 0)
%41 = call i32 @VIM_SIF_I2cWriteByte(i32 19, i32 231)
br label %42
42: ; preds = %1, %31, %22, %12, %3
ret void
}