#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*/ SCLKHigh();
int /*<<< orphan*/ SCLKLow();
int /*<<< orphan*/ SetSDATAHigh();
int /*<<< orphan*/ SetSDATALow();
void SendByte(unsigned char bCurrByte, unsigned char bSize) {
  unsigned char b = 0;
  for (b = 0; b < bSize; b++) {
    if (bCurrByte & 0x80) {
      SetSDATAHigh();
      SCLKHigh();
      SCLKLow();
    } else {
      SetSDATALow();
      SCLKHigh();
      SCLKLow();
    }
    bCurrByte = bCurrByte << 1;
  }
}


x86 assembly (clang, -O0):
<SendByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movb   $0x0,-0x3(%rbp)
movb   $0x0,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
movzbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jge    11c4 <SendByte+0x84>
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1198 <SendByte+0x58>
mov    $0x0,%al
call   1060 <SetSDATAHigh@plt>
mov    $0x0,%al
call   1040 <SCLKHigh@plt>
mov    $0x0,%al
call   1050 <SCLKLow@plt>
jmp    11ad <SendByte+0x6d>
mov    $0x0,%al
call   1030 <SetSDATALow@plt>
mov    $0x0,%al
call   1040 <SCLKHigh@plt>
mov    $0x0,%al
call   1050 <SCLKLow@plt>
movzbl -0x1(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    -0x3(%rbp),%al
add    $0x1,%al
mov    %al,-0x3(%rbp)
jmp    115c <SendByte+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendByte>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
je     1179 <SendByte+0x39>
mov    %esi,%ebx
mov    %edi,%ebp
jmp    116b <SendByte+0x2b>
nopl   (%rax)
call   1030 <SetSDATALow@plt>
xor    %eax,%eax
call   1040 <SCLKHigh@plt>
xor    %eax,%eax
call   1050 <SCLKLow@plt>
add    %bpl,%bpl
add    $0xff,%bl
je     1179 <SendByte+0x39>
xor    %eax,%eax
test   %bpl,%bpl
jns    1150 <SendByte+0x10>
call   1060 <SetSDATAHigh@plt>
jmp    1155 <SendByte+0x15>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @SendByte(i8 zeroext %0, i8 zeroext %1) {
%3 = icmp eq i8 %1, 0
br i1 %3, label %18, label %4
4: ; preds = %2, %12
%5 = phi i8 [ %16, %12 ], [ 0, %2 ]
%6 = phi i8 [ %15, %12 ], [ %0, %2 ]
%7 = icmp sgt i8 %6, -1
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 (...) @SetSDATAHigh()
br label %12
10: ; preds = %4
%11 = tail call i32 (...) @SetSDATALow()
br label %12
12: ; preds = %10, %8
%13 = tail call i32 (...) @SCLKHigh()
%14 = tail call i32 (...) @SCLKLow()
%15 = shl i8 %6, 1
%16 = add nuw i8 %5, 1
%17 = icmp eq i8 %16, %1
br i1 %17, label %18, label %4
18: ; preds = %12, %2
ret void
}