// File: /workspace/github_c_makefile_star2_O3/zhiyb[P]png2tlg/./stb_image.h
// Function: stbi__tga_info(stbi__context*, int*, int*, int*)
static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp)
{
    int tga_w, tga_h, tga_comp, tga_image_type, tga_bits_per_pixel, tga_colormap_bpp;
    int sz, tga_colormap_type;
    stbi__get8(s);                   // discard Offset
    tga_colormap_type = stbi__get8(s); // colormap type
    if( tga_colormap_type > 1 ) {
        stbi__rewind(s);
        return 0;      // only RGB or indexed allowed
    }
    tga_image_type = stbi__get8(s); // image type
    if ( tga_colormap_type == 1 ) { // colormapped (paletted) image
        if (tga_image_type != 1 && tga_image_type != 9) {
            stbi__rewind(s);
            return 0;
        }
        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) ) {
            stbi__rewind(s);
            return 0;
        }
        stbi__skip(s,4);       // skip image x and y origin
        tga_colormap_bpp = sz;
    } else { // "normal" image w/o colormap - only RGB or grey allowed, +/- RLE
        if ( (tga_image_type != 2) && (tga_image_type != 3) && (tga_image_type != 10) && (tga_image_type != 11) ) {
            stbi__rewind(s);
            return 0; // only RGB or grey allowed, +/- RLE
        }
        stbi__skip(s,9); // skip colormap specification and image x/y origin
        tga_colormap_bpp = 0;
    }
    tga_w = stbi__get16le(s);
    if( tga_w < 1 ) {
        stbi__rewind(s);
        return 0;   // test width
    }
    tga_h = stbi__get16le(s);
    if( tga_h < 1 ) {
        stbi__rewind(s);
        return 0;   // test height
    }
    tga_bits_per_pixel = stbi__get8(s); // bits per pixel
    stbi__get8(s); // ignore alpha bits
    if (tga_colormap_bpp != 0) {
        if((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16)) {
            // when using a colormap, tga_bits_per_pixel is the size of the indexes
            // I don't think anything but 8 or 16bit indexes makes sense
            stbi__rewind(s);
            return 0;
        }
        tga_comp = stbi__tga_get_comp(tga_colormap_bpp, 0, NULL);
    } else {
        tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3) || (tga_image_type == 11), NULL);
    }
    if(!tga_comp) {
      stbi__rewind(s);
      return 0;
    }
    if (x) *x = tga_w;
    if (y) *y = tga_h;
    if (comp) *comp = tga_comp;
    return 1;                   // seems to have passed everything
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, 0x20(%rsp)
movq %rdi, %r12
movq 0xb8(%rdi), %rax
movq 0xc0(%rdi), %r13
cmpq %r13, %rax
jae 0x16645
incq %rax
jmp 0x16690
cmpl $0x0, 0x30(%r12)
je 0x16698
movq 0x28(%r12), %rdi
leaq 0x38(%r12), %r13
movl 0x34(%r12), %edx
movq %r13, %rsi
callq *0x10(%r12)
testl %eax, %eax
je 0x1666f
cltq
addq %rax, %r13
jmp 0x16683
movl $0x0, 0x30(%r12)
leaq 0x39(%r12), %r13
movb $0x0, 0x38(%r12)
movq %r13, 0xc0(%r12)
leaq 0x39(%r12), %rax
movq %rax, 0xb8(%r12)
cmpq %r13, %rax
jae 0x166b1
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r12)
movb (%rax), %r14b
movq %rcx, %rax
jmp 0x16711
cmpl $0x0, 0x30(%r12)
je 0x166e0
movq 0x28(%r12), %rdi
leaq 0x38(%r12), %rbp
movl 0x34(%r12), %edx
movq %rbp, %rsi
callq *0x10(%r12)
testl %eax, %eax
je 0x166e5
movslq %eax, %r13
addq %rbp, %r13
movb (%rbp), %r14b
jmp 0x166fc
xorl %r14d, %r14d
jmp 0x1671b
movl $0x0, 0x30(%r12)
leaq 0x39(%r12), %r13
movb $0x0, 0x38(%r12)
xorl %r14d, %r14d
movq %r13, 0xc0(%r12)
leaq 0x39(%r12), %rax
movq %rax, 0xb8(%r12)
cmpb $0x2, %r14b
jae 0x16ab0
cmpq %r13, %rax
movq %rbx, 0x8(%rsp)
jae 0x16738
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r12)
movb (%rax), %bl
movq %rcx, %rax
jmp 0x16795
cmpl $0x0, 0x30(%r12)
je 0x16766
movq 0x28(%r12), %rdi
leaq 0x38(%r12), %rbp
movl 0x34(%r12), %edx
movq %rbp, %rsi
callq *0x10(%r12)
testl %eax, %eax
je 0x1676a
movslq %eax, %r13
addq %rbp, %r13
movb (%rbp), %bl
jmp 0x16780
xorl %ebx, %ebx
jmp 0x16795
movl $0x0, 0x30(%r12)
leaq 0x39(%r12), %r13
movb $0x0, 0x38(%r12)
xorl %ebx, %ebx
movq %r13, 0xc0(%r12)
leaq 0x39(%r12), %rax
movq %rax, 0xb8(%r12)
movl %ebx, %ecx
testb %r14b, %r14b
je 0x167e5
andb $-0x9, %cl
cmpb $0x1, %cl
jne 0x16ab0
cmpq $0x0, 0x10(%r12)
je 0x1681e
movl %r13d, %ecx
subl %eax, %ecx
cmpl $0x3, %ecx
jg 0x1681e
movq %r13, 0xb8(%r12)
movq 0x28(%r12), %rdi
movl $0x4, %esi
subl %ecx, %esi
callq *0x18(%r12)
movq 0xb8(%r12), %rax
movq 0xc0(%r12), %r13
jmp 0x1682a
andb $-0xa, %cl
cmpb $0x2, %cl
jne 0x16ab0
cmpq $0x0, 0x10(%r12)
je 0x16873
movl %r13d, %ecx
subl %eax, %ecx
cmpl $0x8, %ecx
jg 0x16873
movq %r13, 0xb8(%r12)
movq 0x28(%r12), %rdi
movl $0x9, %esi
subl %ecx, %esi
callq *0x18(%r12)
jmp 0x1687f
addq $0x4, %rax
movq %rax, 0xb8(%r12)
cmpq %r13, %rax
jae 0x16840
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r12)
movb (%rax), %r14b
jmp 0x168b3
cmpl $0x0, 0x30(%r12)
je 0x16ab0
movq 0x28(%r12), %rdi
leaq 0x38(%r12), %rbp
movl 0x34(%r12), %edx
movq %rbp, %rsi
callq *0x10(%r12)
testl %eax, %eax
je 0x16887
movslq %eax, %r13
addq %rbp, %r13
movb (%rbp), %r14b
jmp 0x1689e
addq $0x9, %rax
movq %rax, 0xb8(%r12)
xorl %r14d, %r14d
jmp 0x1690e
movl $0x0, 0x30(%r12)
leaq 0x39(%r12), %r13
movb $0x0, 0x38(%r12)
xorl %r14d, %r14d
movq %r13, 0xc0(%r12)
leaq 0x39(%r12), %rcx
movq %rcx, 0xb8(%r12)
cmpb $0x20, %r14b
ja 0x16ab0
movzbl %r14b, %eax
movabsq $0x101018100, %rdx      # imm = 0x101018100
btq %rax, %rdx
jae 0x16ab0
cmpq $0x0, 0x10(%r12)
je 0x16902
movl %r13d, %eax
subl %ecx, %eax
cmpl $0x3, %eax
jg 0x16902
movq %r13, 0xb8(%r12)
movq 0x28(%r12), %rdi
movl $0x4, %esi
subl %eax, %esi
callq *0x18(%r12)
jmp 0x1690e
addq $0x4, %rcx
movq %rcx, 0xb8(%r12)
movq %r12, %rdi
callq 0x136e6
testl %eax, %eax
je 0x16ab0
movl %eax, %ebp
movq %r12, %rdi
callq 0x136e6
testl %eax, %eax
je 0x16ab0
movq 0xb8(%r12), %rcx
movq 0xc0(%r12), %rsi
cmpq %rsi, %rcx
movq %r15, 0x18(%rsp)
jae 0x1695e
leaq 0x1(%rcx), %rdx
movq %rdx, 0xb8(%r12)
movb (%rcx), %r15b
movq %rdx, %rcx
jmp 0x169c6
cmpl $0x0, 0x30(%r12)
je 0x16991
movl %eax, 0x14(%rsp)
movq 0x28(%r12), %rdi
leaq 0x38(%r12), %r13
movl 0x34(%r12), %edx
movq %r13, %rsi
callq *0x10(%r12)
testl %eax, %eax
je 0x16996
movslq %eax, %rsi
addq %r13, %rsi
movb (%r13), %r15b
jmp 0x169ad
xorl %r15d, %r15d
jmp 0x169c6
movl $0x0, 0x30(%r12)
leaq 0x39(%r12), %rsi
movb $0x0, 0x38(%r12)
xorl %r15d, %r15d
movq %rsi, 0xc0(%r12)
leaq 0x39(%r12), %rcx
movq %rcx, 0xb8(%r12)
movl 0x14(%rsp), %eax
cmpq %rsi, %rcx
jae 0x169d0
incq %rcx
jmp 0x16a23
cmpl $0x0, 0x30(%r12)
je 0x16a2b
movl %eax, 0x14(%rsp)
movq 0x28(%r12), %rdi
leaq 0x38(%r12), %r13
movl 0x34(%r12), %edx
movq %r13, %rsi
callq *0x10(%r12)
testl %eax, %eax
je 0x169fe
cltq
addq %rax, %r13
jmp 0x16a12
movl $0x0, 0x30(%r12)
leaq 0x39(%r12), %r13
movb $0x0, 0x38(%r12)
movq %r13, 0xc0(%r12)
leaq 0x39(%r12), %rcx
movl 0x14(%rsp), %eax
movq %rcx, 0xb8(%r12)
testb %r14b, %r14b
je 0x16a63
cmpb $0x8, %r15b
je 0x16a3f
movzbl %r15b, %ecx
cmpl $0x10, %ecx
jne 0x16ab0
movzbl %r14b, %edi
cmpl $0xf, %edi
jle 0x16a90
cmpl $0x20, %edi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rsi
je 0x16ad3
cmpl $0x18, %edi
je 0x16ad3
cmpl $0x10, %edi
je 0x16aa9
jmp 0x16ab0
movzbl %r15b, %edi
cmpl $0xf, %edi
jle 0x16a90
cmpl $0x20, %edi
je 0x16add
cmpl $0x18, %edi
je 0x16add
cmpl $0x10, %edi
movq 0x18(%rsp), %rdx
jne 0x16ab0
andb $-0x9, %bl
xorl %ecx, %ecx
cmpb $0x3, %bl
sete %cl
xorl $0x3, %ecx
jmp 0x16aea
movl $0x1, %ecx
cmpl $0x8, %edi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rsi
je 0x16aef
cmpl $0xf, %edi
jne 0x16ab0
movl $0x3, %ecx
jmp 0x16aea
movups 0xc8(%r12), %xmm0
movups %xmm0, 0xb8(%r12)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
shrb $0x3, %r14b
movzbl %r14b, %ecx
jmp 0x16aef
shrb $0x3, %r15b
movzbl %r15b, %ecx
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x16afb
movl %ebp, (%rdi)
testq %rsi, %rsi
je 0x16b02
movl %eax, (%rsi)
movl $0x1, %eax
testq %rdx, %rdx
je 0x16ac4
movl %ecx, (%rdx)
jmp 0x16ac4