// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/ltr/pdom_model_set.c
// Function: gt_pdom_model_set_new
GtPdomModelSet* gt_pdom_model_set_new(GtStrArray *hmmfiles, bool force,
                                      GtError *err)
{
  GtStr *concat_dbnames, *cmdline, *indexfilename = NULL;
  GtUword i;
  char *md5_hash, ch;
  const char *tmpdir;
  int had_err = 0, rval;
  FILE *dest;
  GtPdomModelSet *pdom_model_set;
  gt_assert(hmmfiles);
  gt_error_check(err);

  rval = system("hmmpress -h > /dev/null");
  if (WEXITSTATUS(rval) != 0) {
    gt_error_set(err, "Error running hmmpress. "
                      PDOM_MODEL_SET_HMMER_NOT_FOUND);
    return NULL;
  }
  rval = system("hmmconvert -h > /dev/null");
  if (WEXITSTATUS(rval) != 0) {
    gt_error_set(err, "Error running hmmconvert. "
                      PDOM_MODEL_SET_HMMER_NOT_FOUND);
    return NULL;
  }

  pdom_model_set = gt_calloc((size_t) 1, sizeof (GtPdomModelSet));
  concat_dbnames = gt_str_new();
  for (i = 0; !had_err && i < gt_str_array_size(hmmfiles); i++) {
    const char *filename = gt_str_array_get(hmmfiles, i);
    if (!gt_file_exists(filename)) {
      gt_error_set(err, "invalid HMM file: %s", filename);
      gt_str_delete(concat_dbnames);
      gt_free(pdom_model_set);
      return NULL;
    } else {
      FILE *fp;
      char line[BUFSIZ];
      GtUword lineno = 0;
      size_t len = 0;

      fp = fopen(filename, "r");
      if (fp == NULL) {
        gt_error_set(err, "can't open HMM file: %s", filename);
        gt_str_delete(concat_dbnames);
        gt_free(pdom_model_set);
        return NULL;
      }

      while (fgets(line, BUFSIZ, fp) != NULL) {
        len = strlen(line);
        lineno++;
        if (len > 5 && strncmp(line, "ALPH", 4 * sizeof (char)) == 0) {
          if (len > 9 && (strncmp(line, "ALPH  Amino", 11 * sizeof (char)) == 0
                     || strncmp(line, "ALPH  amino", 11 * sizeof (char)) == 0
                     || strncmp(line, "ALPH  AMINO", 11 * sizeof (char)) == 0))
          {
            break;
          } else {
            gt_error_set(err, "invalid (non-protein) alphabet definition "
                              "in %s line "GT_WU, filename, lineno);
            gt_str_delete(concat_dbnames);
            gt_free(pdom_model_set);
            fclose(fp);
            return NULL;
          }
        }
      }
      fclose(fp);
      gt_str_append_cstr(concat_dbnames, filename);
    }
  }
  if (!had_err) {
    pdom_model_set->filename = gt_str_new();
    if (!(tmpdir = getenv("TMPDIR")))
      tmpdir = "/tmp";
    gt_str_append_cstr(pdom_model_set->filename, tmpdir);
    gt_str_append_char(pdom_model_set->filename, GT_PATH_SEPARATOR);
    md5_hash = gt_md5_fingerprint(gt_str_get(concat_dbnames),
                                  gt_str_length(concat_dbnames));
    gt_str_append_cstr(pdom_model_set->filename, md5_hash);
    gt_free(md5_hash);
    indexfilename = gt_str_new_cstr(gt_str_get(pdom_model_set->filename));
    gt_str_append_cstr(indexfilename, GT_HMM_INDEX_SUFFIX);
  }

  if (!gt_file_exists(gt_str_get(indexfilename)) || force) {
    dest = fopen(gt_str_get(pdom_model_set->filename), "w+");
    if (!dest) {
      gt_error_set(err, "could not create file %s",
                 gt_str_get(pdom_model_set->filename));
      had_err = -1;
    }
    if (!had_err) {
      for (i = 0; !had_err && i < gt_str_array_size(hmmfiles); i++) {
        FILE *source;
        char cmd[BUFSIZ];
        (void) snprintf(cmd, BUFSIZ, "hmmconvert %s",
                        gt_str_array_get(hmmfiles, i));
        source = popen(cmd, "r");
        if (!source) {
          gt_error_set(err, "error opening/converting HMM file %s",
                            gt_str_array_get(hmmfiles, i));
          had_err = -1;
          gt_pdom_model_set_delete_index(gt_str_get(pdom_model_set->filename));
        }
        if (!had_err) {
          GtWord len = 0;
          while ((ch = fgetc(source)) != EOF) {
            (void) fputc(ch, dest);
            len++;
          }
          (void) pclose(source);
          if (len == 0) {
            gt_error_set(err, "invalid HMMER format encountered trying to "
                              "convert HMM file %s",
                              gt_str_array_get(hmmfiles, i));
            had_err = -1;
            gt_pdom_model_set_delete_index
                                         (gt_str_get(pdom_model_set->filename));
          }
        }
      }
      (void) fclose(dest);
    }
    if (!had_err) {
      cmdline = gt_str_new_cstr("hmmpress -f ");
      gt_str_append_str(cmdline, pdom_model_set->filename);
      gt_str_append_cstr(cmdline, "> /dev/null");   /* XXX: portability? */

      rval = system(gt_str_get(cmdline));
      gt_str_delete(cmdline);
      if (WEXITSTATUS(rval) != 0) {
        gt_error_set(err, "Error executing hmmpress. "
                          "Please make sure your pHMMs are valid and"
                          "share a common version (e.g. HMMER2 or HMMER3).");
        had_err = -1;
      }
    }
  }

  if (had_err) {
    gt_pdom_model_set_delete(pdom_model_set);
    pdom_model_set = NULL;
  }
  gt_str_delete(indexfilename);
  gt_str_delete(concat_dbnames);
  return pdom_model_set;
}

// Assembly:
subq $0x40f8, %rsp           # imm = 0x40F8
movb %sil, %al
movq %rdi, 0x40e8(%rsp)
andb $0x1, %al
movb %al, 0x40e7(%rsp)
movq %rdx, 0x40d8(%rsp)
movq $0x0, 0x40c0(%rsp)
movl $0x0, 0x409c(%rsp)
cmpq $0x0, 0x40e8(%rsp)
jne 0x31443d
movq 0x327b94(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x201bfd(%rip), %rsi    # 0x516013
leaq 0x28064b(%rip), %rdx    # 0x594a68
leaq 0x28064d(%rip), %rcx    # 0x594a71
leaq 0x28065c(%rip), %r8     # 0x594a87
movl $0x49, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x31443f
jmp 0x314441
cmpq $0x0, 0x40d8(%rsp)
je 0x314497
movq 0x40d8(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x31445f
jmp 0x314497
movq 0x327b3a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x201ba3(%rip), %rsi    # 0x516013
leaq 0x201d48(%rip), %rdx    # 0x5161bf
leaq 0x2805f3(%rip), %rcx    # 0x594a71
leaq 0x280602(%rip), %r8     # 0x594a87
movl $0x4a, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x314499
leaq 0x280600(%rip), %rdi    # 0x594aa0
callq 0x19650
movl %eax, 0x4098(%rsp)
movl 0x4098(%rsp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
cmpl $0x0, %eax
je 0x3144e7
movq 0x40d8(%rsp), %rdi
leaq 0x2805e9(%rip), %rsi    # 0x594ab8
movb $0x0, %al
callq 0xd88c0
movq $0x0, 0x40f0(%rsp)
jmp 0x314d16
leaq 0x280620(%rip), %rdi    # 0x594b0e
callq 0x19650
movl %eax, 0x4098(%rsp)
movl 0x4098(%rsp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
cmpl $0x0, %eax
je 0x314535
movq 0x40d8(%rsp), %rdi
leaq 0x28060b(%rip), %rsi    # 0x594b28
movb $0x0, %al
callq 0xd88c0
movq $0x0, 0x40f0(%rsp)
jmp 0x314d16
movl $0x1, %edi
movl $0x8, %esi
leaq 0x280541(%rip), %rdx    # 0x594a87
movl $0x59, %ecx
callq 0xe83c0
movq %rax, 0x4088(%rsp)
callq 0x11d4a0
movq %rax, 0x40d0(%rsp)
movq $0x0, 0x40b8(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x409c(%rsp)
movb %al, 0x47(%rsp)
jne 0x3145ad
movq 0x40b8(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x40e8(%rsp), %rdi
callq 0x11fcc0
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
setb %al
movb %al, 0x47(%rsp)
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0x3145ba
jmp 0x314864
movq 0x40e8(%rsp), %rdi
movq 0x40b8(%rsp), %rsi
callq 0x11f8c0
movq %rax, 0x4080(%rsp)
movq 0x4080(%rsp), %rdi
callq 0xde820
testb $0x1, %al
jne 0x31463d
movq 0x40d8(%rsp), %rdi
movq 0x4080(%rsp), %rdx
leaq 0x280581(%rip), %rsi    # 0x594b80
movb $0x0, %al
callq 0xd88c0
movq 0x40d0(%rsp), %rdi
callq 0x11f560
movq 0x4088(%rsp), %rdi
leaq 0x280465(%rip), %rsi    # 0x594a87
movl $0x60, %edx
callq 0xe88c0
movq $0x0, 0x40f0(%rsp)
jmp 0x314d16
movq $0x0, 0x2068(%rsp)
movq $0x0, 0x2060(%rsp)
movq 0x4080(%rsp), %rdi
leaq 0x217976(%rip), %rsi    # 0x52bfda
callq 0x19800
movq %rax, 0x4078(%rsp)
cmpq $0x0, 0x4078(%rsp)
jne 0x3146d1
movq 0x40d8(%rsp), %rdi
movq 0x4080(%rsp), %rdx
leaq 0x280502(%rip), %rsi    # 0x594b95
movb $0x0, %al
callq 0xd88c0
movq 0x40d0(%rsp), %rdi
callq 0x11f560
movq 0x4088(%rsp), %rdi
leaq 0x2803d1(%rip), %rsi    # 0x594a87
movl $0x6c, %edx
callq 0xe88c0
movq $0x0, 0x40f0(%rsp)
jmp 0x314d16
jmp 0x3146d3
leaq 0x2070(%rsp), %rdi
movq 0x4078(%rsp), %rdx
movl $0x2000, %esi           # imm = 0x2000
callq 0x19b60
cmpq $0x0, %rax
je 0x314827
leaq 0x2070(%rsp), %rdi
callq 0x192b0
movq %rax, 0x2060(%rsp)
movq 0x2068(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x2068(%rsp)
cmpq $0x5, 0x2060(%rsp)
jbe 0x314822
leaq 0x2070(%rsp), %rdi
leaq 0x28046f(%rip), %rsi    # 0x594bad
movl $0x4, %edx
callq 0x192f0
cmpl $0x0, %eax
jne 0x314822
cmpq $0x9, 0x2060(%rsp)
jbe 0x3147b8
leaq 0x2070(%rsp), %rdi
leaq 0x280447(%rip), %rsi    # 0x594bb2
movl $0xb, %edx
callq 0x192f0
cmpl $0x0, %eax
je 0x3147b6
leaq 0x2070(%rsp), %rdi
leaq 0x280435(%rip), %rsi    # 0x594bbe
movl $0xb, %edx
callq 0x192f0
cmpl $0x0, %eax
je 0x3147b6
leaq 0x2070(%rsp), %rdi
leaq 0x280423(%rip), %rsi    # 0x594bca
movl $0xb, %edx
callq 0x192f0
cmpl $0x0, %eax
jne 0x3147b8
jmp 0x314827
movq 0x40d8(%rsp), %rdi
movq 0x4080(%rsp), %rdx
movq 0x2068(%rsp), %rcx
leaq 0x2803ff(%rip), %rsi    # 0x594bd6
movb $0x0, %al
callq 0xd88c0
movq 0x40d0(%rsp), %rdi
callq 0x11f560
movq 0x4088(%rsp), %rdi
leaq 0x28028d(%rip), %rsi    # 0x594a87
movl $0x7d, %edx
callq 0xe88c0
movq 0x4078(%rsp), %rdi
callq 0x19780
movq $0x0, 0x40f0(%rsp)
jmp 0x314d16
jmp 0x3146d3
movq 0x4078(%rsp), %rdi
callq 0x19780
movq 0x40d0(%rsp), %rdi
movq 0x4080(%rsp), %rsi
callq 0x11d550
jmp 0x31484b
movq 0x40b8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40b8(%rsp)
jmp 0x314571
cmpl $0x0, 0x409c(%rsp)
jne 0x314974
callq 0x11d4a0
movq %rax, %rcx
movq 0x4088(%rsp), %rax
movq %rcx, (%rax)
leaq 0x2967fa(%rip), %rdi    # 0x5ab086
callq 0x198a0
movq %rax, 0x40a0(%rsp)
cmpq $0x0, %rax
jne 0x3148ae
leaq 0x226c1e(%rip), %rax    # 0x53b4c4
movq %rax, 0x40a0(%rsp)
movq 0x4088(%rsp), %rax
movq (%rax), %rdi
movq 0x40a0(%rsp), %rsi
callq 0x11d550
movq 0x4088(%rsp), %rax
movq (%rax), %rdi
movl $0x2f, %esi
callq 0x11da70
movq 0x40d0(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x30(%rsp)
movq 0x40d0(%rsp), %rdi
callq 0x11dfa0
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0xeeef0
movq %rax, 0x40b0(%rsp)
movq 0x4088(%rsp), %rax
movq (%rax), %rdi
movq 0x40b0(%rsp), %rsi
callq 0x11d550
movq 0x40b0(%rsp), %rdi
leaq 0x280151(%rip), %rsi    # 0x594a87
movl $0x90, %edx
callq 0xe88c0
movq 0x4088(%rsp), %rax
movq (%rax), %rdi
callq 0x11dee0
movq %rax, %rdi
callq 0x11d510
movq %rax, 0x40c0(%rsp)
movq 0x40c0(%rsp), %rdi
leaq 0x2803fb(%rip), %rsi    # 0x594d6a
callq 0x11d550
movq 0x40c0(%rsp), %rdi
callq 0x11dee0
movq %rax, %rdi
callq 0xde820
testb $0x1, %al
jne 0x31498f
jmp 0x31499d
testb $0x1, 0x40e7(%rsp)
je 0x314cc9
movq 0x4088(%rsp), %rax
movq (%rax), %rdi
callq 0x11dee0
movq %rax, %rdi
leaq 0x201ced(%rip), %rsi    # 0x5166a4
callq 0x19800
movq %rax, 0x4090(%rsp)
cmpq $0x0, 0x4090(%rsp)
jne 0x314a0d
movq 0x40d8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x4088(%rsp), %rax
movq (%rax), %rdi
callq 0x11dee0
movq 0x28(%rsp), %rdi
movq %rax, %rdx
leaq 0x280214(%rip), %rsi    # 0x594c0f
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x409c(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x409c(%rsp)
jne 0x314c19
movq $0x0, 0x40b8(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x409c(%rsp)
movb %al, 0x27(%rsp)
jne 0x314a63
movq 0x40b8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40e8(%rsp), %rdi
callq 0x11fcc0
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
setb %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x314a70
jmp 0x314c0c
leaq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x40e8(%rsp), %rdi
movq 0x40b8(%rsp), %rsi
callq 0x11f8c0
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl $0x2000, %esi           # imm = 0x2000
leaq 0x280185(%rip), %rdx    # 0x594c28
movb $0x0, %al
callq 0x19b90
leaq 0x50(%rsp), %rdi
leaq 0x217524(%rip), %rsi    # 0x52bfda
callq 0x191d0
movq %rax, 0x2058(%rsp)
cmpq $0x0, 0x2058(%rsp)
jne 0x314b29
movq 0x40d8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x40e8(%rsp), %rdi
movq 0x40b8(%rsp), %rsi
callq 0x11f8c0
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x280137(%rip), %rsi    # 0x594c36
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x409c(%rsp) # imm = 0xFFFFFFFF
movq 0x4088(%rsp), %rax
movq (%rax), %rdi
callq 0x11dee0
movq %rax, %rdi
callq 0x314d30
cmpl $0x0, 0x409c(%rsp)
jne 0x314bf1
movq $0x0, 0x48(%rsp)
movq 0x2058(%rsp), %rdi
callq 0x19b50
movb %al, 0x40af(%rsp)
movsbl %al, %eax
cmpl $-0x1, %eax
je 0x314b81
movsbl 0x40af(%rsp), %edi
movq 0x4090(%rsp), %rsi
callq 0x198d0
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x314b40
movq 0x2058(%rsp), %rdi
callq 0x199b0
cmpq $0x0, 0x48(%rsp)
jne 0x314bef
movq 0x40d8(%rsp), %rax
movq %rax, (%rsp)
movq 0x40e8(%rsp), %rdi
movq 0x40b8(%rsp), %rsi
callq 0x11f8c0
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x280096(%rip), %rsi    # 0x594c5b
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x409c(%rsp) # imm = 0xFFFFFFFF
movq 0x4088(%rsp), %rax
movq (%rax), %rdi
callq 0x11dee0
movq %rax, %rdi
callq 0x314d30
jmp 0x314bf1
jmp 0x314bf3
movq 0x40b8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x40b8(%rsp)
jmp 0x314a27
movq 0x4090(%rsp), %rdi
callq 0x19780
cmpl $0x0, 0x409c(%rsp)
jne 0x314cc7
leaq 0x28006c(%rip), %rdi    # 0x594c9a
callq 0x11d510
movq %rax, 0x40c8(%rsp)
movq 0x40c8(%rsp), %rdi
movq 0x4088(%rsp), %rax
movq (%rax), %rsi
callq 0x11d750
movq 0x40c8(%rsp), %rdi
leaq 0x27e960(%rip), %rsi    # 0x5935c2
callq 0x11d550
movq 0x40c8(%rsp), %rdi
callq 0x11dee0
movq %rax, %rdi
callq 0x19650
movl %eax, 0x4098(%rsp)
movq 0x40c8(%rsp), %rdi
callq 0x11f560
movl 0x4098(%rsp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
cmpl $0x0, %eax
je 0x314cc5
movq 0x40d8(%rsp), %rdi
leaq 0x27fff4(%rip), %rsi    # 0x594ca7
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x409c(%rsp) # imm = 0xFFFFFFFF
jmp 0x314cc7
jmp 0x314cc9
cmpl $0x0, 0x409c(%rsp)
je 0x314cec
movq 0x4088(%rsp), %rdi
callq 0x314e40
movq $0x0, 0x4088(%rsp)
movq 0x40c0(%rsp), %rdi
callq 0x11f560
movq 0x40d0(%rsp), %rdi
callq 0x11f560
movq 0x4088(%rsp), %rax
movq %rax, 0x40f0(%rsp)
movq 0x40f0(%rsp), %rax
addq $0x40f8, %rsp           # imm = 0x40F8
retq
nopw %cs:(%rax,%rax)