#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*/ compute_color_line_STDEV(unsigned char const *const, int,
                                            float *, float *);
int rgb_to_565(int, int, int);
void LSE_master_colors_max_min(int *cmax, int *cmin, int channels,
                               const unsigned char *const uncompressed) {
  int i, j;
  int c0[3], c1[3];
  float sum_x[] = {0.0f, 0.0f, 0.0f};
  float sum_x2[] = {0.0f, 0.0f, 0.0f};
  float dot_max = 1.0f, dot_min = -1.0f;
  float vec_len2 = 0.0f;
  float dot;
  if ((channels < 3) || (channels > 4)) {
    return;
  }
  compute_color_line_STDEV(uncompressed, channels, sum_x, sum_x2);
  vec_len2 = 1.0f / (0.00001f + sum_x2[0] * sum_x2[0] + sum_x2[1] * sum_x2[1] +
                     sum_x2[2] * sum_x2[2]);
  dot_max = (sum_x2[0] * uncompressed[0] + sum_x2[1] * uncompressed[1] +
             sum_x2[2] * uncompressed[2]);
  dot_min = dot_max;
  for (i = 1; i < 16; ++i) {
    dot = (sum_x2[0] * uncompressed[i * channels + 0] +
           sum_x2[1] * uncompressed[i * channels + 1] +
           sum_x2[2] * uncompressed[i * channels + 2]);
    if (dot < dot_min) {
      dot_min = dot;
    } else if (dot > dot_max) {
      dot_max = dot;
    }
  }
  dot = sum_x2[0] * sum_x[0] + sum_x2[1] * sum_x[1] + sum_x2[2] * sum_x[2];
  dot_min -= dot;
  dot_max -= dot;
  dot_min *= vec_len2;
  dot_max *= vec_len2;
  for (i = 0; i < 3; ++i) {
    c0[i] = (int)(0.5f + sum_x[i] + dot_max * sum_x2[i]);
    if (c0[i] < 0) {
      c0[i] = 0;
    } else if (c0[i] > 255) {
      c0[i] = 255;
    }
    c1[i] = (int)(0.5f + sum_x[i] + dot_min * sum_x2[i]);
    if (c1[i] < 0) {
      c1[i] = 0;
    } else if (c1[i] > 255) {
      c1[i] = 255;
    }
  }
  i = rgb_to_565(c0[0], c0[1], c0[2]);
  j = rgb_to_565(c1[0], c1[1], c1[2]);
  if (i > j) {
    *cmax = i;
    *cmin = j;
  } else {
    *cmax = j;
    *cmin = i;
  }
}


