#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_OV7649(unsigned char val) {
  unsigned char x1, x2;
  if (val == 1)
    val = 2;
  else if (val == 2)
    val = 1;
  VIM_SIF_I2cReadByte(0x12, &x1);
  VIM_SIF_I2cReadByte(0x75, &x2);
  VIM_SIF_I2cWriteByte(0x12,
                       (unsigned char)((x1 & 0xbf) | ((val & 0x01) << 6)));
  VIM_SIF_I2cWriteByte(0x75,
                       (unsigned char)((x2 & 0x7f) | ((val & 0x02) << 6)));
}


x86 assembly (clang, -O0):
<SensorSetMirrorFlip_OV7649>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    1144 <SensorSetMirrorFlip_OV7649+0x24>
movb   $0x2,-0x1(%rbp)
jmp    115a <SensorSetMirrorFlip_OV7649+0x3a>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    1155 <SensorSetMirrorFlip_OV7649+0x35>
movb   $0x1,-0x1(%rbp)
jmp    115a <SensorSetMirrorFlip_OV7649+0x3a>
mov    $0x12,%edi
lea    -0x2(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    $0x75,%edi
lea    -0x3(%rbp),%rsi
call   1030 <VIM_SIF_I2cReadByte@plt>
movzbl -0x2(%rbp),%eax
and    $0xbf,%eax
movzbl -0x1(%rbp),%ecx
and    $0x1,%ecx
shl    $0x6,%ecx
or     %ecx,%eax
mov    $0x12,%edi
movzbl %al,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
movzbl -0x3(%rbp),%eax
and    $0x7f,%eax
movzbl -0x1(%rbp),%ecx
and    $0x2,%ecx
shl    $0x6,%ecx
or     %ecx,%eax
mov    $0x75,%edi
movzbl %al,%esi
call   1040 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetMirrorFlip_OV7649>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%eax
shl    $0x6,%al
cmp    $0x2,%dil
movzbl %al,%eax
mov    $0x40,%ecx
cmovne %eax,%ecx
cmp    $0x1,%dil
mov    $0x80,%ebx
cmovne %ecx,%ebx
lea    0xf(%rsp),%rsi
mov    $0x12,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
lea    0xe(%rsp),%rsi
mov    $0x75,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
mov    0xf(%rsp),%al
and    $0xbf,%al
mov    %ebx,%ecx
and    $0x40,%cl
or     %al,%cl
movzbl %cl,%esi
mov    $0x12,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
mov    0xe(%rsp),%al
and    $0x7f,%al
and    $0x80,%bl
or     %al,%bl
movzbl %bl,%esi
mov    $0x75,%edi
call   1040 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @SensorSetMirrorFlip_OV7649(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %2
%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 = call i32 @VIM_SIF_I2cReadByte(i32 18, i8* %3)
%17 = call i32 @VIM_SIF_I2cReadByte(i32 117, i8* %4)
%18 = load i8, i8* %3
%19 = zext i8 %18 to i32
%20 = and i32 %19, 191
%21 = load i8, i8* %2
%22 = zext i8 %21 to i32
%23 = and i32 %22, 1
%24 = shl i32 %23, 6
%25 = or i32 %20, %24
%26 = trunc i32 %25 to i8
%27 = call i32 @VIM_SIF_I2cWriteByte(i32 18, i8 zeroext %26)
%28 = load i8, i8* %4
%29 = zext i8 %28 to i32
%30 = and i32 %29, 127
%31 = load i8, i8* %2
%32 = zext i8 %31 to i32
%33 = and i32 %32, 2
%34 = shl i32 %33, 6
%35 = or i32 %30, %34
%36 = trunc i32 %35 to i8
%37 = call i32 @VIM_SIF_I2cWriteByte(i32 117, i8 zeroext %36)
ret void
}

LLVM IR (-O2):
define void @SensorSetMirrorFlip_OV7649(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = icmp eq i8 %0, 1
%5 = icmp eq i8 %0, 2
%6 = shl i8 %0, 6
%7 = select i1 %5, i8 64, i8 %6
%8 = select i1 %4, i8 -128, i8 %7
%9 = call i32 @VIM_SIF_I2cReadByte(i32 18, i8* %2)
%10 = call i32 @VIM_SIF_I2cReadByte(i32 117, i8* %3)
%11 = load i8, i8* %2
%12 = and i8 %11, -65
%13 = and i8 %8, 64
%14 = or i8 %12, %13
%15 = call i32 @VIM_SIF_I2cWriteByte(i32 18, i8 zeroext %14)
%16 = load i8, i8* %3
%17 = and i8 %16, 127
%18 = and i8 %8, -128
%19 = or i8 %17, %18
%20 = call i32 @VIM_SIF_I2cWriteByte(i32 117, i8 zeroext %19)
ret void
}