// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
leaq 0xaa80(%rip), %rsi      # 0x2d7b2
callq 0x21f4c
testl %eax, %eax
je 0x22de8
cmpq $0x0, 0x10(%r14)
je 0x22d75
movq 0xc0(%r14), %rcx
movl 0xb8(%r14), %edx
movl %ecx, %eax
subl %edx, %eax
cmpl $0x57, %eax
jg 0x22d75
movq %rcx, 0xb8(%r14)
movq 0x28(%r14), %rdi
movl $0x58, %esi
subl %eax, %esi
callq *0x18(%r14)
jmp 0x22d7d
addq $0x58, 0xb8(%r14)
movq %r14, %rdi
callq 0x1e01c
movl %eax, (%r12)
movq %r14, %rdi
callq 0x1e01c
movl %eax, (%r15)
cmpq $0x0, 0x10(%r14)
je 0x22dae
movq 0x28(%r14), %rdi
callq *0x20(%r14)
testl %eax, %eax
je 0x22dbe
cmpl $0x0, 0x30(%r14)
je 0x22de8
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jae 0x22de8
movl (%r12), %ecx
testl %ecx, %ecx
je 0x22e0b
xorl %ebp, %ebp
movl $0x10000000, %eax       # imm = 0x10000000
xorl %edx, %edx
idivl %ecx
cmpl (%r15), %eax
jge 0x22e0b
movups 0xc8(%r14), %xmm0
movups %xmm0, 0xb8(%r14)
jmp 0x22dfa
movups 0xc8(%r14), %xmm0
movups %xmm0, 0xb8(%r14)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x10(%r14)
movq %rbx, 0x10(%rsp)
je 0x22e46
movq 0xc0(%r14), %rcx
movl 0xb8(%r14), %edx
movl %ecx, %eax
subl %edx, %eax
cmpl $0x7, %eax
jg 0x22e46
movq %rcx, 0xb8(%r14)
movq 0x28(%r14), %rdi
movl $0x8, %esi
subl %eax, %esi
callq *0x18(%r14)
jmp 0x22e4e
addq $0x8, 0xb8(%r14)
leaq 0x38(%r14), %r15
leaq 0x39(%r14), %rax
movq %rax, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
xorl %ebx, %ebx
xorl %ebp, %ebp
cmpl $0xa, %ebx
je 0x230a0
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x22edb
cmpl $0x0, 0x30(%r14)
je 0x22eaf
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %r15, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x22eb4
movq %r15, 0xb8(%r14)
cltq
addq %r15, %rax
movq %rax, 0xc0(%r14)
jmp 0x22ed4
xorl %r13d, %r13d
jmp 0x22eea
movl $0x0, 0x30(%r14)
movq %r15, 0xb8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movzbl (%rax), %r13d
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x22f55
cmpl $0x0, 0x30(%r14)
je 0x22f29
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %r15, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x22f2e
movq %r15, 0xb8(%r14)
cltq
addq %r15, %rax
movq %rax, 0xc0(%r14)
jmp 0x22f4e
xorl %r12d, %r12d
jmp 0x22f67
movl $0x0, 0x30(%r14)
movq %r15, 0xb8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
cmpb $0x8, (%rax)
sete %r12b
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x22fcd
cmpl $0x0, 0x30(%r14)
je 0x22fd7
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %r15, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x22fa6
movq %r15, 0xb8(%r14)
cltq
addq %r15, %rax
movq %rax, 0xc0(%r14)
jmp 0x22fc6
movl $0x0, 0x30(%r14)
movq %r15, 0xb8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
incq %rax
movq %rax, 0xb8(%r14)
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jb 0x23041
cmpl $0x0, 0x30(%r14)
je 0x23016
movq 0x28(%r14), %rdi
movl 0x34(%r14), %edx
movq %r15, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x2301a
movq %r15, 0xb8(%r14)
cltq
addq %r15, %rax
movq %rax, 0xc0(%r14)
jmp 0x2303a
xorl %eax, %eax
jmp 0x2304f
movl $0x0, 0x30(%r14)
movq %r15, 0xb8(%r14)
movq 0x8(%rsp), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movzbl (%rax), %eax
incl %ebx
orl %eax, 0x4(%rsp)
cmpq $0x0, 0x10(%r14)
je 0x2306f
movq 0x28(%r14), %rdi
callq *0x20(%r14)
testl %eax, %eax
je 0x23089
cmpl $0x0, 0x30(%r14)
je 0x23090
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
jae 0x23090
xorb $0x1, %r12b
movb $0x1, %al
je 0x230a2
jmp 0x23090
movb $0x1, %al
testb %r12b, %r12b
jne 0x230a2
movups 0xc8(%r14), %xmm0
movups %xmm0, 0xb8(%r14)
xorl %eax, %eax
testb %al, %al
je 0x22dfa
testl %r13d, %r13d
jne 0x22e67
movl 0x4(%rsp), %eax
andl $0x10, %eax
cmpl $0x1, %eax
movl $0x4, %eax
sbbl $0x0, %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl $0x1, %ebp
jmp 0x22dfa