#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 SensorSetMirrorFlip_S5KA3AFX(unsigned char val) {
  VIM_SIF_I2cWriteByte(0xef, 02);
  switch (val) {
  case 0:
    VIM_SIF_I2cWriteByte(0x02, 0x40);
    break;
  case 1:
    VIM_SIF_I2cWriteByte(0x02, 0x80);
    break;
  case 2:
    VIM_SIF_I2cWriteByte(0x02, 0xc0);
    break;
  default:
    VIM_SIF_I2cWriteByte(0x02, 0x00);
    break;
  }
}


x86 assembly (clang, -O0):
<SensorSetMirrorFlip_S5KA3AFX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xef,%edi
mov    $0x2,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1163 <SensorSetMirrorFlip_S5KA3AFX+0x53>
jmp    1141 <SensorSetMirrorFlip_S5KA3AFX+0x31>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     1177 <SensorSetMirrorFlip_S5KA3AFX+0x67>
jmp    1152 <SensorSetMirrorFlip_S5KA3AFX+0x42>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     118b <SensorSetMirrorFlip_S5KA3AFX+0x7b>
jmp    119f <SensorSetMirrorFlip_S5KA3AFX+0x8f>
mov    $0x2,%edi
mov    $0x40,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    11ab <SensorSetMirrorFlip_S5KA3AFX+0x9b>
mov    $0x2,%edi
mov    $0x80,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    11ab <SensorSetMirrorFlip_S5KA3AFX+0x9b>
mov    $0x2,%edi
mov    $0xc0,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
jmp    11ab <SensorSetMirrorFlip_S5KA3AFX+0x9b>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetMirrorFlip_S5KA3AFX>:
push   %rbx
mov    %edi,%ebx
mov    $0xef,%edi
mov    $0x2,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
mov    %ebx,%eax
shl    $0x6,%eax
add    $0x40,%eax
xor    %esi,%esi
cmp    $0x3,%bl
cmovb  %eax,%esi
mov    $0x2,%edi
pop    %rbx
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetMirrorFlip_S5KA3AFX(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 2)
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
switch i32 %5, label %12 [
i32 0, label %6
i32 1, label %8
i32 2, label %10
]
6: ; preds = %1
%7 = call i32 @VIM_SIF_I2cWriteByte(i32 2, i32 64)
br label %14
8: ; preds = %1
%9 = call i32 @VIM_SIF_I2cWriteByte(i32 2, i32 128)
br label %14
10: ; preds = %1
%11 = call i32 @VIM_SIF_I2cWriteByte(i32 2, i32 192)
br label %14
12: ; preds = %1
%13 = call i32 @VIM_SIF_I2cWriteByte(i32 2, i32 0)
br label %14
14: ; preds = %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
define void @SensorSetMirrorFlip_S5KA3AFX(i8 zeroext %0) {
%2 = tail call i32 @VIM_SIF_I2cWriteByte(i32 239, i32 2)
%3 = icmp ult i8 %0, 3
%4 = zext i8 %0 to i32
%5 = shl nuw nsw i32 %4, 6
%6 = add nuw nsw i32 %5, 64
%7 = select i1 %3, i32 %6, i32 0
%8 = tail call i32 @VIM_SIF_I2cWriteByte(i32 2, i32 %7)
ret void
}