#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 GLfloat;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned int, unsigned int,
                           unsigned int, ...);
char *colorGetter(GLfloat *variable) {
  static char string[21];
  unsigned int a, r, g, b;
  if (variable[3] >= 0)
    a = variable[3] * 255;
  r = variable[0] * 255;
  g = variable[1] * 255;
  b = variable[2] * 255;
  if ((variable[3] >= 0) && (variable[3] < 1))
    sprintf(string, "#%.2X%.2X%.2X%.2X", a, r, g, b);
  else
    sprintf(string, "#%.2X%.2X%.2X", r, g, b);
  return string;
}


x86 assembly (clang, -O0):
<colorGetter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,0xc(%rax)
jl     1138 <colorGetter+0x28>
mov    -0x8(%rbp),%rax
imul   $0xff,0xc(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xff,(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xff,0x4(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xff,0x8(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,0xc(%rax)
jl     11a5 <colorGetter+0x95>
mov    -0x8(%rbp),%rax
cmpl   $0x1,0xc(%rax)
jge    11a5 <colorGetter+0x95>
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0x2eae(%rip),%rdi
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11c4 <colorGetter+0xb4>
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0x2e8a(%rip),%rdi
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2e75(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colorGetter>:
push   %rax
mov    (%rdi),%eax
mov    0x4(%rdi),%edx
mov    %eax,%ecx
shl    $0x8,%ecx
sub    %eax,%ecx
mov    %edx,%r8d
shl    $0x8,%r8d
sub    %edx,%r8d
mov    0x8(%rdi),%eax
mov    %eax,%r9d
shl    $0x8,%r9d
sub    %eax,%r9d
cmpl   $0x0,0xc(%rdi)
je     1159 <colorGetter+0x49>
lea    0x2eff(%rip),%rdi
lea    0xeca(%rip),%rsi
mov    %ecx,%edx
mov    %r8d,%ecx
mov    %r9d,%r8d
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    1170 <colorGetter+0x60>
lea    0x2ee0(%rip),%rdi
lea    0xe99(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0x2ec9(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@colorGetter.string = internal global [21 x i8] zeroinitializer
@.str = [18 x i8] c"#%.2X%.2X%.2X%.2X\00"
@.str.1 = [14 x i8] c"#%.2X%.2X%.2X\00"
define i8* @colorGetter(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %2
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 3
%9 = load i32, i32* %8
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 3
%14 = load i32, i32* %13
%15 = mul nsw i32 %14, 255
store i32 %15, i32* %3
br label %16
16: ; preds = %11, %1
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = mul nsw i32 %19, 255
store i32 %20, i32* %4
%21 = load i32*, i32** %2
%22 = getelementptr inbounds i32, i32* %21, i64 1
%23 = load i32, i32* %22
%24 = mul nsw i32 %23, 255
store i32 %24, i32* %5
%25 = load i32*, i32** %2
%26 = getelementptr inbounds i32, i32* %25, i64 2
%27 = load i32, i32* %26
%28 = mul nsw i32 %27, 255
store i32 %28, i32* %6
%29 = load i32*, i32** %2
%30 = getelementptr inbounds i32, i32* %29, i64 3
%31 = load i32, i32* %30
%32 = icmp sge i32 %31, 0
br i1 %32, label %33, label %44
33: ; preds = %16
%34 = load i32*, i32** %2
%35 = getelementptr inbounds i32, i32* %34, i64 3
%36 = load i32, i32* %35
%37 = icmp slt i32 %36, 1
br i1 %37, label %38, label %44
38: ; preds = %33
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = call i32 (i8*, i8*, i32, i32, i32, ...) @sprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @colorGetter.string, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %39, i32 %40, i32 %41, i32 %42)
br label %49
44: ; preds = %33, %16
%45 = load i32, i32* %4
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = call i32 (i8*, i8*, i32, i32, i32, ...) @sprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @colorGetter.string, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %45, i32 %46, i32 %47)
br label %49
49: ; preds = %44, %38
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @colorGetter.string, i64 0, i64 0)
}

LLVM IR (-O2):
@colorGetter.string = internal global [21 x i8] zeroinitializer
@.str = [18 x i8] c"#%.2X%.2X%.2X%.2X\00"
@.str.1 = [14 x i8] c"#%.2X%.2X%.2X\00"
define i8* @colorGetter(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = load i32, i32* %0
%5 = mul nsw i32 %4, 255
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 255
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 255
%12 = icmp eq i32 %3, 0
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = tail call i32 (i8*, i8*, i32, i32, i32, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @colorGetter.string, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 0, i32 %5, i32 %8, i32 %11)
br label %17
15: ; preds = %1
%16 = tail call i32 (i8*, i8*, i32, i32, i32, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @colorGetter.string, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %8, i32 %11)
br label %17
17: ; preds = %15, %13
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @colorGetter.string, i64 0, i64 0)
}