#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*/ Draco9210ClearDataOut();
int /*<<< orphan*/ Draco9210SetDataOut();
int /*<<< orphan*/ Draco9210ToggleClock();
void DracoWriteData(unsigned char data) {
  int i;
  unsigned char mask = 0x80, databit;
  for (i = 0; i < 8; i++) {
    databit = data & mask;
    if (data & mask) {
      Draco9210SetDataOut();
    } else {
      Draco9210ClearDataOut();
    }
    mask >>= 1;
    Draco9210ToggleClock();
  }
}


x86 assembly (clang, -O0):
<DracoWriteData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x80,-0x9(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    11a5 <DracoWriteData+0x75>
movzbl -0x1(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xa(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     117f <DracoWriteData+0x4f>
mov    $0x0,%al
call   1030 <Draco9210SetDataOut@plt>
jmp    1186 <DracoWriteData+0x56>
mov    $0x0,%al
call   1050 <Draco9210ClearDataOut@plt>
movzbl -0x9(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x9(%rbp)
mov    $0x0,%al
call   1040 <Draco9210ToggleClock@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <DracoWriteData+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DracoWriteData>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
test   $0x80,%bl
jne    1141 <DracoWriteData+0x11>
call   1050 <Draco9210ClearDataOut@plt>
jmp    1146 <DracoWriteData+0x16>
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
call   1040 <Draco9210ToggleClock@plt>
xor    %eax,%eax
test   $0x40,%bl
jne    115b <DracoWriteData+0x2b>
call   1050 <Draco9210ClearDataOut@plt>
jmp    1160 <DracoWriteData+0x30>
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
call   1040 <Draco9210ToggleClock@plt>
xor    %eax,%eax
test   $0x20,%bl
jne    1175 <DracoWriteData+0x45>
call   1050 <Draco9210ClearDataOut@plt>
jmp    117a <DracoWriteData+0x4a>
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
call   1040 <Draco9210ToggleClock@plt>
xor    %eax,%eax
test   $0x10,%bl
jne    118f <DracoWriteData+0x5f>
call   1050 <Draco9210ClearDataOut@plt>
jmp    1194 <DracoWriteData+0x64>
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
call   1040 <Draco9210ToggleClock@plt>
xor    %eax,%eax
test   $0x8,%bl
jne    11a9 <DracoWriteData+0x79>
call   1050 <Draco9210ClearDataOut@plt>
jmp    11ae <DracoWriteData+0x7e>
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
call   1040 <Draco9210ToggleClock@plt>
xor    %eax,%eax
test   $0x4,%bl
jne    11c3 <DracoWriteData+0x93>
call   1050 <Draco9210ClearDataOut@plt>
jmp    11c8 <DracoWriteData+0x98>
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
call   1040 <Draco9210ToggleClock@plt>
xor    %eax,%eax
test   $0x2,%bl
jne    11dd <DracoWriteData+0xad>
call   1050 <Draco9210ClearDataOut@plt>
jmp    11e2 <DracoWriteData+0xb2>
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
call   1040 <Draco9210ToggleClock@plt>
xor    %eax,%eax
test   $0x1,%bl
jne    11f7 <DracoWriteData+0xc7>
call   1050 <Draco9210ClearDataOut@plt>
jmp    11fc <DracoWriteData+0xcc>
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <Draco9210ToggleClock@plt>

LLVM IR (-O0):
define void @DracoWriteData(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %2
store i8 -128, i8* %4
store i32 0, i32* %3
br label %6
6: ; preds = %32, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %35
9: ; preds = %6
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
%12 = load i8, i8* %4
%13 = zext i8 %12 to i32
%14 = and i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %5
%16 = load i8, i8* %2
%17 = zext i8 %16 to i32
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = and i32 %17, %19
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %9
%23 = call i32 (...) @Draco9210SetDataOut()
br label %26
24: ; preds = %9
%25 = call i32 (...) @Draco9210ClearDataOut()
br label %26
26: ; preds = %24, %22
%27 = load i8, i8* %4
%28 = zext i8 %27 to i32
%29 = ashr i32 %28, 1
%30 = trunc i32 %29 to i8
store i8 %30, i8* %4
%31 = call i32 (...) @Draco9210ToggleClock()
br label %32
32: ; preds = %26
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %6
35: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @DracoWriteData(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @Draco9210SetDataOut()
br label %9
7: ; preds = %1
%8 = tail call i32 (...) @Draco9210ClearDataOut()
br label %9
9: ; preds = %7, %5
%10 = tail call i32 (...) @Draco9210ToggleClock()
%11 = and i32 %2, 64
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 (...) @Draco9210SetDataOut()
br label %17
15: ; preds = %9
%16 = tail call i32 (...) @Draco9210ClearDataOut()
br label %17
17: ; preds = %15, %13
%18 = tail call i32 (...) @Draco9210ToggleClock()
%19 = and i32 %2, 32
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = tail call i32 (...) @Draco9210SetDataOut()
br label %25
23: ; preds = %17
%24 = tail call i32 (...) @Draco9210ClearDataOut()
br label %25
25: ; preds = %23, %21
%26 = tail call i32 (...) @Draco9210ToggleClock()
%27 = and i32 %2, 16
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = tail call i32 (...) @Draco9210SetDataOut()
br label %33
31: ; preds = %25
%32 = tail call i32 (...) @Draco9210ClearDataOut()
br label %33
33: ; preds = %31, %29
%34 = tail call i32 (...) @Draco9210ToggleClock()
%35 = and i32 %2, 8
%36 = icmp eq i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %33
%38 = tail call i32 (...) @Draco9210SetDataOut()
br label %41
39: ; preds = %33
%40 = tail call i32 (...) @Draco9210ClearDataOut()
br label %41
41: ; preds = %39, %37
%42 = tail call i32 (...) @Draco9210ToggleClock()
%43 = and i32 %2, 4
%44 = icmp eq i32 %43, 0
br i1 %44, label %47, label %45
45: ; preds = %41
%46 = tail call i32 (...) @Draco9210SetDataOut()
br label %49
47: ; preds = %41
%48 = tail call i32 (...) @Draco9210ClearDataOut()
br label %49
49: ; preds = %47, %45
%50 = tail call i32 (...) @Draco9210ToggleClock()
%51 = and i32 %2, 2
%52 = icmp eq i32 %51, 0
br i1 %52, label %55, label %53
53: ; preds = %49
%54 = tail call i32 (...) @Draco9210SetDataOut()
br label %57
55: ; preds = %49
%56 = tail call i32 (...) @Draco9210ClearDataOut()
br label %57
57: ; preds = %55, %53
%58 = tail call i32 (...) @Draco9210ToggleClock()
%59 = and i32 %2, 1
%60 = icmp eq i32 %59, 0
br i1 %60, label %63, label %61
61: ; preds = %57
%62 = tail call i32 (...) @Draco9210SetDataOut()
br label %65
63: ; preds = %57
%64 = tail call i32 (...) @Draco9210ClearDataOut()
br label %65
65: ; preds = %63, %61
%66 = tail call i32 (...) @Draco9210ToggleClock()
ret void
}