#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*/ delay(int);
int /*<<< orphan*/ set_data(int);
int /*<<< orphan*/ set_sclk(int);
void LEDOutput(unsigned char c) {
  unsigned char i;
  for (i = 8; i >= 1; i--) {
    if (c & 0x80) {
      set_data(1);
    } else {
      set_data(0);
    }
    c <<= 1;
    set_sclk(0);
    delay((0x01));
    set_sclk(1);
    delay((0x01));
  }
}


x86 assembly (clang, -O0):
<LEDOutput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x8,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x1,%eax
jl     11b3 <LEDOutput+0x83>
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1170 <LEDOutput+0x40>
mov    $0x1,%edi
call   1050 <set_data@plt>
jmp    1177 <LEDOutput+0x47>
xor    %edi,%edi
call   1050 <set_data@plt>
movzbl -0x1(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x1(%rbp)
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    -0x2(%rbp),%al
add    $0xff,%al
mov    %al,-0x2(%rbp)
jmp    1142 <LEDOutput+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LEDOutput>:
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
shr    $0x7,%al
movzbl %al,%edi
call   1050 <set_data@plt>
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    %ebx,%eax
shr    $0x6,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <set_data@plt>
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    %ebx,%eax
shr    $0x5,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <set_data@plt>
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    %ebx,%eax
shr    $0x4,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <set_data@plt>
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    %ebx,%eax
shr    $0x3,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <set_data@plt>
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    %ebx,%eax
shr    $0x2,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <set_data@plt>
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    %ebx,%eax
shr    %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <set_data@plt>
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
and    $0x1,%ebx
mov    %ebx,%edi
call   1050 <set_data@plt>
xor    %edi,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <set_sclk@plt>
mov    $0x1,%edi
pop    %rbx
jmp    1040 <delay@plt>

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

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