// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x6a9e(%rip), %rsi      # 0xe81a6
callq 0x40c0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xe1724
movl $0x0, -0x4(%rbp)
jmp 0xe19d5
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xe0e70
movq %rax, -0x30(%rbp)
cmpl $0x8, -0x20(%rbp)
je 0xe19c5
movl -0x20(%rbp), %eax
movq %rax, -0x58(%rbp)
subq $0x7, %rax
ja 0xe1991
movq -0x58(%rbp), %rax
leaq 0xd645(%rip), %rcx      # 0xeeda0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rsi
cmpl $0x0, -0x20(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %edx
callq 0xe0fc0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xe17b9
cmpq $0x0, -0x48(%rbp)
je 0xe17ab
cmpl $0x0, -0x24(%rbp)
je 0xe17ab
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0xe17b7
movq -0x50(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0xe17e0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xe17d2
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xe17de
movl $0x0, -0x4(%rbp)
jmp 0xe19d5
jmp 0xe17e0
movq -0x50(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0xe17fe
movl $0x0, -0x1c(%rbp)
jmp 0xe1805
movl $0x1, -0x1c(%rbp)
jmp 0xe199f
movl $0x1, -0x1c(%rbp)
movl $0x0, -0x24(%rbp)
jmp 0xe199f
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x1, -0x1c(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0xe199f
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rsi
callq 0x4210
cmpl $0x0, %eax
jne 0xe186f
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xe18bc
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rsi
callq 0x4210
cmpl $0x0, %eax
jne 0xe18ae
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0xe18ba
movl $0x0, -0x4(%rbp)
jmp 0xe19d5
jmp 0xe18bc
movl $0x1, -0x24(%rbp)
movl $0x1, -0x1c(%rbp)
jmp 0xe199f
cmpq $0x0, -0x38(%rbp)
je 0xe191c
cmpq $0x0, -0x30(%rbp)
je 0xe18fb
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x54ba0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xe191a
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xc6d0(%rip), %rsi      # 0xedfda
callq 0x54ba0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xe1928
movl $0x0, -0x4(%rbp)
jmp 0xe19d5
movl $0x0, -0x1c(%rbp)
jmp 0xe199f
movl $0x2, -0x1c(%rbp)
jmp 0xe199f
cmpl $0x0, -0x1c(%rbp)
jne 0xe1960
movq -0x30(%rbp), %rdi
callq 0xe11d0
movq %rax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x27430
jmp 0xe198f
cmpl $0x1, -0x1c(%rbp)
jne 0xe1984
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x54ba0
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0xe198d
movl $0x0, -0x4(%rbp)
jmp 0xe19d5
jmp 0xe198f
jmp 0xe199f
leaq 0xd4d1(%rip), %rdi      # 0xeee69
movb $0x0, %al
callq 0x4030
cmpq $0x0, -0x30(%rbp)
je 0xe19af
movq -0x30(%rbp), %rdi
callq 0x52e80
movq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xe0e70
movq %rax, -0x30(%rbp)
jmp 0xe1735
movq -0x18(%rbp), %rdi
callq 0x4250
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq