// File: /workspace/github_c_makefile_star2_O3/zhiyb[P]png2tlg/./stb_image.h
// Function: stbi__hdr_load(stbi__context*, int*, int*, int*, int, stbi__result_info*)
static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri)
{
   char buffer[STBI__HDR_BUFLEN];
   char *token;
   int valid = 0;
   int width, height;
   stbi_uc *scanline;
   float *hdr_data;
   int len;
   unsigned char count, value;
   int i, j, k, c1,c2, z;
   const char *headerToken;
   STBI_NOTUSED(ri);

   // Check identifier
   headerToken = stbi__hdr_gettoken(s,buffer);
   if (strcmp(headerToken, "#?RADIANCE") != 0 && strcmp(headerToken, "#?RGBE") != 0)
      return stbi__errpf("not HDR", "Corrupt HDR image");

   // Parse header
   for(;;) {
      token = stbi__hdr_gettoken(s,buffer);
      if (token[0] == 0) break;
      if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
   }

   if (!valid)    return stbi__errpf("unsupported format", "Unsupported HDR format");

   // Parse width and height
   // can't use sscanf() if we're not using stdio!
   token = stbi__hdr_gettoken(s,buffer);
   if (strncmp(token, "-Y ", 3))  return stbi__errpf("unsupported data layout", "Unsupported HDR format");
   token += 3;
   height = (int) strtol(token, &token, 10);
   while (*token == ' ') ++token;
   if (strncmp(token, "+X ", 3))  return stbi__errpf("unsupported data layout", "Unsupported HDR format");
   token += 3;
   width = (int) strtol(token, NULL, 10);

   *x = width;
   *y = height;

   if (comp) *comp = 3;
   if (req_comp == 0) req_comp = 3;

   if (!stbi__mad4sizes_valid(width, height, req_comp, sizeof(float), 0))
      return stbi__errpf("too large", "HDR image is too large");

   // Read data
   hdr_data = (float *) stbi__malloc_mad4(width, height, req_comp, sizeof(float), 0);
   if (!hdr_data)
      return stbi__errpf("outofmem", "Out of memory");

   // Load image data
   // image data is stored as some number of sca
   if ( width < 8 || width >= 32768) {
      // Read flat data
      for (j=0; j < height; ++j) {
         for (i=0; i < width; ++i) {
            stbi_uc rgbe[4];
           main_decode_loop:
            stbi__getn(s, rgbe, 4);
            stbi__hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp);
         }
      }
   } else {
      // Read RLE-encoded data
      scanline = NULL;

      for (j = 0; j < height; ++j) {
         c1 = stbi__get8(s);
         c2 = stbi__get8(s);
         len = stbi__get8(s);
         if (c1 != 2 || c2 != 2 || (len & 0x80)) {
            // not run-length encoded, so we have to actually use THIS data as a decoded
            // pixel (note this can't be a valid pixel--one of RGB must be >= 128)
            stbi_uc rgbe[4];
            rgbe[0] = (stbi_uc) c1;
            rgbe[1] = (stbi_uc) c2;
            rgbe[2] = (stbi_uc) len;
            rgbe[3] = (stbi_uc) stbi__get8(s);
            stbi__hdr_convert(hdr_data, rgbe, req_comp);
            i = 1;
            j = 0;
            STBI_FREE(scanline);
            goto main_decode_loop; // yes, this makes no sense
         }
         len <<= 8;
         len |= stbi__get8(s);
         if (len != width) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("invalid decoded scanline length", "corrupt HDR"); }
         if (scanline == NULL) {
            scanline = (stbi_uc *) stbi__malloc_mad2(width, 4, 0);
            if (!scanline) {
               STBI_FREE(hdr_data);
               return stbi__errpf("outofmem", "Out of memory");
            }
         }

         for (k = 0; k < 4; ++k) {
            int nleft;
            i = 0;
            while ((nleft = width - i) > 0) {
               count = stbi__get8(s);
               if (count > 128) {
                  // Run
                  value = stbi__get8(s);
                  count -= 128;
                  if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); }
                  for (z = 0; z < count; ++z)
                     scanline[i++ * 4 + k] = value;
               } else {
                  // Dump
                  if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); }
                  for (z = 0; z < count; ++z)
                     scanline[i++ * 4 + k] = stbi__get8(s);
               }
            }
         }
         for (i=0; i < width; ++i)
            stbi__hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp);
      }
      if (scanline)
         STBI_FREE(scanline);
   }

   return hdr_data;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x498, %rsp            # imm = 0x498
movl %r8d, %r15d
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %rbp
movq %rdi, %rbx
leaq 0x90(%rsp), %r12
movq %r12, %rsi
callq 0x15595
movabsq $0x4e41494441523f23, %rax # imm = 0x4E41494441523F23
xorq (%r12), %rax
movabsq $0x45434e41494441, %rcx # imm = 0x45434E41494441
xorq 0x3(%r12), %rcx
orq %rax, %rcx
je 0xc8d6
movl $0x47523f23, %eax       # imm = 0x47523F23
xorl 0x90(%rsp), %eax
movl $0x454247, %ecx         # imm = 0x454247
xorl 0x93(%rsp), %ecx
orl %eax, %ecx
je 0xc8d6
leaq 0xc99f(%rip), %rax      # 0x19270
jmp 0xcf84
movq %rbp, 0x28(%rsp)
movq %r14, 0x10(%rsp)
leaq 0x90(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15595
cmpb $0x0, (%r12)
je 0xcf74
movq %r13, %r14
movl %r15d, %ebp
xorl %r15d, %r15d
movl $0x1, %r13d
leaq 0x90(%rsp), %r12
movdqu 0x97(%rsp), %xmm0
pcmpeqb 0xb7aa(%rip), %xmm0     # 0x180d0
movdqa 0x90(%rsp), %xmm1
pcmpeqb 0xb7a9(%rip), %xmm1     # 0x180e0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
cmovel %r13d, %r15d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15595
cmpb $0x0, 0x90(%rsp)
jne 0xc915
testl %r15d, %r15d
je 0xcf74
movl %ebp, %r15d
movq %r14, %rbp
leaq 0x90(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15595
movl $0x592d, %eax           # imm = 0x592D
xorl (%r12), %eax
movzbl 0x2(%r12), %ecx
xorl $0x20, %ecx
orw %ax, %cx
jne 0xcf7d
leaq 0x93(%rsp), %rdi
leaq 0x80(%rsp), %r12
movq %rdi, (%r12)
movq %r12, %rsi
movl $0xa, %edx
callq 0x2230
movq %rax, %r13
movq (%r12), %rdi
addq $0x2, %rdi
movb -0x2(%rdi), %al
incq %rdi
cmpb $0x20, %al
je 0xc9c6
cmpb $0x2b, %al
jne 0xcf7d
cmpb $0x58, -0x2(%rdi)
jne 0xcf7d
cmpb $0x20, -0x1(%rdi)
jne 0xcf7d
movq %rdi, 0x80(%rsp)
xorl %esi, %esi
movl $0xa, %edx
callq 0x2230
movq %rax, %r14
movq 0x28(%rsp), %rcx
movl %r14d, (%rcx)
movq 0x10(%rsp), %rax
movl %r13d, (%rax)
testq %rbp, %rbp
je 0xca1f
movl $0x3, (%rbp)
testl %r15d, %r15d
movl $0x3, %ebp
cmovnel %r15d, %ebp
movl %r14d, %edi
movl %r13d, %esi
movl %ebp, %edx
callq 0x157b9
testl %eax, %eax
je 0xcfa3
movl %r14d, %edi
movl %r13d, %esi
movl %ebp, %edx
callq 0x15815
testq %rax, %rax
je 0xd035
movq %rax, %r15
movl %ebp, 0x1c(%rsp)
leal -0x8000(%r14), %eax
xorl %ebp, %ebp
cmpl $0xffff8008, %eax       # imm = 0xFFFF8008
movq %r14, 0x28(%rsp)
jb 0xd043
testl %r13d, %r13d
jle 0xcf8e
movq %r13, %rcx
leaq 0x38(%rbx), %r13
leaq 0x39(%rbx), %rax
movq %rax, 0x10(%rsp)
leal (,%r14,4), %eax
movq %rax, 0x70(%rsp)
movslq 0x1c(%rsp), %r12
movl %r14d, %edx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rcx, 0x48(%rsp)
andq %rax, %rcx
movq %rcx, 0x58(%rsp)
andq %rax, %r14
movq %r14, 0x50(%rsp)
imulq %r12, %rdx
shlq $0x2, %rdx
movq %rdx, 0x60(%rsp)
shlq $0x2, %r12
xorl %r14d, %r14d
movq %r15, 0x30(%rsp)
movq $0x0, 0x20(%rsp)
movq %r12, 0x78(%rsp)
movq 0xb8(%rbx), %rcx
movq 0xc0(%rbx), %rax
cmpq %rax, %rcx
jae 0xcb0b
leaq 0x1(%rcx), %rdx
movq %rdx, 0xb8(%rbx)
movb (%rcx), %sil
movq %rdx, %rcx
jmp 0xcb59
cmpl $0x0, 0x30(%rbx)
je 0xcb32
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r13, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xcb36
cltq
addq %r13, %rax
movb (%r13), %sil
movq 0x10(%rsp), %rcx
jmp 0xcb4b
xorl %esi, %esi
jmp 0xcb59
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %esi, %esi
movq 0x10(%rsp), %rcx
movq %rcx, %rax
movq %rax, 0xc0(%rbx)
movq %rcx, 0xb8(%rbx)
cmpq %rax, %rcx
jae 0xcb71
leaq 0x1(%rcx), %rdx
movq %rdx, 0xb8(%rbx)
movb (%rcx), %bpl
movq %rdx, %rcx
jmp 0xcbc7
cmpl $0x0, 0x30(%rbx)
je 0xcb9c
movl %esi, 0xc(%rsp)
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r13, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xcba0
cltq
addq %r13, %rax
movb (%r13), %bpl
movq 0x10(%rsp), %rcx
jmp 0xcbb5
xorl %ebp, %ebp
jmp 0xcbc7
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %ebp, %ebp
movq 0x10(%rsp), %rcx
movq %rcx, %rax
movq %rax, 0xc0(%rbx)
movq %rcx, 0xb8(%rbx)
movl 0xc(%rsp), %esi
cmpq %rax, %rcx
movq %r14, 0x68(%rsp)
jae 0xcbe4
leaq 0x1(%rcx), %rdx
movq %rdx, 0xb8(%rbx)
movb (%rcx), %r14b
movq %rdx, %rcx
jmp 0xcc3a
cmpl $0x0, 0x30(%rbx)
je 0xcc0e
movl %esi, %r12d
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r13, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xcc13
cltq
addq %r13, %rax
movb (%r13), %r14b
movq 0x10(%rsp), %rcx
jmp 0xcc29
xorl %r14d, %r14d
jmp 0xcc3a
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %r14d, %r14d
movq 0x10(%rsp), %rcx
movq %rcx, %rax
movl %r12d, %esi
movq %rax, 0xc0(%rbx)
movq %rcx, 0xb8(%rbx)
cmpb $0x2, %sil
jne 0xcfc7
cmpb $0x2, %bpl
jne 0xcfc7
testb %r14b, %r14b
js 0xcfc7
cmpq %rax, %rcx
jae 0xcc6b
leaq 0x1(%rcx), %rax
movq %rax, 0xb8(%rbx)
movb (%rcx), %al
jmp 0xccba
cmpl $0x0, 0x30(%rbx)
je 0xcc93
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r13, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xcc97
movslq %eax, %rcx
addq %r13, %rcx
movb (%r13), %al
movq 0x10(%rsp), %rdx
jmp 0xccac
xorl %eax, %eax
jmp 0xccba
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %eax, %eax
movq 0x10(%rsp), %rdx
movq %rdx, %rcx
movq %rcx, 0xc0(%rbx)
movq %rdx, 0xb8(%rbx)
movzbl %r14b, %ecx
shll $0x8, %ecx
movzbl %al, %eax
orl %ecx, %eax
movq 0x28(%rsp), %r14
cmpl %r14d, %eax
jne 0xd00f
movq 0x20(%rsp), %rax
testq %rax, %rax
jne 0xccf1
movq 0x70(%rsp), %rdi
callq 0x2200
testq %rax, %rax
je 0xd02d
movq %rax, 0x20(%rsp)
movq %rax, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
xorl %r12d, %r12d
movl %r14d, %ebp
movq 0xb8(%rbx), %rdx
movq 0xc0(%rbx), %rax
cmpq %rax, %rdx
jae 0xcd32
movl %r12d, 0xc(%rsp)
leaq 0x1(%rdx), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rdx), %r14b
jmp 0xcd86
cmpl $0x0, 0x30(%rbx)
je 0xcef2
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r13, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xcd5d
cltq
addq %r13, %rax
movb (%r13), %r14b
movq 0x10(%rsp), %rcx
jmp 0xcd73
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %r14d, %r14d
movq 0x10(%rsp), %rcx
movq %rcx, %rax
movl %r12d, 0xc(%rsp)
movq %rax, 0xc0(%rbx)
movq %rcx, 0xb8(%rbx)
movzbl %r14b, %r12d
cmpb $-0x7f, %r12b
jb 0xcdab
cmpq %rax, %rcx
jae 0xce5c
leaq 0x1(%rcx), %rax
movq %rax, 0xb8(%rbx)
movb (%rcx), %al
jmp 0xceab
cmpl %r12d, %ebp
jb 0xcfac
testl %r12d, %r12d
je 0xcee8
movslq 0xc(%rsp), %rax
movq 0x38(%rsp), %rcx
leaq (%rcx,%rax,4), %r14
movl %r12d, %r12d
xorl %ebp, %ebp
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jae 0xcdef
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
jmp 0xce3e
cmpl $0x0, 0x30(%rbx)
je 0xce17
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r13, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xce1b
movslq %eax, %rcx
addq %r13, %rcx
movb (%r13), %al
movq 0x10(%rsp), %rdx
jmp 0xce30
xorl %eax, %eax
jmp 0xce3e
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %eax, %eax
movq 0x10(%rsp), %rdx
movq %rdx, %rcx
movq %rcx, 0xc0(%rbx)
movq %rdx, 0xb8(%rbx)
movb %al, (%r14,%rbp,4)
incq %rbp
cmpl %ebp, %r12d
jne 0xcdd0
movl 0xc(%rsp), %r12d
addl %ebp, %r12d
movq 0x28(%rsp), %r14
jmp 0xcef2
cmpl $0x0, 0x30(%rbx)
je 0xce84
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r13, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xce88
movslq %eax, %rcx
addq %r13, %rcx
movb (%r13), %al
movq 0x10(%rsp), %rdx
jmp 0xce9d
xorl %eax, %eax
jmp 0xceab
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %eax, %eax
movq 0x10(%rsp), %rdx
movq %rdx, %rcx
movq %rcx, 0xc0(%rbx)
movq %rdx, 0xb8(%rbx)
andl $0x7f, %r12d
cmpl %r12d, %ebp
jb 0xcfac
andb $0x7f, %r14b
je 0xcee8
movslq 0xc(%rsp), %rcx
movq 0x38(%rsp), %rdx
leaq (%rdx,%rcx,4), %rcx
xorl %edx, %edx
movq 0x28(%rsp), %r14
movb %al, (%rcx,%rdx,4)
incq %rdx
cmpl %edx, %r12d
jne 0xced3
movl 0xc(%rsp), %r12d
addl %edx, %r12d
jmp 0xcef2
movq 0x28(%rsp), %r14
movl 0xc(%rsp), %r12d
movl %r14d, %ebp
subl %r12d, %ebp
jg 0xcd0a
movq 0x40(%rsp), %rcx
incq %rcx
incq 0x38(%rsp)
movq %rcx, 0x40(%rsp)
cmpq $0x4, %rcx
jne 0xcd04
movq 0x50(%rsp), %r14
movq 0x20(%rsp), %r12
movq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
movl 0x1c(%rsp), %edx
callq 0x15846
addq 0x78(%rsp), %rbp
addq $0x4, %r12
decq %r14
jne 0xcf29
movq 0x68(%rsp), %r14
incq %r14
movq 0x30(%rsp), %rax
addq 0x60(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq 0x58(%rsp), %r14
jne 0xcae5
movq 0x20(%rsp), %rdi
callq 0x21d0
jmp 0xcf8e
leaq 0xc314(%rip), %rax      # 0x1928f
jmp 0xcf84
leaq 0xc322(%rip), %rax      # 0x192a6
movq %rax, 0x1026d(%rip)     # 0x1d1f8
xorl %r15d, %r15d
movq %r15, %rax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbbf5(%rip), %rax      # 0x18b9f
jmp 0xcf84
movq %r15, %rdi
callq 0x21d0
movq 0x20(%rsp), %rdi
callq 0x21d0
leaq 0xc4b0(%rip), %rax      # 0x19475
jmp 0xcf84
leaq 0x88(%rsp), %r13
movb %sil, (%r13)
movb %bpl, 0x1(%r13)
movb %r14b, 0x2(%r13)
movq %rbx, %rdi
callq 0xfba6
movb %al, 0x3(%r13)
movq %r15, %rdi
movq %r13, %rsi
movl 0x1c(%rsp), %edx
callq 0x15846
movq 0x20(%rsp), %rdi
callq 0x21d0
xorl %ebp, %ebp
movl $0x1, %r12d
movq 0x48(%rsp), %r13
jmp 0xd057
movq %r15, %rdi
callq 0x21d0
movq 0x20(%rsp), %rdi
callq 0x21d0
leaq 0xc296(%rip), %rax      # 0x192be
jmp 0xcf84
movq %r15, %rdi
callq 0x21d0
leaq 0xbb6d(%rip), %rax      # 0x18ba9
jmp 0xcf84
incl %ebp
movl $0x0, %r12d
cmpl %r13d, %ebp
jge 0xcf8e
cmpl %r14d, %r12d
jge 0xd041
leaq 0x8c(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x126e2
movl 0x1c(%rsp), %edx
movl %edx, %eax
movq 0x28(%rsp), %r8
imull %r8d, %eax
imull %ebp, %eax
cltq
leaq (%r15,%rax,4), %rax
movl %r12d, %ecx
imull %edx, %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,4), %rdi
movq %r14, %rsi
movq %r8, %r14
callq 0x15846
incl %r12d
jmp 0xd052