#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*/ putsSPI2(int, unsigned int *);
int /*<<< orphan*/ write_latch(unsigned int);
void send_frame_oneColor(unsigned int red, unsigned int green,
                         unsigned int blue, unsigned int ledStripLen,
                         unsigned int litLen) {
  unsigned int i;
  unsigned int txData[3];
  txData[0] = green | 0x80;
  txData[1] = red | 0x80;
  txData[2] = blue | 0x80;
  for (i = 0; i < ledStripLen; i++) {
    if (i >= litLen) {
      txData[0] = 0x80;
      txData[1] = 0x80;
      txData[2] = 0x80;
    }
    putsSPI2(3, txData);
  }
  write_latch(ledStripLen);
}


x86 assembly (clang, -O0):
<send_frame_oneColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x8(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    11a9 <send_frame_oneColor+0x89>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jb     118d <send_frame_oneColor+0x6d>
movl   $0x80,-0x24(%rbp)
movl   $0x80,-0x20(%rbp)
movl   $0x80,-0x1c(%rbp)
lea    -0x24(%rbp),%rsi
mov    $0x3,%edi
call   1040 <putsSPI2@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <send_frame_oneColor+0x40>
mov    -0x10(%rbp),%edi
call   1030 <write_latch@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_frame_oneColor>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%ebx
or     $0x80,%esi
mov    %esi,0x4(%rsp)
or     $0x80,%edi
mov    %edi,0x8(%rsp)
or     $0x80,%edx
mov    %edx,0xc(%rsp)
test   %ecx,%ecx
je     1198 <send_frame_oneColor+0x78>
mov    %r8d,%r15d
xor    %ebp,%ebp
lea    0x4(%rsp),%r14
movabs $0x8000000080,%r12
jmp    1184 <send_frame_oneColor+0x64>
cs nopw 0x0(%rax,%rax,1)
mov    $0x3,%edi
mov    %r14,%rsi
call   1040 <putsSPI2@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
je     1198 <send_frame_oneColor+0x78>
cmp    %r15d,%ebp
jb     1170 <send_frame_oneColor+0x50>
mov    %r12,0x4(%rsp)
movl   $0x80,0xc(%rsp)
jmp    1170 <send_frame_oneColor+0x50>
mov    %ebx,%edi
call   1030 <write_latch@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @send_frame_oneColor(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [3 x i32]
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %7
%14 = or i32 %13, 128
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 0
store i32 %14, i32* %15
%16 = load i32, i32* %6
%17 = or i32 %16, 128
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 1
store i32 %17, i32* %18
%19 = load i32, i32* %8
%20 = or i32 %19, 128
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 2
store i32 %20, i32* %21
store i32 0, i32* %11
br label %22
22: ; preds = %37, %5
%23 = load i32, i32* %11
%24 = load i32, i32* %9
%25 = icmp ult i32 %23, %24
br i1 %25, label %26, label %40
26: ; preds = %22
%27 = load i32, i32* %11
%28 = load i32, i32* %10
%29 = icmp uge i32 %27, %28
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 0
store i32 128, i32* %31
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 1
store i32 128, i32* %32
%33 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 2
store i32 128, i32* %33
br label %34
34: ; preds = %30, %26
%35 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 0
%36 = call i32 @putsSPI2(i32 3, i32* %35)
br label %37
37: ; preds = %34
%38 = load i32, i32* %11
%39 = add i32 %38, 1
store i32 %39, i32* %11
br label %22
40: ; preds = %22
%41 = load i32, i32* %9
%42 = call i32 @write_latch(i32 %41)
ret void
}

LLVM IR (-O2):
define void @send_frame_oneColor(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [3 x i32]
%7 = bitcast [3 x i32]* %6 to i8*
%8 = or i32 %1, 128
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
store i32 %8, i32* %9
%10 = or i32 %0, 128
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 1
store i32 %10, i32* %11
%12 = or i32 %2, 128
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 2
store i32 %12, i32* %13
%14 = icmp eq i32 %3, 0
br i1 %14, label %23, label %15
15: ; preds = %5, %19
%16 = phi i32 [ %21, %19 ], [ 0, %5 ]
%17 = icmp ult i32 %16, %4
br i1 %17, label %19, label %18
18: ; preds = %15
store i32 128, i32* %9
store i32 128, i32* %11
store i32 128, i32* %13
br label %19
19: ; preds = %18, %15
%20 = call i32 @putsSPI2(i32 3, i32* %9)
%21 = add nuw i32 %16, 1
%22 = icmp eq i32 %21, %3
br i1 %22, label %23, label %15
23: ; preds = %19, %5
%24 = call i32 @write_latch(i32 %3)
ret void
}