// File: alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__load_main(stbi__context*, int*, int*, int*, int, stbi__result_info*, int)
static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc)
{
   memset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields
   ri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed
   ri->channel_order = STBI_ORDER_RGB; // all current input & output are this, but this is here so we can add BGR order
   ri->num_channels = 0;

   #ifndef STBI_NO_JPEG
   if (stbi__jpeg_test(s)) return stbi__jpeg_load(s,x,y,comp,req_comp, ri);
   #endif
   #ifndef STBI_NO_PNG
   if (stbi__png_test(s))  return stbi__png_load(s,x,y,comp,req_comp, ri);
   #endif
   #ifndef STBI_NO_BMP
   if (stbi__bmp_test(s))  return stbi__bmp_load(s,x,y,comp,req_comp, ri);
   #endif
   #ifndef STBI_NO_GIF
   if (stbi__gif_test(s))  return stbi__gif_load(s,x,y,comp,req_comp, ri);
   #endif
   #ifndef STBI_NO_PSD
   if (stbi__psd_test(s))  return stbi__psd_load(s,x,y,comp,req_comp, ri, bpc);
   #endif
   #ifndef STBI_NO_PIC
   if (stbi__pic_test(s))  return stbi__pic_load(s,x,y,comp,req_comp, ri);
   #endif
   #ifndef STBI_NO_PNM
   if (stbi__pnm_test(s))  return stbi__pnm_load(s,x,y,comp,req_comp, ri);
   #endif

   #ifndef STBI_NO_HDR
   if (stbi__hdr_test(s)) {
      float *hdr = stbi__hdr_load(s, x,y,comp,req_comp, ri);
      return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
   }
   #endif

   #ifndef STBI_NO_TGA
   // test tga last because it's a crappy test!
   if (stbi__tga_test(s))
      return stbi__tga_load(s,x,y,comp,req_comp, ri);
   #endif

   return stbi__errpuc("unknown image type", "Image not of any known type, or corrupt");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq %r9, -0x38(%rbp)
movq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x7290
movq -0x38(%rbp), %rax
movl $0x8, (%rax)
movq -0x38(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x38(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x10(%rbp), %rdi
callq 0x5b810
cmpl $0x0, %eax
je 0x5b3b7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
callq 0x5b870
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
movq -0x10(%rbp), %rdi
callq 0x5b8f0
cmpl $0x0, %eax
je 0x5b3eb
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
callq 0x5b920
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
movq -0x10(%rbp), %rdi
callq 0x5b970
cmpl $0x0, %eax
je 0x5b41f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
callq 0x5b9a0
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
movq -0x10(%rbp), %rdi
callq 0x5c800
cmpl $0x0, %eax
je 0x5b453
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
callq 0x5c830
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
movq -0x10(%rbp), %rdi
callq 0x5c930
cmpl $0x0, %eax
je 0x5b48d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
movl 0x10(%rbp), %eax
movl %eax, (%rsp)
callq 0x5c970
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
movq -0x10(%rbp), %rdi
callq 0x5d240
cmpl $0x0, %eax
je 0x5b4c1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
callq 0x5d270
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
movq -0x10(%rbp), %rdi
callq 0x5d410
cmpl $0x0, %eax
je 0x5b4f5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
callq 0x5d480
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
movq -0x10(%rbp), %rdi
callq 0x56dc0
cmpl $0x0, %eax
je 0x5b56d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
callq 0x5d600
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x5b54c
movl -0x2c(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0x5b555
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %esi
movq -0x50(%rbp), %rdi
movl -0x54(%rbp), %ecx
callq 0x5de00
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
movq -0x10(%rbp), %rdi
callq 0x5e010
cmpl $0x0, %eax
je 0x5b59e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x38(%rbp), %r9
callq 0x5e160
movq %rax, -0x8(%rbp)
jmp 0x5b5b9
leaq 0x25a5d(%rip), %rdi     # 0x81002
callq 0x56040
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)