#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*/ endTransmission();
int /*<<< orphan*/ sendLEDFrame(int, int, int, int);
int /*<<< orphan*/ startTransmission();
void setStripColor(int length, int brightness, int r, int g, int b) {
  startTransmission();
  for (int i = 0; i < length; i++) {
    sendLEDFrame(brightness, r, g, b);
  }
  endTransmission();
}


x86 assembly (clang, -O0):
<setStripColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    $0x0,%al
call   1050 <startTransmission@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1181 <setStripColor+0x51>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1030 <sendLEDFrame@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1156 <setStripColor+0x26>
mov    $0x0,%al
call   1040 <endTransmission@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setStripColor>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <startTransmission@plt>
test   %ebx,%ebx
jle    1165 <setStripColor+0x35>
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1030 <sendLEDFrame@plt>
add    $0xffffffff,%ebx
jne    1150 <setStripColor+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <endTransmission@plt>

LLVM IR (-O0):
define void @setStripColor(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
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
%12 = call i32 (...) @startTransmission()
store i32 0, i32* %11
br label %13
13: ; preds = %23, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = call i32 @sendLEDFrame(i32 %18, i32 %19, i32 %20, i32 %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %11
%25 = add nsw i32 %24, 1
store i32 %25, i32* %11
br label %13
26: ; preds = %13
%27 = call i32 (...) @endTransmission()
ret void
}

LLVM IR (-O2):
define void @setStripColor(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 (...) @startTransmission()
%7 = icmp sgt i32 %0, 0
br i1 %7, label %10, label %8
8: ; preds = %10, %5
%9 = tail call i32 (...) @endTransmission()
ret void
10: ; preds = %5, %10
%11 = phi i32 [ %13, %10 ], [ 0, %5 ]
%12 = tail call i32 @sendLEDFrame(i32 %1, i32 %2, i32 %3, i32 %4)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, %0
br i1 %14, label %8, label %10
}