#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*/ clockBegin();
int /*<<< orphan*/ clockEnd();
int /*<<< orphan*/ dataA0();
int /*<<< orphan*/ dataA1();
int /*<<< orphan*/ dataB0();
int /*<<< orphan*/ dataB1();
int /*<<< orphan*/ dataToOutput();
int /*<<< orphan*/ delay();
void writeBits(bool bitA, bool bitB) {
  clockBegin();
  dataToOutput();
  if (bitA)
    dataA1();
  else
    dataA0();
  if (bitB)
    dataB1();
  else
    dataB0();
  delay();
  clockEnd();
}


x86 assembly (clang, -O0):
<writeBits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clockBegin@plt>
mov    $0x0,%al
call   10a0 <dataToOutput@plt>
cmpl   $0x0,-0x4(%rbp)
je     11b2 <writeBits+0x32>
mov    $0x0,%al
call   1080 <dataA1@plt>
jmp    11b9 <writeBits+0x39>
mov    $0x0,%al
call   1050 <dataA0@plt>
cmpl   $0x0,-0x8(%rbp)
je     11cf <writeBits+0x4f>
mov    $0x0,%al
call   1040 <dataB1@plt>
jmp    11d6 <writeBits+0x56>
mov    $0x0,%al
call   1070 <dataB0@plt>
mov    $0x0,%al
call   1060 <delay@plt>
mov    $0x0,%al
call   1090 <clockEnd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeBits>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <clockBegin@plt>
xor    %eax,%eax
call   10a0 <dataToOutput@plt>
xor    %eax,%eax
test   %ebp,%ebp
je     11a2 <writeBits+0x22>
call   1080 <dataA1@plt>
jmp    11a7 <writeBits+0x27>
call   1050 <dataA0@plt>
xor    %eax,%eax
test   %ebx,%ebx
je     11b4 <writeBits+0x34>
call   1040 <dataB1@plt>
jmp    11b9 <writeBits+0x39>
call   1070 <dataB0@plt>
xor    %eax,%eax
call   1060 <delay@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1090 <clockEnd@plt>

LLVM IR (-O0):
define void @writeBits(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @clockBegin()
%6 = call i32 (...) @dataToOutput()
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @dataA1()
br label %13
11: ; preds = %2
%12 = call i32 (...) @dataA0()
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @dataB1()
br label %20
18: ; preds = %13
%19 = call i32 (...) @dataB0()
br label %20
20: ; preds = %18, %16
%21 = call i32 (...) @delay()
%22 = call i32 (...) @clockEnd()
ret void
}

LLVM IR (-O2):
define void @writeBits(i32 %0, i32 %1) {
%3 = tail call i32 (...) @clockBegin()
%4 = tail call i32 (...) @dataToOutput()
%5 = icmp eq i32 %0, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @dataA1()
br label %10
8: ; preds = %2
%9 = tail call i32 (...) @dataA0()
br label %10
10: ; preds = %8, %6
%11 = icmp eq i32 %1, 0
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = tail call i32 (...) @dataB1()
br label %16
14: ; preds = %10
%15 = tail call i32 (...) @dataB0()
br label %16
16: ; preds = %14, %12
%17 = tail call i32 (...) @delay()
%18 = tail call i32 (...) @clockEnd()
ret void
}