// File: /workspace/github_cpp_makefile_star2_O3/srajangarg[P]raytracer/src/core/stb_image.hpp
// Function: stbi__tga_test(stbi__context*)
static int stbi__tga_test(stbi__context *s)
{
   int res = 0;
   int sz, tga_color_type;
   stbi__get8(s);      //   discard Offset
   tga_color_type = stbi__get8(s);   //   color type
   if ( tga_color_type > 1 ) goto errorEnd;   //   only RGB or indexed allowed
   sz = stbi__get8(s);   //   image type
   if ( tga_color_type == 1 ) { // colormapped (paletted) image
      if (sz != 1 && sz != 9) goto errorEnd; // colortype 1 demands image type 1 or 9
      stbi__skip(s,4);       // skip index of first colormap entry and number of entries
      sz = stbi__get8(s);    //   check bits per palette color entry
      if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd;
      stbi__skip(s,4);       // skip image x and y origin
   } else { // "normal" image w/o colormap
      if ( (sz != 2) && (sz != 3) && (sz != 10) && (sz != 11) ) goto errorEnd; // only RGB or grey allowed, +/- RLE
      stbi__skip(s,9); // skip colormap specification and image x/y origin
   }
   if ( stbi__get16le(s) < 1 ) goto errorEnd;      //   test width
   if ( stbi__get16le(s) < 1 ) goto errorEnd;      //   test height
   sz = stbi__get8(s);   //   bits per pixel
   if ( (tga_color_type == 1) && (sz != 8) && (sz != 16) ) goto errorEnd; // for colormapped images, bpp is size of an index
   if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd;

   res = 1; // if we got this far, everything's good and we can return 1 instead of 0

errorEnd:
   stbi__rewind(s);
   return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0xb8(%rdi), %rax
movq 0xc0(%rdi), %r14
cmpq %r14, %rax
jae 0x1c337
incq %rax
jmp 0x1c373
cmpl $0x0, 0x30(%rbx)
je 0x1c37a
movq 0x28(%rbx), %rdi
leaq 0x38(%rbx), %r14
movl 0x34(%rbx), %edx
movq %r14, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x1c359
cltq
addq %rax, %r14
jmp 0x1c368
movl $0x0, 0x30(%rbx)
leaq 0x39(%rbx), %r14
movb $0x0, 0x38(%rbx)
movq %r14, 0xc0(%rbx)
leaq 0x39(%rbx), %rax
movq %rax, 0xb8(%rbx)
cmpq %r14, %rax
jae 0x1c392
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %r12b
movq %rcx, %rax
jmp 0x1c3e1
cmpl $0x0, 0x30(%rbx)
je 0x1c3b8
movq 0x28(%rbx), %rdi
leaq 0x38(%rbx), %r15
movl 0x34(%rbx), %edx
movq %r15, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x1c3bd
movslq %eax, %r14
addq %r15, %r14
movb (%r15), %r12b
jmp 0x1c3cf
xorl %r12d, %r12d
jmp 0x1c3eb
movl $0x0, 0x30(%rbx)
leaq 0x39(%rbx), %r14
movb $0x0, 0x38(%rbx)
xorl %r12d, %r12d
movq %r14, 0xc0(%rbx)
leaq 0x39(%rbx), %rax
movq %rax, 0xb8(%rbx)
cmpb $0x1, %r12b
ja 0x1c4c1
cmpq %r14, %rax
jae 0x1c402
leaq 0x1(%rax), %rdx
movq %rdx, 0xb8(%rbx)
movb (%rax), %cl
movq %rdx, %rax
jmp 0x1c448
cmpl $0x0, 0x30(%rbx)
je 0x1c428
movq 0x28(%rbx), %rdi
leaq 0x38(%rbx), %r15
movl 0x34(%rbx), %edx
movq %r15, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x1c42c
movslq %eax, %r14
addq %r15, %r14
movb (%r15), %cl
jmp 0x1c43d
xorl %ecx, %ecx
jmp 0x1c448
movl $0x0, 0x30(%rbx)
leaq 0x39(%rbx), %r14
movb $0x0, 0x38(%rbx)
xorl %ecx, %ecx
movq %r14, 0xc0(%rbx)
leaq 0x39(%rbx), %rax
testb %r12b, %r12b
je 0x1c48d
andb $-0x9, %cl
xorl %ebp, %ebp
cmpb $0x1, %cl
jne 0x1c4c3
cmpq $0x0, 0x10(%rbx)
je 0x1c4dc
movl %r14d, %ecx
subl %eax, %ecx
cmpl $0x3, %ecx
jg 0x1c4dc
movq %r14, 0xb8(%rbx)
movq 0x28(%rbx), %rdi
movl $0x4, %esi
subl %ecx, %esi
callq *0x18(%rbx)
movq 0xb8(%rbx), %rax
movq 0xc0(%rbx), %r14
jmp 0x1c4e7
andb $-0xa, %cl
cmpb $0x2, %cl
jne 0x1c4c1
cmpq $0x0, 0x10(%rbx)
je 0x1c521
movl %r14d, %ecx
subl %eax, %ecx
cmpl $0x8, %ecx
jg 0x1c521
movq %r14, 0xb8(%rbx)
movq 0x28(%rbx), %rdi
movl $0x9, %esi
subl %ecx, %esi
jmp 0x1c58c
xorl %ebp, %ebp
movups 0xc8(%rbx), %xmm0
movups %xmm0, 0xb8(%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
addq $0x4, %rax
movq %rax, 0xb8(%rbx)
cmpq %r14, %rax
jae 0x1c4fb
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
jmp 0x1c54a
cmpl $0x0, 0x30(%rbx)
je 0x1c4c3
movq 0x28(%rbx), %rdi
leaq 0x38(%rbx), %r15
movl 0x34(%rbx), %edx
movq %r15, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x1c52e
movslq %eax, %r14
addq %r15, %r14
movb (%r15), %al
jmp 0x1c53f
addq $0x9, %rax
movq %rax, 0xb8(%rbx)
jmp 0x1c59c
movl $0x0, 0x30(%rbx)
leaq 0x39(%rbx), %r14
movb $0x0, 0x38(%rbx)
xorl %eax, %eax
movq %r14, 0xc0(%rbx)
leaq 0x39(%rbx), %rcx
cmpb $0x20, %al
ja 0x1c4c3
movzbl %al, %eax
movabsq $0x101018100, %rdx      # imm = 0x101018100
btq %rax, %rdx
jae 0x1c4c3
cmpq $0x0, 0x10(%rbx)
je 0x1c591
movl %r14d, %eax
subl %ecx, %eax
cmpl $0x3, %eax
jg 0x1c591
movq %r14, 0xb8(%rbx)
movq 0x28(%rbx), %rdi
movl $0x4, %esi
subl %eax, %esi
callq *0x18(%rbx)
jmp 0x1c59c
addq $0x4, %rcx
movq %rcx, 0xb8(%rbx)
movq %rbx, %rdi
callq 0x158c8
xorl %ebp, %ebp
testl %eax, %eax
je 0x1c4c3
movq %rbx, %rdi
callq 0x158c8
testl %eax, %eax
je 0x1c4c3
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jae 0x1c5dd
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movb (%rax), %al
jmp 0x1c62a
cmpl $0x0, 0x30(%rbx)
je 0x1c603
movq 0x28(%rbx), %rdi
leaq 0x38(%rbx), %r14
movl 0x34(%rbx), %edx
movq %r14, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x1c607
movslq %eax, %rcx
addq %r14, %rcx
movb (%r14), %al
jmp 0x1c618
xorl %eax, %eax
jmp 0x1c62a
movl $0x0, 0x30(%rbx)
leaq 0x39(%rbx), %rcx
movb $0x0, 0x38(%rbx)
xorl %eax, %eax
movq %rcx, 0xc0(%rbx)
leaq 0x39(%rbx), %rcx
movq %rcx, 0xb8(%rbx)
testb %r12b, %r12b
je 0x1c63e
addb $-0x8, %al
xorl %ebp, %ebp
testb $-0x9, %al
sete %bpl
jmp 0x1c4c3
cmpb $0x20, %al
ja 0x1c4c3
movzbl %al, %eax
movabsq $0x101018100, %rcx      # imm = 0x101018100
btq %rax, %rcx
jae 0x1c4c3
movl $0x1, %ebp
jmp 0x1c4c3