#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_I2cWriteByte(int, int);
void SensorSetBrightness_S5KA3AFX(unsigned char val) {
  VIM_SIF_I2cWriteByte(0xef, 0x01);
  switch (val) {
  case 1:
    VIM_SIF_I2cWriteByte(0xae, 0xa6);
    VIM_SIF_I2cWriteByte(0xaf, 0xa6);
    VIM_SIF_I2cWriteByte(0xef, 0x00);
    VIM_SIF_I2cWriteByte(0x73, 0xa6);
    break;
  case 2:
    VIM_SIF_I2cWriteByte(0xae, 0x98);
    VIM_SIF_I2cWriteByte(0xaf, 0x98);
    VIM_SIF_I2cWriteByte(0xef, 0x00);
    VIM_SIF_I2cWriteByte(0x73, 0x98);
    break;
  case 3:
    VIM_SIF_I2cWriteByte(0xae, 0x88);
    VIM_SIF_I2cWriteByte(0xaf, 0x88);
    VIM_SIF_I2cWriteByte(0xef, 0x00);
    VIM_SIF_I2cWriteByte(0x73, 0x88);
    break;
  case 4:
    VIM_SIF_I2cWriteByte(0xae, 0x08);
    VIM_SIF_I2cWriteByte(0xaf, 0x08);
    VIM_SIF_I2cWriteByte(0xef, 0x00);
    VIM_SIF_I2cWriteByte(0x73, 0x08);
    break;
  case 5:
    VIM_SIF_I2cWriteByte(0xae, 0x18);
    VIM_SIF_I2cWriteByte(0xaf, 0x18);
    VIM_SIF_I2cWriteByte(0xef, 0x00);
    VIM_SIF_I2cWriteByte(0x73, 0x18);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetBrightness_S5KA3AFX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xef,%edi
mov    $0x1,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
movzbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     128d <SensorSetBrightness_S5KA3AFX+0x17d>
mov    -0x10(%rbp),%rax
lea    0xeb2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0xae,%edi
mov    $0xa6,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xaf,%edi
mov    $0xa6,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xef,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0x73,%edi
mov    $0xa6,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    1292 <SensorSetBrightness_S5KA3AFX+0x182>
mov    $0xae,%edi
mov    $0x98,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xaf,%edi
mov    $0x98,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xef,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0x73,%edi
mov    $0x98,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    1292 <SensorSetBrightness_S5KA3AFX+0x182>
mov    $0xae,%edi
mov    $0x88,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xaf,%edi
mov    $0x88,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xef,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0x73,%edi
mov    $0x88,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    1292 <SensorSetBrightness_S5KA3AFX+0x182>
mov    $0xae,%edi
mov    $0x8,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xaf,%edi
mov    $0x8,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xef,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0x73,%edi
mov    $0x8,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    1292 <SensorSetBrightness_S5KA3AFX+0x182>
mov    $0xae,%edi
mov    $0x18,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xaf,%edi
mov    $0x18,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xef,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0x73,%edi
mov    $0x18,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    1292 <SensorSetBrightness_S5KA3AFX+0x182>
jmp    1292 <SensorSetBrightness_S5KA3AFX+0x182>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetBrightness_S5KA3AFX>:
push   %rbx
mov    %edi,%ebx
mov    $0xef,%edi
mov    $0x1,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0xff,%bl
cmp    $0x4,%bl
ja     1169 <SensorSetBrightness_S5KA3AFX+0x59>
movsbq %bl,%rax
lea    0xecb(%rip),%rcx
mov    (%rcx,%rax,4),%ebx
mov    $0xae,%edi
mov    %ebx,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xaf,%edi
mov    %ebx,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0xef,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0x73,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <VIM_SIF_I2cWriteByte@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @SensorSetBrightness_S5KA3AFX(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 1)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
switch i32 %5, label %31 [
i32 1, label %6
i32 2, label %11
i32 3, label %16
i32 4, label %21
i32 5, label %26
]
6: ; preds = %1
%7 = call i32 @VIM_SIF_I2cWriteByte(i32 174, i32 166)
%8 = call i32 @VIM_SIF_I2cWriteByte(i32 175, i32 166)
%9 = call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 0)
%10 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 166)
br label %32
11: ; preds = %1
%12 = call i32 @VIM_SIF_I2cWriteByte(i32 174, i32 152)
%13 = call i32 @VIM_SIF_I2cWriteByte(i32 175, i32 152)
%14 = call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 0)
%15 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 152)
br label %32
16: ; preds = %1
%17 = call i32 @VIM_SIF_I2cWriteByte(i32 174, i32 136)
%18 = call i32 @VIM_SIF_I2cWriteByte(i32 175, i32 136)
%19 = call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 0)
%20 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 136)
br label %32
21: ; preds = %1
%22 = call i32 @VIM_SIF_I2cWriteByte(i32 174, i32 8)
%23 = call i32 @VIM_SIF_I2cWriteByte(i32 175, i32 8)
%24 = call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 0)
%25 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 8)
br label %32
26: ; preds = %1
%27 = call i32 @VIM_SIF_I2cWriteByte(i32 174, i32 24)
%28 = call i32 @VIM_SIF_I2cWriteByte(i32 175, i32 24)
%29 = call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 0)
%30 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 24)
br label %32
31: ; preds = %1
br label %32
32: ; preds = %31, %26, %21, %16, %11, %6
ret void
}

LLVM IR (-O2):
@switch.table.SensorSetBrightness_S5KA3AFX = [5 x i32] [i32 166, i32 152, i32 136, i32 8, i32 24]
define void @SensorSetBrightness_S5KA3AFX(i8 zeroext %0) {
%2 = tail call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 1)
%3 = add i8 %0, -1
%4 = icmp ult i8 %3, 5
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = sext i8 %3 to i64
%7 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table.SensorSetBrightness_S5KA3AFX, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = tail call i32 @VIM_SIF_I2cWriteByte(i32 174, i32 %8)
%10 = tail call i32 @VIM_SIF_I2cWriteByte(i32 175, i32 %8)
%11 = tail call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 0)
%12 = tail call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 %8)
br label %13
13: ; preds = %1, %5
ret void
}