// File: /workspace/github_c_makefile_star2_O0/zhiyb[P]png2tlg/./stb_image.h
// Function: stbi__hdr_to_ldr(float*, int, int, int)
static stbi_uc *stbi__hdr_to_ldr(float   *data, int x, int y, int comp)
{
   int i,k,n;
   stbi_uc *output;
   if (!data) return NULL;
   output = (stbi_uc *) stbi__malloc_mad3(x, y, comp, 0);
   if (output == NULL) { STBI_FREE(data); return stbi__errpuc("outofmem", "Out of memory"); }
   // compute number of non-alpha components
   if (comp & 1) n = comp; else n = comp-1;
   for (i=0; i < x*y; ++i) {
      for (k=0; k < n; ++k) {
         float z = (float) pow(data[i*comp+k]*stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f;
         if (z < 0) z = 0;
         if (z > 255) z = 255;
         output[i*comp + k] = (stbi_uc) stbi__float2int(z);
      }
      if (k < comp) {
         float z = data[i*comp+k] * 255 + 0.5f;
         if (z < 0) z = 0;
         if (z > 255) z = 255;
         output[i*comp + k] = (stbi_uc) stbi__float2int(z);
      }
   }
   STBI_FREE(data);
   return output;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xaf89
movq $0x0, -0x8(%rbp)
jmp 0xb15d
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
xorl %ecx, %ecx
callq 0x13640
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xafcd
movq -0x10(%rbp), %rdi
callq 0x22a0
leaq 0x1598a(%rip), %rdi     # 0x2093e
callq 0x2680
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, -0x8(%rbp)
jmp 0xb15d
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xafe0
movl -0x1c(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0xafe9
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl -0x14(%rbp), %ecx
imull -0x18(%rbp), %ecx
cmpl %ecx, %eax
jge 0xb14c
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xb0b6
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
imull -0x1c(%rbp), %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
mulss 0x1b209(%rip), %xmm0    # 0x2623c
movss 0x1b1fd(%rip), %xmm1    # 0x26238
callq 0x1f910
movss 0x14fc0(%rip), %xmm1    # 0x20008
mulss %xmm1, %xmm0
movss 0x14fbc(%rip), %xmm1    # 0x20010
addss %xmm1, %xmm0
movss %xmm0, -0x34(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x34(%rbp), %xmm0
jbe 0xb06e
xorps %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x34(%rbp), %xmm0
movss 0x14f8d(%rip), %xmm1    # 0x20008
ucomiss %xmm1, %xmm0
jbe 0xb08d
movss 0x14f80(%rip), %xmm0    # 0x20008
movss %xmm0, -0x34(%rbp)
cvttss2si -0x34(%rbp), %eax
movb %al, %dl
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
imull -0x1c(%rbp), %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xb009
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xb13c
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
imull -0x1c(%rbp), %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
movss (%rax,%rcx,4), %xmm0
movss 0x14f2c(%rip), %xmm1    # 0x20008
mulss %xmm1, %xmm0
movss 0x14f28(%rip), %xmm1    # 0x20010
addss %xmm1, %xmm0
movss %xmm0, -0x38(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x38(%rbp), %xmm0
jbe 0xb102
xorps %xmm0, %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x38(%rbp), %xmm0
movss 0x14ef9(%rip), %xmm1    # 0x20008
ucomiss %xmm1, %xmm0
jbe 0xb121
movss 0x14eec(%rip), %xmm0    # 0x20008
movss %xmm0, -0x38(%rbp)
cvttss2si -0x38(%rbp), %eax
movb %al, %dl
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
imull -0x1c(%rbp), %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0xb13e
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xaff0
movq -0x10(%rbp), %rdi
callq 0x22a0
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)