// File: /workspace/github_c_makefile_star2_O3/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 0x13501
xorl %eax, %eax
cmpw $0x0, 0x24(%rbx)
jne 0x13528
movl %eax, 0x20(%rbx)
movl %eax, 0x8(%rbx)
movq 0x18(%rbx), %rsi
movq 0x28(%rbx), %rdi
movq (%rsp), %rdx
callq 0x121da
movq (%rbx), %r15
movq 0x18(%rbx), %r12
movq 0x28(%rbx), %r13
movl 0x24(%rbx), %ebp
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xeedb
cmpl $0xffff, %ebp           # imm = 0xFFFF
ja 0x134f7
testl %eax, %eax
js 0x134f7
movq %r12, %rdi
callq 0x11099
testl %eax, %eax
jne 0x134cf
jmp 0x13501
testl %eax, %eax
jns 0x13501
movw $0x1, 0x24(%rbx)
movl 0x20(%rbx), %eax
cmpl 0x8(%rbx), %eax
jge 0x1363b
cmpw $0x0, 0x24(%rbx)
je 0x13608
leal 0x1(%rax), %ecx
movl %ecx, 0x20(%rbx)
cltq
shlq $0x6, %rax
addq 0x10(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jne 0x13542
movl 0x24(%r13), %ecx
cmpl 0x4(%rsi), %ecx
jl 0x13518
testl %eax, %eax
je 0x135aa
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 0x121da
movq (%rbx), %r15
movq 0x18(%rbx), %r12
movq 0x28(%rbx), %r13
movl 0x24(%rbx), %ebp
movq %r15, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xeedb
cmpl $0xffff, %ebp           # imm = 0xFFFF
ja 0x135f1
testl %eax, %eax
js 0x135f1
movq %r12, %rdi
callq 0x11099
testl %eax, %eax
jne 0x135c5
movzwl 0x24(%rbx), %ecx
jmp 0x13603
movl 0x24(%rbx), %ecx
testl %eax, %eax
jns 0x13603
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
incl %ecx
movl %ecx, 0x24(%rbx)
testw %cx, %cx
jne 0x13633
movq 0x10(%rbx), %r15
movq 0x18(%rbx), %rsi
movl 0x20(%rbx), %eax
movslq %eax, %r14
movq %r14, %rbp
shlq $0x6, %rbp
leaq (%r15,%rbp), %r13
movl (%rsi), %ecx
cmpl %ecx, 0x20(%r15,%rbp)
jge 0x13537
jmp 0x13518
movl 0x20(%rbx), %eax
jmp 0x13518
leaq 0xbec7(%rip), %rdi      # 0x1f509
leaq 0xbe34(%rip), %rsi      # 0x1f47d
leaq 0xbecf(%rip), %rcx      # 0x1f51f
movl $0xe5, %edx
callq 0x21b0