// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/xrf_checker.c
// Function: gt_xrf_checker_is_valid
bool gt_xrf_checker_is_valid(GtXRFChecker *xrc, const char *value, GtError *err)
{
  bool valid = true;
  char *myvalue = gt_cstr_dup(value),
       *dbid = NULL,
       *localid = NULL;
  GtXRFAbbrEntry *e;
  GtUword nof_tokens, i;
  gt_assert(xrc && value);
  gt_error_check(err);

  /* XXX: Thread safety! */
  gt_splitter_reset(xrc->splitter);
  gt_splitter_split(xrc->splitter, myvalue, strlen(myvalue), ',');
  nof_tokens = gt_splitter_size(xrc->splitter);

  for (i = 0; valid && i < nof_tokens; i++) {
    dbid = gt_splitter_get_token(xrc->splitter, i);

    if (!(localid = strchr(dbid, ':'))) {
      gt_error_set(err, "xref \"%s\": separator colon missing", value);
      valid = false;
    }
    if (valid) {
      *localid = '\0';
      if (*(++localid) == '\0') {
        gt_error_set(err, "xref \"%s\": local ID (part after colon) missing",
                     value);
        valid = false;
      }
    }
    if (valid) {
      gt_assert(dbid && localid);
      if (!(e = gt_hashmap_get(xrc->abbrvs, dbid))) {
        gt_error_set(err, "xref \"%s\": unknown database abbreviation \"%s\"",
                     value, dbid);
        valid = false;
      }
    }
    if (valid) {
      /* TODO: use #defines here. */
      const char *regex = NULL;
      gt_assert(e);
      if ((regex = gt_xrf_abbr_entry_get_value(e, "local_id_syntax"))) {
        bool match = false;
        GT_UNUSED int rval;
        rval = gt_grep(&match, regex, localid, NULL);
        gt_assert(rval == 0); /* regex format has been checked before */
        if (!match) {
          gt_error_set(err, "xref \"%s\": local ID \"%s\" does not "
                            "conform to syntax \"%s\" for the "
                            "%s database",
                       value, localid, regex, dbid);
          valid = false;
        }
      }
    }
  }

  gt_free(myvalue);
  return valid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x722dc
movq %rbx, 0x20(%rsp)
testq %rbx, %rbx
je 0x4c5ef
testq %r12, %r12
je 0x4c5ef
movq %rax, %r14
testq %r15, %r15
je 0x4c40a
movq %r15, %rdi
callq 0x3566a
testb %al, %al
jne 0x4c5f4
movq 0x20(%rsp), %r13
movq 0x10(%r13), %rdi
callq 0x3a9a9
movq 0x10(%r13), %rbx
movq %r14, %rdi
callq 0xb260
movq %rbx, %rdi
movq %r14, 0x28(%rsp)
movq %r14, %rsi
movq %rax, %rdx
movl $0x2c, %ecx
callq 0x3a7af
movq 0x10(%r13), %rdi
callq 0x3a9cc
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x4c5b2
movq %r12, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movb $0x1, %bpl
movl $0x1, %r12d
leaq -0x1(%r12), %rsi
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x3a990
movq %rax, %r14
movq %rax, %rdi
movl $0x3a, %esi
callq 0xb210
movq %rax, %r13
testq %rax, %rax
jne 0x4c4ab
xorl %ebp, %ebp
movq 0x18(%rsp), %rdi
leaq 0x9de58(%rip), %rsi     # 0xea2f7
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x3559f
testb $0x1, %bpl
je 0x4c4df
movb $0x0, (%r13)
movq %r13, %r15
incq %r15
cmpb $0x0, 0x1(%r13)
jne 0x4c4e2
xorl %ebp, %ebp
movq 0x18(%rsp), %rdi
leaq 0x9de49(%rip), %rsi     # 0xea31a
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x3559f
jmp 0x4c4e2
movq %r13, %r15
testb $0x1, %bpl
je 0x4c531
testq %r14, %r14
je 0x4c5e5
testq %r15, %r15
je 0x4c5e5
movq 0x20(%rsp), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x77109
movq %rax, %rbx
testq %rax, %rax
jne 0x4c531
xorl %ebx, %ebx
movq 0x18(%rsp), %rdi
leaq 0x9de39(%rip), %rsi     # 0xea359
movq 0x10(%rsp), %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x3559f
xorl %ebp, %ebp
testb $0x1, %bpl
je 0x4c59c
testq %rbx, %rbx
je 0x4c5e0
movq %rbx, %rdi
leaq 0x9de3d(%rip), %rsi     # 0xea387
callq 0x86b65
testq %rax, %rax
je 0x4c59c
movq %rax, %r13
movb $0x0, 0xf(%rsp)
leaq 0xf(%rsp), %rdi
movq %rax, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x76504
testl %eax, %eax
jne 0x4c5ea
cmpb $0x0, 0xf(%rsp)
jne 0x4c59c
xorl %ebp, %ebp
movq 0x18(%rsp), %rdi
leaq 0x9de10(%rip), %rsi     # 0xea397
movq 0x10(%rsp), %rdx
movq %r15, %rcx
movq %r13, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x3559f
cmpq 0x30(%rsp), %r12
jae 0x4c5b5
incq %r12
testb $0x1, %bpl
jne 0x4c466
jmp 0x4c5b5
movb $0x1, %bpl
leaq 0x9dd20(%rip), %rsi     # 0xea2dc
movq 0x28(%rsp), %rdi
movl $0x65, %edx
callq 0x362a0
andb $0x1, %bpl
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x15447
callq 0x153d9
callq 0x15410
callq 0x1536b
callq 0x153a2