// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/razf.c
// Function: razf_write
int razf_write(RAZF* rz, const void *data, int size){
	int ori_size, n;
	int64_t next_block;
	ori_size = size;
	next_block = ((rz->in / RZ_BLOCK_SIZE) + 1) * RZ_BLOCK_SIZE;
	while(rz->in + rz->buf_len + size >= next_block){
		n = next_block - rz->in - rz->buf_len;
		_razf_buffered_write(rz, data, n);
		data += n;
		size -= n;
		razf_flush(rz);
		add_zindex(rz, rz->in, rz->out);
		next_block = ((rz->in / RZ_BLOCK_SIZE) + 1) * RZ_BLOCK_SIZE;
	}
	_razf_buffered_write(rz, data, size);
	return ori_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x20(%rdi), %rcx
leaq 0x7fff(%rcx), %r12
testq %rcx, %rcx
cmovnsq %rcx, %r12
movq %rsi, %r15
andq $-0x8000, %r12          # imm = 0x8000
addq $0x8000, %r12           # imm = 0x8000
movslq 0x84(%rdi), %rax
addq %rcx, %rax
movslq %edx, %rcx
addq %rax, %rcx
cmpq %r12, %rcx
movl %edx, 0x4(%rsp)
jge 0x21b7d
movl %edx, %ebp
jmp 0x21d26
movl $0x1000, %r13d          # imm = 0x1000
movl %edx, %ebp
subq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x21d46
movl 0x84(%r14), %edx
testl %edx, %edx
je 0x21bb8
movq 0x60(%r14), %rsi
movq %r14, %rdi
callq 0x22bd4
movq $0x0, 0x80(%r14)
movq 0x10(%r14), %rdi
movl 0x20(%rdi), %eax
testl %eax, %eax
je 0x21bed
movl 0x8(%r14), %edi
movq 0x68(%r14), %rsi
movl $0x1000, %ebx           # imm = 0x1000
movl $0x1000, %edx           # imm = 0x1000
subl %eax, %edx
callq 0x3640
movq 0x10(%r14), %rdi
movl %ebx, 0x20(%rdi)
movq 0x68(%r14), %rax
movq %rax, 0x18(%rdi)
jmp 0x21bef
xorl %ebx, %ebx
movl $0x3, %esi
callq 0x3180
movq 0x10(%r14), %rax
movl 0x20(%rax), %eax
subl %eax, %ebx
addq 0x28(%r14), %rbx
movq %rbx, 0x28(%r14)
testl %eax, %eax
jne 0x21c48
movl 0x8(%r14), %edi
movq 0x68(%r14), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x3640
movq 0x10(%r14), %rdi
movl %r13d, 0x20(%rdi)
movq 0x68(%r14), %rax
movq %rax, 0x18(%rdi)
movl $0x3, %esi
callq 0x3180
movq 0x10(%r14), %rax
movl 0x20(%rax), %eax
movl $0x1000, %ebx           # imm = 0x1000
jmp 0x21c00
movq %rbx, 0x48(%r14)
movq $0x0, 0x50(%r14)
movq 0x18(%r14), %rcx
movl 0x10(%rcx), %edx
cmpl 0x14(%rcx), %edx
jne 0x21cb7
cvtsi2sd %edx, %xmm0
mulsd 0x5394(%rip), %xmm0     # 0x27000
addsd 0x5394(%rip), %xmm0     # 0x27008
cvttsd2si %xmm0, %eax
movl %eax, 0x14(%rcx)
movq (%rcx), %rdi
movslq %eax, %rsi
shlq $0x2, %rsi
callq 0x3610
movq 0x18(%r14), %rcx
movq %rax, (%rcx)
movq 0x8(%rcx), %rdi
movslq 0x14(%rcx), %rax
shrq $0x11, %rax
leaq 0x8(,%rax,8), %rsi
callq 0x3610
movq 0x18(%r14), %rcx
movq %rax, 0x8(%rcx)
movl 0x10(%rcx), %edx
jmp 0x21cbb
movq 0x8(%rcx), %rax
movslq %edx, %rdx
testl $0x1ffff, %edx          # imm = 0x1FFFF
jne 0x21cd1
movq %rdx, %rsi
shrq $0xe, %rsi
movq %rbx, (%rax,%rsi)
movslq %r12d, %rsi
addq %rsi, %r15
subl %r12d, %ebp
movq %rdx, %rsi
shrq $0x11, %rsi
subl (%rax,%rsi,8), %ebx
movq (%rcx), %rax
movl %ebx, (%rax,%rdx,4)
incl 0x10(%rcx)
movq 0x20(%r14), %rcx
leaq 0x7fff(%rcx), %r12
testq %rcx, %rcx
cmovnsq %rcx, %r12
andq $-0x8000, %r12          # imm = 0x8000
addq $0x8000, %r12           # imm = 0x8000
movslq 0x84(%r14), %rax
addq %rcx, %rax
movslq %ebp, %rcx
addq %rax, %rcx
cmpq %r12, %rcx
jge 0x21b85
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x21d46
movl 0x4(%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq