#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, unsigned char);
void SensorSetMirrorFlip_NOON30PC11(unsigned char val) {
  unsigned char x;
  VIM_SIF_I2cReadByte(0x01, &x);
  if (val == 1)
    val = 2;
  else if (val == 2)
    val = 1;
  VIM_SIF_I2cWriteByte(0x01, (unsigned char)((x & 0xfc) | (val & 0x03)));
}


x86 assembly (clang, -O0):
<SensorSetMirrorFlip_NOON30PC11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    1152 <SensorSetMirrorFlip_NOON30PC11+0x32>
movb   $0x2,-0x1(%rbp)
jmp    1168 <SensorSetMirrorFlip_NOON30PC11+0x48>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    1163 <SensorSetMirrorFlip_NOON30PC11+0x43>
movb   $0x1,-0x1(%rbp)
jmp    1168 <SensorSetMirrorFlip_NOON30PC11+0x48>
movzbl -0x2(%rbp),%eax
and    $0xfc,%eax
movzbl -0x1(%rbp),%ecx
and    $0x3,%ecx
or     %ecx,%eax
mov    $0x1,%edi
movzbl %al,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetMirrorFlip_NOON30PC11>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1,%ebp
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    %ebx,%eax
and    $0x3,%al
cmp    $0x2,%bl
movzbl %al,%eax
cmove  %ebp,%eax
cmp    $0x1,%bl
mov    $0x2,%ecx
cmovne %eax,%ecx
mov    0x7(%rsp),%al
and    $0xfc,%al
or     %cl,%al
movzbl %al,%esi
mov    $0x1,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @SensorSetMirrorFlip_NOON30PC11(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = call i32 @VIM_SIF_I2cReadByte(i32 1, i8* %3)
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %1
store i8 2, i8* %2
br label %15
9: ; preds = %1
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %14
13: ; preds = %9
store i8 1, i8* %2
br label %14
14: ; preds = %13, %9
br label %15
15: ; preds = %14, %8
%16 = load i8, i8* %3
%17 = zext i8 %16 to i32
%18 = and i32 %17, 252
%19 = load i8, i8* %2
%20 = zext i8 %19 to i32
%21 = and i32 %20, 3
%22 = or i32 %18, %21
%23 = trunc i32 %22 to i8
%24 = call i32 @VIM_SIF_I2cWriteByte(i32 1, i8 zeroext %23)
ret void
}

LLVM IR (-O2):
define void @SensorSetMirrorFlip_NOON30PC11(i8 zeroext %0) {
%2 = alloca i8
%3 = call i32 @VIM_SIF_I2cReadByte(i32 1, i8* %2)
%4 = icmp eq i8 %0, 1
%5 = icmp eq i8 %0, 2
%6 = and i8 %0, 3
%7 = select i1 %5, i8 1, i8 %6
%8 = select i1 %4, i8 2, i8 %7
%9 = load i8, i8* %2
%10 = and i8 %9, -4
%11 = or i8 %10, %8
%12 = call i32 @VIM_SIF_I2cWriteByte(i32 1, i8 zeroext %11)
ret void
}