// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x12e60
movq -0x10(%rbp), %rdi
callq 0x12e60
movzbl %al, %eax
movl %eax, -0x48(%rbp)
cmpl $0x1, -0x48(%rbp)
jle 0x1eaeb
movq -0x10(%rbp), %rdi
callq 0xbd40
movl $0x0, -0x4(%rbp)
jmp 0x1ecee
movq -0x10(%rbp), %rdi
callq 0x12e60
movzbl %al, %eax
movl %eax, -0x38(%rbp)
cmpl $0x1, -0x48(%rbp)
jne 0x1eb8b
cmpl $0x1, -0x38(%rbp)
je 0x1eb25
cmpl $0x9, -0x38(%rbp)
je 0x1eb25
movq -0x10(%rbp), %rdi
callq 0xbd40
movl $0x0, -0x4(%rbp)
jmp 0x1ecee
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x13350
movq -0x10(%rbp), %rdi
callq 0x12e60
movzbl %al, %eax
movl %eax, -0x44(%rbp)
cmpl $0x8, -0x44(%rbp)
je 0x1eb75
cmpl $0xf, -0x44(%rbp)
je 0x1eb75
cmpl $0x10, -0x44(%rbp)
je 0x1eb75
cmpl $0x18, -0x44(%rbp)
je 0x1eb75
cmpl $0x20, -0x44(%rbp)
je 0x1eb75
movq -0x10(%rbp), %rdi
callq 0xbd40
movl $0x0, -0x4(%rbp)
jmp 0x1ecee
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x13350
movl -0x44(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x1ebcd
cmpl $0x2, -0x38(%rbp)
je 0x1ebb8
cmpl $0x3, -0x38(%rbp)
je 0x1ebb8
cmpl $0xa, -0x38(%rbp)
je 0x1ebb8
cmpl $0xb, -0x38(%rbp)
je 0x1ebb8
movq -0x10(%rbp), %rdi
callq 0xbd40
movl $0x0, -0x4(%rbp)
jmp 0x1ecee
movq -0x10(%rbp), %rdi
movl $0x9, %esi
callq 0x13350
movl $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1a7d0
movl %eax, -0x2c(%rbp)
cmpl $0x1, -0x2c(%rbp)
jge 0x1ebf4
movq -0x10(%rbp), %rdi
callq 0xbd40
movl $0x0, -0x4(%rbp)
jmp 0x1ecee
movq -0x10(%rbp), %rdi
callq 0x1a7d0
movl %eax, -0x30(%rbp)
cmpl $0x1, -0x30(%rbp)
jge 0x1ec1b
movq -0x10(%rbp), %rdi
callq 0xbd40
movl $0x0, -0x4(%rbp)
jmp 0x1ecee
movq -0x10(%rbp), %rdi
callq 0x12e60
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x12e60
cmpl $0x0, -0x40(%rbp)
je 0x1ec6d
cmpl $0x8, -0x3c(%rbp)
je 0x1ec5a
cmpl $0x10, -0x3c(%rbp)
je 0x1ec5a
movq -0x10(%rbp), %rdi
callq 0xbd40
movl $0x0, -0x4(%rbp)
jmp 0x1ecee
movl -0x40(%rbp), %edi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x1cdd0
movl %eax, -0x34(%rbp)
jmp 0x1ec9f
movl -0x3c(%rbp), %eax
movl %eax, -0x50(%rbp)
movb $0x1, %al
cmpl $0x3, -0x38(%rbp)
movb %al, -0x49(%rbp)
je 0x1ec88
cmpl $0xb, -0x38(%rbp)
sete %al
movb %al, -0x49(%rbp)
movl -0x50(%rbp), %edi
movb -0x49(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x1cdd0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x1ecb7
movq -0x10(%rbp), %rdi
callq 0xbd40
movl $0x0, -0x4(%rbp)
jmp 0x1ecee
cmpq $0x0, -0x18(%rbp)
je 0x1ecc7
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x1ecd7
movl -0x30(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x1ece7
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)