// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/mgth/mg_xmlparser.c
// Function: mg_xmlparser
int mg_xmlparser(ParseStruct *parsestruct_ptr, GtFile * fp_xmlfile,
                 GtError * err)
{
  int had_err = 0;

  /* Expat XML-Error setzen */
  enum XML_Error error;

  /* Puffer zum zeilenweisen Einlesen des XML-Files, XML_Parser
     deklarieren */
  GtStr *buf;
  XML_Parser parser;

  /* Check Umgebungsvariablen */
  gt_error_check(err);

  /* Puffer-String anlegen */
  buf = gt_str_new();

  /* XML-Parser wird initialisiert */
  parser = XML_ParserCreate(NULL);
  /* Die Struktur parsestruct wird als UserData gesetzt */
  XML_SetUserData(parser, parsestruct_ptr);
  /* Start- und Endelement Handler werden gesetzt */
  XML_SetElementHandler(parser, startElement, endElement);
  /* Text-Handler setzen */
  XML_SetCharacterDataHandler(parser, textElement);

  while ((gt_str_read_next_line_generic(buf, fp_xmlfile) != EOF) && !had_err)
  {
    PARSESTRUCT(xml_linenumber)++;
    if (PARSESTRUCT(had_err))
    {
      had_err = -1;
    }

    if ((XML_Parse(parser, gt_str_get(buf), gt_str_length(buf), false) ==
         XML_STATUS_ERROR) && !had_err)
    {
      error = XML_GetErrorCode(parser);
      gt_error_set(err,
                "an error occurred parsing line "GT_WU" of file \"%s\": %s",
                PARSESTRUCT(xml_linenumber), gt_str_get(PARSESTRUCT(xmlfile)),
                XML_ErrorString(error));

      had_err = -1;
    }
    /* reset line buffer */
    gt_str_reset(buf);
  }

  /* finish parsing */
  if ((XML_Parse(parser, NULL, 0, true) == XML_STATUS_ERROR) && !had_err)
  {
    error = XML_GetErrorCode(parser);
    gt_error_set(err,
              "an error occurred while finishing the parsing of file\
               \"%s\": %s",
              gt_str_get(PARSESTRUCT(xmlfile)), XML_ErrorString(error));

    had_err = -1;
  }

  if (PARSESTRUCT(xml_tag_flag) && !(!had_err) && PARSESTRUCT(giexp_flag))
  {
    gt_str_array_delete(MATRIXSTRUCT(hit_gi_nr));
    gt_str_array_delete(MATRIXSTRUCT(hit_num));
    gt_str_array_delete(MATRIXSTRUCT(hit_dna));
    gt_str_array_delete(MATRIXSTRUCT(hit_gi_def));
    gt_str_array_delete(MATRIXSTRUCT(hit_acc));
    gt_str_array_delete(MATRIXSTRUCT(fasta_row));
    gt_str_array_delete(MATRIXSTRUCT(hit_from));
    gt_str_array_delete(MATRIXSTRUCT(hit_to));
    gt_str_array_delete(MATRIXSTRUCT(hsp_qseq));
    gt_str_array_delete(MATRIXSTRUCT(hsp_hseq));
    gt_str_array_delete(PARSESTRUCT(query_frame_tmp));
    gt_str_array_delete(PARSESTRUCT(hit_frame_tmp));
  }

  /* Freigeben des XML-Parser und loeschen des Puffer-Strings */
  XML_ParserFree(parser);
  gt_str_delete(buf);

  return had_err;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movl $0x0, 0x5c(%rsp)
cmpq $0x0, 0x60(%rsp)
je 0x31b18b
movq 0x60(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x31b153
jmp 0x31b18b
movq 0x320e46(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x1faeaf(%rip), %rsi    # 0x516013
leaq 0x1fb054(%rip), %rdx    # 0x5161bf
leaq 0x27bca1(%rip), %rcx    # 0x596e13
leaq 0x27bca7(%rip), %r8     # 0x596e20
movl $0x121, %r9d            # imm = 0x121
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x31b18d
callq 0x11d4a0
movq %rax, 0x50(%rsp)
xorl %eax, %eax
movl %eax, %edi
callq 0x372850
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
movq 0x70(%rsp), %rsi
callq 0x374d20
movq 0x48(%rsp), %rdi
leaq 0x2d0(%rip), %rsi       # 0x31b490
leaq 0x429(%rip), %rdx       # 0x31b5f0
callq 0x374e50
movq 0x48(%rsp), %rdi
leaq 0x1cb8(%rip), %rsi      # 0x31ce90
callq 0x374ec0
movq 0x50(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x11e6f0
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
movb %al, 0x47(%rsp)
je 0x31b207
cmpl $0x0, 0x5c(%rsp)
setne %al
xorb $-0x1, %al
movb %al, 0x47(%rsp)
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0x31b214
jmp 0x31b2ff
movq 0x70(%rsp), %rax
movq 0xe0(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xe0(%rax)
movq 0x70(%rsp), %rax
cmpl $0x0, 0xd0(%rax)
je 0x31b241
movl $0xffffffff, 0x5c(%rsp) # imm = 0xFFFFFFFF
movq 0x48(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x38(%rsp)
movq 0x50(%rsp), %rdi
callq 0x11dfa0
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x3752f0
cmpl $0x0, %eax
jne 0x31b2f0
cmpl $0x0, 0x5c(%rsp)
jne 0x31b2f0
movq 0x48(%rsp), %rdi
callq 0x375ff0
movl %eax, 0x58(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rax
movq 0xe0(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rax
movq 0x48(%rax), %rdi
callq 0x11dee0
movq %rax, 0x28(%rsp)
movl 0x58(%rsp), %edi
callq 0x3764a0
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq %rax, %r8
leaq 0x27bb57(%rip), %rsi    # 0x596e38
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x5c(%rsp) # imm = 0xFFFFFFFF
movq 0x50(%rsp), %rdi
callq 0x11e110
jmp 0x31b1dd
movq 0x48(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x3752f0
cmpl $0x0, %eax
jne 0x31b377
cmpl $0x0, 0x5c(%rsp)
jne 0x31b377
movq 0x48(%rsp), %rdi
callq 0x375ff0
movl %eax, 0x58(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x70(%rsp), %rax
movq 0x48(%rax), %rdi
callq 0x11dee0
movq %rax, 0x10(%rsp)
movl 0x58(%rsp), %edi
callq 0x3764a0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
leaq 0x27bb04(%rip), %rsi    # 0x596e6c
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x5c(%rsp) # imm = 0xFFFFFFFF
movq 0x70(%rsp), %rax
movzwl 0xda(%rax), %eax
cmpl $0x0, %eax
je 0x31b472
cmpl $0x0, 0x5c(%rsp)
je 0x31b472
movq 0x70(%rsp), %rax
movzwl 0xdc(%rax), %eax
cmpl $0x0, %eax
je 0x31b472
movq 0x70(%rsp), %rax
movq 0x130(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x138(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x168(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x140(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x148(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x150(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x158(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x160(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x170(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x178(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x11fd20
movq 0x70(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x11fd20
movq 0x48(%rsp), %rdi
callq 0x3731e0
movq 0x50(%rsp), %rdi
callq 0x11f560
movl 0x5c(%rsp), %eax
addq $0x78, %rsp
retq
nop