// File: /workspace/github_c_makefile_star2_O1/lh3[P]bgt/atomic.c
// Function: bcf_atom_read
const bcf_atom_t *bcf_atom_read(bcf_atombuf_t *buf)
{
	if (buf->start == buf->a.n) {
		if (buf->no_vcf) return 0;
		buf->a.n = buf->start = 0;
		bcf_atomize(buf->h, buf->b, &buf->a);
		if (flt_read1(buf->in, buf->h, buf->b, buf->keep_flt) < 0)
			buf->no_vcf = 1;
	}
	assert(buf->start < buf->a.n);
	for (;;) {
		if (buf->no_vcf || buf->a.a[buf->start].rid < buf->b->rid || (buf->a.a[buf->start].rid == buf->b->rid && buf->a.a[buf->start].pos < buf->b->pos))
			return &buf->a.a[buf->start++];
		if (buf->start != 0) {
			bcf_atom_t *tmp;
			tmp = (bcf_atom_t*)malloc(buf->start * sizeof(bcf_atom_t));
			memcpy(tmp, buf->a.a, buf->start * sizeof(bcf_atom_t));
			memmove(buf->a.a, &buf->a.a[buf->start], (buf->a.n - buf->start) * sizeof(bcf_atom_t));
			buf->a.n -= buf->start;
			memcpy(buf->a.a + buf->a.n, tmp, buf->start * sizeof(bcf_atom_t));
			buf->start = 0;
			free(tmp);
		}
		bcf_atomize(buf->h, buf->b, &buf->a);
		if (flt_read1(buf->in, buf->h, buf->b, buf->keep_flt) < 0)
			buf->no_vcf = 1;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x20(%rdi), %eax
leaq 0x8(%rdi), %rcx
movq %rcx, (%rsp)
cmpl 0x8(%rdi), %eax
jne 0x1313e
xorl %eax, %eax
cmpw $0x0, 0x24(%rbx)
jne 0x1325b
movl %eax, 0x20(%rbx)
movl %eax, 0x8(%rbx)
movq 0x18(%rbx), %rsi
movq 0x28(%rbx), %rdi
movq (%rsp), %rdx
callq 0x1204e
movq (%rbx), %r15
movq 0x18(%rbx), %r12
movq 0x28(%rbx), %r13
movl 0x24(%rbx), %r14d
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xee67
movl %eax, %ebp
cmpl $0xffff, %r14d          # imm = 0xFFFF
ja 0x13134
testl %ebp, %ebp
js 0x13134
movq %r12, %rdi
callq 0x10f06
testl %eax, %eax
jne 0x1310b
testl %ebp, %ebp
jns 0x1313e
movw $0x1, 0x24(%rbx)
movl 0x20(%rbx), %eax
cmpl 0x8(%rbx), %eax
jge 0x1326a
cmpw $0x0, 0x24(%rbx)
jne 0x13249
movq 0x10(%rbx), %r15
movq 0x18(%rbx), %rax
movslq 0x20(%rbx), %r14
movq %r14, %rbp
shlq $0x6, %rbp
leaq (%r15,%rbp), %r13
movl (%rax), %ecx
cmpl %ecx, 0x20(%r15,%rbp)
jl 0x13249
jne 0x13188
movl 0x24(%r13), %ecx
cmpl 0x4(%rax), %ecx
jl 0x13249
testl %r14d, %r14d
je 0x131ed
movq %rbp, %rdi
callq 0x22e0
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x2280
movslq 0x8(%rbx), %rdx
subq %r14, %rdx
shlq $0x6, %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x2360
movslq 0x20(%rbx), %rdx
movslq 0x8(%rbx), %rdi
subq %rdx, %rdi
movl %edi, 0x8(%rbx)
shlq $0x6, %rdi
addq 0x10(%rbx), %rdi
shlq $0x6, %rdx
movq %r12, %rsi
callq 0x2280
movl $0x0, 0x20(%rbx)
movq %r12, %rdi
callq 0x2050
movq 0x18(%rbx), %rsi
movq 0x28(%rbx), %rdi
movq (%rsp), %rdx
callq 0x1204e
movq (%rbx), %r15
movq 0x18(%rbx), %r12
movq 0x28(%rbx), %r13
movl 0x24(%rbx), %r14d
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xee67
movl %eax, %ebp
cmpl $0xffff, %r14d          # imm = 0xFFFF
ja 0x13236
testl %ebp, %ebp
js 0x13236
movq %r12, %rdi
callq 0x10f06
testl %eax, %eax
jne 0x1320d
testl %ebp, %ebp
jns 0x1314a
movw $0x1, 0x24(%rbx)
jmp 0x1314a
movslq 0x20(%rbx), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x20(%rbx)
shlq $0x6, %rax
addq 0x10(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc28d(%rip), %rdi      # 0x1f4fe
leaq 0xc1fa(%rip), %rsi      # 0x1f472
leaq 0xc295(%rip), %rcx      # 0x1f514
movl $0xe5, %edx
callq 0x21b0