#include <XML/DTD.d>
#include <__oo2c.h>
#include <setjmp.h>

void XML_DTD__InitDeclaration(XML_DTD__Declaration decl, XML_UnicodeBuffer__CharArray name) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)decl;
  *(OOC_INT64*)(_check_pointer(i0, 15157)) = 0;
  i1 = (OOC_INT64)name;
  *(OOC_INT64*)((_check_pointer(i0, 15180))+8) = i1;
  return;
  ;
}

static void XML_DTD__InitNamespace(XML_DTD__Namespace ns) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)ns;
  *(OOC_INT64*)(_check_pointer(i0, 15275)) = 0;
  return;
  ;
}

XML_DTD__Namespace XML_DTD__NewNamespace(void) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__Namespace.baseTypes[0]);
  XML_DTD__InitNamespace((XML_DTD__Namespace)i0);
  return (XML_DTD__Namespace)i0;
  ;
}

OOC_CHAR8 XML_DTD__NamespaceDesc_Add(XML_DTD__Namespace ns, XML_DTD__Declaration decl) {
  register OOC_INT64 i0;
  auto OOC_CHAR8 XML_DTD__NamespaceDesc_Add_RecAdd(XML_DTD__Declaration *list);
    
    OOC_CHAR8 XML_DTD__NamespaceDesc_Add_RecAdd(XML_DTD__Declaration *list) {
      register OOC_INT64 i0,i1,i2;

      i0 = (OOC_INT64)*list;
      i1 = i0==(OOC_INT64)0;
      if (i1) goto l7;
      i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 15968))+8);
      i2 = (OOC_INT64)decl;
      i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i2, 15982))+8);
      i1 = (
      _cmp16((const void*)(_check_pointer(i1, 15974)),(const void*)(_check_pointer(i2, 15988))))!=0;
      if (i1) goto l5;
      return 0u;
      goto l8;
l5:
      i0 = XML_DTD__NamespaceDesc_Add_RecAdd((void*)(_check_pointer(i0, 16023)));
      return i0;
      goto l8;
l7:
      i0 = (OOC_INT64)decl;
      *list = (XML_DTD__Declaration)i0;
      return 1u;
l8:
      _failed_function(15831); return 0;
      ;
    }


  i0 = (OOC_INT64)decl;
  *(OOC_INT64*)(_check_pointer(i0, 16108)) = 0;
  i0 = (OOC_INT64)ns;
  i0 = XML_DTD__NamespaceDesc_Add_RecAdd((void*)(_check_pointer(i0, 16144)));
  return i0;
  ;
}

XML_DTD__Declaration XML_DTD__NamespaceDesc_Get(XML_DTD__Namespace ns, XML_UnicodeBuffer__CharArray name) {
  register OOC_INT64 i0,i1,i2;
  XML_DTD__Declaration ptr;

  i0 = (OOC_INT64)ns;
  i0 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i0, 16277));
  ptr = (XML_DTD__Declaration)i0;
  i1 = i0!=0;
  if (i1) goto l3;
  i1=0u;
  goto l5;
l3:
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 16317))+8);
  i2 = (OOC_INT64)name;
  i1 = (
  _cmp16((const void*)(_check_pointer(i1, 16323)),(const void*)(_check_pointer(i2, 16331))))!=0;
  
l5:
  if (!i1) goto l17;
  i1 = (OOC_INT64)name;
  
l8_loop:
  i0 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i0, 16353));
  ptr = (XML_DTD__Declaration)i0;
  i2 = i0!=0;
  if (i2) goto l11;
  i2=0u;
  goto l13;
l11:
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 16317))+8);
  i2 = (
  _cmp16((const void*)(_check_pointer(i2, 16323)),(const void*)(_check_pointer(i1, 16331))))!=0;
  
l13:
  if (i2) goto l8_loop;
l17:
  return (XML_DTD__Declaration)i0;
  ;
}

void XML_DTD__InitFragment(XML_DTD__Fragment f) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)f;
  *(OOC_INT64*)(_check_pointer(i0, 16548)) = 0;
  return;
  ;
}

void XML_DTD__InitCharacters(XML_DTD__Characters chars, XML_UnicodeBuffer__CharArray source, OOC_INT32 start, OOC_INT32 end) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)chars;
  XML_DTD__InitFragment((XML_DTD__Fragment)i0);
  i1 = (OOC_INT64)source;
  *(OOC_INT64*)((_check_pointer(i0, 16739))+8) = i1;
  i1 = start;
  *(OOC_INT32*)((_check_pointer(i0, 16768))+16) = i1;
  i1 = end;
  *(OOC_INT32*)((_check_pointer(i0, 16801))+20) = i1;
  return;
  ;
}

XML_DTD__Characters XML_DTD__BuilderDesc_NewCharacters(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray source, OOC_INT32 start, OOC_INT32 end, OOC_CHAR8 createCopy) {
  register OOC_INT64 i0,i1,i2,i3,i4,i5,i6,i7,i8,i9;
  XML_DTD__Characters chars;
  OOC_INT32 len;
  XML_UnicodeBuffer__CharArray copy;
  OOC_INT32 i;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__Characters.baseTypes[0]);
  chars = (XML_DTD__Characters)i0;
  i1 = createCopy;
  if (i1) goto l3;
  i1 = end;
  i2 = start;
  i3 = (OOC_INT64)source;
  XML_DTD__InitCharacters((XML_DTD__Characters)i0, (XML_UnicodeBuffer__CharArray)i3, i2, i1);
  goto l12;
l3:
  i1 = start;
  i2 = end;
  i2 = i2-i1;
  len = i2;
  i3 = (OOC_INT64)RT0__NewObject(_td_XML_UnicodeBuffer__CharArray.baseTypes[0], i2);
  copy = (XML_UnicodeBuffer__CharArray)i3;
  i = 0;
  i4 = 0<i2;
  if (!i4) goto l11;
  i4 = (OOC_INT64)source;
  i5=i1;i1=0;
l6_loop:
  i6 = _check_pointer(i3, 17196);
  i7 = OOC_ARRAY_LENGTH(i6, 0);
  i8 = _check_pointer(i4, 17209);
  i9 = OOC_ARRAY_LENGTH(i8, 0);
  i8 = *(OOC_UINT16*)(i8+(_check_index(i5, i9, OOC_UINT32, 17209))*2);
  *(OOC_UINT16*)(i6+(_check_index(i1, i7, OOC_UINT32, 17196))*2) = i8;
  i1 = i1+1;
  i = i1;
  i5 = i5+1;
  i6 = i1<i2;
  if (i6) goto l6_loop;
l11:
  XML_DTD__InitCharacters((XML_DTD__Characters)i0, (XML_UnicodeBuffer__CharArray)i3, 0, i2);
l12:
  return (XML_DTD__Characters)i0;
  ;
}

void XML_DTD__InitEntityRef(XML_DTD__EntityRef entRef, XML_UnicodeBuffer__CharArray name, XML_DTD__Entity entity) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)entRef;
  XML_DTD__InitFragment((XML_DTD__Fragment)i0);
  i1 = (OOC_INT64)name;
  *(OOC_INT64*)((_check_pointer(i0, 17501))+8) = i1;
  i1 = (OOC_INT64)entity;
  *(OOC_INT64*)((_check_pointer(i0, 17527))+16) = i1;
  return;
  ;
}

XML_DTD__EntityRef XML_DTD__BuilderDesc_NewEntityRef(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray name, XML_DTD__Entity entity) {
  register OOC_INT64 i0,i1,i2;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__EntityRef.baseTypes[0]);
  i1 = (OOC_INT64)name;
  i2 = (OOC_INT64)entity;
  XML_DTD__InitEntityRef((XML_DTD__EntityRef)i0, (XML_UnicodeBuffer__CharArray)i1, (XML_DTD__Entity)i2);
  return (XML_DTD__EntityRef)i0;
  ;
}

