// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/tools/gt_condenseq_hmmsearch.c
// Function: hmmsearch_process_coarse_hits
static int hmmsearch_process_coarse_hits(
                                       char *table_filename,
                                       GtCondenseq *ces,
                                       GtCondenseqHmmsearchArguments *arguments,
                                       GtTimer *timer,
                                       GtLogger *logger,
                                       GtError *err) {
  int had_err = 0;
  FILE *table = NULL;
  GtRBTree *sequences = NULL;
  GtSplitter *splitter = gt_splitter_new();
  GtStr *line = gt_str_new();
  GtStr *query = gt_str_new(),
        *fine_fasta_filename = gt_str_new_cstr("condenseq");
  GtTimer *hmmtimer = NULL;
  GtUword filecount = (GtUword) 1,
          hmmcounter = 1;
  const GtUword fine_fasta_name_length = gt_str_length(fine_fasta_filename),
        table_name_length = gt_str_length(arguments->outtable_filename);
  unsigned int querycount = 0;

  if (timer != NULL) {
    gt_timer_show_progress(timer, "processing coarse hits", stderr);
    hmmtimer = gt_timer_new_with_progress_description("ran 1 fine hmmsearch");
    gt_timer_start(hmmtimer);
  }
  table = gt_xfopen(table_filename, "r");

  sequences = gt_rbtree_new(hmmsearch_cmp_seqnum,
                            hmmsearch_tree_free_node, NULL);

  while (!had_err && gt_str_read_next_line(line, table) == 0) {
    char *c_line = gt_str_get(line);
    GtUword uid;
    const GtUword target_column = 0,
          query_column = (GtUword) 3;

    if (c_line[0] != '#') {
      const char *token, *skip;
      gt_splitter_split_non_empty(splitter, c_line, gt_str_length(line), ' ');
      gt_assert(gt_splitter_size(splitter) >= (GtUword) 23);
      token = gt_splitter_get_token(splitter, target_column);
      /* seqids printed with -debug will contain 'unique' in front of the actual
         id as a number */
      if ((skip = strchr(token, 'e')) != NULL) {
        token=++skip;
      }
      if (gt_parse_uword(&uid, token) == 0) {
        /* old files had a ',' at the end of 'unique000', this leads to an error
           with gt_parse_uword() */
        if (sscanf(token, GT_WU ",", &uid) != 1) {
          gt_error_set(err, "couldn't parse target number: %s", token);
          had_err = -1;
        }
      }
      if (!had_err &&
          (gt_str_length(query) == 0 ||
          strcmp(gt_str_get(query),
                 gt_splitter_get_token(splitter, query_column)) != 0)) {
        gt_str_set(query, gt_splitter_get_token(splitter, query_column));
        querycount++;
        gt_logger_log(logger, "new query (%u): %s", querycount,
                      gt_str_get(query));
      }
      if (!had_err && arguments->max_queries != 0 &&
          querycount > arguments->max_queries) {
        hmmsearch_create_fine_fas(fine_fasta_filename, sequences, ces);
        gt_logger_log(logger, "fine fasta: %s",
                      gt_str_get(fine_fasta_filename));
        if (table_name_length != 0) {
          gt_str_append_uword(arguments->outtable_filename, filecount++);
          gt_str_append_cstr(arguments->outtable_filename, ".tab");
          gt_logger_log(logger, "out table: %s",
                        gt_str_get(arguments->outtable_filename));
        }
        had_err =
          hmmsearch_call_fine_search(table_name_length != 0 ?
                                     arguments->outtable_filename :
                                     NULL,
                                     gt_str_get(fine_fasta_filename),
                                     gt_str_get(arguments->hmmsearch_path),
                                     gt_str_get(arguments->hmm),
                                     arguments->hmm_num_threads,
                                     logger, err);
        if (hmmtimer != NULL)
          gt_timer_show_progress_formatted(hmmtimer, stderr, "ran " GT_WU
                                           " fine hmmsearch", ++hmmcounter);
        gt_rbtree_clear(sequences);
        gt_str_set_length(fine_fasta_filename, fine_fasta_name_length);
        if (table_name_length != 0)
          gt_str_set_length(arguments->outtable_filename, table_name_length);
        querycount = 1;
      }
      if (!had_err) {
        if (gt_condenseq_each_redundant_seq(ces, uid,
                                            hmmsearch_process_seq,
                                            sequences, err) == 0) {
          had_err = -1;
        }
      }
      gt_splitter_reset(splitter);
    }
    gt_str_reset(line);
  }
  gt_splitter_delete(splitter);
  gt_str_delete(line);
  gt_str_delete(query);
  gt_xfclose(table);

  if (!had_err) {
    hmmsearch_create_fine_fas(fine_fasta_filename, sequences, ces);
    gt_logger_log(logger, "fine fasta: %s",
                  gt_str_get(fine_fasta_filename));
    if (table_name_length != 0) {
      gt_str_append_uword(arguments->outtable_filename, filecount);
      gt_str_append_cstr(arguments->outtable_filename, ".tab");
      gt_logger_log(logger, "out table: %s",
                    gt_str_get(arguments->outtable_filename));
    }
    had_err =
      hmmsearch_call_fine_search(table_name_length != 0 ?
                                 arguments->outtable_filename :
                                 NULL,
                                 gt_str_get(fine_fasta_filename),
                                 gt_str_get(arguments->hmmsearch_path),
                                 gt_str_get(arguments->hmm),
                                 arguments->hmm_num_threads,
                                 logger, err);
  }
  if (hmmtimer != NULL)
    gt_timer_show_progress_final(hmmtimer, stderr);

  gt_timer_delete(hmmtimer);
  gt_log_log("created " GT_WU " files", filecount);
  gt_rbtree_delete(sequences);
  gt_str_delete(fine_fasta_filename);
  return had_err;
}

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x160(%rsp)
movq %rsi, 0x158(%rsp)
movq %rdx, 0x150(%rsp)
movq %rcx, 0x148(%rsp)
movq %r8, 0x140(%rsp)
movq %r9, 0x138(%rsp)
movl $0x0, 0x134(%rsp)
movq $0x0, 0x128(%rsp)
movq $0x0, 0x120(%rsp)
callq 0x11afb0
movq %rax, 0x118(%rsp)
callq 0x11d4a0
movq %rax, 0x110(%rsp)
callq 0x11d4a0
movq %rax, 0x108(%rsp)
leaq 0x523863(%rip), %rdi    # 0x54be5b
callq 0x11d510
movq %rax, 0x100(%rsp)
movq $0x0, 0xf8(%rsp)
movq $0x1, 0xf0(%rsp)
movq $0x1, 0xe8(%rsp)
movq 0x100(%rsp), %rdi
callq 0x11dfa0
movq %rax, 0xe0(%rsp)
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x11dfa0
movq %rax, 0xd8(%rsp)
movl $0x0, 0xd4(%rsp)
cmpq $0x0, 0x148(%rsp)
je 0x286ac
movq 0x148(%rsp), %rdi
movq 0x613924(%rip), %rax    # 0x63bfa0
movq (%rax), %rdx
leaq 0x4f2096(%rip), %rsi    # 0x51a71c
callq 0x121930
leaq 0x4f20a1(%rip), %rdi    # 0x51a733
callq 0x1213a0
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x1213f0
movq 0x160(%rsp), %rdi
leaq 0x50391f(%rip), %rsi    # 0x52bfda
callq 0x126af0
movq %rax, 0x128(%rsp)
leaq 0x791(%rip), %rdi       # 0x28e60
leaq 0x84a(%rip), %rsi       # 0x28f20
xorl %eax, %eax
movl %eax, %edx
callq 0x1b7e90
movq %rax, 0x120(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x134(%rsp)
movb %al, 0x9f(%rsp)
jne 0x2871c
movq 0x110(%rsp), %rdi
movq 0x128(%rsp), %rsi
callq 0x11e3a0
cmpl $0x0, %eax
sete %al
movb %al, 0x9f(%rsp)
movb 0x9f(%rsp), %al
testb $0x1, %al
jne 0x2872c
jmp 0x28c3e
movq 0x110(%rsp), %rdi
callq 0x11dee0
movq %rax, 0xc8(%rsp)
movq $0x0, 0xb8(%rsp)
movq $0x3, 0xb0(%rsp)
movq 0xc8(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
je 0x28c2c
movq 0x118(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x110(%rsp), %rdi
callq 0x11dfa0
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rsi
movq %rax, %rdx
movl $0x20, %ecx
callq 0x11b230
movq 0x118(%rsp), %rdi
callq 0x11b5b0
cmpq $0x17, %rax
jae 0x28802
movq 0x6137cf(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x4ed838(%rip), %rsi    # 0x516013
leaq 0x4f1f66(%rip), %rdx    # 0x51a748
leaq 0x4f1f8a(%rip), %rcx    # 0x51a773
leaq 0x4f1b1a(%rip), %r8     # 0x51a30a
movl $0x188, %r9d            # imm = 0x188
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x28804
movq 0x118(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11b4c0
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
movl $0x65, %esi
callq 0x19240
movq %rax, 0xa0(%rsp)
cmpq $0x0, %rax
je 0x28859
movq 0xa0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rsi
leaq 0xc0(%rsp), %rdi
callq 0xf86d0
cmpl $0x0, %eax
jne 0x288c1
movq 0xa8(%rsp), %rdi
leaq 0x550ac6(%rip), %rsi    # 0x579348
leaq 0xc0(%rsp), %rdx
movb $0x0, %al
callq 0x19770
cmpl $0x1, %eax
je 0x288bf
movq 0x138(%rsp), %rdi
movq 0xa8(%rsp), %rdx
leaq 0x4f0c55(%rip), %rsi    # 0x519502
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x134(%rsp) # imm = 0xFFFFFFFF
jmp 0x288c1
cmpl $0x0, 0x134(%rsp)
jne 0x2899a
movq 0x108(%rsp), %rdi
callq 0x11dfa0
cmpq $0x0, %rax
je 0x2891e
movq 0x108(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x80(%rsp)
movq 0x118(%rsp), %rdi
movl $0x3, %esi
callq 0x11b4c0
movq 0x80(%rsp), %rdi
movq %rax, %rsi
callq 0x19980
cmpl $0x0, %eax
je 0x2899a
movq 0x108(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x118(%rsp), %rdi
movl $0x3, %esi
callq 0x11b4c0
movq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0x11d650
movl 0xd4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xd4(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x70(%rsp)
movl 0xd4(%rsp), %eax
movl %eax, 0x7c(%rsp)
movq 0x108(%rsp), %rdi
callq 0x11dee0
movq 0x70(%rsp), %rdi
movl 0x7c(%rsp), %edx
movq %rax, %rcx
leaq 0x4f1dfe(%rip), %rsi    # 0x51a791
movb $0x0, %al
callq 0xe7cd0
cmpl $0x0, 0x134(%rsp)
jne 0x28bd6
movq 0x150(%rsp), %rax
cmpl $0x0, 0x20(%rax)
je 0x28bd6
movl 0xd4(%rsp), %eax
movq 0x150(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jbe 0x28bd6
movq 0x100(%rsp), %rdi
movq 0x120(%rsp), %rsi
movq 0x158(%rsp), %rdx
callq 0x28f40
movq 0x140(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x100(%rsp), %rdi
callq 0x11dee0
movq 0x60(%rsp), %rdi
movq %rax, %rdx
leaq 0x4f1d8c(%rip), %rsi    # 0x51a7a4
movb $0x0, %al
callq 0xe7cd0
cmpq $0x0, 0xd8(%rsp)
je 0x28a9e
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0xf0(%rsp), %rsi
movq %rsi, %rax
addq $0x1, %rax
movq %rax, 0xf0(%rsp)
callq 0x11d930
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x4f1d4e(%rip), %rsi    # 0x51a7b3
callq 0x11d550
movq 0x140(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x11dee0
movq 0x58(%rsp), %rdi
movq %rax, %rdx
leaq 0x4f1d21(%rip), %rsi    # 0x51a7b8
movb $0x0, %al
callq 0xe7cd0
cmpq $0x0, 0xd8(%rsp)
je 0x28abc
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x50(%rsp)
jmp 0x28ac5
xorl %eax, %eax
movq %rax, 0x50(%rsp)
jmp 0x28ac5
movq 0x50(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x100(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x40(%rsp)
movq 0x150(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x11dee0
movq %rax, 0x48(%rsp)
movq 0x150(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x11dee0
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rax, %rcx
movq 0x150(%rsp), %rax
movl 0x24(%rax), %r8d
movq 0x140(%rsp), %r9
movq 0x138(%rsp), %rax
movq %rax, (%rsp)
callq 0x29030
movl %eax, 0x134(%rsp)
cmpq $0x0, 0xf8(%rsp)
je 0x28b85
movq 0xf8(%rsp), %rdi
movq 0x613440(%rip), %rax    # 0x63bfa0
movq (%rax), %rsi
movq 0xe8(%rsp), %rcx
addq $0x1, %rcx
movq %rcx, 0xe8(%rsp)
leaq 0x4f1c48(%rip), %rdx    # 0x51a7c6
movb $0x0, %al
callq 0x121970
movq 0x120(%rsp), %rdi
callq 0x1b7f80
movq 0x100(%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0x11dfd0
cmpq $0x0, 0xd8(%rsp)
je 0x28bcb
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0xd8(%rsp), %rsi
callq 0x11dfd0
movl $0x1, 0xd4(%rsp)
cmpl $0x0, 0x134(%rsp)
jne 0x28c1f
movq 0x158(%rsp), %rdi
movq 0xc0(%rsp), %rsi
movq 0x120(%rsp), %rcx
movq 0x138(%rsp), %r8
leaq 0x729(%rip), %rdx       # 0x29330
callq 0x141560
cmpq $0x0, %rax
jne 0x28c1d
movl $0xffffffff, 0x134(%rsp) # imm = 0xFFFFFFFF
jmp 0x28c1f
movq 0x118(%rsp), %rdi
callq 0x11b540
movq 0x110(%rsp), %rdi
callq 0x11e110
jmp 0x286e7
movq 0x118(%rsp), %rdi
callq 0x11b600
movq 0x110(%rsp), %rdi
callq 0x11f560
movq 0x108(%rsp), %rdi
callq 0x11f560
movq 0x128(%rsp), %rdi
callq 0x126990
cmpl $0x0, 0x134(%rsp)
jne 0x28de5
movq 0x100(%rsp), %rdi
movq 0x120(%rsp), %rsi
movq 0x158(%rsp), %rdx
callq 0x28f40
movq 0x140(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x100(%rsp), %rdi
callq 0x11dee0
movq 0x30(%rsp), %rdi
movq %rax, %rdx
leaq 0x4f1ade(%rip), %rsi    # 0x51a7a4
movb $0x0, %al
callq 0xe7cd0
cmpq $0x0, 0xd8(%rsp)
je 0x28d3d
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0xf0(%rsp), %rsi
callq 0x11d930
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rdi
leaq 0x4f1aaf(%rip), %rsi    # 0x51a7b3
callq 0x11d550
movq 0x140(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x11dee0
movq 0x28(%rsp), %rdi
movq %rax, %rdx
leaq 0x4f1a82(%rip), %rsi    # 0x51a7b8
movb $0x0, %al
callq 0xe7cd0
cmpq $0x0, 0xd8(%rsp)
je 0x28d5b
movq 0x150(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x28d64
xorl %eax, %eax
movq %rax, 0x20(%rsp)
jmp 0x28d64
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x100(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x10(%rsp)
movq 0x150(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x11dee0
movq %rax, 0x18(%rsp)
movq 0x150(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x11dee0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rax, %rcx
movq 0x150(%rsp), %rax
movl 0x24(%rax), %r8d
movq 0x140(%rsp), %r9
movq 0x138(%rsp), %rax
movq %rax, (%rsp)
callq 0x29030
movl %eax, 0x134(%rsp)
cmpq $0x0, 0xf8(%rsp)
je 0x28e07
movq 0xf8(%rsp), %rdi
movq 0x6131a1(%rip), %rax    # 0x63bfa0
movq (%rax), %rsi
callq 0x121d70
movq 0xf8(%rsp), %rdi
callq 0x121f00
movq 0xf0(%rsp), %rsi
leaq 0x4f19ba(%rip), %rdi    # 0x51a7dd
movb $0x0, %al
callq 0xe7740
movq 0x120(%rsp), %rdi
callq 0x1b7f50
movq 0x100(%rsp), %rdi
callq 0x11f560
movl 0x134(%rsp), %eax
addq $0x168, %rsp            # imm = 0x168
retq
nopw %cs:(%rax,%rax)