// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/expat-2.0.1/lib/xmlparse.c
// Function: poolGrow
static XML_Bool FASTCALL
poolGrow(STRING_POOL *pool)
{
  if (pool->freeBlocks) {
    if (pool->start == 0) {
      pool->blocks = pool->freeBlocks;
      pool->freeBlocks = pool->freeBlocks->next;
      pool->blocks->next = NULL;
      pool->start = pool->blocks->s;
      pool->end = pool->start + pool->blocks->size;
      pool->ptr = pool->start;
      return XML_TRUE;
    }
    if (pool->end - pool->start < pool->freeBlocks->size) {
      BLOCK *tem = pool->freeBlocks->next;
      pool->freeBlocks->next = pool->blocks;
      pool->blocks = pool->freeBlocks;
      pool->freeBlocks = tem;
      memcpy(pool->blocks->s, pool->start,
             (pool->end - pool->start) * sizeof(XML_Char));
      pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
      pool->start = pool->blocks->s;
      pool->end = pool->start + pool->blocks->size;
      return XML_TRUE;
    }
  }
  if (pool->blocks && pool->start == pool->blocks->s) {
    int blockSize = (int)(pool->end - pool->start)*2;
    pool->blocks = (BLOCK *)
      pool->mem->realloc_fcn(pool->blocks,
                             (offsetof(BLOCK, s)
                              + blockSize * sizeof(XML_Char)));
    if (pool->blocks == NULL)
      return XML_FALSE;
    pool->blocks->size = blockSize;
    pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
    pool->start = pool->blocks->s;
    pool->end = pool->start + blockSize;
  }
  else {
    BLOCK *tem;
    int blockSize = (int)(pool->end - pool->start);
    if (blockSize < INIT_BLOCK_SIZE)
      blockSize = INIT_BLOCK_SIZE;
    else
      blockSize *= 2;
    tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s)
                                        + blockSize * sizeof(XML_Char));
    if (!tem)
      return XML_FALSE;
    tem->size = blockSize;
    tem->next = pool->blocks;
    pool->blocks = tem;
    if (pool->ptr != pool->start)
      memcpy(tem->s, pool->start,
             (pool->ptr - pool->start) * sizeof(XML_Char));
    pool->ptr = tem->s + (pool->ptr - pool->start);
    pool->start = tem->s;
    pool->end = tem->s + blockSize;
  }
  return XML_TRUE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x24f851
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
je 0x24f937
movq 0x10(%rbx), %rdx
subq %rsi, %rdx
movslq 0x8(%rdi), %rax
cmpq %rax, %rdx
jge 0x24f851
movq (%rdi), %rax
movq (%rbx), %rcx
movq %rcx, (%rdi)
movq %rdi, (%rbx)
movq %rax, 0x8(%rbx)
addq $0xc, %rdi
callq 0x17660
movq (%rbx), %rax
movq 0x18(%rbx), %rcx
subq 0x20(%rbx), %rcx
leaq 0xc(%rax), %rdx
addq %rax, %rcx
addq $0xc, %rcx
movq %rcx, 0x18(%rbx)
movq %rdx, 0x20(%rbx)
movslq 0x8(%rax), %rcx
addq %rcx, %rax
addq $0xc, %rax
jmp 0x24f931
movq (%rbx), %rdi
movq 0x10(%rbx), %rax
testq %rdi, %rdi
setne %dl
movq 0x20(%rbx), %rcx
leaq 0xc(%rdi), %rsi
cmpq %rsi, %rcx
sete %sil
andb %dl, %sil
subl %ecx, %eax
cmpb $0x1, %sil
jne 0x24f8bc
addl %eax, %eax
movq 0x28(%rbx), %rcx
movslq %eax, %r14
leaq 0xc(%r14), %rsi
callq *0x8(%rcx)
movq %rax, (%rbx)
testq %rax, %rax
je 0x24f967
movl %r14d, 0x8(%rax)
leaq 0xc(%rax), %rcx
movq 0x18(%rbx), %rdx
subq 0x20(%rbx), %rdx
addq %rax, %rdx
addq $0xc, %rdx
movq %rdx, 0x18(%rbx)
movq %rcx, 0x20(%rbx)
addq %r14, %rax
addq $0xc, %rax
jmp 0x24f931
leal (%rax,%rax), %r15d
movl $0x400, %ecx            # imm = 0x400
cmpl %ecx, %eax
cmovll %ecx, %r15d
movq 0x28(%rbx), %rax
leaq 0xc(%r15), %rdi
callq *(%rax)
testq %rax, %rax
je 0x24f967
movq %rax, %r14
movl %r15d, 0x8(%rax)
movq (%rbx), %rax
movq %rax, (%r14)
movq %r14, (%rbx)
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rsi
movq %rax, %rdx
movq %rax, %rcx
subq %rsi, %rdx
je 0x24f912
leaq 0xc(%r14), %rdi
callq 0x17660
movq 0x18(%rbx), %rcx
movq 0x20(%rbx), %rax
leaq 0xc(%r14), %rdx
subq %rax, %rcx
leaq (%r14,%rcx), %rax
addq $0xc, %rax
movq %rax, 0x18(%rbx)
movq %rdx, 0x20(%rbx)
leaq (%r14,%r15), %rax
addq $0xc, %rax
movq %rax, 0x10(%rbx)
jmp 0x24f963
movq %rdi, (%rbx)
movq (%rdi), %rax
movq %rax, 0x8(%rbx)
movq $0x0, (%rdi)
leaq 0xc(%rdi), %rax
movq %rax, 0x20(%rbx)
movslq 0x8(%rdi), %rcx
addq %rdi, %rcx
addq $0xc, %rcx
movq %rcx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movb $0x1, %al
jmp 0x24f969
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq