// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0xb8(%rdi), %rax
cmpq 0xc0(%rdi), %rax
jb 0x15e21
cmpl $0x0, 0x30(%r14)
je 0x15e2b
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r13
movl 0x34(%r14), %edx
movq %r13, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x15dfb
movq %r13, 0xb8(%r14)
cltq
addq %r13, %rax
movq %rax, 0xc0(%r14)
jmp 0x15e1a
movl $0x0, 0x30(%r14)
movq %r13, 0xb8(%r14)
leaq 0x39(%r14), %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 0x15e98
cmpl $0x0, 0x30(%r14)
je 0x15e6e
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r13
movl 0x34(%r14), %edx
movq %r13, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x15e72
movq %r13, 0xb8(%r14)
cltq
addq %r13, %rax
movq %rax, 0xc0(%r14)
jmp 0x15e91
xorl %ebp, %ebp
jmp 0x15ea6
movl $0x0, 0x30(%r14)
movq %r13, 0xb8(%r14)
leaq 0x39(%r14), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %bpl
cmpb $0x2, %bpl
jb 0x15ecd
movups 0xc8(%r14), %xmm0
movups %xmm0, 0xb8(%r14)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
movq %rbx, 0x10(%rsp)
jb 0x15f3f
cmpl $0x0, 0x30(%r14)
je 0x15f15
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r13
movl 0x34(%r14), %edx
movq %r13, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x15f19
movq %r13, 0xb8(%r14)
cltq
addq %r13, %rax
movq %rax, 0xc0(%r14)
jmp 0x15f38
xorl %ebx, %ebx
jmp 0x15f4c
movl $0x0, 0x30(%r14)
movq %r13, 0xb8(%r14)
leaq 0x39(%r14), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %bl
movl %ebx, %eax
cmpb $0x1, %bpl
jne 0x15f94
andb $-0x9, %al
cmpb $0x1, %al
jne 0x15eac
cmpq $0x0, 0x10(%r14)
je 0x15fd9
movq 0xc0(%r14), %rcx
movl 0xb8(%r14), %edx
movl %ecx, %eax
subl %edx, %eax
cmpl $0x3, %eax
jg 0x15fd9
movq %rcx, 0xb8(%r14)
movq 0x28(%r14), %rdi
movl $0x4, %esi
subl %eax, %esi
callq *0x18(%r14)
jmp 0x15fe1
andb $-0xa, %al
cmpb $0x2, %al
jne 0x15eac
movq %r15, 0x18(%rsp)
cmpq $0x0, 0x10(%r14)
je 0x16029
movq 0xc0(%r14), %rcx
movl 0xb8(%r14), %edx
movl %ecx, %eax
subl %edx, %eax
cmpl $0x8, %eax
jg 0x16029
movq %rcx, 0xb8(%r14)
movq 0x28(%r14), %rdi
movl $0x9, %esi
subl %eax, %esi
callq *0x18(%r14)
jmp 0x16031
addq $0x4, 0xb8(%r14)
movq 0xb8(%r14), %rax
cmpq 0xc0(%r14), %rax
movq %r15, 0x18(%rsp)
jb 0x16064
cmpl $0x0, 0x30(%r14)
je 0x16039
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r13
movl 0x34(%r14), %edx
movq %r13, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x1603e
movq %r13, 0xb8(%r14)
cltq
addq %r13, %rax
movq %rax, 0xc0(%r14)
jmp 0x1605d
addq $0x9, 0xb8(%r14)
xorl %r15d, %r15d
jmp 0x160d2
xorl %r15d, %r15d
jmp 0x16072
movl $0x0, 0x30(%r14)
movq %r13, 0xb8(%r14)
leaq 0x39(%r14), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
movb (%rax), %r15b
cmpb $0x20, %r15b
ja 0x15eac
movzbl %r15b, %eax
movabsq $0x101018100, %rcx      # imm = 0x101018100
btq %rax, %rcx
jae 0x15eac
cmpq $0x0, 0x10(%r14)
je 0x160ca
movq 0xc0(%r14), %rcx
movl 0xb8(%r14), %edx
movl %ecx, %eax
subl %edx, %eax
cmpl $0x3, %eax
jg 0x160ca
movq %rcx, 0xb8(%r14)
movq 0x28(%r14), %rdi
movl $0x4, %esi
subl %eax, %esi
callq *0x18(%r14)
jmp 0x160d2
addq $0x4, 0xb8(%r14)
movq %r14, %rdi
callq 0x12ebf
testl %eax, %eax
je 0x15eac
movl %eax, %ebp
movq %r14, %rdi
callq 0x12ebf
testl %eax, %eax
je 0x15eac
movq 0xb8(%r14), %rdx
cmpq 0xc0(%r14), %rdx
movq %r12, 0x20(%rsp)
jb 0x1616f
cmpl $0x0, 0x30(%r14)
je 0x16140
movl %eax, 0xc(%rsp)
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r13
movl 0x34(%r14), %edx
movq %r13, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x16145
movq %r13, 0xb8(%r14)
cltq
addq %r13, %rax
movq %rax, 0xc0(%r14)
jmp 0x16164
xorl %r12d, %r12d
jmp 0x1617d
movl $0x0, 0x30(%r14)
movq %r13, 0xb8(%r14)
leaq 0x39(%r14), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movl 0xc(%rsp), %eax
movq 0xb8(%r14), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0xb8(%r14)
movb (%rdx), %r12b
movq 0xb8(%r14), %rcx
cmpq 0xc0(%r14), %rcx
jb 0x161ee
cmpl $0x0, 0x30(%r14)
je 0x161f8
movl %eax, 0xc(%rsp)
movq 0x28(%r14), %rdi
leaq 0x38(%r14), %r13
movl 0x34(%r14), %edx
movq %r13, %rsi
callq *0x10(%r14)
testl %eax, %eax
je 0x161c4
movq %r13, 0xb8(%r14)
cltq
addq %r13, %rax
movq %rax, 0xc0(%r14)
jmp 0x161e3
movl $0x0, 0x30(%r14)
movq %r13, 0xb8(%r14)
leaq 0x39(%r14), %rax
movq %rax, 0xc0(%r14)
movb $0x0, 0x38(%r14)
movl 0xc(%rsp), %eax
movq 0xb8(%r14), %rcx
incq %rcx
movq %rcx, 0xb8(%r14)
testb %r15b, %r15b
je 0x1624d
cmpb $0x8, %r12b
je 0x16210
movzbl %r12b, %ecx
cmpl $0x10, %ecx
jne 0x15eac
movzbl %r15b, %r8d
cmpl $0xf, %r8d
jle 0x16283
cmpl $0x20, %r8d
movq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rdi
je 0x162ce
cmpl $0x18, %r8d
je 0x162ce
cmpl $0x10, %r8d
movq 0x18(%rsp), %rsi
jne 0x162a3
movl $0x3, %ecx
jmp 0x162f3
movzbl %r12b, %r8d
cmpl $0xf, %r8d
jle 0x162a7
cmpl $0x20, %r8d
movq 0x18(%rsp), %rsi
je 0x162dd
cmpl $0x18, %r8d
je 0x162dd
cmpl $0x10, %r8d
movq 0x20(%rsp), %rdx
jne 0x162ec
andb $-0x9, %bl
xorl %ecx, %ecx
cmpb $0x3, %bl
sete %cl
xorl $0x3, %ecx
jmp 0x162ee
movl $0x1, %ecx
cmpl $0x8, %r8d
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
je 0x162f3
cmpl $0xf, %r8d
je 0x16243
xorl %ecx, %ecx
jmp 0x162f3
movl $0x1, %ecx
cmpl $0x8, %r8d
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
je 0x162f3
cmpl $0xf, %r8d
jne 0x162ec
movl $0x3, %ecx
jmp 0x162ee
shrb $0x3, %r15b
movzbl %r15b, %ecx
movq 0x18(%rsp), %rsi
jmp 0x162f3
shrb $0x3, %r12b
movzbl %r12b, %ecx
movq 0x20(%rsp), %rdx
jmp 0x162ee
xorl %ecx, %ecx
movq 0x10(%rsp), %rdi
testl %ecx, %ecx
je 0x15eac
testq %rdi, %rdi
je 0x16302
movl %ebp, (%rdi)
testq %rsi, %rsi
je 0x16309
movl %eax, (%rsi)
movl $0x1, %eax
testq %rdx, %rdx
je 0x15ebe
movl %ecx, (%rdx)
jmp 0x15ebe