// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rcx, 0x18(%rsp)
movl %edx, 0x14(%rsp)
movq %rsi, %r15
movq 0x290(%rdi), %r12
movq %rdi, 0x8(%rsp)
leaq 0x330(%rdi), %rax
movq %rax, 0x40(%rsp)
leaq 0xa0(%r12), %rax
movq %rax, 0x38(%rsp)
movq %r12, %rbp
movq %r15, %rdi
movq 0x18(%rsp), %r12
movq %r12, %rsi
movq %r14, %rdx
leaq 0x20(%rsp), %rcx
callq *0x18(%r15)
movl $0x1, %r13d
leal 0x4(%rax), %ecx
cmpl $0xe, %ecx
ja 0x25ad33
leaq 0x17993f(%rip), %rdx    # 0x3d465c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movl $0x0, 0x4(%rsp)
jmp 0x25afd5
cmpl $0x27, %eax
je 0x25ae52
movl $0x17, 0x4(%rsp)
jmp 0x25aecf
movq %r15, %rdi
movq %r12, %rsi
callq *0x50(%r15)
testl %eax, %eax
js 0x25af1f
cmpb $0x0, 0x14(%rsp)
jne 0x25ad85
cmpl $0x20, %eax
jne 0x25ad85
movq 0x18(%rbx), %rcx
movl $0x4, %r13d
cmpq 0x20(%rbx), %rcx
je 0x25b017
cmpb $0x20, -0x1(%rcx)
je 0x25b017
movl %eax, %edi
leaq 0x2c(%rsp), %rsi
callq 0x25c4a8
testl %eax, %eax
je 0x25af1f
xorl %r13d, %r13d
testl %eax, %eax
jle 0x25b017
movq %r14, 0x30(%rsp)
movl %eax, %r12d
xorl %r14d, %r14d
movq 0x18(%rbx), %rax
cmpq 0x10(%rbx), %rax
jne 0x25adc9
movq %rbx, %rdi
callq 0x2578ac
testb %al, %al
je 0x25b004
movb 0x2c(%rsp,%r14), %al
movq 0x18(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%rbx)
movb %al, (%rcx)
incq %r14
cmpq %r14, %r12
jne 0x25adaf
jmp 0x25b012
movslq 0x80(%r15), %rax
leaq (%r12,%rax), %rsi
movq 0x20(%rsp), %rdx
subq %rax, %rdx
movq %r15, %rdi
callq *0x58(%r15)
movl %eax, %r13d
testb %r13b, %r13b
je 0x25af4f
movq 0x18(%rbx), %rax
cmpq 0x10(%rbx), %rax
jne 0x25ae29
movq %rbx, %rdi
callq 0x2578ac
testb %al, %al
je 0x25afda
movq 0x18(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%rbx)
movb %r13b, (%rax)
movl $0x4, %r13d
jmp 0x25b017
movslq 0x80(%r15), %rax
addq %r12, %rax
movq %rax, 0x20(%rsp)
cmpb $0x0, 0x14(%rsp)
je 0x25ae8a
movq 0x18(%rbx), %rax
cmpq 0x10(%rbx), %rax
jne 0x25ae73
movq %rbx, %rdi
callq 0x2578ac
testb %al, %al
je 0x25afc7
movq 0x18(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%rbx)
movb $0x20, (%rax)
movq %rbp, %r12
jmp 0x25b020
movq 0x18(%rbx), %rax
cmpq 0x20(%rbx), %rax
je 0x25ae82
cmpb $0x20, -0x1(%rax)
jne 0x25ae59
jmp 0x25ae82
movl $0x4, 0x4(%rsp)
movq 0x8(%rsp), %rcx
cmpq %r15, 0x120(%rcx)
jne 0x25afd5
movq 0x20(%rsp), %rax
movq %rax, 0x210(%rcx)
jmp 0x25afd5
movl $0x4, 0x4(%rsp)
movq 0x8(%rsp), %rax
cmpq %r15, 0x120(%rax)
jne 0x25afd5
movq %r12, 0x210(%rax)
jmp 0x25afd5
movq 0x20(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x257718
testq %rax, %rax
movq %rbp, %r12
jne 0x25b020
movl $0x1, %r13d
movl $0x1, 0x4(%rsp)
jmp 0x25b02d
movq 0x8(%rsp), %rax
cmpq %r15, 0x120(%rax)
movq %rbp, %r12
jne 0x25af3c
movq 0x18(%rsp), %rcx
movq %rcx, 0x210(%rax)
movl $0xe, 0x4(%rsp)
movl $0x1, %r13d
jmp 0x25b01a
movslq 0x80(%r15), %rax
leaq (%r12,%rax), %rdx
movq 0x20(%rsp), %rcx
subq %rax, %rcx
movq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x2573a3
movl $0x1, %r13d
testq %rax, %rax
je 0x25afe0
movq %rbp, %r12
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x257a9b
movq %rax, %rdx
movq 0x8(%rsp), %rcx
movq 0x350(%rcx), %rax
movq %rax, 0x348(%rcx)
cmpq %rbx, 0x38(%rsp)
je 0x25afea
cmpb $0x0, 0x101(%r12)
je 0x25b04b
cmpb $0x0, 0x102(%r12)
setne %al
jmp 0x25b047
movl $0x1, %r13d
movl $0x1, 0x4(%rsp)
movq %rbp, %r12
jmp 0x25b02d
movl $0x1, %r13d
movl $0x1, 0x4(%rsp)
jmp 0x25b017
cmpb $0x0, 0x102(%r12)
je 0x25b03b
movq 0x8(%rsp), %rax
cmpq $0x0, 0x228(%rax)
jmp 0x25b044
movl $0x1, %r13d
movl $0x1, 0x4(%rsp)
movq 0x30(%rsp), %r14
movq %rbp, %r12
testb $0x3, %r13b
jne 0x25b02d
xorl %r13d, %r13d
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
testl %r13d, %r13d
je 0x25acee
jmp 0x25b136
cmpb $0x0, 0x101(%r12)
sete %al
testb %al, %al
je 0x25b060
testq %rdx, %rdx
je 0x25b075
cmpb $0x0, 0x3a(%rdx)
jne 0x25b065
movl $0x18, 0x4(%rsp)
jmp 0x25b01a
testq %rdx, %rdx
je 0x25b0b1
cmpb $0x0, 0x38(%rdx)
je 0x25b07f
movl $0xc, 0x4(%rsp)
jmp 0x25b08e
movl $0xb, 0x4(%rsp)
jmp 0x25b01a
cmpq $0x0, 0x30(%rdx)
je 0x25b0bc
movl $0xf, 0x4(%rsp)
movq 0x8(%rsp), %rax
cmpq %r15, 0x120(%rax)
jne 0x25b01a
movq 0x18(%rsp), %rcx
movq %rcx, 0x210(%rax)
jmp 0x25b01a
movl $0x4, %r13d
jmp 0x25b01a
movq 0x8(%rdx), %rcx
testq %rcx, %rcx
je 0x25b10b
movslq 0x10(%rdx), %r8
addq %rcx, %r8
movb $0x1, 0x38(%rdx)
movq 0x8(%rsp), %rdi
movq 0x1b8(%rdi), %rsi
movq %rdx, %r12
movzbl 0x14(%rsp), %edx
movq %rbx, %r9
callq 0x25aca9
movb $0x0, 0x38(%r12)
xorl %r13d, %r13d
testl %eax, %eax
setne %r13b
movl 0x4(%rsp), %ecx
cmovnel %eax, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x25b017
movl $0x10, 0x4(%rsp)
movq 0x8(%rsp), %rax
cmpq %r15, 0x120(%rax)
jne 0x25b017
movq 0x18(%rsp), %rcx
movq %rcx, 0x210(%rax)
jmp 0x25b017
movl 0x4(%rsp), %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq