// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/expat-2.0.1/lib/xmlparse.c
// Function: appendAttributeValue
static enum XML_Error
appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
                     const char *ptr, const char *end,
                     STRING_POOL *pool)
{
  DTD * const dtd = _dtd;  /* save one level of indirection */
  for (;;) {
    const char *next;
    int tok = XmlAttributeValueTok(enc, ptr, end, &next);
    switch (tok) {
    case XML_TOK_NONE:
      return XML_ERROR_NONE;
    case XML_TOK_INVALID:
      if (enc == encoding)
        eventPtr = next;
      return XML_ERROR_INVALID_TOKEN;
    case XML_TOK_PARTIAL:
      if (enc == encoding)
        eventPtr = ptr;
      return XML_ERROR_INVALID_TOKEN;
    case XML_TOK_CHAR_REF:
      {
        XML_Char buf[XML_ENCODE_MAX];
        int i;
        int n = XmlCharRefNumber(enc, ptr);
        if (n < 0) {
          if (enc == encoding)
            eventPtr = ptr;
          return XML_ERROR_BAD_CHAR_REF;
        }
        if (!isCdata
            && n == 0x20 /* space */
            && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
          break;
        n = XmlEncode(n, (ICHAR *)buf);
        if (!n) {
          if (enc == encoding)
            eventPtr = ptr;
          return XML_ERROR_BAD_CHAR_REF;
        }
        for (i = 0; i < n; i++) {
          if (!poolAppendChar(pool, buf[i]))
            return XML_ERROR_NO_MEMORY;
        }
      }
      break;
    case XML_TOK_DATA_CHARS:
      if (!poolAppend(pool, enc, ptr, next))
        return XML_ERROR_NO_MEMORY;
      break;
    case XML_TOK_TRAILING_CR:
      next = ptr + enc->minBytesPerChar;
      /* fall through */
    case XML_TOK_ATTRIBUTE_VALUE_S:
    case XML_TOK_DATA_NEWLINE:
      if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
        break;
      if (!poolAppendChar(pool, 0x20))
        return XML_ERROR_NO_MEMORY;
      break;
    case XML_TOK_ENTITY_REF:
      {
        const XML_Char *name;
        ENTITY *entity;
        char checkEntityDecl;
        XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc,
                                              ptr + enc->minBytesPerChar,
                                              next - enc->minBytesPerChar);
        if (ch) {
          if (!poolAppendChar(pool, ch))
                return XML_ERROR_NO_MEMORY;
          break;
        }
        name = poolStoreString(&temp2Pool, enc,
                               ptr + enc->minBytesPerChar,
                               next - enc->minBytesPerChar);
        if (!name)
          return XML_ERROR_NO_MEMORY;
        entity = (ENTITY *)lookup(&dtd->generalEntities, name, 0);
        poolDiscard(&temp2Pool);
        /* First, determine if a check for an existing declaration is needed;
           if yes, check that the entity exists, and that it is internal.
        */
        if (pool == &dtd->pool)  /* are we called from prolog? */
          checkEntityDecl =
#ifdef XML_DTD
              prologState.documentEntity &&
#endif /* XML_DTD */
              (dtd->standalone
               ? !openInternalEntities
               : !dtd->hasParamEntityRefs);
        else /* if (pool == &tempPool): we are called from content */
          checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone;
        if (checkEntityDecl) {
          if (!entity)
            return XML_ERROR_UNDEFINED_ENTITY;
          else if (!entity->is_internal)
            return XML_ERROR_ENTITY_DECLARED_IN_PE;
        }
        else if (!entity) {
          /* Cannot report skipped entity here - see comments on
             skippedEntityHandler.
          if (skippedEntityHandler)
            skippedEntityHandler(handlerArg, name, 0);
          */
          /* Cannot call the default handler because this would be
             out of sync with the call to the startElementHandler.
          if ((pool == &tempPool) && defaultHandler)
            reportDefault(parser, enc, ptr, next);
          */
          break;
        }
        if (entity->open) {
          if (enc == encoding)
            eventPtr = ptr;
          return XML_ERROR_RECURSIVE_ENTITY_REF;
        }
        if (entity->notation) {
          if (enc == encoding)
            eventPtr = ptr;
          return XML_ERROR_BINARY_ENTITY_REF;
        }
        if (!entity->textPtr) {
          if (enc == encoding)
            eventPtr = ptr;
              return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
        }
        else {
          enum XML_Error result;
          const XML_Char *textEnd = entity->textPtr + entity->textLen;
          entity->open = XML_TRUE;
          result = appendAttributeValue(parser, internalEncoding, isCdata,
                                        (char *)entity->textPtr,
                                        (char *)textEnd, pool);
          entity->open = XML_FALSE;
          if (result)
            return result;
        }
      }
      break;
    default:
      if (enc == encoding)
        eventPtr = ptr;
      return XML_ERROR_UNEXPECTED_STATE;
    }
    ptr = next;
  }
  /* not reached */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r12
movq %r8, %r13
movq %rcx, %r14
movl %edx, 0xc(%rsp)
movq %rsi, %r15
movq 0x290(%rdi), %rax
movq %rdi, (%rsp)
leaq 0x330(%rdi), %rbp
movq %rax, 0x30(%rsp)
addq $0xa0, %rax
movq %rax, 0x28(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
leaq 0x10(%rsp), %rcx
callq *0x18(%r15)
leal 0x4(%rax), %ecx
cmpl $0xe, %ecx
ja 0x2526cc
leaq 0x17888a(%rip), %rdx    # 0x3caf3c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movslq 0x80(%r15), %rax
addq %rax, %r14
movq %r14, 0x10(%rsp)
jmp 0x2526d5
cmpl $0x27, %eax
jne 0x252963
movq 0x18(%r12), %rax
cmpb $0x0, 0xc(%rsp)
je 0x25270e
cmpq 0x10(%r12), %rax
jne 0x2526fd
movq %r12, %rdi
callq 0x24f7dc
testb %al, %al
je 0x25293c
movq 0x18(%r12), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%r12)
movb $0x20, (%rax)
jmp 0x252924
cmpq 0x20(%r12), %rax
je 0x252924
cmpb $0x20, -0x1(%rax)
jne 0x2526e1
jmp 0x252924
movq %r15, %rdi
movq %r14, %rsi
callq *0x50(%r15)
testl %eax, %eax
js 0x252943
cmpb $0x0, 0xc(%rsp)
setne %cl
cmpl $0x20, %eax
setne %dl
orb %cl, %dl
jne 0x252762
movq 0x18(%r12), %rcx
cmpq 0x20(%r12), %rcx
je 0x252924
cmpb $0x20, -0x1(%rcx)
je 0x252924
movl %eax, %edi
leaq 0x1c(%rsp), %rsi
callq 0x253cfc
testl %eax, %eax
je 0x252943
jle 0x252924
movl %eax, %ebx
xorl %r14d, %r14d
movq 0x18(%r12), %rax
cmpq 0x10(%r12), %rax
jne 0x2527a2
movq %r12, %rdi
callq 0x24f7dc
testb %al, %al
je 0x25293c
movq 0x18(%r12), %rax
movb 0x1c(%rsp,%r14), %cl
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%r12)
movb %cl, (%rax)
incq %r14
cmpq %r14, %rbx
jne 0x252781
jmp 0x252924
movslq 0x80(%r15), %rax
leaq (%r14,%rax), %rsi
movq 0x10(%rsp), %rdx
subq %rax, %rdx
movq %r15, %rdi
callq *0x58(%r15)
movl %eax, %ebx
testb %bl, %bl
je 0x252831
movq 0x18(%r12), %rax
cmpq 0x10(%r12), %rax
jne 0x252800
movq %r12, %rdi
callq 0x24f7dc
testb %al, %al
je 0x25293c
movq 0x18(%r12), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%r12)
movb %bl, (%rax)
jmp 0x252924
movq 0x10(%rsp), %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x24f67d
testq %rax, %rax
jne 0x252924
jmp 0x25293c
movslq 0x80(%r15), %rax
leaq (%r14,%rax), %rdx
movq 0x10(%rsp), %rcx
subq %rax, %rcx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x24f2f4
testq %rax, %rax
je 0x25293c
movq %rbp, 0x20(%rsp)
movq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x24f9cf
movq %rax, %rbx
movq (%rsp), %rcx
movq 0x350(%rcx), %rax
movq %rax, 0x348(%rcx)
cmpq %r12, 0x28(%rsp)
je 0x2528b6
cmpb $0x0, 0x101(%rbp)
je 0x25289d
cmpb $0x0, 0x102(%rbp)
je 0x2528c9
testq %rbx, %rbx
je 0x2529d0
cmpb $0x0, 0x3a(%rbx)
movq 0x20(%rsp), %rbp
jne 0x2528d3
jmp 0x2529d7
cmpb $0x0, 0x102(%rbp)
je 0x25292e
cmpq $0x0, 0x228(%rcx)
je 0x25289d
testq %rbx, %rbx
movq 0x20(%rsp), %rbp
je 0x252924
cmpb $0x0, 0x38(%rbx)
jne 0x252998
cmpq $0x0, 0x30(%rbx)
jne 0x25299f
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
je 0x2529a6
movslq 0x10(%rbx), %r8
addq %rcx, %r8
movb $0x1, 0x38(%rbx)
movq (%rsp), %rdi
movq 0x1b8(%rdi), %rsi
movzbl 0xc(%rsp), %edx
movq %r12, %r9
callq 0x252651
movb $0x0, 0x38(%rbx)
testl %eax, %eax
jne 0x2529ce
movq 0x10(%rsp), %r14
jmp 0x252691
cmpb $0x0, 0x101(%rbp)
jne 0x2528c9
jmp 0x25289d
movl $0x1, %eax
jmp 0x2529bf
movl $0xe, %eax
movq (%rsp), %rcx
cmpq %r15, 0x120(%rcx)
jne 0x2529bf
movq %r14, 0x210(%rcx)
movl $0xe, %eax
jmp 0x2529bf
movl $0x17, %eax
jmp 0x2529ab
movl $0x4, %eax
movq (%rsp), %rcx
cmpq %r15, 0x120(%rcx)
jne 0x2529bf
movq %rcx, %rdx
movq 0x10(%rsp), %rcx
movq %rcx, 0x210(%rdx)
jmp 0x2529bf
xorl %eax, %eax
jmp 0x2529bf
movl $0x4, %eax
jmp 0x2529ab
movl $0xc, %eax
jmp 0x2529ab
movl $0xf, %eax
jmp 0x2529ab
movl $0x10, %eax
movq (%rsp), %rcx
cmpq %r15, 0x120(%rcx)
jne 0x2529bf
movq %r14, 0x210(%rcx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2529bf
movl $0xb, %eax
jmp 0x2529bf
movl $0x18, %eax
jmp 0x2529bf