#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 SensorSetBrightness_OV7725(unsigned char val) {
  unsigned char x;
  switch (val) {
  case 1:
    VIM_SIF_I2cReadByte(0xab, &x);
    VIM_SIF_I2cWriteByte(0xab, (unsigned char)(x | 0x08));
    VIM_SIF_I2cReadByte(0xa6, &x);
    VIM_SIF_I2cWriteByte(0xa6, (unsigned char)(x | 0x04));
    VIM_SIF_I2cWriteByte(0x9b, 0x58);
    break;
  case 2:
    VIM_SIF_I2cReadByte(0xab, &x);
    VIM_SIF_I2cWriteByte(0xab, (unsigned char)(x | 0x08));
    VIM_SIF_I2cReadByte(0xa6, &x);
    VIM_SIF_I2cWriteByte(0xa6, (unsigned char)(x | 0x04));
    VIM_SIF_I2cWriteByte(0x9b, 0x38);
    break;
  case 3:
    VIM_SIF_I2cReadByte(0xab, &x);
    VIM_SIF_I2cWriteByte(0xab, (unsigned char)(x & 0xf7));
    VIM_SIF_I2cReadByte(0xa6, &x);
    VIM_SIF_I2cWriteByte(0xa6, (unsigned char)(x | 0x04));
    VIM_SIF_I2cWriteByte(0x9b, 0x08);
    break;
  case 4:
    VIM_SIF_I2cReadByte(0xab, &x);
    VIM_SIF_I2cWriteByte(0xab, (unsigned char)(x & 0xf7));
    VIM_SIF_I2cReadByte(0xa6, &x);
    VIM_SIF_I2cWriteByte(0xa6, (unsigned char)(x | 0x04));
    VIM_SIF_I2cWriteByte(0x9b, 0x28);
    break;
  case 5:
    VIM_SIF_I2cReadByte(0xab, &x);
    VIM_SIF_I2cWriteByte(0xab, (unsigned char)(x & 0xf7));
    VIM_SIF_I2cReadByte(0xa6, &x);
    VIM_SIF_I2cWriteByte(0xa6, (unsigned char)(x | 0x04));
    VIM_SIF_I2cWriteByte(0x9b, 0x48);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetBrightness_OV7725>:
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    $0x4,%eax
ja     1316 <SensorSetBrightness_OV7725+0x1f6>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0xab,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
or     $0x8,%eax
movzbl %al,%esi
mov    $0xab,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0xa6,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
or     $0x4,%eax
movzbl %al,%esi
mov    $0xa6,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9b,%edi
mov    $0x58,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    131b <SensorSetBrightness_OV7725+0x1fb>
mov    $0xab,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
or     $0x8,%eax
movzbl %al,%esi
mov    $0xab,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0xa6,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
or     $0x4,%eax
movzbl %al,%esi
mov    $0xa6,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9b,%edi
mov    $0x38,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    131b <SensorSetBrightness_OV7725+0x1fb>
mov    $0xab,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
and    $0xf7,%eax
movzbl %al,%esi
mov    $0xab,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0xa6,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
or     $0x4,%eax
movzbl %al,%esi
mov    $0xa6,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9b,%edi
mov    $0x8,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    131b <SensorSetBrightness_OV7725+0x1fb>
mov    $0xab,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
and    $0xf7,%eax
movzbl %al,%esi
mov    $0xab,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0xa6,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
or     $0x4,%eax
movzbl %al,%esi
mov    $0xa6,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9b,%edi
mov    $0x28,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    131b <SensorSetBrightness_OV7725+0x1fb>
mov    $0xab,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
and    $0xf7,%eax
movzbl %al,%esi
mov    $0xab,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0xa6,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
or     $0x4,%eax
movzbl %al,%esi
mov    $0xa6,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9b,%edi
mov    $0x48,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
jmp    131b <SensorSetBrightness_OV7725+0x1fb>
jmp    131b <SensorSetBrightness_OV7725+0x1fb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetBrightness_OV7725>:
add    $0xff,%dil
cmp    $0x4,%dil
ja     1210 <SensorSetBrightness_OV7725+0xf0>
push   %rbx
sub    $0x10,%rsp
movzbl %dil,%eax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf(%rsp),%rsi
mov    $0xab,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    0xf(%rsp),%al
or     $0x8,%al
mov    $0x58,%ebx
jmp    11d1 <SensorSetBrightness_OV7725+0xb1>
lea    0xf(%rsp),%rsi
mov    $0xab,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    0xf(%rsp),%al
or     $0x8,%al
mov    $0x38,%ebx
jmp    11d1 <SensorSetBrightness_OV7725+0xb1>
lea    0xf(%rsp),%rsi
mov    $0xab,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    0xf(%rsp),%al
and    $0xf7,%al
mov    $0x8,%ebx
jmp    11d1 <SensorSetBrightness_OV7725+0xb1>
lea    0xf(%rsp),%rsi
mov    $0xab,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    0xf(%rsp),%al
and    $0xf7,%al
mov    $0x28,%ebx
jmp    11d1 <SensorSetBrightness_OV7725+0xb1>
lea    0xf(%rsp),%rsi
mov    $0xab,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    0xf(%rsp),%al
and    $0xf7,%al
mov    $0x48,%ebx
movzbl %al,%esi
mov    $0xab,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
lea    0xf(%rsp),%rsi
mov    $0xa6,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl 0xf(%rsp),%esi
or     $0x4,%esi
mov    $0xa6,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    $0x9b,%edi
mov    %ebx,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @SensorSetBrightness_OV7725(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 %86 [
i32 1, label %6
i32 2, label %22
i32 3, label %38
i32 4, label %54
i32 5, label %70
]
6: ; preds = %1
%7 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %3)
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = or i32 %9, 8
%11 = trunc i32 %10 to i8
%12 = zext i8 %11 to i32
%13 = call i32 @VIM_SIF_I2cWriteByte(i32 171, i32 %12)
%14 = call i32 @VIM_SIF_I2cReadByte(i32 166, i8* %3)
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = or i32 %16, 4
%18 = trunc i32 %17 to i8
%19 = zext i8 %18 to i32
%20 = call i32 @VIM_SIF_I2cWriteByte(i32 166, i32 %19)
%21 = call i32 @VIM_SIF_I2cWriteByte(i32 155, i32 88)
br label %87
22: ; preds = %1
%23 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %3)
%24 = load i8, i8* %3
%25 = zext i8 %24 to i32
%26 = or i32 %25, 8
%27 = trunc i32 %26 to i8
%28 = zext i8 %27 to i32
%29 = call i32 @VIM_SIF_I2cWriteByte(i32 171, i32 %28)
%30 = call i32 @VIM_SIF_I2cReadByte(i32 166, i8* %3)
%31 = load i8, i8* %3
%32 = zext i8 %31 to i32
%33 = or i32 %32, 4
%34 = trunc i32 %33 to i8
%35 = zext i8 %34 to i32
%36 = call i32 @VIM_SIF_I2cWriteByte(i32 166, i32 %35)
%37 = call i32 @VIM_SIF_I2cWriteByte(i32 155, i32 56)
br label %87
38: ; preds = %1
%39 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %3)
%40 = load i8, i8* %3
%41 = zext i8 %40 to i32
%42 = and i32 %41, 247
%43 = trunc i32 %42 to i8
%44 = zext i8 %43 to i32
%45 = call i32 @VIM_SIF_I2cWriteByte(i32 171, i32 %44)
%46 = call i32 @VIM_SIF_I2cReadByte(i32 166, i8* %3)
%47 = load i8, i8* %3
%48 = zext i8 %47 to i32
%49 = or i32 %48, 4
%50 = trunc i32 %49 to i8
%51 = zext i8 %50 to i32
%52 = call i32 @VIM_SIF_I2cWriteByte(i32 166, i32 %51)
%53 = call i32 @VIM_SIF_I2cWriteByte(i32 155, i32 8)
br label %87
54: ; preds = %1
%55 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %3)
%56 = load i8, i8* %3
%57 = zext i8 %56 to i32
%58 = and i32 %57, 247
%59 = trunc i32 %58 to i8
%60 = zext i8 %59 to i32
%61 = call i32 @VIM_SIF_I2cWriteByte(i32 171, i32 %60)
%62 = call i32 @VIM_SIF_I2cReadByte(i32 166, i8* %3)
%63 = load i8, i8* %3
%64 = zext i8 %63 to i32
%65 = or i32 %64, 4
%66 = trunc i32 %65 to i8
%67 = zext i8 %66 to i32
%68 = call i32 @VIM_SIF_I2cWriteByte(i32 166, i32 %67)
%69 = call i32 @VIM_SIF_I2cWriteByte(i32 155, i32 40)
br label %87
70: ; preds = %1
%71 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %3)
%72 = load i8, i8* %3
%73 = zext i8 %72 to i32
%74 = and i32 %73, 247
%75 = trunc i32 %74 to i8
%76 = zext i8 %75 to i32
%77 = call i32 @VIM_SIF_I2cWriteByte(i32 171, i32 %76)
%78 = call i32 @VIM_SIF_I2cReadByte(i32 166, i8* %3)
%79 = load i8, i8* %3
%80 = zext i8 %79 to i32
%81 = or i32 %80, 4
%82 = trunc i32 %81 to i8
%83 = zext i8 %82 to i32
%84 = call i32 @VIM_SIF_I2cWriteByte(i32 166, i32 %83)
%85 = call i32 @VIM_SIF_I2cWriteByte(i32 155, i32 72)
br label %87
86: ; preds = %1
br label %87
87: ; preds = %86, %70, %54, %38, %22, %6
ret void
}

