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

/* Variables and functions */
int /*<<< orphan*/ Change_RGB_LED(int /*<<< orphan*/ *);
int /*<<< orphan*/ Set_CCR_Color(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ scale_fade(int /*<<< orphan*/, int /*<<< orphan*/);
void Set_RGB_LED_Scale(uint8_t step, uint32_t color) {
  int i;
  uint16_t ccr[3];
  Set_CCR_Color(color, ccr);
  for (i = 0; i < 3; i++)
    ccr[i] = scale_fade(step, ccr[i]);
  Change_RGB_LED(ccr);
}


x86 assembly (clang, -O0):
<Set_RGB_LED_Scale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1040 <Set_CCR_Color@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1183 <Set_RGB_LED_Scale+0x53>
mov    -0x4(%rbp),%edi
movslq -0xc(%rbp),%rax
mov    -0x18(%rbp,%rax,4),%esi
call   1050 <scale_fade@plt>
mov    %eax,%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x18(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <Set_RGB_LED_Scale+0x21>
lea    -0x18(%rbp),%rdi
call   1030 <Change_RGB_LED@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Set_RGB_LED_Scale>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0xc(%rsp),%r14
mov    %esi,%edi
mov    %r14,%rsi
call   1040 <Set_CCR_Color@plt>
mov    0xc(%rsp),%esi
mov    %ebx,%edi
call   1050 <scale_fade@plt>
mov    %eax,0xc(%rsp)
mov    0x10(%rsp),%esi
mov    %ebx,%edi
call   1050 <scale_fade@plt>
mov    %eax,0x10(%rsp)
mov    0x14(%rsp),%esi
mov    %ebx,%edi
call   1050 <scale_fade@plt>
mov    %eax,0x14(%rsp)
mov    %r14,%rdi
call   1030 <Change_RGB_LED@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @Set_RGB_LED_Scale(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [3 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%9 = call i32 @Set_CCR_Color(i32 %7, i32* %8)
store i32 0, i32* %5
br label %10
10: ; preds = %23, %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @scale_fade(i32 %14, i32 %18)
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 %21
store i32 %19, i32* %22
br label %23
23: ; preds = %13
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %10
26: ; preds = %10
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%28 = call i32 @Change_RGB_LED(i32* %27)
ret void
}

LLVM IR (-O2):
define void @Set_RGB_LED_Scale(i32 %0, i32 %1) {
%3 = alloca [3 x i32]
%4 = bitcast [3 x i32]* %3 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%6 = call i32 @Set_CCR_Color(i32 %1, i32* %5)
%7 = load i32, i32* %5
%8 = call i32 @scale_fade(i32 %0, i32 %7)
store i32 %8, i32* %5
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%10 = load i32, i32* %9
%11 = call i32 @scale_fade(i32 %0, i32 %10)
store i32 %11, i32* %9
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%13 = load i32, i32* %12
%14 = call i32 @scale_fade(i32 %0, i32 %13)
store i32 %14, i32* %12
%15 = call i32 @Change_RGB_LED(i32* %5)
ret void
}