#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 SensorSetMode_S5K83A(unsigned char val) {
  VIM_SIF_I2cWriteByte(0xec, 0x00);
  switch (val) {
  case 1:
    VIM_SIF_I2cWriteByte(0x74, 0x04);
    VIM_SIF_I2cWriteByte(0x73, 0x00);
    break;
  case 2:
    VIM_SIF_I2cWriteByte(0x74, 0x08);
    VIM_SIF_I2cWriteByte(0x73, 0x00);
    break;
  case 4:
    VIM_SIF_I2cWriteByte(0x73, 0x21);
    break;
  case 3:
    VIM_SIF_I2cWriteByte(0x73, 0x00);
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetMode_S5K83A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xec,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
movzbl -0x1(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11b9 <SensorSetMode_S5K83A+0xa9>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x74,%edi
mov    $0x4,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0x73,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    11be <SensorSetMode_S5K83A+0xae>
mov    $0x74,%edi
mov    $0x8,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    $0x73,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    11be <SensorSetMode_S5K83A+0xae>
mov    $0x73,%edi
mov    $0x21,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    11be <SensorSetMode_S5K83A+0xae>
mov    $0x73,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    11be <SensorSetMode_S5K83A+0xae>
jmp    11be <SensorSetMode_S5K83A+0xae>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetMode_S5K83A>:
push   %rbx
mov    %edi,%ebx
mov    $0xec,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0xff,%bl
cmp    $0x3,%bl
ja     114b <SensorSetMode_S5K83A+0x3b>
mov    $0x21,%esi
movzbl %bl,%eax
lea    0xeca(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x74,%edi
mov    $0x4,%esi
jmp    1157 <SensorSetMode_S5K83A+0x47>
pop    %rbx
ret
mov    $0x74,%edi
mov    $0x8,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
xor    %esi,%esi
mov    $0x73,%edi
pop    %rbx
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetMode_S5K83A(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @VIM_SIF_I2cWriteByte(i32 236, i32 0)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
switch i32 %5, label %16 [
i32 1, label %6
i32 2, label %9
i32 4, label %12
i32 3, label %14
]
6: ; preds = %1
%7 = call i32 @VIM_SIF_I2cWriteByte(i32 116, i32 4)
%8 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 0)
br label %17
9: ; preds = %1
%10 = call i32 @VIM_SIF_I2cWriteByte(i32 116, i32 8)
%11 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 0)
br label %17
12: ; preds = %1
%13 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 33)
br label %17
14: ; preds = %1
%15 = call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 0)
br label %17
16: ; preds = %1
br label %17
17: ; preds = %16, %14, %12, %9, %6
ret void
}

LLVM IR (-O2):
define void @SensorSetMode_S5K83A(i8 zeroext %0) {
%2 = tail call i32 @VIM_SIF_I2cWriteByte(i32 236, i32 0)
switch i8 %0, label %11 [
i8 1, label %3
i8 2, label %5
i8 4, label %8
i8 3, label %7
]
3: ; preds = %1
%4 = tail call i32 @VIM_SIF_I2cWriteByte(i32 116, i32 4)
br label %8
5: ; preds = %1
%6 = tail call i32 @VIM_SIF_I2cWriteByte(i32 116, i32 8)
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %3, %5, %7
%9 = phi i32 [ 0, %7 ], [ 0, %5 ], [ 0, %3 ], [ 33, %1 ]
%10 = tail call i32 @VIM_SIF_I2cWriteByte(i32 115, i32 %9)
br label %11
11: ; preds = %8, %1
ret void
}