#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*/ lum(int, int, int);
int /*<<< orphan*/ sat(int, int, int);
int /*<<< orphan*/ setlum(int, int, int, int /*<<< orphan*/, int *, int *,
                          int *);
int /*<<< orphan*/ setsat(int, int, int, int /*<<< orphan*/, int *, int *,
                          int *);
void fz_hue_rgb(int *bdr, int *bdg, int *bdb, int sr, int sg, int sb) {
  int tr, tg, tb;
  setsat(sr, sg, sb, sat(*bdr, *bdg, *bdb), &tr, &tg, &tb);
  setlum(tr, tg, tb, lum(*bdr, *bdg, *bdb), bdr, bdg, bdb);
}


x86 assembly (clang, -O0):
<fz_hue_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
call   1050 <sat@plt>
mov    -0x48(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    %eax,%ecx
lea    -0x28(%rbp),%r8
lea    -0x2c(%rbp),%r9
lea    -0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <setsat@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
call   1060 <lum@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    %eax,%ecx
mov    -0x8(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x18(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <setlum@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fz_hue_rgb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r12d
mov    %r8d,%r13d
mov    %ecx,%ebp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rdi),%edi
mov    (%rsi),%esi
mov    (%rdx),%edx
call   1050 <sat@plt>
lea    0xc(%rsp),%rcx
mov    %rcx,(%rsp)
lea    0x14(%rsp),%r8
lea    0x10(%rsp),%r9
mov    %ebp,%edi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %eax,%ecx
call   1040 <setsat@plt>
mov    0x14(%rsp),%ebp
mov    0x10(%rsp),%r12d
mov    0xc(%rsp),%r13d
mov    (%r15),%edi
mov    (%r14),%esi
mov    (%rbx),%edx
call   1060 <lum@plt>
mov    %rbx,(%rsp)
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r13d,%edx
mov    %eax,%ecx
mov    %r15,%r8
mov    %r14,%r9
call   1030 <setlum@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fz_hue_rgb(i32* %0, i32* %1, i32* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
%21 = load i32*, i32** %8
%22 = load i32, i32* %21
%23 = load i32*, i32** %9
%24 = load i32, i32* %23
%25 = call i32 @sat(i32 %20, i32 %22, i32 %24)
%26 = call i32 @setsat(i32 %16, i32 %17, i32 %18, i32 %25, i32* %13, i32* %14, i32* %15)
%27 = load i32, i32* %13
%28 = load i32, i32* %14
%29 = load i32, i32* %15
%30 = load i32*, i32** %7
%31 = load i32, i32* %30
%32 = load i32*, i32** %8
%33 = load i32, i32* %32
%34 = load i32*, i32** %9
%35 = load i32, i32* %34
%36 = call i32 @lum(i32 %31, i32 %33, i32 %35)
%37 = load i32*, i32** %7
%38 = load i32*, i32** %8
%39 = load i32*, i32** %9
%40 = call i32 @setlum(i32 %27, i32 %28, i32 %29, i32 %36, i32* %37, i32* %38, i32* %39)
ret void
}

LLVM IR (-O2):
define void @fz_hue_rgb(i32* %0, i32* %1, i32* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = bitcast i32* %7 to i8*
%11 = bitcast i32* %8 to i8*
%12 = bitcast i32* %9 to i8*
%13 = load i32, i32* %0
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = tail call i32 @sat(i32 %13, i32 %14, i32 %15)
%17 = call i32 @setsat(i32 %3, i32 %4, i32 %5, i32 %16, i32* %7, i32* %8, i32* %9)
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = load i32, i32* %9
%21 = load i32, i32* %0
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = call i32 @lum(i32 %21, i32 %22, i32 %23)
%25 = call i32 @setlum(i32 %18, i32 %19, i32 %20, i32 %24, i32* %0, i32* %1, i32* %2)
ret void
}