// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/samtools-0.1.18/razf.c
// Function: read_gz_header
static int _read_gz_header(unsigned char *data, int size, int *extra_off, int *extra_len){
	int method, flags, n, len;
	if(size < 2) return 0;
	if(data[0] != 0x1f || data[1] != 0x8b) return 0;
	if(size < 4) return 0;
	method = data[2];
	flags  = data[3];
	if(method != Z_DEFLATED || (flags & RESERVED)) return 0;
	n = 4 + 6; // Skip 6 bytes
	*extra_off = n + 2;
	*extra_len = 0;
	if(flags & EXTRA_FIELD){
		if(size < n + 2) return 0;
		len = ((int)data[n + 1] << 8) | data[n];
		n += 2;
		*extra_off = n;
		while(len){
			if(n >= size) return 0;
			n ++;
			len --;
		}
		*extra_len = n - (*extra_off);
	}
	if(flags & ORIG_NAME) while(n < size && data[n++]);
	if(flags & COMMENT) while(n < size && data[n++]);
	if(flags & HEAD_CRC){
		if(n + 2 > size) return 0;
		n += 2;
	}
	return n;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movl %esi, -0x14(%rsp)
movq %rdx, -0x20(%rsp)
movq %rcx, -0x28(%rsp)
cmpl $0x2, -0x14(%rsp)
jge 0x4fd827
movl $0x0, -0x4(%rsp)
jmp 0x4fda4a
movq -0x10(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1f, %eax
jne 0x4fd844
movq -0x10(%rsp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x8b, %eax
je 0x4fd851
movl $0x0, -0x4(%rsp)
jmp 0x4fda4a
cmpl $0x4, -0x14(%rsp)
jge 0x4fd865
movl $0x0, -0x4(%rsp)
jmp 0x4fda4a
movq -0x10(%rsp), %rax
movzbl 0x2(%rax), %eax
movl %eax, -0x2c(%rsp)
movq -0x10(%rsp), %rax
movzbl 0x3(%rax), %eax
movl %eax, -0x30(%rsp)
cmpl $0x8, -0x2c(%rsp)
jne 0x4fd894
movl -0x30(%rsp), %eax
andl $0xe0, %eax
cmpl $0x0, %eax
je 0x4fd8a1
movl $0x0, -0x4(%rsp)
jmp 0x4fda4a
movl $0xa, -0x34(%rsp)
movl -0x34(%rsp), %ecx
addl $0x2, %ecx
movq -0x20(%rsp), %rax
movl %ecx, (%rax)
movq -0x28(%rsp), %rax
movl $0x0, (%rax)
movl -0x30(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4fd976
movl -0x14(%rsp), %eax
movl -0x34(%rsp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jge 0x4fd8ee
movl $0x0, -0x4(%rsp)
jmp 0x4fda4a
movq -0x10(%rsp), %rax
movl -0x34(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
shll $0x8, %eax
movq -0x10(%rsp), %rcx
movslq -0x34(%rsp), %rdx
movzbl (%rcx,%rdx), %ecx
orl %ecx, %eax
movl %eax, -0x38(%rsp)
movl -0x34(%rsp), %eax
addl $0x2, %eax
movl %eax, -0x34(%rsp)
movl -0x34(%rsp), %ecx
movq -0x20(%rsp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x38(%rsp)
je 0x4fd964
movl -0x34(%rsp), %eax
cmpl -0x14(%rsp), %eax
jl 0x4fd94c
movl $0x0, -0x4(%rsp)
jmp 0x4fda4a
movl -0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rsp)
movl -0x38(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rsp)
jmp 0x4fd92e
movl -0x34(%rsp), %ecx
movq -0x20(%rsp), %rax
subl (%rax), %ecx
movq -0x28(%rsp), %rax
movl %ecx, (%rax)
movl -0x30(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x4fd9c5
jmp 0x4fd984
movl -0x34(%rsp), %ecx
xorl %eax, %eax
cmpl -0x14(%rsp), %ecx
movb %al, -0x39(%rsp)
jge 0x4fd9b7
movq -0x10(%rsp), %rax
movl -0x34(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x34(%rsp)
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x39(%rsp)
movb -0x39(%rsp), %al
testb $0x1, %al
jne 0x4fd9c1
jmp 0x4fd9c3
jmp 0x4fd984
jmp 0x4fd9c5
movl -0x30(%rsp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x4fda14
jmp 0x4fd9d3
movl -0x34(%rsp), %ecx
xorl %eax, %eax
cmpl -0x14(%rsp), %ecx
movb %al, -0x3a(%rsp)
jge 0x4fda06
movq -0x10(%rsp), %rax
movl -0x34(%rsp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x34(%rsp)
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x3a(%rsp)
movb -0x3a(%rsp), %al
testb $0x1, %al
jne 0x4fda10
jmp 0x4fda12
jmp 0x4fd9d3
jmp 0x4fda14
movl -0x30(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x4fda42
movl -0x34(%rsp), %eax
addl $0x2, %eax
cmpl -0x14(%rsp), %eax
jle 0x4fda37
movl $0x0, -0x4(%rsp)
jmp 0x4fda4a
movl -0x34(%rsp), %eax
addl $0x2, %eax
movl %eax, -0x34(%rsp)
movl -0x34(%rsp), %eax
movl %eax, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nop