// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/expat-2.0.1/lib/xmlparse.c
// Function: internalEntityProcessor
static enum XML_Error PTRCALL
internalEntityProcessor(XML_Parser parser,
                        const char *s,
                        const char *end,
                        const char **nextPtr)
{
  ENTITY *entity;
  const char *textStart, *textEnd;
  const char *next;
  enum XML_Error result;
  OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities;
  if (!openEntity)
    return XML_ERROR_UNEXPECTED_STATE;

  entity = openEntity->entity;
  textStart = ((char *)entity->textPtr) + entity->processed;
  textEnd = (char *)(entity->textPtr + entity->textLen);

#ifdef XML_DTD
  if (entity->is_param) {
    int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
    result = doProlog(parser, internalEncoding, textStart, textEnd, tok, 
                      next, &next, XML_FALSE);
  }
  else
#endif /* XML_DTD */
    result = doContent(parser, openEntity->startTagLevel, internalEncoding, 
                       textStart, textEnd, &next, XML_FALSE);  

  if (result != XML_ERROR_NONE)
    return result;
  else if (textEnd != next && ps_parsing == XML_SUSPENDED) {
    entity->processed = (int)(next - (char *)entity->textPtr);
    return result;
  }
  else {
    entity->open = XML_FALSE;
    openInternalEntities = openEntity->next;
    /* put openEntity back in list of free instances */
    openEntity->next = freeInternalEntities;
    freeInternalEntities = openEntity;
  }

#ifdef XML_DTD
  if (entity->is_param) {
    int tok;
    processor = prologProcessor;
    tok = XmlPrologTok(encoding, s, end, &next);
    return doProlog(parser, encoding, s, end, tok, next, nextPtr, 
                    (XML_Bool)!ps_finalBuffer);
  }
  else
#endif /* XML_DTD */
  {
    processor = contentProcessor;
    /* see externalEntityContentProcessor vs contentProcessor */
    return doContent(parser, parentParser ? 1 : 0, encoding, s, end,
                     nextPtr, (XML_Bool)!ps_finalBuffer); 
  }  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x228(%rdi), %rbp
testq %rbp, %rbp
je 0x2521df
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rcx, 0x8(%rsp)
movq 0x18(%rbp), %rbx
movq 0x8(%rbx), %rax
movslq 0x14(%rbx), %rcx
addq %rax, %rcx
movslq 0x10(%rbx), %r13
addq %rax, %r13
movl 0x20(%rbp), %esi
movq 0x1b8(%rdi), %rdx
movl $0x0, (%rsp)
leaq 0x10(%rsp), %r9
movq %r13, %r8
callq 0x25001c
testl %eax, %eax
jne 0x252254
movq 0x10(%rsp), %rax
cmpq %rax, %r13
je 0x2521e6
cmpl $0x3, 0x378(%r12)
jne 0x2521e6
subl 0x8(%rbx), %eax
movl %eax, 0x14(%rbx)
xorl %eax, %eax
jmp 0x252254
movl $0x17, %eax
jmp 0x252254
movb $0x0, 0x38(%rbx)
movq 0x10(%rbp), %rax
movq %rax, 0x228(%r12)
movq 0x230(%r12), %rax
movq %rax, 0x10(%rbp)
movq %rbp, 0x230(%r12)
leaq -0x2e84(%rip), %rax     # 0x24f38d
movq %rax, 0x200(%r12)
xorl %esi, %esi
cmpq $0x0, 0x370(%r12)
setne %sil
movq 0x120(%r12), %rdx
xorl %eax, %eax
cmpb $0x0, 0x37c(%r12)
sete %al
movl %eax, (%rsp)
movq %r12, %rdi
movq %r15, %rcx
movq %r14, %r8
movq 0x8(%rsp), %r9
callq 0x25001c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq