// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/razf.c
// Function: razf_read
static int _razf_read(RAZF* rz, void *data, int size){
	int ret, tin;
	if(rz->z_eof || rz->z_err) return 0;
	if (rz->file_type == FILE_TYPE_PLAIN) {
#ifdef _USE_KNETFILE
		ret = knet_read(rz->x.fpr, data, size);
#else
		ret = read(rz->filedes, data, size);
#endif        
		if (ret == 0) rz->z_eof = 1;
		return ret;
	}
	rz->stream->avail_out = size;
	rz->stream->next_out  = data;
	while(rz->stream->avail_out){
		if(rz->stream->avail_in == 0){
			if(rz->in >= rz->end){ rz->z_eof = 1; break; }
			if(rz->end - rz->in < RZ_BUFFER_SIZE){
#ifdef _USE_KNETFILE
				rz->stream->avail_in = knet_read(rz->x.fpr, rz->inbuf, rz->end -rz->in);
#else
				rz->stream->avail_in = read(rz->filedes, rz->inbuf, rz->end -rz->in);
#endif        
			} else {
#ifdef _USE_KNETFILE
				rz->stream->avail_in = knet_read(rz->x.fpr, rz->inbuf, RZ_BUFFER_SIZE);
#else
				rz->stream->avail_in = read(rz->filedes, rz->inbuf, RZ_BUFFER_SIZE);
#endif        
			}
			if(rz->stream->avail_in == 0){
				rz->z_eof = 1;
				break;
			}
			rz->stream->next_in = rz->inbuf;
		}
		tin = rz->stream->avail_in;
		ret = inflate(rz->stream, Z_BLOCK);
		rz->in += tin - rz->stream->avail_in;
		if(ret == Z_NEED_DICT || ret == Z_MEM_ERROR || ret == Z_DATA_ERROR){
			fprintf(stderr, "[_razf_read] inflate error: %d %s (at %s:%d)\n", ret, rz->stream->msg ? rz->stream->msg : "", __FILE__, __LINE__);
			rz->z_err = 1;
			break;
		}
		if(ret == Z_STREAM_END){
			rz->z_eof = 1;
			break;
		}
		if ((rz->stream->data_type&128) && !(rz->stream->data_type&64)){
			rz->buf_flush = 1;
			rz->next_block_pos = rz->in;
			break;
		}
	}
	return size - rz->stream->avail_out;
}

// Assembly:
xorl %eax, %eax
cmpl $0x0, 0x8c(%rdi)
je 0x2255b
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x88(%rdi)
jne 0x22658
cmpl $0x2, 0x4(%rbx)
jne 0x2259f
movq 0x8(%rbx), %rdi
movl $0x1000, %edx           # imm = 0x1000
callq 0x1cabb
testl %eax, %eax
jne 0x22658
movl $0x1, 0x8c(%rbx)
xorl %eax, %eax
jmp 0x22658
movq 0x10(%rbx), %rdi
movl $0x1000, 0x20(%rdi)     # imm = 0x1000
movq %rsi, 0x18(%rdi)
movl $0x1000, %r15d          # imm = 0x1000
movl $0xc0, %ebp
cmpl $0x0, 0x20(%rdi)
je 0x22650
movl 0x8(%rdi), %r14d
testl %r14d, %r14d
jne 0x22601
movq 0x30(%rbx), %rdx
subq 0x20(%rbx), %rdx
jle 0x22646
movq 0x8(%rbx), %rdi
movq 0x60(%rbx), %rsi
cmpq %r15, %rdx
cmovgeq %r15, %rdx
callq 0x1cabb
movq %rax, %r14
movq 0x10(%rbx), %rdi
movl %r14d, 0x8(%rdi)
testl %r14d, %r14d
je 0x22646
movq 0x60(%rbx), %rax
movq %rax, (%rdi)
movl $0x5, %esi
callq 0x3270
movq 0x10(%rbx), %rdi
subl 0x8(%rdi), %r14d
addq 0x20(%rbx), %r14
movq %r14, 0x20(%rbx)
cmpl $0x1, %eax
je 0x22646
leal 0x4(%rax), %ecx
cmpl $0x2, %ecx
jb 0x22663
cmpl $0x2, %eax
je 0x22663
movl 0x58(%rdi), %eax
andl %ebp, %eax
cmpl $0x80, %eax
jne 0x225b9
movl $0x1, 0x40(%rbx)
movq %r14, 0x58(%rbx)
jmp 0x22650
movl $0x1, 0x8c(%rbx)
movl $0x1000, %eax           # imm = 0x1000
subl 0x20(%rdi), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xb97e(%rip), %rcx      # 0x2dfe8
movq (%rcx), %rdx
movq 0x30(%rdi), %rsi
testq %rsi, %rsi
leaq 0x33da(%rip), %rcx      # 0x25a55
cmovneq %rsi, %rcx
leaq 0x4a4a(%rip), %rsi      # 0x270d0
leaq 0x4a3c(%rip), %r8       # 0x270c9
movq %rdx, %rdi
movl %eax, %edx
movl $0x25d, %r9d            # imm = 0x25D
xorl %eax, %eax
callq 0x3630
movl $0x1, 0x88(%rbx)
movq 0x10(%rbx), %rdi
jmp 0x22650