#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 */
scalar_t__ _TIFFmalloc(int);
float *setupLuma(float c) {
  float *v = (float *)_TIFFmalloc(256 * sizeof(float));
  int i;
  for (i = 0; i < 256; i++)
    v[i] = c * i;
  return (v);
}


x86 assembly (clang, -O0):
<setupLuma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    $0x400,%edi
call   1030 <_TIFFmalloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    1168 <setupLuma+0x58>
movss  -0x4(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1132 <setupLuma+0x22>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setupLuma>:
sub    $0x18,%rsp
movaps %xmm0,(%rsp)
mov    $0x400,%edi
call   1030 <_TIFFmalloc@plt>
movaps (%rsp),%xmm7
shufps $0x0,%xmm7,%xmm7
movdqa 0xece(%rip),%xmm0
mov    $0xc,%ecx
movdqa 0xed1(%rip),%xmm1
movdqa 0xed9(%rip),%xmm2
movdqa 0xee1(%rip),%xmm3
movdqa 0xee9(%rip),%xmm4
nopw   0x0(%rax,%rax,1)
movdqa %xmm0,%xmm5
paddd  %xmm1,%xmm5
cvtdq2ps %xmm0,%xmm6
cvtdq2ps %xmm5,%xmm5
mulps  %xmm7,%xmm6
mulps  %xmm7,%xmm5
movups %xmm6,-0x30(%rax,%rcx,4)
movups %xmm5,-0x20(%rax,%rcx,4)
movdqa %xmm0,%xmm5
paddd  %xmm2,%xmm5
movdqa %xmm0,%xmm6
paddd  %xmm3,%xmm6
cvtdq2ps %xmm5,%xmm5
cvtdq2ps %xmm6,%xmm6
mulps  %xmm7,%xmm5
mulps  %xmm7,%xmm6
movups %xmm5,-0x10(%rax,%rcx,4)
movups %xmm6,(%rax,%rcx,4)
paddd  %xmm4,%xmm0
add    $0x10,%rcx
cmp    $0x10c,%rcx
jne    1160 <setupLuma+0x50>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float* @setupLuma(float %0) {
%2 = alloca float
%3 = alloca float*
%4 = alloca i32
store float %0, float* %2
%5 = call i64 @_TIFFmalloc(i32 1024)
%6 = inttoptr i64 %5 to float*
store float* %6, float** %3
store i32 0, i32* %4
br label %7
7: ; preds = %19, %1
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 256
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load float, float* %2
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to float
%14 = fmul float %11, %13
%15 = load float*, float** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds float, float* %15, i64 %17
store float %14, float* %18
br label %19
19: ; preds = %10
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %7
22: ; preds = %7
%23 = load float*, float** %3
ret float* %23
}

LLVM IR (-O2):
define float* @setupLuma(float %0) {
%2 = tail call i64 @_TIFFmalloc(i32 1024)
%3 = inttoptr i64 %2 to float*
%4 = insertelement <4 x float> poison, float %0, i64 0
%5 = shufflevector <4 x float> %4, <4 x float> poison, <4 x i32> zeroinitializer
%6 = insertelement <4 x float> poison, float %0, i64 0
%7 = shufflevector <4 x float> %6, <4 x float> poison, <4 x i32> zeroinitializer
br label %8
8: ; preds = %8, %1
%9 = phi i64 [ 0, %1 ], [ %31, %8 ]
%10 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %1 ], [ %32, %8 ]
%11 = add <4 x i32> %10, <i32 4, i32 4, i32 4, i32 4>
%12 = sitofp <4 x i32> %10 to <4 x float>
%13 = sitofp <4 x i32> %11 to <4 x float>
%14 = fmul <4 x float> %5, %12
%15 = fmul <4 x float> %7, %13
%16 = getelementptr inbounds float, float* %3, i64 %9
%17 = bitcast float* %16 to <4 x float>*
store <4 x float> %14, <4 x float>* %17
%18 = getelementptr inbounds float, float* %16, i64 4
%19 = bitcast float* %18 to <4 x float>*
store <4 x float> %15, <4 x float>* %19
%20 = or i64 %9, 8
%21 = add <4 x i32> %10, <i32 8, i32 8, i32 8, i32 8>
%22 = add <4 x i32> %10, <i32 12, i32 12, i32 12, i32 12>
%23 = sitofp <4 x i32> %21 to <4 x float>
%24 = sitofp <4 x i32> %22 to <4 x float>
%25 = fmul <4 x float> %5, %23
%26 = fmul <4 x float> %7, %24
%27 = getelementptr inbounds float, float* %3, i64 %20
%28 = bitcast float* %27 to <4 x float>*
store <4 x float> %25, <4 x float>* %28
%29 = getelementptr inbounds float, float* %27, i64 4
%30 = bitcast float* %29 to <4 x float>*
store <4 x float> %26, <4 x float>* %30
%31 = add nuw nsw i64 %9, 16
%32 = add <4 x i32> %10, <i32 16, i32 16, i32 16, i32 16>
%33 = icmp eq i64 %31, 256
br i1 %33, label %34, label %8
34: ; preds = %8
ret float* %3
}