// File: alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__pic_load(stbi__context*, int*, int*, int*, int, stbi__result_info*)
static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp, stbi__result_info *ri)
{
   stbi_uc *result;
   int i, x,y, internal_comp;
   STBI_NOTUSED(ri);

   if (!comp) comp = &internal_comp;

   for (i=0; i<92; ++i)
      stbi__get8(s);

   x = stbi__get16be(s);
   y = stbi__get16be(s);
   if (stbi__at_eof(s))  return stbi__errpuc("bad file","file too short (pic header)");
   if (!stbi__mad3sizes_valid(x, y, 4, 0)) return stbi__errpuc("too large", "PIC image too large to decode");

   stbi__get32be(s); //skip `ratio'
   stbi__get16be(s); //skip `fields'
   stbi__get16be(s); //skip `pad'

   // intermediate buffer is RGBA
   result = (stbi_uc *) stbi__malloc_mad3(x, y, 4, 0);
   memset(result, 0xff, x*y*4);

   if (!stbi__pic_load_core(s,x,y,comp, result)) {
      STBI_FREE(result);
      result=0;
   }
   *px = x;
   *py = y;
   if (req_comp == 0) req_comp = *comp;
   result=stbi__convert_format(result,4,req_comp,x,y);

   return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq %r9, -0x38(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x5d29f
leaq -0x50(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x44(%rbp)
cmpl $0x5c, -0x44(%rbp)
jge 0x5d2c0
movq -0x10(%rbp), %rdi
callq 0x65d00
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x5d2a6
movq -0x10(%rbp), %rdi
callq 0x65e40
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x65e40
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x653d0
cmpl $0x0, %eax
je 0x5d306
leaq 0x244a6(%rip), %rdi     # 0x81793
callq 0x56040
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, -0x8(%rbp)
jmp 0x5d3fc
movl -0x48(%rbp), %edi
movl -0x4c(%rbp), %esi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x662a0
cmpl $0x0, %eax
jne 0x5d33d
leaq 0x23dd4(%rip), %rdi     # 0x810f8
callq 0x56040
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, -0x8(%rbp)
jmp 0x5d3fc
movq -0x10(%rbp), %rdi
callq 0x6b410
movq -0x10(%rbp), %rdi
callq 0x65e40
movq -0x10(%rbp), %rdi
callq 0x65e40
movl -0x48(%rbp), %edi
movl -0x4c(%rbp), %esi
movl $0x4, %edx
xorl %ecx, %ecx
callq 0x664e0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movl -0x48(%rbp), %eax
imull -0x4c(%rbp), %eax
shll $0x2, %eax
movslq %eax, %rdx
movl $0xff, %esi
callq 0x7290
movq -0x10(%rbp), %rdi
movl -0x48(%rbp), %esi
movl -0x4c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %r8
callq 0x6ef30
cmpq $0x0, %rax
jne 0x5d3b7
movq -0x40(%rbp), %rdi
callq 0x75e0
movq $0x0, -0x40(%rbp)
movl -0x48(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x4c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x2c(%rbp)
jne 0x5d3d8
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x48(%rbp), %ecx
movl -0x4c(%rbp), %r8d
movl $0x4, %esi
callq 0x6a860
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)