void XML_DTD__InitAttValue(XML_DTD__AttValue attValue) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)attValue;
  *(OOC_INT64*)(_check_pointer(i0, 17889)) = 0;
  *(OOC_INT64*)((_check_pointer(i0, 17924))+8) = 0;
  return;
  ;
}

XML_DTD__AttValue XML_DTD__BuilderDesc_NewAttValue(XML_DTD__Builder b) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__AttValue.baseTypes[0]);
  XML_DTD__InitAttValue((XML_DTD__AttValue)i0);
  return (XML_DTD__AttValue)i0;
  ;
}

void XML_DTD__AttValueDesc_Clear(XML_DTD__AttValue attValue) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)attValue;
  *(OOC_INT64*)(_check_pointer(i0, 18204)) = 0;
  *(OOC_INT64*)((_check_pointer(i0, 18239))+8) = 0;
  return;
  ;
}

void XML_DTD__AttValueDesc_Append(XML_DTD__AttValue attValue, XML_DTD__Fragment fragment) {
  register OOC_INT64 i0,i1,i2;

  i0 = (OOC_INT64)fragment;
  *(OOC_INT64*)(_check_pointer(i0, 18356)) = 0;
  i1 = (OOC_INT64)attValue;
  i2 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i1, 18387));
  i2 = i2==0;
  if (i2) goto l3;
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i1, 18478))+8);
  *(OOC_INT64*)(_check_pointer(i2, 18492)) = i0;
  goto l4;
l3:
  *(OOC_INT64*)(_check_pointer(i1, 18428)) = i0;
l4:
  *(OOC_INT64*)((_check_pointer(i1, 18532))+8) = i0;
  return;
  ;
}

OOC_INT32 XML_DTD__AttValueDesc_Length(XML_DTD__AttValue attValue) {
  register OOC_INT64 i0,i1,i2,i3;
  OOC_INT32 len;
  XML_DTD__Fragment fragment;

  len = 0;
  i0 = (OOC_INT64)attValue;
  i0 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i0, 18805));
  fragment = (XML_DTD__Fragment)i0;
  i1 = i0!=0;
  if (i1) goto l3;
  i0=0;
  goto l21;
l3:
  i1=0;
l4_loop:
  i2 = OOC_TYPE_TEST(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i0, 18870)))), &_td_XML_DTD__EntityRefDesc);
  if (i2) goto l11;
  i2 = OOC_TYPE_TEST(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i0, 19085)))), &_td_XML_DTD__CharactersDesc);
  if (i2) goto l9;
  _failed_with(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i0, 19075)))), 19075);
  
  goto l16;
l9:
  i2 = *(OOC_INT32*)((_check_pointer(i0, 19127))+20);
  i3 = *(OOC_INT32*)((_check_pointer(i0, 19147))+16);
  i1 = i1+(i2-i3);
  len = i1;
  
  goto l16;
l11:
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 18905))+16);
  i2 = i2!=0;
  if (i2) goto l14;
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 19045))+8);
  i3 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 19045))+8);
  i3 = OOC_ARRAY_LENGTH((_check_pointer(i3, 19051)), 0);
  i2 = LongStrings__Length((void*)(_check_pointer(i2, 19051)), i3);
  i1 = i1+(i2+2);
  len = i1;
  
  goto l16;
l14:
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 18954))+16);
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i2, 18962))+40);
  i2 = XML_DTD__AttValueDesc_Length((XML_DTD__AttValue)i2);
  i1 = i1+i2;
  len = i1;
  
l16:
  i0 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i0, 19199));
  fragment = (XML_DTD__Fragment)i0;
  i2 = i0!=0;
  if (i2) goto l4_loop;
l20:
  i0=i1;
l21:
  return i0;
  ;
}

XML_UnicodeBuffer__CharArray XML_DTD__AttValueDesc_FlattenValue(XML_DTD__AttValue attValue, OOC_CHAR8 normalizeWhitespace, OOC_CHAR8 *didNormalization) {
  register OOC_INT64 i0,i1,i2,i3;
  OOC_INT32 len;
  XML_UnicodeBuffer__CharArray str;
  OOC_INT32 pos;
  OOC_CHAR8 skipSpace;
  auto void XML_DTD__AttValueDesc_FlattenValue_Append(XML_DTD__AttValue attValue);
    
    void XML_DTD__AttValueDesc_FlattenValue_Append(XML_DTD__AttValue attValue) {
      register OOC_INT64 i0,i1,i2,i3;
      XML_DTD__Fragment f;
      auto void XML_DTD__AttValueDesc_FlattenValue_Append_Copy(const XML_DTD__StringVar source, OOC_LEN source_0d, OOC_INT32 start, OOC_INT32 end);
        
        void XML_DTD__AttValueDesc_FlattenValue_Append_Copy(const XML_DTD__StringVar source, OOC_LEN source_0d, OOC_INT32 start, OOC_INT32 end) {
          register OOC_INT64 i0,i1,i2,i3,i4,i5,i6,i7;
          OOC_INT32 i;

          i0 = start;
          i = i0;
          i1 = end;
          i2 = i0!=i1;
          if (!i2) goto l16;
          i2 = (OOC_INT64)str;
          i3 = normalizeWhitespace;
          
l3_loop:
          i4 = *(OOC_UINT16*)((OOC_INT64)source+(_check_index(i0, source_0d, OOC_UINT32, 20124))*2);
          i4 = i4==32u;
          if (i4) goto l6;
          skipSpace = 0u;
          i4 = _check_pointer(i2, 20409);
          i5 = OOC_ARRAY_LENGTH(i4, 0);
          i6 = pos;
          i7 = *(OOC_UINT16*)((OOC_INT64)source+(_check_index(i0, source_0d, OOC_UINT32, 20424))*2);
          *(OOC_UINT16*)(i4+(_check_index(i6, i5, OOC_UINT32, 20409))*2) = i7;
          pos = (i6+1);
          goto l11;
l6:
          i4 = skipSpace;
          i4 = !i4;
          if (i4) goto l9;
          *didNormalization = 1u;
          goto l11;
l9:
          i4 = _check_pointer(i2, 20188);
          i5 = OOC_ARRAY_LENGTH(i4, 0);
          i6 = pos;
          *(OOC_UINT16*)(i4+(_check_index(i6, i5, OOC_UINT32, 20188))*2) = 32u;
          pos = (i6+1);
          skipSpace = i3;
l11:
          i0 = i0+1;
          i = i0;
          i4 = i0!=i1;
          if (i4) goto l3_loop;
l16:
          return;
          ;
        }


      i0 = (OOC_INT64)attValue;
      i0 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i0, 20546));
      f = (XML_DTD__Fragment)i0;
      i1 = i0!=0;
      if (!i1) goto l20;
l3_loop:
      i1 = OOC_TYPE_TEST(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i0, 20601)))), &_td_XML_DTD__EntityRefDesc);
      if (i1) goto l10;
      i1 = OOC_TYPE_TEST(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i0, 20855)))), &_td_XML_DTD__CharactersDesc);
      if (i1) goto l8;
      _failed_with(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i0, 20852)))), 20852);
      goto l15;
l8:
      i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20888))+8);
      i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20888))+8);
      i3 = *(OOC_INT32*)((_check_pointer(i0, 20900))+16);
      i0 = *(OOC_INT32*)((_check_pointer(i0, 20916))+20);
      i2 = OOC_ARRAY_LENGTH((_check_pointer(i2, 20896)), 0);
      XML_DTD__AttValueDesc_FlattenValue_Append_Copy((void*)(_check_pointer(i1, 20896)), i2, i3, i0);
      goto l15;
l10:
      i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20631))+16);
      i1 = i1!=0;
      if (i1) goto l13;
      XML_DTD__AttValueDesc_FlattenValue_Append_Copy(((OOC_CHAR16[]){38,0}), 2, 0, 1);
      i0 = (OOC_INT64)f;
      i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20757))+8);
      i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20757))+8);
      i3 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20790))+8);
      i0 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20790))+8);
      i0 = OOC_ARRAY_LENGTH((_check_pointer(i0, 20796)), 0);
      i0 = LongStrings__Length((void*)(_check_pointer(i3, 20796)), i0);
      i2 = OOC_ARRAY_LENGTH((_check_pointer(i2, 20763)), 0);
      XML_DTD__AttValueDesc_FlattenValue_Append_Copy((void*)(_check_pointer(i1, 20763)), i2, 0, i0);
      XML_DTD__AttValueDesc_FlattenValue_Append_Copy(((OOC_CHAR16[]){59,0}), 2, 0, 1);
      goto l15;
