#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__ calloc(long, int);
float pow(float, float);
float *gamma_transform(float c, float power, float *array,
                       long int array_size) {
  float *ret = (float *)calloc(array_size, sizeof(float));
  int k;
  for (k = 0; k < array_size; k++)
    *(ret + k) = c * pow(*(array + k), power);
  return ret;
}


x86 assembly (clang, -O0):
<gamma_transform>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    11a9 <gamma_transform+0x89>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1153 <gamma_transform+0x33>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma_transform>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %rdi,%r13
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
mov    %rsi,%rdi
mov    $0x4,%esi
call   1030 <calloc@plt>
mov    %rax,%r14
test   %r15,%r15
jle    125b <gamma_transform+0x13b>
movss  0x8(%rsp),%xmm0
lea    -0x1(%r15),%rax
mov    %r15d,%r12d
and    $0x3,%r12d
cmp    $0x3,%rax
jae    1179 <gamma_transform+0x59>
xor    %ebx,%ebx
movaps %xmm0,%xmm1
jmp    121c <gamma_transform+0xfc>
and    $0xfffffffffffffffc,%r15
xor    %ebx,%ebx
movaps %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  0x0(%r13,%rbx,4),%xmm0
call   1040 <pow@plt>
mulss  0xc(%rsp),%xmm0
movss  %xmm0,(%r14,%rbx,4)
movss  0x4(%r13,%rbx,4),%xmm0
movss  0x8(%rsp),%xmm1
call   1040 <pow@plt>
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0x4(%r14,%rbx,4)
movss  0x8(%r13,%rbx,4),%xmm0
movss  0x8(%rsp),%xmm1
call   1040 <pow@plt>
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0x8(%r14,%rbx,4)
movss  0xc(%r13,%rbx,4),%xmm0
movss  0x8(%rsp),%xmm1
call   1040 <pow@plt>
movss  0xc(%rsp),%xmm2
movss  0x8(%rsp),%xmm1
mulss  %xmm2,%xmm0
movss  %xmm0,0xc(%r14,%rbx,4)
add    $0x4,%rbx
cmp    %rbx,%r15
jne    1190 <gamma_transform+0x70>
test   %r12,%r12
je     125b <gamma_transform+0x13b>
lea    (%r14,%rbx,4),%r15
lea    0x0(%r13,%rbx,4),%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
movss  0x0(%r13,%rbx,4),%xmm0
call   1040 <pow@plt>
movss  0xc(%rsp),%xmm2
movss  0x8(%rsp),%xmm1
mulss  %xmm2,%xmm0
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1230 <gamma_transform+0x110>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float* @gamma_transform(float %0, float %1, float* %2, i64 %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float*
%8 = alloca i64
%9 = alloca float*
%10 = alloca i32
store float %0, float* %5
store float %1, float* %6
store float* %2, float** %7
store i64 %3, i64* %8
%11 = load i64, i64* %8
%12 = call i64 @calloc(i64 %11, i32 4)
%13 = inttoptr i64 %12 to float*
store float* %13, float** %9
store i32 0, i32* %10
br label %14
14: ; preds = %33, %4
%15 = load i32, i32* %10
%16 = sext i32 %15 to i64
%17 = load i64, i64* %8
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %36
19: ; preds = %14
%20 = load float, float* %5
%21 = load float*, float** %7
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float, float* %21, i64 %23
%25 = load float, float* %24
%26 = load float, float* %6
%27 = call float @pow(float %25, float %26)
%28 = fmul float %20, %27
%29 = load float*, float** %9
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float, float* %29, i64 %31
store float %28, float* %32
br label %33
33: ; preds = %19
%34 = load i32, i32* %10
%35 = add nsw i32 %34, 1
store i32 %35, i32* %10
br label %14
36: ; preds = %14
%37 = load float*, float** %9
ret float* %37
}

LLVM IR (-O2):
define float* @gamma_transform(float %0, float %1, float* nocapture %2, i64 %3) {
%5 = tail call i64 @calloc(i64 %3, i32 4)
%6 = inttoptr i64 %5 to float*
%7 = icmp sgt i64 %3, 0
br i1 %7, label %8, label %57
8: ; preds = %4
%9 = add i64 %3, -1
%10 = and i64 %3, 3
%11 = icmp ult i64 %9, 3
br i1 %11, label %43, label %12
12: ; preds = %8
%13 = and i64 %3, -4
br label %14
14: ; preds = %14, %12
%15 = phi i64 [ 0, %12 ], [ %40, %14 ]
%16 = phi i64 [ 0, %12 ], [ %41, %14 ]
%17 = getelementptr inbounds float, float* %2, i64 %15
%18 = load float, float* %17
%19 = tail call float @pow(float %18, float %1)
%20 = fmul float %19, %0
%21 = getelementptr inbounds float, float* %6, i64 %15
store float %20, float* %21
%22 = or i64 %15, 1
%23 = getelementptr inbounds float, float* %2, i64 %22
%24 = load float, float* %23
%25 = tail call float @pow(float %24, float %1)
%26 = fmul float %25, %0
%27 = getelementptr inbounds float, float* %6, i64 %22
store float %26, float* %27
%28 = or i64 %15, 2
%29 = getelementptr inbounds float, float* %2, i64 %28
%30 = load float, float* %29
%31 = tail call float @pow(float %30, float %1)
%32 = fmul float %31, %0
%33 = getelementptr inbounds float, float* %6, i64 %28
store float %32, float* %33
%34 = or i64 %15, 3
%35 = getelementptr inbounds float, float* %2, i64 %34
%36 = load float, float* %35
%37 = tail call float @pow(float %36, float %1)
%38 = fmul float %37, %0
%39 = getelementptr inbounds float, float* %6, i64 %34
store float %38, float* %39
%40 = add nuw nsw i64 %15, 4
%41 = add i64 %16, 4
%42 = icmp eq i64 %41, %13
br i1 %42, label %43, label %14
43: ; preds = %14, %8
%44 = phi i64 [ 0, %8 ], [ %40, %14 ]
%45 = icmp eq i64 %10, 0
br i1 %45, label %57, label %46
46: ; preds = %43, %46
%47 = phi i64 [ %54, %46 ], [ %44, %43 ]
%48 = phi i64 [ %55, %46 ], [ 0, %43 ]
%49 = getelementptr inbounds float, float* %2, i64 %47
%50 = load float, float* %49
%51 = tail call float @pow(float %50, float %1)
%52 = fmul float %51, %0
%53 = getelementptr inbounds float, float* %6, i64 %47
store float %52, float* %53
%54 = add nuw nsw i64 %47, 1
%55 = add i64 %48, 1
%56 = icmp eq i64 %55, %10
br i1 %56, label %57, label %46
57: ; preds = %43, %46, %4
ret float* %6
}