void transfer_RGB_FLOAT_to_RGBA8888(unsigned char *(*output), float *input) {
  unsigned char r =
      (unsigned char)(((input[0]) < (0)
                           ? (0)
                           : ((input[0]) > (1) ? (1) : (input[0]))) *
                      0xff);
  unsigned char g =
      (unsigned char)(((input[1]) < (0)
                           ? (0)
                           : ((input[1]) > (1) ? (1) : (input[1]))) *
                      0xff);
  unsigned char b =
      (unsigned char)(((input[2]) < (0)
                           ? (0)
                           : ((input[2]) > (1) ? (1) : (input[2]))) *
                      0xff);
  *(*output)++ = r;
  *(*output)++ = g;
  *(*output)++ = b;
  *(*output)++ = 0xff;
}


x86 assembly (clang, -O0):
<transfer_RGB_FLOAT_to_RGBA8888>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomiss (%rax),%xmm0
jbe    1129 <transfer_RGB_FLOAT_to_RGBA8888+0x29>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    116b <transfer_RGB_FLOAT_to_RGBA8888+0x6b>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  0xec7(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1154 <transfer_RGB_FLOAT_to_RGBA8888+0x54>
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1161 <transfer_RGB_FLOAT_to_RGBA8888+0x61>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xe8c(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomiss 0x4(%rax),%xmm0
jbe    11a1 <transfer_RGB_FLOAT_to_RGBA8888+0xa1>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    11e5 <transfer_RGB_FLOAT_to_RGBA8888+0xe5>
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  0xe4e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11cd <transfer_RGB_FLOAT_to_RGBA8888+0xcd>
movss  0xe3d(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    11db <transfer_RGB_FLOAT_to_RGBA8888+0xdb>
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  0xe12(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %al,-0x12(%rbp)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
ucomiss 0x8(%rax),%xmm0
jbe    121b <transfer_RGB_FLOAT_to_RGBA8888+0x11b>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    125f <transfer_RGB_FLOAT_to_RGBA8888+0x15f>
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  0xdd4(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1247 <transfer_RGB_FLOAT_to_RGBA8888+0x147>
movss  0xdc3(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1255 <transfer_RGB_FLOAT_to_RGBA8888+0x155>
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
movss  0xd98(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %al,-0x13(%rbp)
mov    -0x11(%rbp),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x12(%rbp),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x13(%rbp),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movb   $0xff,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer_RGB_FLOAT_to_RGBA8888>:
movss  (%rsi),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    1111 <transfer_RGB_FLOAT_to_RGBA8888+0x11>
xor    %r8d,%r8d
jmp    112a <transfer_RGB_FLOAT_to_RGBA8888+0x2a>
mov    $0xff,%r8b
ucomiss 0xee5(%rip),%xmm1
ja     112a <transfer_RGB_FLOAT_to_RGBA8888+0x2a>
mulss  0xedf(%rip),%xmm1
cvttss2si %xmm1,%r8d
movss  0x4(%rsi),%xmm1
ucomiss %xmm1,%xmm0
jbe    1138 <transfer_RGB_FLOAT_to_RGBA8888+0x38>
xor    %ecx,%ecx
jmp    114f <transfer_RGB_FLOAT_to_RGBA8888+0x4f>
mov    $0xff,%cl
ucomiss 0xebf(%rip),%xmm1
ja     114f <transfer_RGB_FLOAT_to_RGBA8888+0x4f>
mulss  0xeb9(%rip),%xmm1
cvttss2si %xmm1,%ecx
movss  0x8(%rsi),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    1160 <transfer_RGB_FLOAT_to_RGBA8888+0x60>
xor    %edx,%edx
jmp    1177 <transfer_RGB_FLOAT_to_RGBA8888+0x77>
mov    $0xff,%dl
ucomiss 0xe97(%rip),%xmm0
ja     1177 <transfer_RGB_FLOAT_to_RGBA8888+0x77>
mulss  0xe91(%rip),%xmm0
cvttss2si %xmm0,%edx
mov    (%rdi),%rsi
lea    0x1(%rsi),%rax
mov    %rax,(%rdi)
mov    %r8b,(%rsi)
mov    (%rdi),%rax
lea    0x1(%rax),%rsi
mov    %rsi,(%rdi)
mov    %cl,(%rax)
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
mov    %dl,(%rax)
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
movb   $0xff,(%rax)
ret

LLVM IR (-O0):
define void @transfer_RGB_FLOAT_to_RGBA8888(i8** %0, float* %1) {
%3 = alloca i8**
%4 = alloca float*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8** %0, i8*** %3
store float* %1, float** %4
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
%11 = fcmp olt float %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %2
br label %25
13: ; preds = %2
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 0
%16 = load float, float* %15
%17 = fcmp ogt float %16, 1.000000e+00
br i1 %17, label %18, label %19
18: ; preds = %13
br label %23
19: ; preds = %13
%20 = load float*, float** %4
%21 = getelementptr inbounds float, float* %20, i64 0
%22 = load float, float* %21
br label %23
23: ; preds = %19, %18
%24 = phi float [ 1.000000e+00, %18 ], [ %22, %19 ]
br label %25
25: ; preds = %23, %12
%26 = phi float [ 0.000000e+00, %12 ], [ %24, %23 ]
%27 = fmul float %26, 2.550000e+02
%28 = fptoui float %27 to i8
store i8 %28, i8* %5
%29 = load float*, float** %4
%30 = getelementptr inbounds float, float* %29, i64 1
%31 = load float, float* %30
%32 = fcmp olt float %31, 0.000000e+00
br i1 %32, label %33, label %34
33: ; preds = %25
br label %46
34: ; preds = %25
%35 = load float*, float** %4
%36 = getelementptr inbounds float, float* %35, i64 1
%37 = load float, float* %36
%38 = fcmp ogt float %37, 1.000000e+00
br i1 %38, label %39, label %40
39: ; preds = %34
br label %44
40: ; preds = %34
%41 = load float*, float** %4
%42 = getelementptr inbounds float, float* %41, i64 1
%43 = load float, float* %42
br label %44
44: ; preds = %40, %39
%45 = phi float [ 1.000000e+00, %39 ], [ %43, %40 ]
br label %46
46: ; preds = %44, %33
%47 = phi float [ 0.000000e+00, %33 ], [ %45, %44 ]
%48 = fmul float %47, 2.550000e+02
%49 = fptoui float %48 to i8
store i8 %49, i8* %6
%50 = load float*, float** %4
%51 = getelementptr inbounds float, float* %50, i64 2
%52 = load float, float* %51
%53 = fcmp olt float %52, 0.000000e+00
br i1 %53, label %54, label %55
54: ; preds = %46
br label %67
55: ; preds = %46
%56 = load float*, float** %4
%57 = getelementptr inbounds float, float* %56, i64 2
%58 = load float, float* %57
%59 = fcmp ogt float %58, 1.000000e+00
br i1 %59, label %60, label %61
60: ; preds = %55
br label %65
61: ; preds = %55
%62 = load float*, float** %4
%63 = getelementptr inbounds float, float* %62, i64 2
%64 = load float, float* %63
br label %65
65: ; preds = %61, %60
%66 = phi float [ 1.000000e+00, %60 ], [ %64, %61 ]
br label %67
67: ; preds = %65, %54
%68 = phi float [ 0.000000e+00, %54 ], [ %66, %65 ]
%69 = fmul float %68, 2.550000e+02
%70 = fptoui float %69 to i8
store i8 %70, i8* %7
%71 = load i8, i8* %5
%72 = load i8**, i8*** %3
%73 = load i8*, i8** %72
%74 = getelementptr inbounds i8, i8* %73, i32 1
store i8* %74, i8** %72
store i8 %71, i8* %73
%75 = load i8, i8* %6
%76 = load i8**, i8*** %3
%77 = load i8*, i8** %76
%78 = getelementptr inbounds i8, i8* %77, i32 1
store i8* %78, i8** %76
store i8 %75, i8* %77
%79 = load i8, i8* %7
%80 = load i8**, i8*** %3
%81 = load i8*, i8** %80
%82 = getelementptr inbounds i8, i8* %81, i32 1
store i8* %82, i8** %80
store i8 %79, i8* %81
%83 = load i8**, i8*** %3
%84 = load i8*, i8** %83
%85 = getelementptr inbounds i8, i8* %84, i32 1
store i8* %85, i8** %83
store i8 -1, i8* %84
ret void
}

LLVM IR (-O2):
define void @transfer_RGB_FLOAT_to_RGBA8888(i8** nocapture %0, float* nocapture %1) {
%3 = load float, float* %1
%4 = fcmp olt float %3, 0.000000e+00
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = fcmp ogt float %3, 1.000000e+00
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = fmul float %3, 2.550000e+02
%9 = fptoui float %8 to i8
br label %10
10: ; preds = %7, %5, %2
%11 = phi i8 [ 0, %2 ], [ %9, %7 ], [ -1, %5 ]
%12 = getelementptr inbounds float, float* %1, i64 1
%13 = load float, float* %12
%14 = fcmp olt float %13, 0.000000e+00
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = fcmp ogt float %13, 1.000000e+00
br i1 %16, label %20, label %17
17: ; preds = %15
%18 = fmul float %13, 2.550000e+02
%19 = fptoui float %18 to i8
br label %20
20: ; preds = %17, %15, %10
%21 = phi i8 [ 0, %10 ], [ %19, %17 ], [ -1, %15 ]
%22 = getelementptr inbounds float, float* %1, i64 2
%23 = load float, float* %22
%24 = fcmp olt float %23, 0.000000e+00
br i1 %24, label %30, label %25
25: ; preds = %20
%26 = fcmp ogt float %23, 1.000000e+00
br i1 %26, label %30, label %27
27: ; preds = %25
%28 = fmul float %23, 2.550000e+02
%29 = fptoui float %28 to i8
br label %30
30: ; preds = %27, %25, %20
%31 = phi i8 [ 0, %20 ], [ %29, %27 ], [ -1, %25 ]
%32 = load i8*, i8** %0
%33 = getelementptr inbounds i8, i8* %32, i64 1
store i8* %33, i8** %0
store i8 %11, i8* %32
%34 = load i8*, i8** %0
%35 = getelementptr inbounds i8, i8* %34, i64 1
store i8* %35, i8** %0
store i8 %21, i8* %34
%36 = load i8*, i8** %0
%37 = getelementptr inbounds i8, i8* %36, i64 1
store i8* %37, i8** %0
store i8 %31, i8* %36
%38 = load i8*, i8** %0
%39 = getelementptr inbounds i8, i8* %38, i64 1
store i8* %39, i8** %0
store i8 -1, i8* %38
ret void
}