// File: /workspace/github_c_makefile_star2_O2/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 0x720d(%rip), %rsi      # 0x9b87f
callq 0x40f0
testq %rax, %rax
je 0x9488e
movq %rax, %r14
leaq 0xc(%rsp), %rsi
movq %rax, %rdi
callq 0x94163
movq %rax, %r13
addq $0x8, %rbx
movq %rbx, 0x20(%rsp)
xorl %r12d, %r12d
movl $0x0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
xorl %ebx, %ebx
movq $0x0, 0x10(%rsp)
xorl %ebp, %ebp
movl 0xc(%rsp), %r15d
cmpq $0x8, %r15
ja 0x947e7
leaq 0xdf2d(%rip), %rcx      # 0xa2600
movslq (%rcx,%r15,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %edx, %edx
testl %r15d, %r15d
sete %dl
movq %r13, %rdi
movq %rbx, %rsi
callq 0x9424f
testq %rbx, %rbx
je 0x947f5
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
setne %cl
cmpl $0x0, 0x8(%rsp)
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x94805
addq $0x28, %rsi
movq %rsi, %rbx
movq %rax, 0x10(%rsp)
jmp 0x94809
movq (%rbp), %rsi
movq %r13, %rdi
callq 0x4260
testl %eax, %eax
je 0x94861
movq 0x18(%rbp), %rbp
movq (%rbp), %rsi
movq %r13, %rdi
callq 0x4260
testl %eax, %eax
je 0x94864
jmp 0x9488e
pushq $0x1
popq %rax
movl %eax, %r12d
movl $0x0, 0x8(%rsp)
jmp 0x94839
movq 0x18(%rbp), %rax
pushq $0x1
popq %rcx
movl %ecx, %r12d
movl %ecx, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
jmp 0x9483c
cmpl $0x1, %r12d
je 0x94823
testl %r12d, %r12d
jne 0x9488e
movq %r13, %rdi
callq 0x94350
movq 0x10(%rbp), %rdi
movq %rax, 0x18(%rsp)
movq %rax, %rsi
callq 0x19ac7
xorl %r12d, %r12d
jmp 0x94839
movq 0x18(%rsp), %r15
testq %r15, %r15
je 0x9488e
movq 0x8(%r15), %rdi
testq %r13, %r13
je 0x94879
movq %r13, %rsi
callq 0x3604c
movq %rax, 0x8(%r15)
xorl %r12d, %r12d
jmp 0x94844
pushq $0x2
jmp 0x94835
leaq 0xdedd(%rip), %rdi      # 0xa26cb
callq 0x4090
jmp 0x94839
movq 0x20(%rsp), %rbx
cmpq $0x0, (%rbx)
je 0x94809
jmp 0x9488e
addq $0x20, %rbx
movq %rax, (%rbx)
xorl %r12d, %r12d
testl %r15d, %r15d
setne %r12b
movl $0x0, 0x8(%rsp)
movq %rax, %rbp
jmp 0x9483c
movq 0x8(%rbp), %rdi
movq %r13, %rsi
callq 0x3604c
movq %rax, 0x8(%rbp)
pushq $0x1
popq %rax
movl %eax, %r12d
movq %rbx, %rax
movq %rax, %rbx
testq %r13, %r13
je 0x9484c
movq %r13, %rdi
callq 0x34ff7
movq %r14, %rdi
leaq 0xc(%rsp), %rsi
callq 0x94163
movq %rax, %r13
jmp 0x946bd
movq %rbp, %rbx
movq 0x18(%rbp), %rax
pushq $0x1
popq %rcx
movl %ecx, %r12d
movl %ecx, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
jmp 0x9483c
leaq 0xd09e(%rip), %rsi      # 0xa191e
callq 0x3604c
movq %rax, 0x8(%r15)
xorl %r12d, %r12d
jmp 0x9484c
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x42a0
pushq $0x1
popq %rax
jmp 0x94890