// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/expat-2.0.1/lib/xmlparse.c
// Function: dtdCopy
static int
dtdCopy(DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms)
{
  HASH_TABLE_ITER iter;

  /* Copy the prefix table. */

  hashTableIterInit(&iter, &(oldDtd->prefixes));
  for (;;) {
    const XML_Char *name;
    const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);
    if (!oldP)
      break;
    name = poolCopyString(&(newDtd->pool), oldP->name);
    if (!name)
      return 0;
    if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX)))
      return 0;
  }

  hashTableIterInit(&iter, &(oldDtd->attributeIds));

  /* Copy the attribute id table. */

  for (;;) {
    ATTRIBUTE_ID *newA;
    const XML_Char *name;
    const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);

    if (!oldA)
      break;
    /* Remember to allocate the scratch byte before the name. */
    if (!poolAppendChar(&(newDtd->pool), XML_T('\0')))
      return 0;
    name = poolCopyString(&(newDtd->pool), oldA->name);
    if (!name)
      return 0;
    ++name;
    newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name,
                                  sizeof(ATTRIBUTE_ID));
    if (!newA)
      return 0;
    newA->maybeTokenized = oldA->maybeTokenized;
    if (oldA->prefix) {
      newA->xmlns = oldA->xmlns;
      if (oldA->prefix == &oldDtd->defaultPrefix)
        newA->prefix = &newDtd->defaultPrefix;
      else
        newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes),
                                        oldA->prefix->name, 0);
    }
  }

  /* Copy the element type table. */

  hashTableIterInit(&iter, &(oldDtd->elementTypes));

  for (;;) {
    int i;
    ELEMENT_TYPE *newE;
    const XML_Char *name;
    const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);
    if (!oldE)
      break;
    name = poolCopyString(&(newDtd->pool), oldE->name);
    if (!name)
      return 0;
    newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name,
                                  sizeof(ELEMENT_TYPE));
    if (!newE)
      return 0;
    if (oldE->nDefaultAtts) {
      newE->defaultAtts = (DEFAULT_ATTRIBUTE *)
          ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
      if (!newE->defaultAtts) {
        ms->free_fcn(newE);
        return 0;
      }
    }
    if (oldE->idAtt)
      newE->idAtt = (ATTRIBUTE_ID *)
          lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0);
    newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;
    if (oldE->prefix)
      newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes),
                                      oldE->prefix->name, 0);
    for (i = 0; i < newE->nDefaultAtts; i++) {
      newE->defaultAtts[i].id = (ATTRIBUTE_ID *)
          lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);
      newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;
      if (oldE->defaultAtts[i].value) {
        newE->defaultAtts[i].value
            = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);
        if (!newE->defaultAtts[i].value)
          return 0;
      }
      else
        newE->defaultAtts[i].value = NULL;
    }
  }

  /* Copy the entity tables. */
  if (!copyEntityTable(&(newDtd->generalEntities),
                       &(newDtd->pool),
                       &(oldDtd->generalEntities)))
      return 0;

#ifdef XML_DTD
  if (!copyEntityTable(&(newDtd->paramEntities),
                       &(newDtd->pool),
                       &(oldDtd->paramEntities)))
      return 0;
  newDtd->paramEntityRead = oldDtd->paramEntityRead;
#endif /* XML_DTD */

  newDtd->keepProcessing = oldDtd->keepProcessing;
  newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs;
  newDtd->standalone = oldDtd->standalone;

  /* Don't want deep copying for scaffolding */
  newDtd->in_eldecl = oldDtd->in_eldecl;
  newDtd->scaffold = oldDtd->scaffold;
  newDtd->contentStringLen = oldDtd->contentStringLen;
  newDtd->scaffSize = oldDtd->scaffSize;
  newDtd->scaffLevel = oldDtd->scaffLevel;
  newDtd->scaffIndex = oldDtd->scaffIndex;

  return 1;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movq 0x60(%rsp), %rsi
addq $0x78, %rsi
leaq 0x48(%rsp), %rdi
callq 0x37fe50
leaq 0x48(%rsp), %rdi
callq 0x37fe90
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x37444f
jmp 0x3744af
movq 0x68(%rsp), %rdi
addq $0xa0, %rdi
movq 0x38(%rsp), %rax
movq (%rax), %rsi
callq 0x373d60
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x40(%rsp)
jne 0x374482
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
movq 0x68(%rsp), %rdi
addq $0x78, %rdi
movq 0x40(%rsp), %rsi
movl $0x10, %edx
callq 0x37ade0
cmpq $0x0, %rax
jne 0x3744ad
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
jmp 0x374436
movq 0x60(%rsp), %rsi
addq $0x50, %rsi
leaq 0x48(%rsp), %rdi
callq 0x37fe50
leaq 0x48(%rsp), %rdi
callq 0x37fe90
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x3744de
jmp 0x374646
movq 0x68(%rsp), %rax
movq 0xb8(%rax), %rax
movq 0x68(%rsp), %rcx
cmpq 0xb0(%rcx), %rax
jne 0x374515
movq 0x68(%rsp), %rdi
addq $0xa0, %rdi
callq 0x37a570
cmpb $0x0, %al
jne 0x374515
xorl %eax, %eax
testb $0x1, %al
jne 0x374545
jmp 0x374538
movq 0x68(%rsp), %rcx
movq 0xb8(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0xb8(%rcx)
movb $0x0, (%rax)
movb $0x1, %al
testb $0x1, %al
jne 0x374545
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
movq 0x68(%rsp), %rdi
addq $0xa0, %rdi
movq 0x20(%rsp), %rax
movq (%rax), %rsi
callq 0x373d60
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0x374578
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rdi
addq $0x50, %rdi
movq 0x28(%rsp), %rsi
movl $0x18, %edx
callq 0x37ade0
movq %rax, 0x30(%rsp)
cmpq $0x0, 0x30(%rsp)
jne 0x3745b8
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
movq 0x20(%rsp), %rax
movb 0x10(%rax), %cl
movq 0x30(%rsp), %rax
movb %cl, 0x10(%rax)
movq 0x20(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x374641
movq 0x20(%rsp), %rax
movb 0x11(%rax), %cl
movq 0x30(%rsp), %rax
movb %cl, 0x11(%rax)
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x60(%rsp), %rcx
addq $0x108, %rcx            # imm = 0x108
cmpq %rcx, %rax
jne 0x374615
movq 0x68(%rsp), %rcx
addq $0x108, %rcx            # imm = 0x108
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x37463f
movq 0x68(%rsp), %rdi
addq $0x78, %rdi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x37ade0
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
jmp 0x374641
jmp 0x3744c2
movq 0x60(%rsp), %rsi
addq $0x28, %rsi
leaq 0x48(%rsp), %rdi
callq 0x37fe50
leaq 0x48(%rsp), %rdi
callq 0x37fe90
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
jne 0x374673
jmp 0x3748fc
movq 0x68(%rsp), %rdi
addq $0xa0, %rdi
movq (%rsp), %rax
movq (%rax), %rsi
callq 0x373d60
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0x3746a5
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
movq 0x68(%rsp), %rdi
addq $0x28, %rdi
movq 0x8(%rsp), %rsi
movl $0x28, %edx
callq 0x37ade0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x3746d7
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
movq (%rsp), %rax
cmpl $0x0, 0x18(%rax)
je 0x37472e
movq 0x58(%rsp), %rax
movq (%rax), %rax
movq (%rsp), %rcx
movslq 0x18(%rcx), %rcx
imulq $0x18, %rcx, %rdi
callq *%rax
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x10(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x37472c
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rsp), %rdi
callq *%rax
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
jmp 0x37472e
movq (%rsp), %rax
cmpq $0x0, 0x10(%rax)
je 0x374762
movq 0x68(%rsp), %rdi
addq $0x50, %rdi
movq (%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x37ade0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x10(%rax)
movq (%rsp), %rax
movl 0x18(%rax), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x18(%rax)
movq 0x10(%rsp), %rax
movl %ecx, 0x1c(%rax)
movq (%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3747ad
movq 0x68(%rsp), %rdi
addq $0x78, %rdi
movq (%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x37ade0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movq 0x10(%rsp), %rcx
cmpl 0x18(%rcx), %eax
jge 0x3748f7
movq 0x68(%rsp), %rdi
addq $0x50, %rdi
movq (%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x37ade0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq (%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb 0x8(%rax), %cl
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x8(%rax)
movq (%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
je 0x3748c8
movq 0x68(%rsp), %rdi
addq $0xa0, %rdi
movq (%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
callq 0x373d60
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
jne 0x3748c6
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
jmp 0x3748e5
movq 0x10(%rsp), %rax
movq 0x20(%rax), %rax
movslq 0x1c(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq $0x0, 0x10(%rax)
jmp 0x3748e7
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x3747b5
jmp 0x374659
movq 0x68(%rsp), %rdi
movq 0x68(%rsp), %rsi
addq $0xa0, %rsi
movq 0x60(%rsp), %rdx
callq 0x381510
cmpl $0x0, %eax
jne 0x374929
movl $0x0, 0x74(%rsp)
jmp 0x3749fb
movq 0x60(%rsp), %rax
movb 0x100(%rax), %cl
movq 0x68(%rsp), %rax
movb %cl, 0x100(%rax)
movq 0x60(%rsp), %rax
movb 0x101(%rax), %cl
movq 0x68(%rsp), %rax
movb %cl, 0x101(%rax)
movq 0x60(%rsp), %rax
movb 0x102(%rax), %cl
movq 0x68(%rsp), %rax
movb %cl, 0x102(%rax)
movq 0x60(%rsp), %rax
movb 0x118(%rax), %cl
movq 0x68(%rsp), %rax
movb %cl, 0x118(%rax)
movq 0x60(%rsp), %rax
movq 0x120(%rax), %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x120(%rax)
movq 0x60(%rsp), %rax
movl 0x128(%rax), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x128(%rax)
movq 0x60(%rsp), %rax
movl 0x12c(%rax), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x12c(%rax)
movq 0x60(%rsp), %rax
movl 0x134(%rax), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x134(%rax)
movq 0x60(%rsp), %rax
movq 0x138(%rax), %rcx
movq 0x68(%rsp), %rax
movq %rcx, 0x138(%rax)
movl $0x1, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)