// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/xmlparser.c
// Function: xml_parse
BOOLEAN xml_parse(Xmldocumentptr document)
{
 FILE* infile;
 XML_TEXT_TYPE texttype = XML_TEXT_ATTRIBUTE;
 XML_TOKEN_TYPE tokentype;
 BOOLEAN sibling_closed = BOOLEAN_FALSE;
 char* token;
 Xmlattributeptr att = NULL;
 Xmlelementptr parent = NULL, sibling = NULL, current = NULL;
 infile = fopen(document->filename, "r");
 if (!infile)
   return BOOLEAN_FALSE;
 token = xml_get_next_token(infile, &tokentype);
 while (tokentype != XML_END)
  {
   switch (tokentype){
     case    XML_OPENING_TAG_WITH_ATTRIBUTES:
     case XML_OPENING_TAG_WITHOUT_ATTRIBUTES:current = xmlelement(token, parent, tokentype == XML_OPENING_TAG_WITH_ATTRIBUTES);
                                             if (parent)
                                              {
                                               if (sibling && sibling_closed)
                                                {
                                                 sibling->sibling = current;
                                                 sibling = current;
                                                }
                                               else
                                                 parent->child = current;
                                              }
                                             else
                                               if (!(document->root))
                                                 document->root = current;
                                               else
                                                 return BOOLEAN_FALSE;
                                             parent = current;
                                             sibling_closed = BOOLEAN_FALSE;
                                             if (tokentype == XML_OPENING_TAG_WITH_ATTRIBUTES)
                                               texttype = XML_TEXT_ATTRIBUTE;
                                             else
                                               texttype = XML_TEXT_VALUE;
                                             break;
     case             XML_OPENING_TAG_FINISH:texttype = XML_TEXT_VALUE;
                                             sibling_closed = BOOLEAN_FALSE;
                                             break;
     case    XML_CLOSING_TAG_WITH_ATTRIBUTES:sibling = current;
                                             parent = current->parent;
                                             texttype = XML_TEXT_VALUE;
                                             sibling_closed = BOOLEAN_TRUE;
                                             break;
     case XML_CLOSING_TAG_WITHOUT_ATTRIBUTES:if (strcmp(token, current->name) == 0)
                                              {
                                               sibling = current;
                                               parent = current->parent;
                                              }
                                             else
                                               if (strcmp(token, current->parent->name) == 0)
                                                {
                                                 sibling = parent;
                                                 parent = current->parent->parent;
                                                 current = current->parent;
                                                }
                                               else
                                                 return BOOLEAN_FALSE;
                                             sibling_closed = BOOLEAN_TRUE;
                                             texttype = XML_TEXT_VALUE;
                                             break;
     case                XML_ATTRIBUTE_VALUE:if (att)
                                               if (token)
                                                 att->value = strcopy(att->value, token);
                                               else
                                                 att->value = strcopy(att->value, "");
                                             else
                                               return BOOLEAN_FALSE;
                                             texttype = XML_TEXT_ATTRIBUTE;
                                             break;
     case                          XML_EQUAL:texttype = XML_TEXT_NOT_AVAILABLE;
                                             break;
     case                           XML_TEXT:if (texttype == XML_TEXT_ATTRIBUTE)
                                              {
                                               att = xmlattribute(token);
                                               link_list_insert(current->attributes, att);
                                              }
                                             else
                                               if (texttype == XML_TEXT_VALUE)
                                                 current->pcdata = strcopy(current->pcdata, token);
                                               else 
                                                 return BOOLEAN_FALSE;
                                             break;
     default                                :printf("This token type not supported\n");
                                             break;
   }
   if (token)
     safe_free(token);
   token = xml_get_next_token(infile, &tokentype);
  }
 fclose(infile);
 return BOOLEAN_TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
leaq 0x79fc(%rip), %rsi      # 0xa888f
callq 0x40f0
testq %rax, %rax
je 0xa10d8
movq %rax, %r14
leaq 0xc(%rsp), %rsi
movq %rax, %rdi
callq 0xa095f
movq %rax, %rbp
addq $0x8, %rbx
movq %rbx, 0x20(%rsp)
xorl %r15d, %r15d
movl $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r12d, %r12d
movq $0x0, 0x10(%rsp)
xorl %r13d, %r13d
movl 0xc(%rsp), %eax
cmpq $0x8, %rax
ja 0xa1029
leaq 0xe6cb(%rip), %rdx      # 0xaf5c0
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %edx, %edx
testl %eax, %eax
sete %dl
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa0a5b
movq %rax, %rbx
testq %r12, %r12
je 0xa1037
movq 0x10(%rsp), %rdx
testq %rdx, %rdx
setne %al
cmpl $0x0, 0x8(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa1048
addq $0x28, %rdx
movq %rdx, %r12
movq %rbx, 0x10(%rsp)
jmp 0xa104c
movq (%r13), %rsi
movq %rbp, %rdi
callq 0x4260
testl %eax, %eax
je 0xa1081
movq 0x18(%r13), %r13
movq (%r13), %rsi
movq %rbp, %rdi
callq 0x4260
testl %eax, %eax
je 0xa1084
jmp 0xa10d8
movl $0x1, %r15d
movl $0x0, 0x8(%rsp)
jmp 0xa10b0
movq 0x18(%r13), %rbx
movl $0x1, %r15d
movl $0x1, 0x8(%rsp)
movq %r13, 0x10(%rsp)
jmp 0xa10b3
cmpl $0x1, %r15d
je 0xa1069
testl %r15d, %r15d
jne 0xa10d8
movl $0x10, %edi
leaq 0xe632(%rip), %rsi      # 0xaf5fc
movl $0x2, %edx
callq 0x390f5
movq %rax, %rbx
movq (%rax), %rdi
movq %rbp, %rsi
callq 0x3a404
movq %rax, (%rbx)
movq 0x10(%r13), %rdi
movq %rbx, 0x18(%rsp)
movq %rbx, %rsi
callq 0x1b66e
jmp 0xa10ad
movq 0x18(%rsp), %rbx
testq %rbx, %rbx
je 0xa10d8
movq 0x8(%rbx), %rdi
testq %rbp, %rbp
je 0xa109d
movq %rbp, %rsi
jmp 0xa10a4
movl $0x2, %r15d
jmp 0xa10b0
leaq 0xe65b(%rip), %rdi      # 0xaf68b
callq 0x4090
jmp 0xa10b0
movq 0x20(%rsp), %r12
cmpq $0x0, (%r12)
je 0xa104c
jmp 0xa10d8
addq $0x20, %r12
movq %rbx, (%r12)
xorl %r15d, %r15d
cmpl $0x0, 0xc(%rsp)
setne %r15b
movl $0x0, 0x8(%rsp)
movq %rbx, %r13
jmp 0xa10b3
movq 0x8(%r13), %rdi
movq %rbp, %rsi
callq 0x3a404
movq %rax, 0x8(%r13)
movl $0x1, %r15d
jmp 0xa10b0
movq %r13, %r12
movq 0x18(%r13), %rbx
movl $0x1, %r15d
movl $0x1, 0x8(%rsp)
movq %r12, 0x10(%rsp)
jmp 0xa10b3
leaq 0xd88a(%rip), %rsi      # 0xae92e
callq 0x3a404
movq %rax, 0x8(%rbx)
xorl %r15d, %r15d
movq %r12, %rbx
testq %rbp, %rbp
je 0xa10c0
movq %rbp, %rdi
callq 0x39194
movq %r14, %rdi
leaq 0xc(%rsp), %rsi
callq 0xa095f
movq %rax, %rbp
movq %rbx, %r12
jmp 0xa0ee0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x42a0
movl $0x1, %eax
jmp 0xa10da