l13:
      i0 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20673))+16);
      i0 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 20681))+40);
      XML_DTD__AttValueDesc_FlattenValue_Append((XML_DTD__AttValue)i0);
l15:
      i0 = (OOC_INT64)f;
      i0 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i0, 20956));
      f = (XML_DTD__Fragment)i0;
      i1 = i0!=0;
      if (i1) goto l3_loop;
l20:
      return;
      ;
    }


  i0 = (OOC_INT64)attValue;
  i1 = XML_DTD__AttValueDesc_Length((XML_DTD__AttValue)i0);
  len = i1;
  str = (XML_UnicodeBuffer__CharArray)((OOC_INT64)RT0__NewObject(_td_XML_UnicodeBuffer__CharArray.baseTypes[0], (i1+2)));
  pos = 0;
  i1 = normalizeWhitespace;
  skipSpace = i1;
  *didNormalization = 0u;
  XML_DTD__AttValueDesc_FlattenValue_Append((XML_DTD__AttValue)i0);
  i0 = (OOC_INT64)str;
  i1 = normalizeWhitespace;
  if (i1) goto l3;
  i1=0u;
  goto l5;
l3:
  i1 = pos;
  i1 = i1!=0;
  
l5:
  if (i1) goto l7;
  i1=0u;
  goto l9;
l7:
  i1 = _check_pointer(i0, 21304);
  i2 = pos;
  i3 = OOC_ARRAY_LENGTH(i1, 0);
  i1 = *(OOC_UINT16*)(i1+(_check_index((i2-1), i3, OOC_UINT32, 21304))*2);
  i1 = i1==32u;
  
l9:
  if (!i1) goto l11;
  i1 = pos;
  pos = (i1-1);
  *didNormalization = 1u;
l11:
  i1 = _check_pointer(i0, 21382);
  i2 = OOC_ARRAY_LENGTH(i1, 0);
  i3 = pos;
  *(OOC_UINT16*)(i1+(_check_index(i3, i2, OOC_UINT32, 21382))*2) = 0u;
  return (XML_UnicodeBuffer__CharArray)i0;
  ;
}

XML_UnicodeBuffer__CharArray XML_DTD__AttValueDesc_Flatten(XML_DTD__AttValue attValue, XML_DTD__AttrDecl attrDecl) {
  register OOC_INT64 i0,i1;
  OOC_CHAR8 didNormalization;

  i0 = (OOC_INT64)attrDecl;
  i1 = i0!=(OOC_INT64)0;
  if (i1) goto l3;
  i0=0u;
  goto l4;
l3:
  i0 = *(OOC_INT8*)((_check_pointer(i0, 21952))+24);
  i0 = i0!=9;
  
l4:
  i1 = (OOC_INT64)attValue;
  i0 = (OOC_INT64)XML_DTD__AttValueDesc_FlattenValue((XML_DTD__AttValue)i1, i0, (void*)(OOC_INT64)&didNormalization);
  return (XML_UnicodeBuffer__CharArray)i0;
  ;
}

XML_UnicodeBuffer__CharArray XML_DTD__AttValueDesc_FlattenNorm(XML_DTD__AttValue attValue, XML_DTD__AttrDecl attrDecl, OOC_CHAR8 *didNormalization) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)attrDecl;
  i1 = i0!=(OOC_INT64)0;
  if (i1) goto l3;
  i0=0u;
  goto l4;
l3:
  i0 = *(OOC_INT8*)((_check_pointer(i0, 22505))+24);
  i0 = i0!=9;
  
l4:
  i1 = (OOC_INT64)attValue;
  i0 = (OOC_INT64)XML_DTD__AttValueDesc_FlattenValue((XML_DTD__AttValue)i1, i0, (void*)(OOC_INT64)didNormalization);
  return (XML_UnicodeBuffer__CharArray)i0;
  ;
}

XML_DTD__Enumeration XML_DTD__BuilderDesc_NewEnumeration(XML_DTD__Builder b) {
  register OOC_INT64 i0;
  XML_DTD__Enumeration _enum;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__Enumeration.baseTypes[0]);
  _enum = (XML_DTD__Enumeration)i0;
  *(OOC_INT64*)(_check_pointer(i0, 22822)) = 0;
  *(OOC_INT64*)((_check_pointer(i0, 22849))+8) = 0;
  return (XML_DTD__Enumeration)i0;
  ;
}

void XML_DTD__EnumerationDesc_Append(XML_DTD__Enumeration _enum, XML_UnicodeBuffer__CharArray name) {
  register OOC_INT64 i0,i1,i2;
  XML_DTD__NameNode node;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__NameNode.baseTypes[0]);
  node = (XML_DTD__NameNode)i0;
  *(OOC_INT64*)(_check_pointer(i0, 23019)) = 0;
  i1 = (OOC_INT64)name;
  *(OOC_INT64*)((_check_pointer(i0, 23042))+8) = i1;
  i1 = (OOC_INT64)_enum;
  i2 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i1, 23075));
  i2 = i2==0;
  if (i2) goto l3;
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i1, 23146))+8);
  *(OOC_INT64*)(_check_pointer(i2, 23156)) = i0;
  goto l4;
l3:
  *(OOC_INT64*)(_check_pointer(i1, 23108)) = i0;
l4:
  *(OOC_INT64*)((_check_pointer(i1, 23188))+8) = i0;
  return;
  ;
}

OOC_CHAR8 XML_DTD__EnumerationDesc_Matches(XML_DTD__Enumeration _enum, XML_DTD__StringVar name, OOC_LEN name_0d) {
  register OOC_INT64 i0,i1;
  XML_DTD__NameNode ptr;

  i0 = (OOC_INT64)_enum;
  i0 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i0, 23452));
  ptr = (XML_DTD__NameNode)i0;
  i1 = i0!=0;
  if (i1) goto l3;
  i1=0u;
  goto l5;
l3:
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 23492))+8);
  i1 = (
  _cmp16((const void*)(_check_pointer(i1, 23498)),(const void*)(OOC_INT64)name))!=0;
  
l5:
  if (!i1) goto l17;
l8_loop:
  i0 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i0, 23527));
  ptr = (XML_DTD__NameNode)i0;
  i1 = i0!=0;
  if (i1) goto l11;
  i1=0u;
  goto l13;
l11:
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 23492))+8);
  i1 = (
  _cmp16((const void*)(_check_pointer(i1, 23498)),(const void*)(OOC_INT64)name))!=0;
  
l13:
  if (i1) goto l8_loop;
l17:
  return (i0!=0);
  ;
}

void XML_DTD__InitAttrDecl(XML_DTD__AttrDecl attrDecl, XML_UnicodeBuffer__CharArray elementName, XML_UnicodeBuffer__CharArray name, OOC_INT8 type, XML_DTD__Enumeration _enum, OOC_INT8 _default, XML_DTD__AttValue defaultValue, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)attrDecl;
  i1 = (OOC_INT64)name;
  XML_DTD__InitDeclaration((XML_DTD__Declaration)i0, (XML_UnicodeBuffer__CharArray)i1);
  i1 = (OOC_INT64)elementName;
  *(OOC_INT64*)((_check_pointer(i0, 23904))+16) = i1;
  i1 = type;
  *(OOC_INT8*)((_check_pointer(i0, 23946))+24) = i1;
  i1 = externalMarkupDecl;
  *(OOC_UINT8*)((_check_pointer(i0, 23974))+25) = i1;
  i1 = (OOC_INT64)_enum;
  *(OOC_INT64*)((_check_pointer(i0, 24030))+32) = i1;
  i1 = _default;
  *(OOC_INT8*)((_check_pointer(i0, 24065))+40) = i1;
  i1 = (OOC_INT64)defaultValue;
  *(OOC_INT64*)((_check_pointer(i0, 24099))+48) = i1;
  return;
  ;
}

XML_DTD__AttrDecl XML_DTD__BuilderDesc_NewAttrDecl(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray elementName, XML_UnicodeBuffer__CharArray name, OOC_INT8 type, XML_DTD__Enumeration _enum, OOC_INT8 _default, XML_DTD__AttValue defaultValue, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1,i2,i3,i4,i5,i6,i7;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__AttrDecl.baseTypes[0]);
  i1 = (OOC_INT64)elementName;
  i2 = (OOC_INT64)name;
  i3 = type;
  i4 = (OOC_INT64)_enum;
  i5 = _default;
  i6 = (OOC_INT64)defaultValue;
  i7 = externalMarkupDecl;
  XML_DTD__InitAttrDecl((XML_DTD__AttrDecl)i0, (XML_UnicodeBuffer__CharArray)i1, (XML_UnicodeBuffer__CharArray)i2, i3, (XML_DTD__Enumeration)i4, i5, (XML_DTD__AttValue)i6, i7);
  return (XML_DTD__AttrDecl)i0;
  ;
}

void XML_DTD__BuilderDesc_AddAttribute(XML_DTD__Builder b, XML_DTD__AttrDecl attrDecl) {
  register OOC_INT64 i0,i1,i2;

  i0 = (OOC_INT64)b;
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 24709))+32);
  i1 = i1==(OOC_INT64)0;
  if (i1) goto l3;
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 24788))+40);
  i2 = (OOC_INT64)attrDecl;
  *(OOC_INT64*)(_check_pointer(i1, 24803)) = i2;
  i1=i2;
  goto l4;
l3:
  i1 = (OOC_INT64)attrDecl;
  *(OOC_INT64*)((_check_pointer(i0, 24744))+32) = i1;
  
l4:
  *(OOC_INT64*)((_check_pointer(i0, 24836))+40) = i1;
  return;
  ;
}

void XML_DTD__BuilderDesc_AttachAttributes(XML_DTD__Builder b) {
  register OOC_INT64 i0,i1,i2,i3,i4;
  XML_DTD__Declaration ptr;
  XML_DTD__AttrDecl attrDecl;
  XML_DTD__Declaration decl;
  XML_DTD__ElementDecl elemDecl;
  OOC_CHAR8 dummy;

  i0 = (OOC_INT64)b;
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 25147))+32);
  ptr = (XML_DTD__Declaration)i1;
  *(OOC_INT64*)((_check_pointer(i0, 25169))+32) = (OOC_INT64)0;
  *(OOC_INT64*)((_check_pointer(i0, 25198))+40) = (OOC_INT64)0;
  i2 = i1!=(OOC_INT64)0;
  if (!i2) goto l27;
l3_loop:
  i1 = _type_guard(i1, ((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i1, 25274)))), &_td_XML_DTD__AttrDeclDesc, 25274);
  attrDecl = (XML_DTD__AttrDecl)i1;
  i2 = (OOC_INT64)*(OOC_INT64*)(_check_pointer(i1, 25306));
  ptr = (XML_DTD__Declaration)i2;
  i3 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 25336))+24);
  i4 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i1, 25369))+16);
  i3 = (OOC_INT64)XML_DTD__NamespaceDesc_Get((XML_DTD__Namespace)i3, (XML_UnicodeBuffer__CharArray)i4);
  decl = (XML_DTD__Declaration)i3;
  i4 = i3==(OOC_INT64)0;
  if (i4) goto l21;
  i3 = _type_guard(i3, ((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i3, 25525)))), &_td_XML_DTD__ElementDeclDesc, 25525);
  elemDecl = (XML_DTD__ElementDecl)i3;
  i4 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i3, 25564))+40);
  i4 = XML_DTD__NamespaceDesc_Add((XML_DTD__Namespace)i4, (XML_DTD__Declaration)i1);
  dummy = i4;
  i4 = *(OOC_INT8*)((_check_pointer(i1, 25617))+24);
  i4 = i4==0;
  if (i4) goto l15;
  i4 = *(OOC_INT8*)((_check_pointer(i1, 25817))+24);
  i4 = i4==7;
  if (!i4) goto l22;
  i4 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i3, 25867))+56);
  i4 = i4==(OOC_INT64)0;
  if (i4) goto l12;
  i1 = (OOC_INT64)XML_DTD__undefAttr;
  *(OOC_INT64*)((_check_pointer(i3, 25976))+56) = i1;
  goto l22;
l12:
  *(OOC_INT64*)((_check_pointer(i3, 25914))+56) = i1;
  goto l22;
l15:
  i4 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i3, 25661))+48);
  i4 = i4==(OOC_INT64)0;
  if (i4) goto l18;
  i1 = (OOC_INT64)XML_DTD__undefAttr;
  *(OOC_INT64*)((_check_pointer(i3, 25758))+48) = i1;
  goto l22;
l18:
  *(OOC_INT64*)((_check_pointer(i3, 25702))+48) = i1;
  goto l22;
l21:
  OOC_TBCALL(((OOC_INT64)OOC_TBPROC_ADR(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i0, 25463)))), XML_DTD__BuilderDesc_AddAttribute)),XML_DTD__BuilderDesc_AddAttribute)((XML_DTD__Builder)i0, (XML_DTD__AttrDecl)i1);
l22:
  i1 = i2!=(OOC_INT64)0;
  if (!i1) goto l27;
  i1=i2;
  goto l3_loop;
l27:
  *(OOC_INT64*)((_check_pointer(i0, 26054))+40) = (OOC_INT64)0;
  return;
  ;
}

static void XML_DTD__InitEntity(XML_DTD__Entity ent, XML_UnicodeBuffer__CharArray name, OOC_INT8 type, XML_UnicodeBuffer__CharArray entityValue, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)ent;
  i1 = (OOC_INT64)name;
  XML_DTD__InitDeclaration((XML_DTD__Declaration)i0, (XML_UnicodeBuffer__CharArray)i1);
  i1 = type;
  *(OOC_INT8*)((_check_pointer(i0, 26383))+16) = i1;
  i1 = externalMarkupDecl;
  *(OOC_UINT8*)((_check_pointer(i0, 26406))+32) = i1;
  i1 = (OOC_INT64)entityValue;
  *(OOC_INT64*)((_check_pointer(i0, 26457))+24) = i1;
  *(OOC_UINT8*)((_check_pointer(i0, 26494))+33) = 0u;
  *(OOC_INT64*)((_check_pointer(i0, 26523))+40) = (OOC_INT64)0;
  return;
  ;
}

void XML_DTD__EntityDesc_SetEntityValue(XML_DTD__Entity entity, XML_UnicodeBuffer__CharArray entityValue) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)entity;
  i1 = (OOC_INT64)entityValue;
  *(OOC_INT64*)((_check_pointer(i0, 26644))+24) = i1;
  return;
  ;
}

OOC_INT32 XML_DTD__EntityDesc_LengthValue(XML_DTD__Entity entity) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)entity;
  i0 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 26827))+24);
  i0 = OOC_ARRAY_LENGTH((_check_pointer(i0, 26840)), 0);
  return (i0-2);
  ;
}

OOC_CHAR8 XML_DTD__EntityDesc_IsDocumentEntity(XML_DTD__Entity entity) {

  return 0u;
  ;
}

static void XML_DTD__InitInternalEntity(XML_DTD__InternalEntity ent, XML_UnicodeBuffer__CharArray name, OOC_INT8 type, XML_UnicodeBuffer__CharArray entityValue, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1,i2,i3,i4;

  i0 = (OOC_INT64)ent;
  i1 = (OOC_INT64)name;
  i2 = type;
  i3 = (OOC_INT64)entityValue;
  i4 = externalMarkupDecl;
  XML_DTD__InitEntity((XML_DTD__Entity)i0, (XML_UnicodeBuffer__CharArray)i1, i2, (XML_UnicodeBuffer__CharArray)i3, i4);
  return;
  ;
}

XML_DTD__InternalEntity XML_DTD__BuilderDesc_NewInternalEntity(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray name, OOC_INT8 type, XML_UnicodeBuffer__CharArray entityValue, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1,i2,i3,i4;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__InternalEntity.baseTypes[0]);
  i1 = (OOC_INT64)name;
  i2 = type;
  i3 = (OOC_INT64)entityValue;
  i4 = externalMarkupDecl;
  XML_DTD__InitInternalEntity((XML_DTD__InternalEntity)i0, (XML_UnicodeBuffer__CharArray)i1, i2, (XML_UnicodeBuffer__CharArray)i3, i4);
  return (XML_DTD__InternalEntity)i0;
  ;
}

OOC_CHAR8 XML_DTD__BuilderDesc_IsValidEntityDecl(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray name, XML_UnicodeBuffer__CharArray entityValue) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)name;
  i1 = (
  _cmp16((const void*)(_check_pointer(i0, 28068)),(const void*)((OOC_CHAR16[]){108,116,0})))==0;
  if (i1) goto l31;
  i1 = (
  _cmp16((const void*)(_check_pointer(i0, 28136)),(const void*)((OOC_CHAR16[]){97,109,112,0})))==0;
  if (i1) goto l29;
  i1 = (
  _cmp16((const void*)(_check_pointer(i0, 28205)),(const void*)((OOC_CHAR16[]){103,116,0})))==0;
  if (i1) goto l23;
  i1 = (
  _cmp16((const void*)(_check_pointer(i0, 28297)),(const void*)((OOC_CHAR16[]){97,112,111,115,0})))==0;
  if (i1) goto l17;
  i0 = (
  _cmp16((const void*)(_check_pointer(i0, 28391)),(const void*)((OOC_CHAR16[]){113,117,111,116,0})))==0;
  if (i0) goto l11;
  return 1u;
  goto l32;
l11:
  i0 = (OOC_INT64)entityValue;
  i1 = (
  _cmp16((const void*)(_check_pointer(i0, 28433)),(const void*)((OOC_CHAR16[]){34,0})))==0;
  if (i1) goto l14;
  i0 = (
  _cmp16((const void*)(_check_pointer(i0, 28457)),(const void*)((OOC_CHAR16[]){38,35,51,52,59,0})))==0;
  
  goto l15;
l14:
  i0=1u;
l15:
  return i0;
  goto l32;
l17:
  i0 = (OOC_INT64)entityValue;
  i1 = (
  _cmp16((const void*)(_check_pointer(i0, 28339)),(const void*)((OOC_CHAR16[]){39,0})))==0;
  if (i1) goto l20;
  i0 = (
  _cmp16((const void*)(_check_pointer(i0, 28363)),(const void*)((OOC_CHAR16[]){38,35,51,57,59,0})))==0;
  
  goto l21;
l20:
  i0=1u;
l21:
  return i0;
  goto l32;
l23:
  i0 = (OOC_INT64)entityValue;
  i1 = (
  _cmp16((const void*)(_check_pointer(i0, 28245)),(const void*)((OOC_CHAR16[]){62,0})))==0;
  if (i1) goto l26;
  i0 = (
  _cmp16((const void*)(_check_pointer(i0, 28269)),(const void*)((OOC_CHAR16[]){38,35,54,50,59,0})))==0;
  
  goto l27;
l26:
  i0=1u;
l27:
  return i0;
  goto l32;
l29:
  i0 = (OOC_INT64)entityValue;
  return ((
  _cmp16((const void*)(_check_pointer(i0, 28177)),(const void*)((OOC_CHAR16[]){38,35,51,56,59,0})))==0);
  goto l32;
l31:
  i0 = (OOC_INT64)entityValue;
  return ((
  _cmp16((const void*)(_check_pointer(i0, 28108)),(const void*)((OOC_CHAR16[]){38,35,54,48,59,0})))==0);
l32:
  _failed_function(27719); return 0;
  ;
}

static void XML_DTD__InitExternalEntity(XML_DTD__ExternalEntity ent, XML_UnicodeBuffer__CharArray name, OOC_INT8 type, XML_UnicodeBuffer__CharArray _public, XML_UnicodeBuffer__CharArray system, XML_UnicodeBuffer__CharArray ndata, URI__URI baseURI, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1,i2,i3;

  i0 = (OOC_INT64)ent;
  i1 = (OOC_INT64)name;
  i2 = type;
  i3 = externalMarkupDecl;
  XML_DTD__InitEntity((XML_DTD__Entity)i0, (XML_UnicodeBuffer__CharArray)i1, i2, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, i3);
  i1 = (OOC_INT64)_public;
  *(OOC_INT64*)((_check_pointer(i0, 28887))+48) = i1;
  i1 = (OOC_INT64)system;
  *(OOC_INT64*)((_check_pointer(i0, 28914))+56) = i1;
  i1 = (OOC_INT64)baseURI;
  *(OOC_INT64*)((_check_pointer(i0, 28941))+72) = i1;
  i1 = (OOC_INT64)ndata;
  *(OOC_INT64*)((_check_pointer(i0, 28970))+64) = i1;
  *(OOC_INT64*)((_check_pointer(i0, 28995))+80) = (OOC_INT64)0;
  *(OOC_INT64*)((_check_pointer(i0, 29020))+88) = (OOC_INT64)0;
  *(OOC_INT8*)((_check_pointer(i0, 29046))+96) = 3;
  return;
  ;
}

XML_DTD__ExternalEntity XML_DTD__BuilderDesc_NewExternalEntity(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray name, OOC_INT8 type, XML_UnicodeBuffer__CharArray _public, XML_UnicodeBuffer__CharArray system, XML_UnicodeBuffer__CharArray ndata, URI__URI baseURI, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1,i2,i3,i4,i5,i6,i7;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__ExternalEntity.baseTypes[0]);
  i1 = (OOC_INT64)name;
  i2 = type;
  i3 = (OOC_INT64)_public;
  i4 = (OOC_INT64)system;
  i5 = (OOC_INT64)ndata;
  i6 = (OOC_INT64)baseURI;
  i7 = externalMarkupDecl;
  XML_DTD__InitExternalEntity((XML_DTD__ExternalEntity)i0, (XML_UnicodeBuffer__CharArray)i1, i2, (XML_UnicodeBuffer__CharArray)i3, (XML_UnicodeBuffer__CharArray)i4, (XML_UnicodeBuffer__CharArray)i5, (URI__URI)i6, i7);
  return (XML_DTD__ExternalEntity)i0;
  ;
}

void XML_DTD__ExternalEntityDesc_SetCodecFactory(XML_DTD__ExternalEntity entity, XML_UnicodeCodec__Factory codecFactory) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)entity;
  i1 = (OOC_INT64)codecFactory;
  *(OOC_INT64*)((_check_pointer(i0, 29709))+104) = i1;
  return;
  ;
}

void XML_DTD__ExternalEntityDesc_SetVersion(XML_DTD__ExternalEntity entity, XML_UnicodeBuffer__CharArray version) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)entity;
  i1 = (OOC_INT64)version;
  *(OOC_INT64*)((_check_pointer(i0, 29849))+80) = i1;
  return;
  ;
}

void XML_DTD__ExternalEntityDesc_SetEncoding(XML_DTD__ExternalEntity entity, XML_UnicodeBuffer__CharArray encoding) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)entity;
  i1 = (OOC_INT64)encoding;
  *(OOC_INT64*)((_check_pointer(i0, 29975))+88) = i1;
  return;
  ;
}

void XML_DTD__ExternalEntityDesc_SetStandalone(XML_DTD__ExternalEntity entity, OOC_INT8 standalone) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)entity;
  i1 = standalone;
  *(OOC_INT8*)((_check_pointer(i0, 30116))+96) = i1;
  return;
  ;
}

OOC_CHAR8 XML_DTD__ExternalEntityDesc_IsDocumentEntity(XML_DTD__ExternalEntity entity) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)entity;
  i0 = *(OOC_INT8*)((_check_pointer(i0, 30257))+16);
  return (i0==5);
  ;
}

XML_DTD__ExternalEntity XML_DTD__BuilderDesc_NewExternalDTD(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray _public, XML_UnicodeBuffer__CharArray system, URI__URI baseURI) {
  register OOC_INT64 i0,i1,i2,i3;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__ExternalEntity.baseTypes[0]);
  i1 = (OOC_INT64)_public;
  i2 = (OOC_INT64)system;
  i3 = (OOC_INT64)baseURI;
  XML_DTD__InitExternalEntity((XML_DTD__ExternalEntity)i0, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, 6, (XML_UnicodeBuffer__CharArray)i1, (XML_UnicodeBuffer__CharArray)i2, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, (URI__URI)i3, 0u);
  return (XML_DTD__ExternalEntity)i0;
  ;
}

XML_DTD__ExternalEntity XML_DTD__BuilderDesc_NewDocumentEntity(XML_DTD__Builder b, URI__URI baseURI) {
  register OOC_INT64 i0,i1;
  XML_DTD__ExternalEntity entity;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__ExternalEntity.baseTypes[0]);
  entity = (XML_DTD__ExternalEntity)i0;
  i1 = (OOC_INT64)baseURI;
  XML_DTD__InitExternalEntity((XML_DTD__ExternalEntity)i0, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, 5, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, (URI__URI)i1, 0u);
  *(OOC_INT8*)((_check_pointer(i0, 30928))+96) = 2;
  return (XML_DTD__ExternalEntity)i0;
  ;
}

static void XML_DTD__InitNotation(XML_DTD__Notation notation, XML_UnicodeBuffer__CharArray name, XML_UnicodeBuffer__CharArray _public, XML_UnicodeBuffer__CharArray system, URI__URI baseURI) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)notation;
  i1 = (OOC_INT64)name;
  XML_DTD__InitDeclaration((XML_DTD__Declaration)i0, (XML_UnicodeBuffer__CharArray)i1);
  i1 = (OOC_INT64)_public;
  *(OOC_INT64*)((_check_pointer(i0, 31255))+16) = i1;
  i1 = (OOC_INT64)system;
  *(OOC_INT64*)((_check_pointer(i0, 31287))+24) = i1;
  i1 = (OOC_INT64)baseURI;
  *(OOC_INT64*)((_check_pointer(i0, 31319))+32) = i1;
  return;
  ;
}

XML_DTD__Notation XML_DTD__BuilderDesc_NewNotation(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray name, XML_UnicodeBuffer__CharArray _public, XML_UnicodeBuffer__CharArray system, URI__URI baseURI) {
  register OOC_INT64 i0,i1,i2,i3,i4;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__Notation.baseTypes[0]);
  i1 = (OOC_INT64)name;
  i2 = (OOC_INT64)_public;
  i3 = (OOC_INT64)system;
  i4 = (OOC_INT64)baseURI;
  XML_DTD__InitNotation((XML_DTD__Notation)i0, (XML_UnicodeBuffer__CharArray)i1, (XML_UnicodeBuffer__CharArray)i2, (XML_UnicodeBuffer__CharArray)i3, (URI__URI)i4);
  return (XML_DTD__Notation)i0;
  ;
}

static void XML_DTD__InitCP(XML_DTD__CP cp, OOC_INT8 cpMode) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)cp;
  i1 = cpMode;
  *(OOC_INT8*)(_check_pointer(i0, 31800)) = i1;
  *(OOC_INT64*)((_check_pointer(i0, 31826))+8) = 0;
  return;
  ;
}

void XML_DTD__CPDesc_SetNext(XML_DTD__CP cp, XML_DTD__CP next) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)cp;
  i1 = (OOC_INT64)next;
  *(OOC_INT64*)((_check_pointer(i0, 31909))+8) = i1;
  return;
  ;
}

void XML_DTD__CPDesc_SetMode(XML_DTD__CP cp, OOC_INT8 cpMode) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)cp;
  i1 = cpMode;
  *(OOC_INT8*)(_check_pointer(i0, 32002)) = i1;
  return;
  ;
}

void XML_DTD__InitChoiceCP(XML_DTD__ChoiceCP choiceCP, OOC_INT8 cpMode, XML_DTD__CP list) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)choiceCP;
  i1 = cpMode;
  XML_DTD__InitCP((XML_DTD__CP)i0, i1);
  i1 = (OOC_INT64)list;
  *(OOC_INT64*)((_check_pointer(i0, 32165))+16) = i1;
  return;
  ;
}

XML_DTD__ChoiceCP XML_DTD__BuilderDesc_NewChoiceCP(XML_DTD__Builder b, OOC_INT8 cpMode, XML_DTD__CP list) {
  register OOC_INT64 i0,i1,i2;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__ChoiceCP.baseTypes[0]);
  i1 = cpMode;
  i2 = (OOC_INT64)list;
  XML_DTD__InitChoiceCP((XML_DTD__ChoiceCP)i0, i1, (XML_DTD__CP)i2);
  return (XML_DTD__ChoiceCP)i0;
  ;
}

void XML_DTD__InitSeqCP(XML_DTD__SeqCP seqCP, OOC_INT8 cpMode, XML_DTD__CP list) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)seqCP;
  i1 = cpMode;
  XML_DTD__InitCP((XML_DTD__CP)i0, i1);
  i1 = (OOC_INT64)list;
  *(OOC_INT64*)((_check_pointer(i0, 32532))+16) = i1;
  return;
  ;
}

XML_DTD__SeqCP XML_DTD__BuilderDesc_NewSeqCP(XML_DTD__Builder b, OOC_INT8 cpMode, XML_DTD__CP list) {
  register OOC_INT64 i0,i1,i2;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__SeqCP.baseTypes[0]);
  i1 = cpMode;
  i2 = (OOC_INT64)list;
  XML_DTD__InitSeqCP((XML_DTD__SeqCP)i0, i1, (XML_DTD__CP)i2);
  return (XML_DTD__SeqCP)i0;
  ;
}

void XML_DTD__InitNameCP(XML_DTD__NameCP nameCP, OOC_INT8 cpMode, XML_UnicodeBuffer__CharArray name) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)nameCP;
  i1 = cpMode;
  XML_DTD__InitCP((XML_DTD__CP)i0, i1);
  i1 = (OOC_INT64)name;
  *(OOC_INT64*)((_check_pointer(i0, 32878))+16) = i1;
  return;
  ;
}

XML_DTD__NameCP XML_DTD__BuilderDesc_NewNameCP(XML_DTD__Builder b, OOC_INT8 cpMode, XML_UnicodeBuffer__CharArray name) {
  register OOC_INT64 i0,i1,i2;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__NameCP.baseTypes[0]);
  i1 = cpMode;
  i2 = (OOC_INT64)name;
  XML_DTD__InitNameCP((XML_DTD__NameCP)i0, i1, (XML_UnicodeBuffer__CharArray)i2);
  return (XML_DTD__NameCP)i0;
  ;
}

void XML_DTD__InitElementDecl(XML_DTD__ElementDecl elemDecl, XML_UnicodeBuffer__CharArray name, XML_DTD__CP contentModel, XML_DTD__Namespace attrNamespace, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1,i2;

  i0 = (OOC_INT64)elemDecl;
  i1 = (OOC_INT64)name;
  XML_DTD__InitDeclaration((XML_DTD__Declaration)i0, (XML_UnicodeBuffer__CharArray)i1);
  i1 = (OOC_INT64)contentModel;
  *(OOC_INT64*)((_check_pointer(i0, 33315))+16) = i1;
  *(OOC_INT8*)((_check_pointer(i0, 33359))+32) = 1;
  *(OOC_INT64*)((_check_pointer(i0, 33400))+24) = (OOC_INT64)0;
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i0, 33438))+16);
  i2 = i2!=(OOC_INT64)0;
  if (!i2) goto l27;
  i2 = OOC_TYPE_TEST(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i1, 33488)))), &_td_XML_DTD__NameCPDesc);
  if (i2) goto l17;
  i2 = OOC_TYPE_TEST(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i1, 33841)))), &_td_XML_DTD__ChoiceCPDesc);
  if (i2) goto l7;
  *(OOC_INT8*)((_check_pointer(i0, 34114))+32) = 3;
  goto l27;
l7:
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i1, 33879))+16);
  i2 = OOC_TYPE_TEST(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i2, 33886)))), &_td_XML_DTD__NameCPDesc);
  if (i2) goto l10;
  i1=0u;
  goto l12;
l10:
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i1, 33923))+16);
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer((_type_guard(i1, ((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i1, 33930)))), &_td_XML_DTD__NameCPDesc, 33930)), 33937))+16);
  i1 = (
  _cmp16((const void*)(_check_pointer(i1, 33943)),(const void*)((OOC_CHAR16[]){35,80,67,68,65,84,65,0})))==0;
  
l12:
  if (i1) goto l14;
  *(OOC_INT8*)((_check_pointer(i0, 34042))+32) = 3;
  goto l27;
l14:
  *(OOC_INT8*)((_check_pointer(i0, 33981))+32) = 2;
  goto l27;
l17:
  i2 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i1, 33524))+16);
  i2 = (
  _cmp16((const void*)(_check_pointer(i2, 33530)),(const void*)((OOC_CHAR16[]){69,77,80,84,89,0})))==0;
  if (i2) goto l24;
  i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i1, 33623))+16);
  i1 = (
  _cmp16((const void*)(_check_pointer(i1, 33629)),(const void*)((OOC_CHAR16[]){65,78,89,0})))==0;
  if (i1) goto l22;
  *(OOC_INT8*)((_check_pointer(i0, 33722))+32) = 1;
  goto l27;
l22:
  *(OOC_INT8*)((_check_pointer(i0, 33663))+32) = 1;
  goto l27;
l24:
  *(OOC_INT8*)((_check_pointer(i0, 33566))+32) = 0;
l27:
  i1 = externalMarkupDecl;
  *(OOC_UINT8*)((_check_pointer(i0, 34178))+33) = i1;
  *(OOC_UINT8*)((_check_pointer(i0, 34234))+34) = 0u;
  i1 = (OOC_INT64)attrNamespace;
  *(OOC_INT64*)((_check_pointer(i0, 34271))+40) = i1;
  *(OOC_INT64*)((_check_pointer(i0, 34317))+48) = (OOC_INT64)0;
  *(OOC_INT64*)((_check_pointer(i0, 34346))+56) = (OOC_INT64)0;
  return;
  ;
}

XML_DTD__ElementDecl XML_DTD__BuilderDesc_NewElementDecl(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray name, XML_DTD__CP contentModel, OOC_CHAR8 externalMarkupDecl) {
  register OOC_INT64 i0,i1,i2,i3,i4;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__ElementDecl.baseTypes[0]);
  i1 = (OOC_INT64)XML_DTD__NewNamespace();
  i2 = (OOC_INT64)name;
  i3 = (OOC_INT64)contentModel;
  i4 = externalMarkupDecl;
  XML_DTD__InitElementDecl((XML_DTD__ElementDecl)i0, (XML_UnicodeBuffer__CharArray)i2, (XML_DTD__CP)i3, (XML_DTD__Namespace)i1, i4);
  return (XML_DTD__ElementDecl)i0;
  ;
}

void XML_DTD__ElementDeclDesc_SetRegexp(XML_DTD__ElementDecl elemDecl, XML_DTD__RegexpInfo regexp) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)elemDecl;
  i1 = (OOC_INT64)regexp;
  *(OOC_INT64*)((_check_pointer(i0, 34787))+24) = i1;
  return;
  ;
}

void XML_DTD__ElementDeclDesc_SetMultipleDecl(XML_DTD__ElementDecl elemDecl) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)elemDecl;
  *(OOC_UINT8*)((_check_pointer(i0, 34896))+34) = 1u;
  return;
  ;
}

OOC_CHAR8 XML_DTD__ElementDeclDesc_IsEmpty(XML_DTD__ElementDecl elemDecl) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)elemDecl;
  i0 = *(OOC_INT8*)((_check_pointer(i0, 35027))+32);
  return (i0==0);
  ;
}

OOC_CHAR8 XML_DTD__ElementDeclDesc_IsElementContent(XML_DTD__ElementDecl elemDecl) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)elemDecl;
  i0 = *(OOC_INT8*)((_check_pointer(i0, 35166))+32);
  return (i0==3);
  ;
}

void XML_DTD__BuilderDesc_SetRootName(XML_DTD__Builder b, XML_UnicodeBuffer__CharArray name) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)b;
  i1 = (OOC_INT64)name;
  *(OOC_INT64*)(_check_pointer(i0, 35379)) = i1;
  return;
  ;
}

static void XML_DTD__InitNamespaceDeclaration(XML_DTD__NamespaceDeclaration namespaceDecl, XML_UnicodeBuffer__CharArray prefix, XML_DTD__StringURI uri) {
  register OOC_INT64 i0,i1;

  i0 = (OOC_INT64)namespaceDecl;
  i1 = (OOC_INT64)prefix;
  *(OOC_INT64*)(_check_pointer(i0, 35691)) = i1;
  i1 = (OOC_INT64)uri;
  *(OOC_INT64*)((_check_pointer(i0, 35728))+8) = i1;
  return;
  ;
}

XML_DTD__NamespaceDeclaration XML_DTD__NewNamespaceDeclaration(XML_UnicodeBuffer__CharArray prefix, XML_DTD__StringURI uri) {
  register OOC_INT64 i0,i1,i2;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__NamespaceDeclaration.baseTypes[0]);
  i1 = (OOC_INT64)prefix;
  i2 = (OOC_INT64)uri;
  XML_DTD__InitNamespaceDeclaration((XML_DTD__NamespaceDeclaration)i0, (XML_UnicodeBuffer__CharArray)i1, (XML_DTD__StringURI)i2);
  return (XML_DTD__NamespaceDeclaration)i0;
  ;
}

XML_UnicodeBuffer__CharArray XML_DTD__GetString(OOC_CHAR16 string[], OOC_LEN string_0d, OOC_INT32 start, OOC_INT32 end) {
  register OOC_INT64 i0,i1,i2,i3,i4,i5,i6;
  XML_UnicodeBuffer__CharArray s;
  OOC_INT32 i;

  i0 = end;
  i1 = start;
  i0 = i0-i1;
  i2 = (OOC_INT64)RT0__NewObject(_td_XML_UnicodeBuffer__CharArray.baseTypes[0], (i0+1));
  s = (XML_UnicodeBuffer__CharArray)i2;
  i = 0;
  i3 = 0<i0;
  if (!i3) goto l8;
  i3=i1;i1=0;
l3_loop:
  i4 = _check_pointer(i2, 36332);
  i5 = OOC_ARRAY_LENGTH(i4, 0);
  i6 = *(OOC_UINT16*)((OOC_INT64)string+(_check_index(i3, string_0d, OOC_UINT32, 36345))*2);
  *(OOC_UINT16*)(i4+(_check_index(i1, i5, OOC_UINT32, 36332))*2) = i6;
  i1 = i1+1;
  i = i1;
  i3 = i3+1;
  i4 = i1<i0;
  if (i4) goto l3_loop;
l8:
  i1 = _check_pointer(i2, 36369);
  i3 = OOC_ARRAY_LENGTH(i1, 0);
  *(OOC_UINT16*)(i1+(_check_index(i0, i3, OOC_UINT32, 36369))*2) = 0u;
  return (XML_UnicodeBuffer__CharArray)i2;
  ;
}

XML_UnicodeBuffer__CharArray XML_DTD__GetStringValue(const OOC_CHAR16 string__ref[], OOC_LEN string_0d) {
  register OOC_INT64 i0;
  OOC_ALLOCATE_VPAR(string,OOC_CHAR16 ,string_0d)

  OOC_INITIALIZE_VPAR(string__ref,string,OOC_CHAR16 ,(string_0d*2))
  i0 = LongStrings__Length((void*)(OOC_INT64)string, string_0d);
  i0 = (OOC_INT64)XML_DTD__GetString((void*)(OOC_INT64)string, string_0d, 0, i0);
  return (XML_UnicodeBuffer__CharArray)i0;
  ;
}

XML_DTD__StringURI XML_DTD__GetStringURI(OOC_CHAR8 string[], OOC_LEN string_0d, OOC_INT32 start, OOC_INT32 end) {
  register OOC_INT64 i0,i1,i2,i3,i4,i5,i6;
  XML_DTD__StringURI s;
  OOC_INT32 i;

  i0 = end;
  i1 = start;
  i0 = i0-i1;
  i2 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__StringURI.baseTypes[0], (i0+1));
  s = (XML_DTD__StringURI)i2;
  i = 0;
  i3 = 0<i0;
  if (!i3) goto l8;
  i3=i1;i1=0;
l3_loop:
  i4 = _check_pointer(i2, 36770);
  i5 = OOC_ARRAY_LENGTH(i4, 0);
  i6 = *(OOC_UINT8*)((OOC_INT64)string+(_check_index(i3, string_0d, OOC_UINT32, 36783)));
  *(OOC_UINT8*)(i4+(_check_index(i1, i5, OOC_UINT32, 36770))) = i6;
  i1 = i1+1;
  i = i1;
  i3 = i3+1;
  i4 = i1<i0;
  if (i4) goto l3_loop;
l8:
  i1 = _check_pointer(i2, 36807);
  i3 = OOC_ARRAY_LENGTH(i1, 0);
  *(OOC_UINT8*)(i1+(_check_index(i0, i3, OOC_UINT32, 36807))) = 0u;
  return (XML_DTD__StringURI)i2;
  ;
}

void XML_DTD__Init(XML_DTD__Builder b) {
  register OOC_INT64 i0,i1;
  auto void XML_DTD__Init_PredefEntity(const OOC_CHAR16 name__ref[], OOC_LEN name_0d, const OOC_CHAR16 replacement__ref[], OOC_LEN replacement_0d);
    
    void XML_DTD__Init_PredefEntity(const OOC_CHAR16 name__ref[], OOC_LEN name_0d, const OOC_CHAR16 replacement__ref[], OOC_LEN replacement_0d) {
      register OOC_INT64 i0,i1,i2,i3,i4;
      OOC_ALLOCATE_VPAR(name,OOC_CHAR16 ,name_0d)
      OOC_ALLOCATE_VPAR(replacement,OOC_CHAR16 ,replacement_0d)
      XML_UnicodeBuffer__CharArray nameString;
      XML_UnicodeBuffer__CharArray replString;
      XML_DTD__Entity entity;

      OOC_INITIALIZE_VPAR(name__ref,name,OOC_CHAR16 ,(name_0d*2))
      OOC_INITIALIZE_VPAR(replacement__ref,replacement,OOC_CHAR16 ,(replacement_0d*2))
      i0 = LongStrings__Length((void*)(OOC_INT64)name, name_0d);
      i0 = (OOC_INT64)RT0__NewObject(_td_XML_UnicodeBuffer__CharArray.baseTypes[0], (i0+1));
      nameString = (XML_UnicodeBuffer__CharArray)i0;
      i1 = OOC_ARRAY_LENGTH((_check_pointer(i0, 37287)), 0);
      _copy_16((const void*)(OOC_INT64)name,(void*)(_check_pointer(i0, 37287)),i1);
      i1 = LongStrings__Length((void*)(OOC_INT64)replacement, replacement_0d);
      i1 = (OOC_INT64)RT0__NewObject(_td_XML_UnicodeBuffer__CharArray.baseTypes[0], (i1+2));
      replString = (XML_UnicodeBuffer__CharArray)i1;
      i2 = OOC_ARRAY_LENGTH((_check_pointer(i1, 37386)), 0);
      _copy_16((const void*)(OOC_INT64)replacement,(void*)(_check_pointer(i1, 37386)),i2);
      i2 = _check_pointer(i1, 37406);
      i3 = OOC_ARRAY_LENGTH((_check_pointer(i1, 37422)), 0);
      i4 = OOC_ARRAY_LENGTH(i2, 0);
      *(OOC_UINT16*)(i2+(_check_index((i3-2), i4, OOC_UINT32, 37406))*2) = 65535u;
      i2 = (OOC_INT64)b;
      i0 = (OOC_INT64)OOC_TBCALL(((OOC_INT64)OOC_TBPROC_ADR(((OOC_INT64)OOC_TYPE_TAG((_check_pointer(i2, 37480)))), XML_DTD__BuilderDesc_NewInternalEntity)),XML_DTD__BuilderDesc_NewInternalEntity)((XML_DTD__Builder)i2, (XML_UnicodeBuffer__CharArray)i0, 0, (XML_UnicodeBuffer__CharArray)i1, 0u);
      entity = (XML_DTD__Entity)i0;
      i1 = (OOC_INT64)b;
      i1 = (OOC_INT64)*(OOC_INT64*)((_check_pointer(i1, 37611))+8);
      i0 = XML_DTD__NamespaceDesc_Add((XML_DTD__Namespace)i1, (XML_DTD__Declaration)i0);
      return;
      ;
    }


  i0 = (OOC_INT64)b;
  *(OOC_INT64*)(_check_pointer(i0, 37677)) = 0;
  i1 = (OOC_INT64)XML_DTD__NewNamespace();
  *(OOC_INT64*)((_check_pointer(i0, 37701))+8) = i1;
  i1 = (OOC_INT64)XML_DTD__NewNamespace();
  *(OOC_INT64*)((_check_pointer(i0, 37739))+16) = i1;
  i1 = (OOC_INT64)XML_DTD__NewNamespace();
  *(OOC_INT64*)((_check_pointer(i0, 37777))+24) = i1;
  *(OOC_INT64*)((_check_pointer(i0, 37825))+32) = 0;
  *(OOC_INT64*)((_check_pointer(i0, 37854))+40) = 0;
  XML_DTD__Init_PredefEntity(((OOC_CHAR16[]){108,116,0}), 3, ((OOC_CHAR16[]){38,35,54,48,59,0}), 6);
  XML_DTD__Init_PredefEntity(((OOC_CHAR16[]){103,116,0}), 3, ((OOC_CHAR16[]){62,0}), 2);
  XML_DTD__Init_PredefEntity(((OOC_CHAR16[]){97,109,112,0}), 4, ((OOC_CHAR16[]){38,35,51,56,59,0}), 6);
  XML_DTD__Init_PredefEntity(((OOC_CHAR16[]){97,112,111,115,0}), 5, ((OOC_CHAR16[]){39,0}), 2);
  XML_DTD__Init_PredefEntity(((OOC_CHAR16[]){113,117,111,116,0}), 5, ((OOC_CHAR16[]){34,0}), 2);
  return;
  ;
}

XML_DTD__Builder XML_DTD__New(void) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__Builder.baseTypes[0]);
  XML_DTD__Init((XML_DTD__Builder)i0);
  return (XML_DTD__Builder)i0;
  ;
}

void OOC_XML_DTD_init(void) {
  register OOC_INT64 i0;

  i0 = (OOC_INT64)RT0__NewObject(_td_XML_DTD__AttrDecl.baseTypes[0]);
  XML_DTD__undefAttr = (XML_DTD__AttrDecl)i0;
  XML_DTD__InitAttrDecl((XML_DTD__AttrDecl)i0, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, (XML_UnicodeBuffer__CharArray)(OOC_INT64)0, (-1), (XML_DTD__Enumeration)(OOC_INT64)0, (-1), (XML_DTD__AttValue)(OOC_INT64)0, 0u);
  return;
  ;
}

/* --- */
