// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x93e1(%rip), %rsi      # 0x2c872
callq 0x223cc
testl %eax, %eax
je 0x237ac
cmpq $0x0, 0x10(%rbx)
je 0x234d3
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rdx
movl %edx, %ecx
subl %eax, %ecx
cmpl $0x57, %ecx
jg 0x234da
movq %rdx, 0xb8(%rbx)
movq 0x28(%rbx), %rdi
movl $0x58, %esi
subl %ecx, %esi
callq *0x18(%rbx)
jmp 0x234e5
movq 0xb8(%rbx), %rax
addq $0x58, %rax
movq %rax, 0xb8(%rbx)
movq %rbx, %rdi
callq 0x1e517
movl %eax, (%r12)
movq %rbx, %rdi
callq 0x1e517
movl %eax, (%r15)
cmpq $0x0, 0x10(%rbx)
je 0x23518
movq 0x28(%rbx), %rdi
callq *0x20(%rbx)
testl %eax, %eax
je 0x2352c
cmpl $0x0, 0x30(%rbx)
je 0x237ac
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jae 0x237ac
movl (%r12), %ecx
testl %ecx, %ecx
je 0x23557
xorl %esi, %esi
movl $0x10000000, %eax       # imm = 0x10000000
xorl %edx, %edx
idivl %ecx
cmpl (%r15), %eax
jge 0x23557
movups 0xc8(%rbx), %xmm0
movups %xmm0, 0xb8(%rbx)
jmp 0x237bc
cmpq $0x0, 0x10(%rbx)
movq %r14, 0x8(%rsp)
je 0x23591
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %rdx
movl %edx, %ecx
subl %eax, %ecx
cmpl $0x7, %ecx
jg 0x23598
movq %rdx, 0xb8(%rbx)
movq 0x28(%rbx), %rdi
movl $0x8, %esi
subl %ecx, %esi
callq *0x18(%rbx)
jmp 0x235a3
movq 0xb8(%rbx), %rax
addq $0x8, %rax
movq %rax, 0xb8(%rbx)
leaq 0x38(%rbx), %r15
leaq 0x39(%rbx), %r12
movl $0xb, %r14d
xorl %r13d, %r13d
movq %r15, 0x10(%rsp)
decl %r14d
je 0x237ba
movq 0xb8(%rbx), %rcx
movq 0xc0(%rbx), %rax
cmpq %rax, %rcx
jae 0x235eb
leaq 0x1(%rcx), %rdx
movq %rdx, 0xb8(%rbx)
movb (%rcx), %cl
movl %ecx, 0x4(%rsp)
movq %rdx, %rcx
jmp 0x23641
cmpl $0x0, 0x30(%rbx)
je 0x23610
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r15, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x2361a
cltq
addq %r15, %rax
movb (%r15), %cl
movl %ecx, 0x4(%rsp)
jmp 0x23630
movl $0x0, 0x4(%rsp)
jmp 0x23641
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
movl $0x0, 0x4(%rsp)
movq %r12, %rax
movq %rax, 0xc0(%rbx)
movq %r12, 0xb8(%rbx)
movq %r12, %rcx
cmpq %rax, %rcx
jae 0x23659
leaq 0x1(%rcx), %rdx
movq %rdx, 0xb8(%rbx)
movb (%rcx), %bpl
movq %rdx, %rcx
jmp 0x2369f
cmpl $0x0, 0x30(%rbx)
je 0x2367a
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r15, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x2367e
cltq
addq %r15, %rax
movb (%r15), %bpl
jmp 0x2368e
xorl %ebp, %ebp
jmp 0x2369f
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %ebp, %ebp
movq %r12, %rax
movq %rax, 0xc0(%rbx)
movq %r12, 0xb8(%rbx)
movq %r12, %rcx
cmpq %rax, %rcx
jae 0x236a9
incq %rcx
jmp 0x236df
cmpl $0x0, 0x30(%rbx)
je 0x236e6
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r15, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x236c7
cltq
addq %r15, %rax
jmp 0x236d5
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
movq %r12, %rax
movq %rax, 0xc0(%rbx)
movq %r12, %rcx
movq %rcx, 0xb8(%rbx)
cmpq %rax, %rcx
jae 0x236fe
leaq 0x1(%rcx), %rdx
movq %rdx, 0xb8(%rbx)
movb (%rcx), %r15b
movq %rdx, %rcx
jmp 0x23746
cmpl $0x0, 0x30(%rbx)
je 0x2371f
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r15, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x23724
cltq
addq %r15, %rax
movb (%r15), %r15b
jmp 0x23735
xorl %r15d, %r15d
jmp 0x23746
movl $0x0, 0x30(%rbx)
movb $0x0, 0x38(%rbx)
xorl %r15d, %r15d
movq %r12, %rax
movq %rax, 0xc0(%rbx)
movq %r12, 0xb8(%rbx)
movq %r12, %rcx
cmpq $0x0, 0x10(%rbx)
je 0x2376c
movq 0x28(%rbx), %rdi
callq *0x20(%rbx)
testl %eax, %eax
je 0x23771
cmpl $0x0, 0x30(%rbx)
je 0x237ac
movq 0xb8(%rbx), %rcx
movq 0xc0(%rbx), %rax
cmpq %rax, %rcx
jae 0x237ac
cmpb $0x8, %bpl
jne 0x237ac
movzbl %r15b, %eax
orl %eax, %r13d
cmpb $0x0, 0x4(%rsp)
movq 0x10(%rsp), %r15
jne 0x235b9
andl $0x10, %r13d
cmpl $0x1, %r13d
movl $0x4, %eax
sbbl $0x0, %eax
movq 0x8(%rsp), %rcx
movl %eax, (%rcx)
movl $0x1, %esi
jmp 0x237bc
movups 0xc8(%rbx), %xmm0
movups %xmm0, 0xb8(%rbx)
xorl %esi, %esi
movl %esi, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq