// File: srajangarg[P]raytracer/src/core/stb_image.hpp
// Function: stbi__pic_info(stbi__context*, int*, int*, int*)
static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp)
{
   int act_comp=0,num_packets=0,chained;
   stbi__pic_packet packets[10];

   if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) {
      stbi__rewind(s);
      return 0;
   }

   stbi__skip(s, 88);

   *x = stbi__get16be(s);
   *y = stbi__get16be(s);
   if (stbi__at_eof(s)) {
      stbi__rewind( s);
      return 0;
   }
   if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) {
      stbi__rewind( s );
      return 0;
   }

   stbi__skip(s, 8);

   do {
      stbi__pic_packet *packet;

      if (num_packets==sizeof(packets)/sizeof(packets[0]))
         return 0;

      packet = &packets[num_packets++];
      chained = stbi__get8(s);
      packet->size    = stbi__get8(s);
      packet->type    = stbi__get8(s);
      packet->channel = stbi__get8(s);
      act_comp |= packet->channel;

      if (stbi__at_eof(s)) {
          stbi__rewind( s );
          return 0;
      }
      if (packet->size != 8) {
          stbi__rewind( s );
          return 0;
      }
   } while (chained);

   *comp = (act_comp & 0x10 ? 4 : 3);

   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1167d(%rip), %rsi     # 0x4858e
callq 0x349e0
cmpl $0x0, %eax
jne 0x36f30
movq -0x10(%rbp), %rdi
callq 0x2b420
movl $0x0, -0x4(%rbp)
jmp 0x370b5
movq -0x10(%rbp), %rdi
movl $0x58, %esi
callq 0x2d340
movq -0x10(%rbp), %rdi
callq 0x2cf90
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x2cf90
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
callq 0x2c540
cmpl $0x0, %eax
je 0x36f83
movq -0x10(%rbp), %rdi
callq 0x2b420
movl $0x0, -0x4(%rbp)
jmp 0x370b5
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x36fb5
movq -0x18(%rbp), %rcx
movl $0x10000000, %eax       # imm = 0x10000000
cltd
idivl (%rcx)
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x36fb5
movq -0x10(%rbp), %rdi
callq 0x2b420
movl $0x0, -0x4(%rbp)
jmp 0x370b5
movq -0x10(%rbp), %rdi
movl $0x8, %esi
callq 0x2d340
movslq -0x30(%rbp), %rax
cmpq $0xa, %rax
jne 0x36fd9
movl $0x0, -0x4(%rbp)
jmp 0x370b5
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movslq %eax, %rcx
leaq -0x60(%rbp), %rax
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2ce50
movzbl %al, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movq -0x68(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movq -0x68(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rdi
callq 0x2ce50
movb %al, %cl
movq -0x68(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x68(%rbp), %rax
movzbl 0x2(%rax), %eax
orl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c540
cmpl $0x0, %eax
je 0x37068
movq -0x10(%rbp), %rdi
callq 0x2b420
movl $0x0, -0x4(%rbp)
jmp 0x370b5
movq -0x68(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x8, %eax
je 0x37086
movq -0x10(%rbp), %rdi
callq 0x2b420
movl $0x0, -0x4(%rbp)
jmp 0x370b5
jmp 0x37088
cmpl $0x0, -0x34(%rbp)
jne 0x36fc3
movl -0x2c(%rbp), %edx
andl $0x10, %edx
movl $0x3, %ecx
movl $0x4, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nop