// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %r8, %r13
movq %rcx, %r14
movq %rsi, %r15
movq 0x290(%rdi), %rax
movq %rdi, 0x10(%rsp)
leaq 0x330(%rdi), %rcx
movq %rcx, 0x38(%rsp)
movq %rax, 0x30(%rsp)
addq $0xa0, %rax
movq %rax, 0x28(%rsp)
leaq 0x8(%rsp), %rbp
movl %edx, 0x1c(%rsp)
movzbl %dl, %eax
movl %eax, 0x20(%rsp)
movq %r8, 0x40(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq *0x18(%r15)
leal 0x4(%rax), %ecx
cmpl $0xe, %ecx
ja 0x201d48
leaq 0x16961e(%rip), %rdx    # 0x36b34c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movslq 0x80(%r15), %rax
addq %rax, %r14
movq %r14, 0x8(%rsp)
jmp 0x201d51
cmpl $0x27, %eax
jne 0x201fee
movq 0x18(%r12), %rax
cmpb $0x0, 0x1c(%rsp)
je 0x201d8a
cmpq 0x10(%r12), %rax
jne 0x201d79
movq %r12, %rdi
callq 0x1ff0dd
testb %al, %al
je 0x201fd7
movq 0x18(%r12), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%r12)
movb $0x20, (%rax)
jmp 0x201fb8
cmpq 0x20(%r12), %rax
je 0x201fb8
cmpb $0x20, -0x1(%rax)
jne 0x201d5d
jmp 0x201fb8
movq 0x10(%rsp), %r13
movq %r15, %rdi
movq %r14, %rsi
callq *0x50(%r15)
pushq $0xe
popq %rbp
testl %eax, %eax
js 0x201fdc
cmpb $0x0, 0x1c(%rsp)
setne %cl
cmpl $0x20, %eax
setne %dl
orb %cl, %dl
jne 0x201e6b
movq 0x18(%r12), %rcx
cmpq 0x20(%r12), %rcx
je 0x201de6
cmpb $0x20, -0x1(%rcx)
jne 0x201e6b
movq 0x40(%rsp), %r13
leaq 0x8(%rsp), %rbp
jmp 0x201fb8
movslq 0x80(%r15), %rax
leaq (%r14,%rax), %rsi
movq 0x8(%rsp), %rdx
subq %rax, %rdx
movq %r15, %rdi
callq *0x58(%r15)
movl %eax, %ebx
testb %bl, %bl
je 0x201ecb
movq 0x18(%r12), %rax
cmpq 0x10(%r12), %rax
jne 0x201e3a
movq %r12, %rdi
callq 0x1ff0dd
testb %al, %al
je 0x201fd7
movq 0x18(%r12), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x18(%r12)
movb %bl, (%rax)
jmp 0x201fb8
movq 0x8(%rsp), %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1fef72
testq %rax, %rax
jne 0x201fb8
jmp 0x201fd7
movl %eax, %edi
leaq 0x24(%rsp), %rsi
callq 0x20321c
testl %eax, %eax
je 0x201fdc
movl %eax, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
xorl %r14d, %r14d
cmpq %r14, %rbx
je 0x201de6
movq 0x18(%r12), %rax
cmpq 0x10(%r12), %rax
jne 0x201eb6
movq %r12, %rdi
callq 0x1ff0dd
testb %al, %al
je 0x201fd0
movq 0x18(%r12), %rax
movb 0x24(%rsp,%r14), %cl
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%r12)
movb %cl, (%rax)
incq %r14
jmp 0x201e8c
movslq 0x80(%r15), %rax
leaq (%r14,%rax), %rdx
movq 0x8(%rsp), %rcx
subq %rax, %rcx
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x1fec0c
testq %rax, %rax
je 0x201fd7
movq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x1ff2cb
movq %rax, %rbx
movq 0x10(%rsp), %rcx
movq 0x350(%rcx), %rax
movq %rax, 0x348(%rcx)
cmpq %r12, 0x28(%rsp)
je 0x201f4e
cmpb $0x0, 0x101(%rbp)
je 0x201f35
cmpb $0x0, 0x102(%rbp)
je 0x201f61
testq %rbx, %rbx
je 0x202059
cmpb $0x0, 0x3a(%rbx)
leaq 0x8(%rsp), %rbp
jne 0x201f6b
jmp 0x202060
cmpb $0x0, 0x102(%rbp)
je 0x201fc2
cmpq $0x0, 0x228(%rcx)
je 0x201f35
testq %rbx, %rbx
leaq 0x8(%rsp), %rbp
je 0x201fb8
cmpb $0x0, 0x38(%rbx)
jne 0x202019
cmpq $0x0, 0x30(%rbx)
movq 0x10(%rsp), %rdi
jne 0x202033
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
je 0x202037
movslq 0x10(%rbx), %r8
addq %rcx, %r8
movb $0x1, 0x38(%rbx)
movq 0x1b8(%rdi), %rsi
movl 0x20(%rsp), %edx
movq %r12, %r9
callq 0x201cb8
movb $0x0, 0x38(%rbx)
testl %eax, %eax
jne 0x201fda
movq 0x8(%rsp), %r14
jmp 0x201d0f
cmpb $0x0, 0x101(%rbp)
jne 0x201f61
jmp 0x201f35
pushq $0x1
popq %rbp
movl %ebp, %eax
jmp 0x20204a
pushq $0x1
popq %rax
jmp 0x20204a
cmpq %r15, 0x120(%r13)
jne 0x201fd3
movq %r14, 0x210(%r13)
jmp 0x201fd3
pushq $0x17
jmp 0x20201b
pushq $0x4
popq %rax
movq 0x10(%rsp), %rdx
cmpq %r15, 0x120(%rdx)
jne 0x20204a
movq 0x8(%rsp), %rcx
movq %rcx, 0x210(%rdx)
jmp 0x20204a
pushq $0x4
jmp 0x20201b
xorl %eax, %eax
jmp 0x20204a
pushq $0xc
popq %rax
movq 0x10(%rsp), %rcx
cmpq %r15, 0x120(%rcx)
jne 0x20204a
movq %r14, 0x210(%rcx)
jmp 0x20204a
pushq $0xf
jmp 0x202039
pushq $0x10
popq %rax
cmpq %r15, 0x120(%rdi)
jne 0x20204a
movq %r14, 0x210(%rdi)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0xb
jmp 0x201fd9
pushq $0x18
jmp 0x201fd9