LLVM IR (-O2):
define void @SensorSetBrightness_OV7725(i8 zeroext %0) {
%2 = alloca i8
switch i8 %0, label %34 [
i8 1, label %3
i8 2, label %7
i8 3, label %11
i8 4, label %15
i8 5, label %19
]
3: ; preds = %1
%4 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %2)
%5 = load i8, i8* %2
%6 = or i8 %5, 8
br label %23
7: ; preds = %1
%8 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %2)
%9 = load i8, i8* %2
%10 = or i8 %9, 8
br label %23
11: ; preds = %1
%12 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %2)
%13 = load i8, i8* %2
%14 = and i8 %13, -9
br label %23
15: ; preds = %1
%16 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %2)
%17 = load i8, i8* %2
%18 = and i8 %17, -9
br label %23
19: ; preds = %1
%20 = call i32 @VIM_SIF_I2cReadByte(i32 171, i8* %2)
%21 = load i8, i8* %2
%22 = and i8 %21, -9
br label %23
23: ; preds = %3, %7, %11, %15, %19
%24 = phi i8 [ %6, %3 ], [ %10, %7 ], [ %14, %11 ], [ %18, %15 ], [ %22, %19 ]
%25 = phi i32 [ 88, %3 ], [ 56, %7 ], [ 8, %11 ], [ 40, %15 ], [ 72, %19 ]
%26 = zext i8 %24 to i32
%27 = call i32 @VIM_SIF_I2cWriteByte(i32 171, i32 %26)
%28 = call i32 @VIM_SIF_I2cReadByte(i32 166, i8* %2)
%29 = load i8, i8* %2
%30 = or i8 %29, 4
%31 = zext i8 %30 to i32
%32 = call i32 @VIM_SIF_I2cWriteByte(i32 166, i32 %31)
%33 = call i32 @VIM_SIF_I2cWriteByte(i32 155, i32 %25)
br label %34
34: ; preds = %23, %1
ret void
}