#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 si5351_read_byte(int);
int /*<<< orphan*/ si5351_write_byte(int, int);
void si5351_calibration_mode(int enable) {
  if (enable) {
    si5351_write_byte(187, si5351_read_byte(187) | (1 << 6));
    si5351_write_byte(16, (si5351_read_byte(16) & ~(3 << 2)) | (0 << 2));
  } else {
    si5351_write_byte(16, (si5351_read_byte(16) & ~(3 << 2)) | (3 << 2));
    si5351_write_byte(187, si5351_read_byte(187) & ~(1 << 6));
  }
}


x86 assembly (clang, -O0):
<si5351_calibration_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     116f <si5351_calibration_mode+0x4f>
mov    $0xbb,%edi
call   1040 <si5351_read_byte@plt>
mov    %eax,%esi
or     $0x40,%esi
mov    $0xbb,%edi
call   1030 <si5351_write_byte@plt>
mov    $0x10,%edi
call   1040 <si5351_read_byte@plt>
mov    %eax,%esi
and    $0xfffffff3,%esi
or     $0x0,%esi
mov    $0x10,%edi
call   1030 <si5351_write_byte@plt>
jmp    11a4 <si5351_calibration_mode+0x84>
mov    $0x10,%edi
call   1040 <si5351_read_byte@plt>
mov    %eax,%esi
and    $0xfffffff3,%esi
or     $0xc,%esi
mov    $0x10,%edi
call   1030 <si5351_write_byte@plt>
mov    $0xbb,%edi
call   1040 <si5351_read_byte@plt>
mov    %eax,%esi
and    $0xffffffbf,%esi
mov    $0xbb,%edi
call   1030 <si5351_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<si5351_calibration_mode>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
mov    $0x10,%r14d
mov    $0xbb,%eax
mov    $0xbb,%r15d
cmove  %r14d,%r15d
mov    $0xc,%ecx
mov    $0x40,%ebx
cmove  %ecx,%ebx
cmove  %eax,%r14d
mov    $0xffffffbf,%eax
mov    $0xfffffff3,%ebp
cmove  %eax,%ebp
mov    %r15d,%edi
call   1040 <si5351_read_byte@plt>
or     %eax,%ebx
mov    %r15d,%edi
mov    %ebx,%esi
call   1030 <si5351_write_byte@plt>
mov    %r14d,%edi
call   1040 <si5351_read_byte@plt>
and    %eax,%ebp
mov    %r14d,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <si5351_write_byte@plt>

LLVM IR (-O0):
define void @si5351_calibration_mode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = call i32 @si5351_read_byte(i32 187)
%7 = or i32 %6, 64
%8 = call i32 @si5351_write_byte(i32 187, i32 %7)
%9 = call i32 @si5351_read_byte(i32 16)
%10 = and i32 %9, -13
%11 = or i32 %10, 0
%12 = call i32 @si5351_write_byte(i32 16, i32 %11)
br label %21
13: ; preds = %1
%14 = call i32 @si5351_read_byte(i32 16)
%15 = and i32 %14, -13
%16 = or i32 %15, 12
%17 = call i32 @si5351_write_byte(i32 16, i32 %16)
%18 = call i32 @si5351_read_byte(i32 187)
%19 = and i32 %18, -65
%20 = call i32 @si5351_write_byte(i32 187, i32 %19)
br label %21
21: ; preds = %13, %5
ret void
}

LLVM IR (-O2):
define void @si5351_calibration_mode(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 16, i32 187
%4 = select i1 %2, i32 12, i32 64
%5 = select i1 %2, i32 187, i32 16
%6 = select i1 %2, i32 -65, i32 -13
%7 = tail call i32 @si5351_read_byte(i32 %3)
%8 = or i32 %7, %4
%9 = tail call i32 @si5351_write_byte(i32 %3, i32 %8)
%10 = tail call i32 @si5351_read_byte(i32 %5)
%11 = and i32 %10, %6
%12 = tail call i32 @si5351_write_byte(i32 %5, i32 %11)
ret void
}