#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ set_data(int);
int /*<<< orphan*/ set_rclk(int);
int /*<<< orphan*/ set_sclk(int);
void LEDOutput(uint32_t c) {
  unsigned char i;
  for (i = 16; i >= 1; i--) {
    if (c & 0x8000) {
      set_data(1);
    } else {
      set_data(0);
    }
    c <<= 1;
    set_sclk(0);
    delay((0x01));
    set_sclk(1);
    delay((0x01));
  }
  set_rclk(0);
  delay((0x01));
  set_rclk(1);
  delay((0x01));
}


x86 assembly (clang, -O0):
<LEDOutput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x10,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x1,%eax
jl     11be <LEDOutput+0x7e>
mov    -0x4(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     117c <LEDOutput+0x3c>
mov    $0x1,%edi
call   1060 <set_data@plt>
jmp    1183 <LEDOutput+0x43>
xor    %edi,%edi
call   1060 <set_data@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%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    -0x5(%rbp),%al
add    $0xff,%al
mov    %al,-0x5(%rbp)
jmp    114f <LEDOutput+0xf>
xor    %edi,%edi
call   1050 <set_rclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1050 <set_rclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LEDOutput>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xf0,%bpl
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
shr    $0xf,%edi
and    $0x1,%edi
call   1060 <set_data@plt>
add    %ebx,%ebx
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>
inc    %bpl
jne    1150 <LEDOutput+0x10>
xor    %edi,%edi
call   1050 <set_rclk@plt>
mov    $0x1,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1050 <set_rclk@plt>
mov    $0x1,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <delay@plt>

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

LLVM IR (-O2):
define void @LEDOutput(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i8 [ 16, %1 ], [ %13, %2 ]
%4 = phi i32 [ %0, %1 ], [ %8, %2 ]
%5 = lshr i32 %4, 15
%6 = and i32 %5, 1
%7 = tail call i32 @set_data(i32 %6)
%8 = shl i32 %4, 1
%9 = tail call i32 @set_sclk(i32 0)
%10 = tail call i32 @delay(i32 1)
%11 = tail call i32 @set_sclk(i32 1)
%12 = tail call i32 @delay(i32 1)
%13 = add nsw i8 %3, -1
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %2
15: ; preds = %2
%16 = tail call i32 @set_rclk(i32 0)
%17 = tail call i32 @delay(i32 1)
%18 = tail call i32 @set_rclk(i32 1)
%19 = tail call i32 @delay(i32 1)
ret void
}