#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 */
float pow(unsigned int, double);
void compute_curve_gamma_table_type1(float gamma_table[256], double gamma) {
  unsigned int i;
  for (i = 0; i < 256; i++) {
    gamma_table[i] = pow(i / 255., gamma);
  }
}


x86 assembly (clang, -O0):
<compute_curve_gamma_table_type1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jae    1174 <compute_curve_gamma_table_type1+0x64>
mov    -0x14(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xebb(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,%edi
movsd  -0x10(%rbp),%xmm0
call   1030 <pow@plt>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1128 <compute_curve_gamma_table_type1+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_curve_gamma_table_type1>:
push   %r14
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rdi,%r14
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xece(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
movsd  (%rsp),%xmm0
call   1030 <pow@plt>
lea    0x1(%rbx),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movss  %xmm0,(%r14,%rbx,4)
divsd  0xea2(%rip),%xmm1
cvttsd2si %xmm1,%rdi
movsd  (%rsp),%xmm0
call   1030 <pow@plt>
movss  %xmm0,0x4(%r14,%rbx,4)
add    $0x2,%rbx
cmp    $0x100,%rbx
jne    1120 <compute_curve_gamma_table_type1+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @compute_curve_gamma_table_type1(float* %0, double %1) {
%3 = alloca float*
%4 = alloca double
%5 = alloca i32
store float* %0, float** %3
store double %1, double* %4
store i32 0, i32* %5
br label %6
6: ; preds = %20, %2
%7 = load i32, i32* %5
%8 = icmp ult i32 %7, 256
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %5
%11 = uitofp i32 %10 to double
%12 = fdiv double %11, 2.550000e+02
%13 = fptoui double %12 to i32
%14 = load double, double* %4
%15 = call float @pow(i32 %13, double %14)
%16 = load float*, float** %3
%17 = load i32, i32* %5
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds float, float* %16, i64 %18
store float %15, float* %19
br label %20
20: ; preds = %9
%21 = load i32, i32* %5
%22 = add i32 %21, 1
store i32 %22, i32* %5
br label %6
23: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @compute_curve_gamma_table_type1(float* nocapture writeonly %0, double %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ 0, %2 ], [ %18, %3 ]
%5 = trunc i64 %4 to i32
%6 = uitofp i32 %5 to double
%7 = fdiv double %6, 2.550000e+02
%8 = fptoui double %7 to i32
%9 = tail call float @pow(i32 %8, double %1)
%10 = getelementptr inbounds float, float* %0, i64 %4
store float %9, float* %10
%11 = or i64 %4, 1
%12 = trunc i64 %11 to i32
%13 = uitofp i32 %12 to double
%14 = fdiv double %13, 2.550000e+02
%15 = fptoui double %14 to i32
%16 = tail call float @pow(i32 %15, double %1)
%17 = getelementptr inbounds float, float* %0, i64 %11
store float %16, float* %17
%18 = add nuw nsw i64 %4, 2
%19 = icmp eq i64 %18, 256
br i1 %19, label %20, label %3
20: ; preds = %3
ret void
}