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


x86 assembly (clang, -O0):
<slowChange>:
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   1060 <startTransmission@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119b <slowChange+0x5b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <sendLEDFrame@plt>
mov    $0x19,%edi
call   1030 <wait1Msec@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1166 <slowChange+0x26>
mov    $0x0,%al
call   1050 <endTransmission@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slowChange>:
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   1060 <startTransmission@plt>
test   %ebx,%ebx
jle    117f <slowChange+0x3f>
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1040 <sendLEDFrame@plt>
mov    $0x19,%edi
call   1030 <wait1Msec@plt>
add    $0xffffffff,%ebx
jne    1160 <slowChange+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <endTransmission@plt>

LLVM IR (-O0):
define void @slowChange(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 = %24, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %27
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)
%23 = call i32 @wait1Msec(i32 25)
br label %24
24: ; preds = %17
%25 = load i32, i32* %11
%26 = add nsw i32 %25, 1
store i32 %26, i32* %11
br label %13
27: ; preds = %13
%28 = call i32 (...) @endTransmission()
ret void
}

LLVM IR (-O2):
define void @slowChange(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 [ %14, %10 ], [ 0, %5 ]
%12 = tail call i32 @sendLEDFrame(i32 %1, i32 %2, i32 %3, i32 %4)
%13 = tail call i32 @wait1Msec(i32 25)
%14 = add nuw nsw i32 %11, 1
%15 = icmp eq i32 %14, %0
br i1 %15, label %8, label %10
}