// File: /workspace/github_c_makefile_star2_O1/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, %rbp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x90(%rsp), %r12
movq %r12, %rsi
callq 0x15030
movabsq $0x4e41494441523f23, %rax # imm = 0x4E41494441523F23
xorq (%r12), %rax
movabsq $0x45434e41494441, %rcx # imm = 0x45434E41494441
xorq 0x3(%r12), %rcx
orq %rax, %rcx
je 0xb907
movl $0x47523f23, %eax       # imm = 0x47523F23
xorl 0x90(%rsp), %eax
movl $0x454247, %ecx         # imm = 0x454247
xorl 0x93(%rsp), %ecx
orl %eax, %ecx
je 0xb907
leaq 0xc8be(%rip), %rax      # 0x181c0
jmp 0xba2e
leaq 0x90(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15030
cmpb $0x0, (%r12)
je 0xba22
movq %r13, 0x8(%rsp)
movl %r15d, 0x38(%rsp)
xorl %r15d, %r15d
movl $0x1, %r13d
leaq 0x90(%rsp), %r12
movdqu 0x97(%rsp), %xmm0
pcmpeqb 0xb6ef(%rip), %xmm0     # 0x17040
movdqa 0x90(%rsp), %xmm1
pcmpeqb 0xb6ee(%rip), %xmm1     # 0x17050
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
cmovel %r13d, %r15d
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15030
cmpb $0x0, 0x90(%rsp)
jne 0xb940
movq %r12, 0x28(%rsp)
testl %r15d, %r15d
je 0xba27
movq %rbx, %rdi
movq %r12, %rsi
callq 0x15030
movl $0x592d, %eax           # imm = 0x592D
xorl 0x90(%rsp), %eax
movq %r12, 0x28(%rsp)
movzbl 0x92(%rsp), %ecx
xorl $0x20, %ecx
orw %ax, %cx
jne 0xba19
leaq 0x93(%rsp), %rdi
leaq 0x28(%rsp), %r12
movq %rdi, (%r12)
movq %r12, %rsi
movl $0xa, %edx
callq 0x2240
movq %rax, %r15
movq (%r12), %r12
decq %r12
cmpb $0x20, 0x1(%r12)
leaq 0x1(%r12), %r12
je 0xb9ea
movq %r12, 0x28(%rsp)
leaq 0xc80b(%rip), %rsi      # 0x1820e
movl $0x3, %edx
movq %r12, %rdi
callq 0x20d0
testl %eax, %eax
movq 0x8(%rsp), %r13
je 0xba4d
leaq 0xc7d6(%rip), %rax      # 0x181f6
jmp 0xba2e
movq %r12, 0x28(%rsp)
leaq 0xc7b1(%rip), %rax      # 0x181df
movq %rax, 0x107f3(%rip)     # 0x1c228
xorl %r15d, %r15d
movq %r15, %rax
addq $0x498, %rsp            # imm = 0x498
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x3, %r12
movq %r12, 0x28(%rsp)
movq %r12, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x2240
movq %rax, %r12
movl %r12d, (%r14)
movl %r15d, (%rbp)
testq %r13, %r13
je 0xba7c
movl $0x3, (%r13)
movl 0x38(%rsp), %eax
testl %eax, %eax
movl $0x3, %ebp
cmovnel %eax, %ebp
movl %r12d, %eax
orl %r15d, %eax
js 0xc073
testl %r15d, %r15d
je 0xbaae
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
divl %r15d
cmpl %r12d, %eax
jl 0xc073
movl %r12d, %ecx
imull %r15d, %ecx
movl %ecx, %eax
orl %ebp, %eax
js 0xc073
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
divl %ebp
cmpl %ecx, %eax
jl 0xc073
imull %ebp, %ecx
cmpl $0x20000000, %ecx       # imm = 0x20000000
jae 0xc073
movl %r12d, %edi
movq %r15, 0x38(%rsp)
movl %r15d, %esi
movl %ebp, %edx
callq 0x15254
testq %rax, %rax
je 0xc123
movq %rax, %r15
movl %ebp, 0x14(%rsp)
leal -0x8000(%r12), %eax
xorl %ebp, %ebp
cmpl $0xffff8008, %eax       # imm = 0xFFFF8008
jb 0xc131
movq 0x38(%rsp), %rcx
testl %ecx, %ecx
jle 0xc09d
movq %r12, %rdx
leaq 0x38(%rbx), %r12
leaq 0x39(%rbx), %rax
movq %rax, 0x20(%rsp)
leal (,%rdx,4), %eax
movq %rax, 0x78(%rsp)
movslq 0x14(%rsp), %rbp
movl %edx, %esi
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, %rcx
movq %rcx, 0x68(%rsp)
movq %rdx, 0x18(%rsp)
andq %rax, %rdx
movq %rdx, 0x60(%rsp)
imulq %rbp, %rsi
shlq $0x2, %rsi
movq %rsi, 0x70(%rsp)
shlq $0x2, %rbp
movq $0x0, 0x50(%rsp)
movq %r15, 0x40(%rsp)
xorl %r14d, %r14d
movq %rbp, 0x80(%rsp)
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0xbbef
cmpl $0x0, 0x30(%rbx)
je 0xbbc6
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r12, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xbbca
movq %r12, 0xb8(%rbx)
cltq
addq %r12, %rax
movq %rax, 0xc0(%rbx)
jmp 0xbbe8
xorl %edx, %edx
jmp 0xbbfc
movl $0x0, 0x30(%rbx)
movq %r12, 0xb8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %dl
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0xbc6d
cmpl $0x0, 0x30(%rbx)
je 0xbc3c
movl %edx, 0x8(%rsp)
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r12, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xbc44
movq %r12, 0xb8(%rbx)
cltq
addq %r12, %rax
movq %rax, 0xc0(%rbx)
jmp 0xbc62
movq %r14, %r13
xorl %r14d, %r14d
jmp 0xbc7e
movl $0x0, 0x30(%rbx)
movq %r12, 0xb8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movl 0x8(%rsp), %edx
movq 0xb8(%rbx), %rax
movq %r14, %r13
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %r14b
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0xbceb
cmpl $0x0, 0x30(%rbx)
je 0xbcbe
movl %edx, 0x8(%rsp)
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r12, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xbcc2
movq %r12, 0xb8(%rbx)
cltq
addq %r12, %rax
movq %rax, 0xc0(%rbx)
jmp 0xbce0
xorl %ebp, %ebp
jmp 0xbcf9
movl $0x0, 0x30(%rbx)
movq %r12, 0xb8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
movl 0x8(%rsp), %edx
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %bpl
cmpb $0x2, %dl
jne 0xc0b6
cmpb $0x2, %r14b
jne 0xc0b6
testb %bpl, %bpl
js 0xc0b6
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0xbd7a
cmpl $0x0, 0x30(%rbx)
je 0xbd51
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r12, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xbd55
movq %r12, 0xb8(%rbx)
cltq
addq %r12, %rax
movq %rax, 0xc0(%rbx)
jmp 0xbd73
xorl %eax, %eax
jmp 0xbd88
movl $0x0, 0x30(%rbx)
movq %r12, 0xb8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movzbl (%rax), %eax
movzbl %bpl, %ecx
shll $0x8, %ecx
orl %eax, %ecx
cmpl 0x18(%rsp), %ecx
jne 0xc0ff
testq %r13, %r13
jne 0xbdc5
cmpl $0x1fffffff, 0x18(%rsp) # imm = 0x1FFFFFFF
jle 0xbdaf
xorl %r13d, %r13d
jmp 0xbdbc
movq 0x78(%rsp), %rdi
callq 0x2210
movq %rax, %r13
testq %r13, %r13
je 0xc11b
movq %r13, 0x30(%rsp)
movq %r13, 0x48(%rsp)
movq $0x0, 0x58(%rsp)
cmpl $0x0, 0x18(%rsp)
jle 0xbfe5
xorl %ebp, %ebp
movq 0x18(%rsp), %rax
movl %eax, %r14d
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
movl %ebp, 0x8(%rsp)
jb 0xbe57
cmpl $0x0, 0x30(%rbx)
je 0xbe2d
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r12, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xbe32
movq %r12, 0xb8(%rbx)
cltq
addq %r12, %rax
movq %rax, 0xc0(%rbx)
jmp 0xbe50
xorl %r13d, %r13d
jmp 0xbe65
movl $0x0, 0x30(%rbx)
movq %r12, 0xb8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %r13b
movzbl %r13b, %ebp
cmpb $-0x7f, %bpl
jb 0xbeba
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0xbf8f
cmpl $0x0, 0x30(%rbx)
je 0xbf66
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r12, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xbf6a
movq %r12, 0xb8(%rbx)
cltq
addq %r12, %rax
movq %rax, 0xc0(%rbx)
jmp 0xbf88
cmpl %ebp, %r14d
jb 0xc07f
testl %ebp, %ebp
je 0xbfd0
movslq 0x8(%rsp), %rax
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax,4), %r14
movl %ebp, %r13d
xorl %ebp, %ebp
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0xbf43
cmpl $0x0, 0x30(%rbx)
je 0xbf1a
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r12, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0xbf1e
movq %r12, 0xb8(%rbx)
cltq
addq %r12, %rax
movq %rax, 0xc0(%rbx)
jmp 0xbf3c
xorl %eax, %eax
jmp 0xbf50
movl $0x0, 0x30(%rbx)
movq %r12, 0xb8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
movb %al, (%r14,%rbp,4)
incq %rbp
cmpl %ebp, %r13d
jne 0xbede
movl 0x8(%rsp), %eax
addl %ebp, %eax
movl %eax, %ebp
jmp 0xbfd4
xorl %eax, %eax
jmp 0xbf9c
movl $0x0, 0x30(%rbx)
movq %r12, 0xb8(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
andl $0x7f, %ebp
cmpl %ebp, %r14d
jb 0xc07f
andb $0x7f, %r13b
je 0xbfd0
movslq 0x8(%rsp), %rcx
movq 0x48(%rsp), %rdx
leaq (%rdx,%rcx,4), %rcx
xorl %edx, %edx
movb %al, (%rcx,%rdx,4)
incq %rdx
cmpl %edx, %ebp
jne 0xbfbe
movl 0x8(%rsp), %ebp
addl %edx, %ebp
jmp 0xbfd4
movl 0x8(%rsp), %ebp
movq 0x18(%rsp), %rax
movl %eax, %r14d
subl %ebp, %r14d
jg 0xbded
movq 0x58(%rsp), %rcx
incq %rcx
incq 0x48(%rsp)
movq %rcx, 0x58(%rsp)
cmpq $0x4, %rcx
jne 0xbdd8
movq %r12, 0x8(%rsp)
movq 0x60(%rsp), %r13
movq 0x30(%rsp), %rbp
movq 0x40(%rsp), %r14
cmpl $0x0, 0x18(%rsp)
movl 0x14(%rsp), %r12d
jle 0xc040
movq %r14, %rdi
movq %rbp, %rsi
movl %r12d, %edx
callq 0x152a4
addq 0x80(%rsp), %r14
addq $0x4, %rbp
decq %r13
jne 0xc021
movq 0x50(%rsp), %rcx
incq %rcx
movq 0x40(%rsp), %rax
addq 0x70(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %rcx, 0x50(%rsp)
cmpq 0x68(%rsp), %rcx
movq 0x30(%rsp), %r14
movq 0x8(%rsp), %r12
jne 0xbb8a
jmp 0xc0a0
leaq 0xba75(%rip), %rax      # 0x17aef
jmp 0xba2e
movq %r15, %rdi
callq 0x21e0
movq 0x30(%rsp), %rdi
callq 0x21e0
leaq 0xc331(%rip), %rax      # 0x183c9
jmp 0xba2e
xorl %r14d, %r14d
testq %r14, %r14
je 0xba38
movq %r14, %rdi
callq 0x21e0
jmp 0xba38
leaq 0x88(%rsp), %r12
movb %dl, (%r12)
movb %r14b, 0x1(%r12)
movb %bpl, 0x2(%r12)
movq %rbx, %rdi
callq 0xf413
movb %al, 0x3(%r12)
movq %r15, %rdi
movq %r12, %rsi
movl 0x14(%rsp), %edx
callq 0x152a4
movq %r13, %rdi
callq 0x21e0
xorl %ebp, %ebp
movl $0x1, %r13d
movq 0x18(%rsp), %r12
jmp 0xc146
movq %r15, %rdi
callq 0x21e0
movq %r13, %rdi
callq 0x21e0
leaq 0xc0fc(%rip), %rax      # 0x18212
jmp 0xba2e
movq %r15, %rdi
callq 0x21e0
leaq 0xb9cf(%rip), %rax      # 0x17af9
jmp 0xba2e
incl %ebp
movl $0x0, %r13d
cmpl 0x38(%rsp), %ebp
jge 0xba38
cmpl %r12d, %r13d
jge 0xc12f
leaq 0x8c(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x11f02
movl 0x14(%rsp), %edx
movl %edx, %eax
imull %r12d, %eax
imull %ebp, %eax
cltq
leaq (%r15,%rax,4), %rax
movl %r13d, %ecx
imull %edx, %ecx
movslq %ecx, %rcx
leaq (%rax,%rcx,4), %rdi
movq %r14, %rsi
callq 0x152a4
incl %r13d
jmp 0xc141