// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/samtools-0.1.18/razf.c
// Function: razf_read
int razf_read(RAZF *rz, void *data, int size){
	int ori_size, i;
	ori_size = size;
	while(size > 0){
		if(rz->buf_len){
			if(size < rz->buf_len){
				for(i=0;i<size;i++) ((char*)data)[i] = ((char*)rz->outbuf + rz->buf_off)[i];
				rz->buf_off += size;
				rz->buf_len -= size;
				data += size;
				rz->block_off += size;
				size = 0;
				break;
			} else {
				for(i=0;i<rz->buf_len;i++) ((char*)data)[i] = ((char*)rz->outbuf + rz->buf_off)[i];
				data += rz->buf_len;
				size -= rz->buf_len;
				rz->block_off += rz->buf_len;
				rz->buf_off = 0;
				rz->buf_len = 0;
				if(rz->buf_flush){
					rz->block_pos = rz->next_block_pos;
					rz->block_off = 0;
					rz->buf_flush = 0;
				}
			}
		} else if(rz->buf_flush){
			rz->block_pos = rz->next_block_pos;
			rz->block_off = 0;
			rz->buf_flush = 0;
		}
		if(rz->buf_flush) continue;
		rz->buf_len = _razf_read(rz, rz->outbuf, RZ_BUFFER_SIZE);
		if(rz->z_eof && rz->buf_len == 0) break;
	}
	rz->out += ori_size - size;
	return ori_size - size;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
movl 0x14(%rsp), %eax
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x14(%rsp)
jle 0x4fc79b
movq 0x20(%rsp), %rax
cmpl $0x0, 0x84(%rax)
je 0x4fc70b
movl 0x14(%rsp), %eax
movq 0x20(%rsp), %rcx
cmpl 0x84(%rcx), %eax
jge 0x4fc617
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x14(%rsp), %eax
jge 0x4fc5b8
movq 0x20(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x20(%rsp), %rcx
movslq 0x80(%rcx), %rcx
addq %rcx, %rax
movslq 0xc(%rsp), %rcx
movb (%rax,%rcx), %dl
movq 0x18(%rsp), %rax
movslq 0xc(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x4fc574
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %rax
addl 0x80(%rax), %ecx
movl %ecx, 0x80(%rax)
movl 0x14(%rsp), %edx
movq 0x20(%rsp), %rax
movl 0x84(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x84(%rax)
movl 0x14(%rsp), %ecx
movq 0x18(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movslq 0x14(%rsp), %rcx
movq 0x20(%rsp), %rax
addq 0x50(%rax), %rcx
movq %rcx, 0x50(%rax)
movl $0x0, 0x14(%rsp)
jmp 0x4fc79b
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x20(%rsp), %rcx
cmpl 0x84(%rcx), %eax
jge 0x4fc66a
movq 0x20(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x20(%rsp), %rcx
movslq 0x80(%rcx), %rcx
addq %rcx, %rax
movslq 0xc(%rsp), %rcx
movb (%rax,%rcx), %dl
movq 0x18(%rsp), %rax
movslq 0xc(%rsp), %rcx
movb %dl, (%rax,%rcx)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x4fc61f
movq 0x20(%rsp), %rax
movl 0x84(%rax), %ecx
movq 0x18(%rsp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movl 0x84(%rax), %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x14(%rsp)
movq 0x20(%rsp), %rax
movslq 0x84(%rax), %rcx
movq 0x20(%rsp), %rax
addq 0x50(%rax), %rcx
movq %rcx, 0x50(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x80(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x84(%rax)
movq 0x20(%rsp), %rax
cmpl $0x0, 0x40(%rax)
je 0x4fc707
movq 0x20(%rsp), %rax
movq 0x58(%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x48(%rax)
movq 0x20(%rsp), %rax
movq $0x0, 0x50(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x40(%rax)
jmp 0x4fc709
jmp 0x4fc743
movq 0x20(%rsp), %rax
cmpl $0x0, 0x40(%rax)
je 0x4fc741
movq 0x20(%rsp), %rax
movq 0x58(%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x48(%rax)
movq 0x20(%rsp), %rax
movq $0x0, 0x50(%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x40(%rax)
jmp 0x4fc743
movq 0x20(%rsp), %rax
cmpl $0x0, 0x40(%rax)
je 0x4fc753
jmp 0x4fc53a
movq 0x20(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x68(%rax), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x4fc7c0
movl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x84(%rax)
movq 0x20(%rsp), %rax
cmpl $0x0, 0x8c(%rax)
je 0x4fc796
movq 0x20(%rsp), %rax
cmpl $0x0, 0x84(%rax)
jne 0x4fc796
jmp 0x4fc79b
jmp 0x4fc53a
movl 0x10(%rsp), %eax
subl 0x14(%rsp), %eax
movslq %eax, %rcx
movq 0x20(%rsp), %rax
addq 0x28(%rax), %rcx
movq %rcx, 0x28(%rax)
movl 0x10(%rsp), %eax
subl 0x14(%rsp), %eax
addq $0x28, %rsp
retq