x86 assembly (clang, -O0):
<LSE_master_colors_max_min>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x4c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
lea    -0x58(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
movss  0xe95(%rip),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  0xe84(%rip),%xmm0
movss  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
cmpl   $0x3,-0x14(%rbp)
jl     119d <LSE_master_colors_max_min+0x6d>
cmpl   $0x4,-0x14(%rbp)
jle    11a2 <LSE_master_colors_max_min+0x72>
jmp    1513 <LSE_master_colors_max_min+0x3e3>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x4c(%rbp),%rdx
lea    -0x58(%rbp),%rcx
call   1050 <compute_color_line_STDEV@plt>
movss  -0x58(%rbp),%xmm1
movss  -0x58(%rbp),%xmm0
mulss  %xmm0,%xmm1
movss  0xe3c(%rip),%xmm0
addss  %xmm0,%xmm1
movss  -0x54(%rbp),%xmm0
movss  -0x54(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x50(%rbp),%xmm1
movss  -0x50(%rbp),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xe08(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0x58(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movzbl (%rax),%eax
cvtsi2ss %eax,%xmm2
movss  -0x54(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movzbl 0x1(%rax),%eax
cvtsi2ss %eax,%xmm3
mulss  %xmm3,%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movzbl 0x2(%rax),%eax
cvtsi2ss %eax,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x5c(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x10,-0x24(%rbp)
jge    1331 <LSE_master_colors_max_min+0x201>
movss  -0x58(%rbp),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cvtsi2ss %eax,%xmm2
movss  -0x54(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cvtsi2ss %eax,%xmm3
mulss  %xmm3,%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
cvtsi2ss %eax,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x68(%rbp),%xmm1
movss  -0x60(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1300 <LSE_master_colors_max_min+0x1d0>
movss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
jmp    131e <LSE_master_colors_max_min+0x1ee>
movss  -0x68(%rbp),%xmm0
ucomiss -0x5c(%rbp),%xmm0
jbe    1319 <LSE_master_colors_max_min+0x1e9>
movss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
jmp    131e <LSE_master_colors_max_min+0x1ee>
jmp    1323 <LSE_master_colors_max_min+0x1f3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1261 <LSE_master_colors_max_min+0x131>
movss  -0x58(%rbp),%xmm1
movss  -0x4c(%rbp),%xmm2
movss  -0x54(%rbp),%xmm0
mulss  -0x48(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x50(%rbp),%xmm0
movss  -0x44(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x68(%rbp),%xmm1
movss  -0x60(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0x68(%rbp),%xmm1
movss  -0x5c(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x64(%rbp),%xmm0
mulss  -0x60(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0x64(%rbp),%xmm0
mulss  -0x5c(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    14bc <LSE_master_colors_max_min+0x38c>
movslq -0x24(%rbp),%rax
movss  0xc47(%rip),%xmm1
addss  -0x4c(%rbp,%rax,4),%xmm1
movss  -0x5c(%rbp),%xmm0
movslq -0x24(%rbp),%rax
movss  -0x58(%rbp,%rax,4),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x34(%rbp,%rax,4)
movslq -0x24(%rbp),%rax
cmpl   $0x0,-0x34(%rbp,%rax,4)
jge    140e <LSE_master_colors_max_min+0x2de>
movslq -0x24(%rbp),%rax
movl   $0x0,-0x34(%rbp,%rax,4)
jmp    1431 <LSE_master_colors_max_min+0x301>
movslq -0x24(%rbp),%rax
cmpl   $0xff,-0x34(%rbp,%rax,4)
jle    142c <LSE_master_colors_max_min+0x2fc>
movslq -0x24(%rbp),%rax
movl   $0xff,-0x34(%rbp,%rax,4)
jmp    1431 <LSE_master_colors_max_min+0x301>
movslq -0x24(%rbp),%rax
movss  0xbcf(%rip),%xmm1
addss  -0x4c(%rbp,%rax,4),%xmm1
movss  -0x60(%rbp),%xmm0
movslq -0x24(%rbp),%rax
movss  -0x58(%rbp,%rax,4),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
movslq -0x24(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
jge    1486 <LSE_master_colors_max_min+0x356>
movslq -0x24(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
jmp    14a9 <LSE_master_colors_max_min+0x379>
movslq -0x24(%rbp),%rax
cmpl   $0xff,-0x40(%rbp,%rax,4)
jle    14a4 <LSE_master_colors_max_min+0x374>
movslq -0x24(%rbp),%rax
movl   $0xff,-0x40(%rbp,%rax,4)
jmp    14a9 <LSE_master_colors_max_min+0x379>
jmp    14ae <LSE_master_colors_max_min+0x37e>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13af <LSE_master_colors_max_min+0x27f>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1030 <rgb_to_565@plt>
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1030 <rgb_to_565@plt>
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    1501 <LSE_master_colors_max_min+0x3d1>
mov    -0x24(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1513 <LSE_master_colors_max_min+0x3e3>
mov    -0x28(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LSE_master_colors_max_min>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%r12d
movl   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    -0x5(%r12),%eax
cmp    $0xfffffffe,%eax
jb     13c5 <LSE_master_colors_max_min+0x2a5>
mov    %rcx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x18(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %r12d,%esi
call   1040 <compute_color_line_STDEV@plt>
movss  0x8(%rsp),%xmm0
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
addss  0xe6c(%rip),%xmm1
movsd  0xc(%rsp),%xmm2
movaps %xmm2,%xmm4
mulss  %xmm2,%xmm4
addss  %xmm1,%xmm4
movaps %xmm2,%xmm3
shufps $0x55,%xmm2,%xmm3
movaps %xmm3,%xmm5
movzbl (%rbx),%eax
cvtsi2ss %eax,%xmm6
movzbl 0x1(%rbx),%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
mulss  %xmm3,%xmm5
addss  %xmm4,%xmm5
mulss  %xmm2,%xmm1
mulss  %xmm0,%xmm6
movzbl 0x2(%rbx),%eax
xorps  %xmm4,%xmm4
cvtsi2ss %eax,%xmm4
addss  %xmm1,%xmm6
movaps %xmm2,%xmm8
shufps $0x5,%xmm2,%xmm8
mulss  %xmm3,%xmm4
addss  %xmm6,%xmm4
mov    %r12d,%eax
shufps $0x0,%xmm4,%xmm4
lea    (%rax,%rbx,1),%rcx
add    $0x2,%rcx
mov    $0xf,%edx
jmp    1223 <LSE_master_colors_max_min+0x103>
nopw   0x0(%rax,%rax,1)
movlhps %xmm4,%xmm6
shufps $0xe2,%xmm4,%xmm6
movaps %xmm6,%xmm4
add    %rax,%rcx
add    $0xffffffffffffffff,%rdx
je     126e <LSE_master_colors_max_min+0x14e>
movzbl -0x2(%rcx),%esi
xorps  %xmm7,%xmm7
cvtsi2ss %esi,%xmm7
movzbl -0x1(%rcx),%esi
xorps  %xmm6,%xmm6
cvtsi2ss %esi,%xmm6
mulss  %xmm2,%xmm6
mulss  %xmm0,%xmm7
addss  %xmm6,%xmm7
movzbl (%rcx),%esi
xorps  %xmm6,%xmm6
cvtsi2ss %esi,%xmm6
mulss  %xmm3,%xmm6
addss  %xmm7,%xmm6
movaps %xmm4,%xmm7
shufps $0x55,%xmm4,%xmm7
ucomiss %xmm6,%xmm7
ja     1210 <LSE_master_colors_max_min+0xf0>
ucomiss %xmm4,%xmm6
jbe    121a <LSE_master_colors_max_min+0xfa>
movss  %xmm6,%xmm4
jmp    121a <LSE_master_colors_max_min+0xfa>
movss  0xd8e(%rip),%xmm7
divss  %xmm5,%xmm7
movss  0x18(%rsp),%xmm6
movsd  0x1c(%rsp),%xmm5
mulss  %xmm5,%xmm2
movaps %xmm0,%xmm1
mulss  %xmm6,%xmm1
addss  %xmm2,%xmm1
movaps %xmm5,%xmm2
shufps $0x55,%xmm5,%xmm2
mulss  %xmm3,%xmm2
addss  %xmm1,%xmm2
shufps $0x0,%xmm2,%xmm2
subps  %xmm2,%xmm4
shufps $0x0,%xmm7,%xmm7
mulps  %xmm4,%xmm7
movaps %xmm7,%xmm2
shufps $0x11,%xmm7,%xmm2
addss  0xd47(%rip),%xmm6
shufps $0xe1,%xmm7,%xmm7
shufps $0x0,%xmm0,%xmm0
mulps  %xmm7,%xmm0
shufps $0x0,%xmm6,%xmm6
addps  %xmm0,%xmm6
cvttps2dq %xmm6,%xmm0
pshufd $0x55,%xmm0,%xmm1
movd   %xmm1,%edi
cmp    $0xff,%edi
mov    $0xff,%r8d
cmovae %r8d,%edi
pshufd $0x50,%xmm0,%xmm1
movmskpd %xmm1,%edx
xor    %ecx,%ecx
test   $0x2,%dl
cmovne %ecx,%edi
movd   %xmm0,%r12d
cmp    $0xff,%r12d
cmovae %r8d,%r12d
mulps  %xmm8,%xmm2
test   $0x1,%dl
cmovne %ecx,%r12d
addps  0xced(%rip),%xmm5
shufps $0x5,%xmm5,%xmm5
addps  %xmm2,%xmm5
cvttps2dq %xmm5,%xmm0
movdqa 0xcea(%rip),%xmm1
pxor   %xmm0,%xmm1
movdqa 0xcee(%rip),%xmm2
pcmpgtd %xmm1,%xmm2
movmskps %xmm2,%ebp
pshufd $0xff,%xmm0,%xmm1
movd   %xmm1,%esi
test   $0x8,%bpl
cmove  %r8d,%esi
movmskps %xmm0,%eax
test   $0x8,%al
cmovne %ecx,%esi
pshufd $0xee,%xmm0,%xmm1
movd   %xmm1,%r13d
test   $0x4,%bpl
cmove  %r8d,%r13d
test   $0x4,%al
cmovne %ecx,%r13d
pshufd $0x55,%xmm0,%xmm1
movd   %xmm1,%edx
test   $0x2,%bpl
cmove  %r8d,%edx
test   $0x2,%al
cmovne %ecx,%edx
movd   %xmm0,%ebx
test   $0x1,%bpl
cmove  %r8d,%ebx
test   $0x1,%al
cmovne %ecx,%ebx
call   1030 <rgb_to_565@plt>
mov    %eax,%ebp
mov    %r12d,%edi
mov    %r13d,%esi
mov    %ebx,%edx
call   1030 <rgb_to_565@plt>
cmp    %eax,%ebp
mov    %eax,%ecx
cmovg  %ebp,%ecx
cmovg  %eax,%ebp
mov    %ecx,(%r15)
mov    %ebp,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @LSE_master_colors_max_min(i32* %0, i32* %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca [3 x i32]
%12 = alloca [3 x i32]
%13 = alloca [3 x float]
%14 = alloca [3 x float]
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%19 = bitcast [3 x float]* %13 to i8*
%20 = bitcast [3 x float]* %14 to i8*
store float 1.000000e+00, float* %15
store float -1.000000e+00, float* %16
store float 0.000000e+00, float* %17
%21 = load i32, i32* %7
%22 = icmp slt i32 %21, 3
br i1 %22, label %26, label %23
23: ; preds = %4
%24 = load i32, i32* %7
%25 = icmp sgt i32 %24, 4
br i1 %25, label %26, label %27
26: ; preds = %23, %4
br label %268
27: ; preds = %23
%28 = load i8*, i8** %8
%29 = load i32, i32* %7
%30 = getelementptr inbounds [3 x float], [3 x float]* %13, i64 0, i64 0
%31 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%32 = call i32 @compute_color_line_STDEV(i8* %28, i32 %29, float* %30, float* %31)
%33 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%34 = load float, float* %33
%35 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%36 = load float, float* %35
%37 = call float @llvm.fmuladd.f32(float %34, float %36, float 0x3EE4F8B580000000)
%38 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%39 = load float, float* %38
%40 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%41 = load float, float* %40
%42 = call float @llvm.fmuladd.f32(float %39, float %41, float %37)
%43 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%44 = load float, float* %43
%45 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%46 = load float, float* %45
%47 = call float @llvm.fmuladd.f32(float %44, float %46, float %42)
%48 = fdiv float 1.000000e+00, %47
store float %48, float* %17
%49 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%50 = load float, float* %49
%51 = load i8*, i8** %8
%52 = getelementptr inbounds i8, i8* %51, i64 0
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = sitofp i32 %54 to float
%56 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%57 = load float, float* %56
%58 = load i8*, i8** %8
%59 = getelementptr inbounds i8, i8* %58, i64 1
%60 = load i8, i8* %59
%61 = zext i8 %60 to i32
%62 = sitofp i32 %61 to float
%63 = fmul float %57, %62
%64 = call float @llvm.fmuladd.f32(float %50, float %55, float %63)
%65 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%66 = load float, float* %65
%67 = load i8*, i8** %8
%68 = getelementptr inbounds i8, i8* %67, i64 2
%69 = load i8, i8* %68
%70 = zext i8 %69 to i32
%71 = sitofp i32 %70 to float
%72 = call float @llvm.fmuladd.f32(float %66, float %71, float %64)
store float %72, float* %15
%73 = load float, float* %15
store float %73, float* %16
store i32 1, i32* %9
br label %74
74: ; preds = %130, %27
%75 = load i32, i32* %9
%76 = icmp slt i32 %75, 16
br i1 %76, label %77, label %133
77: ; preds = %74
%78 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%79 = load float, float* %78
%80 = load i8*, i8** %8
%81 = load i32, i32* %9
%82 = load i32, i32* %7
%83 = mul nsw i32 %81, %82
%84 = add nsw i32 %83, 0
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %80, i64 %85
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = sitofp i32 %88 to float
%90 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%91 = load float, float* %90
%92 = load i8*, i8** %8
%93 = load i32, i32* %9
%94 = load i32, i32* %7
%95 = mul nsw i32 %93, %94
%96 = add nsw i32 %95, 1
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %92, i64 %97
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = sitofp i32 %100 to float
%102 = fmul float %91, %101
%103 = call float @llvm.fmuladd.f32(float %79, float %89, float %102)
%104 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%105 = load float, float* %104
%106 = load i8*, i8** %8
%107 = load i32, i32* %9
%108 = load i32, i32* %7
%109 = mul nsw i32 %107, %108
%110 = add nsw i32 %109, 2
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %106, i64 %111
%113 = load i8, i8* %112
%114 = zext i8 %113 to i32
%115 = sitofp i32 %114 to float
%116 = call float @llvm.fmuladd.f32(float %105, float %115, float %103)
store float %116, float* %18
%117 = load float, float* %18
%118 = load float, float* %16
%119 = fcmp olt float %117, %118
br i1 %119, label %120, label %122
120: ; preds = %77
%121 = load float, float* %18
store float %121, float* %16
br label %129
122: ; preds = %77
%123 = load float, float* %18
%124 = load float, float* %15
%125 = fcmp ogt float %123, %124
br i1 %125, label %126, label %128
126: ; preds = %122
%127 = load float, float* %18
store float %127, float* %15
br label %128
128: ; preds = %126, %122
br label %129
129: ; preds = %128, %120
br label %130
130: ; preds = %129
%131 = load i32, i32* %9
%132 = add nsw i32 %131, 1
store i32 %132, i32* %9
br label %74
133: ; preds = %74
%134 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 0
%135 = load float, float* %134
%136 = getelementptr inbounds [3 x float], [3 x float]* %13, i64 0, i64 0
%137 = load float, float* %136
%138 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 1
%139 = load float, float* %138
%140 = getelementptr inbounds [3 x float], [3 x float]* %13, i64 0, i64 1
%141 = load float, float* %140
%142 = fmul float %139, %141
%143 = call float @llvm.fmuladd.f32(float %135, float %137, float %142)
%144 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 2
%145 = load float, float* %144
%146 = getelementptr inbounds [3 x float], [3 x float]* %13, i64 0, i64 2
%147 = load float, float* %146
%148 = call float @llvm.fmuladd.f32(float %145, float %147, float %143)
store float %148, float* %18
%149 = load float, float* %18
%150 = load float, float* %16
%151 = fsub float %150, %149
store float %151, float* %16
%152 = load float, float* %18
%153 = load float, float* %15
%154 = fsub float %153, %152
store float %154, float* %15
%155 = load float, float* %17
%156 = load float, float* %16
%157 = fmul float %156, %155
store float %157, float* %16
%158 = load float, float* %17
%159 = load float, float* %15
%160 = fmul float %159, %158
store float %160, float* %15
store i32 0, i32* %9
br label %161
161: ; preds = %237, %133
%162 = load i32, i32* %9
%163 = icmp slt i32 %162, 3
br i1 %163, label %164, label %240
164: ; preds = %161
%165 = load i32, i32* %9
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [3 x float], [3 x float]* %13, i64 0, i64 %166
%168 = load float, float* %167
%169 = fadd float 5.000000e-01, %168
%170 = load float, float* %15
%171 = load i32, i32* %9
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 %172
%174 = load float, float* %173
%175 = call float @llvm.fmuladd.f32(float %170, float %174, float %169)
%176 = fptosi float %175 to i32
%177 = load i32, i32* %9
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 %178
store i32 %176, i32* %179
%180 = load i32, i32* %9
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 %181
%183 = load i32, i32* %182
%184 = icmp slt i32 %183, 0
br i1 %184, label %185, label %189
185: ; preds = %164
%186 = load i32, i32* %9
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 %187
store i32 0, i32* %188
br label %200
189: ; preds = %164
%190 = load i32, i32* %9
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 %191
%193 = load i32, i32* %192
%194 = icmp sgt i32 %193, 255
br i1 %194, label %195, label %199
195: ; preds = %189
%196 = load i32, i32* %9
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 %197
store i32 255, i32* %198
br label %199
199: ; preds = %195, %189
br label %200
200: ; preds = %199, %185
%201 = load i32, i32* %9
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds [3 x float], [3 x float]* %13, i64 0, i64 %202
%204 = load float, float* %203
%205 = fadd float 5.000000e-01, %204
%206 = load float, float* %16
%207 = load i32, i32* %9
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds [3 x float], [3 x float]* %14, i64 0, i64 %208
%210 = load float, float* %209
%211 = call float @llvm.fmuladd.f32(float %206, float %210, float %205)
%212 = fptosi float %211 to i32
%213 = load i32, i32* %9
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 %214
store i32 %212, i32* %215
%216 = load i32, i32* %9
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 %217
%219 = load i32, i32* %218
%220 = icmp slt i32 %219, 0
br i1 %220, label %221, label %225
221: ; preds = %200
%222 = load i32, i32* %9
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 %223
store i32 0, i32* %224
br label %236
225: ; preds = %200
%226 = load i32, i32* %9
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 %227
%229 = load i32, i32* %228
%230 = icmp sgt i32 %229, 255
br i1 %230, label %231, label %235
231: ; preds = %225
%232 = load i32, i32* %9
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 %233
store i32 255, i32* %234
br label %235
235: ; preds = %231, %225
br label %236
236: ; preds = %235, %221
br label %237
237: ; preds = %236
%238 = load i32, i32* %9
%239 = add nsw i32 %238, 1
store i32 %239, i32* %9
br label %161
240: ; preds = %161
%241 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 0
%242 = load i32, i32* %241
%243 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 1
%244 = load i32, i32* %243
%245 = getelementptr inbounds [3 x i32], [3 x i32]* %11, i64 0, i64 2
%246 = load i32, i32* %245
%247 = call i32 @rgb_to_565(i32 %242, i32 %244, i32 %246)
store i32 %247, i32* %9
%248 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 0
%249 = load i32, i32* %248
%250 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 1
%251 = load i32, i32* %250
%252 = getelementptr inbounds [3 x i32], [3 x i32]* %12, i64 0, i64 2
%253 = load i32, i32* %252
%254 = call i32 @rgb_to_565(i32 %249, i32 %251, i32 %253)
store i32 %254, i32* %10
%255 = load i32, i32* %9
%256 = load i32, i32* %10
%257 = icmp sgt i32 %255, %256
br i1 %257, label %258, label %263
258: ; preds = %240
%259 = load i32, i32* %9
%260 = load i32*, i32** %5
store i32 %259, i32* %260
%261 = load i32, i32* %10
%262 = load i32*, i32** %6
store i32 %261, i32* %262
br label %268
263: ; preds = %240
%264 = load i32, i32* %10
%265 = load i32*, i32** %5
store i32 %264, i32* %265
%266 = load i32, i32* %9
%267 = load i32*, i32** %6
store i32 %266, i32* %267
br label %268
268: ; preds = %26, %263, %258
ret void
}

LLVM IR (-O2):
define void @LSE_master_colors_max_min(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32 %2, i8* %3) {
%5 = alloca [3 x float]
%6 = alloca [3 x float]
%7 = bitcast [3 x float]* %5 to i8*
%8 = bitcast [3 x float]* %6 to i8*
%9 = add i32 %2, -5
%10 = icmp ult i32 %9, -2
br i1 %10, label %137, label %11
11: ; preds = %4
%12 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%13 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 0
%14 = call i32 @compute_color_line_STDEV(i8* %3, i32 %2, float* %12, float* %13)
%15 = load float, float* %13
%16 = call float @llvm.fmuladd.f32(float %15, float %15, float 0x3EE4F8B580000000)
%17 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 1
%18 = bitcast float* %17 to <2 x float>*
%19 = load <2 x float>, <2 x float>* %18
%20 = shufflevector <2 x float> %19, <2 x float> poison, <4 x i32> <i32 1, i32 1, i32 0, i32 0>
%21 = extractelement <2 x float> %19, i64 0
%22 = call float @llvm.fmuladd.f32(float %21, float %21, float %16)
%23 = extractelement <2 x float> %19, i64 1
%24 = call float @llvm.fmuladd.f32(float %23, float %23, float %22)
%25 = load i8, i8* %3
%26 = uitofp i8 %25 to float
%27 = getelementptr inbounds i8, i8* %3, i64 1
%28 = load i8, i8* %27
%29 = uitofp i8 %28 to float
%30 = fmul float %21, %29
%31 = call float @llvm.fmuladd.f32(float %15, float %26, float %30)
%32 = getelementptr inbounds i8, i8* %3, i64 2
%33 = load i8, i8* %32
%34 = uitofp i8 %33 to float
%35 = call float @llvm.fmuladd.f32(float %23, float %34, float %31)
%36 = zext i32 %2 to i64
%37 = insertelement <2 x float> poison, float %35, i64 0
%38 = shufflevector <2 x float> %37, <2 x float> poison, <2 x i32> zeroinitializer
br label %39
39: ; preds = %11, %65
%40 = phi i64 [ 1, %11 ], [ %67, %65 ]
%41 = phi <2 x float> [ %38, %11 ], [ %66, %65 ]
%42 = mul nsw i64 %40, %36
%43 = getelementptr inbounds i8, i8* %3, i64 %42
%44 = load i8, i8* %43
%45 = uitofp i8 %44 to float
%46 = add nuw nsw i64 %42, 1
%47 = getelementptr inbounds i8, i8* %3, i64 %46
%48 = load i8, i8* %47
%49 = uitofp i8 %48 to float
%50 = fmul float %21, %49
%51 = call float @llvm.fmuladd.f32(float %15, float %45, float %50)
%52 = add nuw nsw i64 %42, 2
%53 = getelementptr inbounds i8, i8* %3, i64 %52
%54 = load i8, i8* %53
%55 = uitofp i8 %54 to float
%56 = call float @llvm.fmuladd.f32(float %23, float %55, float %51)
%57 = extractelement <2 x float> %41, i64 1
%58 = fcmp olt float %56, %57
%59 = insertelement <2 x float> %41, float %56, i64 1
br i1 %58, label %65, label %60
60: ; preds = %39
%61 = extractelement <2 x float> %41, i64 0
%62 = fcmp ogt float %56, %61
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = insertelement <2 x float> %41, float %56, i64 0
br label %65
65: ; preds = %39, %63, %60
%66 = phi <2 x float> [ %64, %63 ], [ %41, %60 ], [ %59, %39 ]
%67 = add nuw nsw i64 %40, 1
%68 = icmp eq i64 %67, 16
br i1 %68, label %69, label %39
69: ; preds = %65
%70 = fdiv float 1.000000e+00, %24
%71 = load float, float* %12
%72 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
%73 = bitcast float* %72 to <2 x float>*
%74 = load <2 x float>, <2 x float>* %73
%75 = extractelement <2 x float> %74, i64 0
%76 = fmul float %21, %75
%77 = call float @llvm.fmuladd.f32(float %15, float %71, float %76)
%78 = extractelement <2 x float> %74, i64 1
%79 = call float @llvm.fmuladd.f32(float %23, float %78, float %77)
%80 = insertelement <2 x float> poison, float %79, i64 0
%81 = shufflevector <2 x float> %80, <2 x float> poison, <2 x i32> zeroinitializer
%82 = fsub <2 x float> %66, %81
%83 = insertelement <2 x float> poison, float %70, i64 0
%84 = shufflevector <2 x float> %83, <2 x float> poison, <2 x i32> zeroinitializer
%85 = fmul <2 x float> %84, %82
%86 = shufflevector <2 x float> %85, <2 x float> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
%87 = fadd float %71, 5.000000e-01
%88 = shufflevector <2 x float> %85, <2 x float> undef, <2 x i32> <i32 1, i32 0>
%89 = insertelement <2 x float> poison, float %15, i64 0
%90 = shufflevector <2 x float> %89, <2 x float> poison, <2 x i32> zeroinitializer
%91 = insertelement <2 x float> poison, float %87, i64 0
%92 = shufflevector <2 x float> %91, <2 x float> poison, <2 x i32> zeroinitializer
%93 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %88, <2 x float> %90, <2 x float> %92)
%94 = fptosi <2 x float> %93 to <2 x i32>
%95 = extractelement <2 x i32> %94, i64 1
%96 = icmp ult i32 %95, 255
%97 = select i1 %96, i32 %95, i32 255
%98 = icmp slt <2 x i32> %94, zeroinitializer
%99 = extractelement <2 x i1> %98, i64 1
%100 = select i1 %99, i32 0, i32 %97
%101 = extractelement <2 x i32> %94, i64 0
%102 = icmp ult i32 %101, 255
%103 = select i1 %102, i32 %101, i32 255
%104 = extractelement <2 x i1> %98, i64 0
%105 = select i1 %104, i32 0, i32 %103
%106 = fadd <2 x float> %74, <float 5.000000e-01, float 5.000000e-01>
%107 = shufflevector <2 x float> %106, <2 x float> poison, <4 x i32> <i32 1, i32 1, i32 0, i32 0>
%108 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %86, <4 x float> %20, <4 x float> %107)
%109 = fptosi <4 x float> %108 to <4 x i32>
%110 = icmp ult <4 x i32> %109, <i32 255, i32 255, i32 255, i32 255>
%111 = extractelement <4 x i1> %110, i64 3
%112 = extractelement <4 x i32> %109, i64 3
%113 = select i1 %111, i32 %112, i32 255
%114 = icmp slt <4 x i32> %109, zeroinitializer
%115 = extractelement <4 x i1> %114, i64 3
%116 = select i1 %115, i32 0, i32 %113
%117 = extractelement <4 x i1> %110, i64 2
%118 = extractelement <4 x i32> %109, i64 2
%119 = select i1 %117, i32 %118, i32 255
%120 = extractelement <4 x i1> %114, i64 2
%121 = select i1 %120, i32 0, i32 %119
%122 = extractelement <4 x i1> %110, i64 1
%123 = extractelement <4 x i32> %109, i64 1
%124 = select i1 %122, i32 %123, i32 255
%125 = extractelement <4 x i1> %114, i64 1
%126 = select i1 %125, i32 0, i32 %124
%127 = extractelement <4 x i1> %110, i64 0
%128 = extractelement <4 x i32> %109, i64 0
%129 = select i1 %127, i32 %128, i32 255
%130 = extractelement <4 x i1> %114, i64 0
%131 = select i1 %130, i32 0, i32 %129
%132 = call i32 @rgb_to_565(i32 %100, i32 %116, i32 %126)
%133 = call i32 @rgb_to_565(i32 %105, i32 %121, i32 %131)
%134 = icmp sgt i32 %132, %133
%135 = select i1 %134, i32 %132, i32 %133
%136 = select i1 %134, i32 %133, i32 %132
store i32 %135, i32* %0
store i32 %136, i32* %1
br label %137
137: ; preds = %4, %69
ret void
}