// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/kmer_database.c
// Function: gt_kmer_database_check_consistency
int gt_kmer_database_check_consistency(GtKmerDatabase *kdb, GtError *err)
{
  int had_err = 0;
  GtUword i,
          j,
          end,
          start = (GtUword) 0;

  gt_error_check(err);

  for (i = 0; !had_err && i < kdb->nu_kmer_codes; i++) {
    end = kdb->offset[i + 1];
    if (start > end) {
      gt_error_set(err, "Kmer Database is inconsistent in offset at kmer: "
          GT_WU ", start: " GT_WU ", end: " GT_WU, i, start, end);
      had_err = - 1;
    }
    for (j = start + 1; !had_err && j < end; j++) {
      if (kdb->positions[j - 1] >= kdb->positions[j]) {
        gt_error_set(err, "Kmer Database is inconsistent in positions at "
            "kmer: " GT_WU ", last startposition: " GT_WU
            ", current startposition " GT_WU, i, kdb->positions[j - 1],
            kdb->positions[j]);
        had_err = -1;
      }
      if (kdb->unique_ids[j - 1] > kdb->unique_ids[j]) {
        gt_error_set(err, "Kmer Database is inconsistent in unique_ids at "
            "kmer: " GT_WU ", last startposition: " GT_WU ", current "
            "startposition " GT_WU,
            i, kdb->unique_ids[j - 1], kdb->unique_ids[j]);
        had_err = -1;
      }
    }
    start = end;
  }

  return had_err;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0x19a04f
movq 0x38(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x19a017
jmp 0x19a04f
movq 0x4a1f82(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x37bfeb(%rip), %rsi    # 0x516013
leaq 0x37c190(%rip), %rdx    # 0x5161bf
leaq 0x3bdc83(%rip), %rcx    # 0x557cb9
leaq 0x3bd6fe(%rip), %r8     # 0x55773b
movl $0x299, %r9d            # imm = 0x299
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x19a051
movq $0x0, 0x28(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x34(%rsp)
movb %al, 0xf(%rsp)
jne 0x19a07c
movq 0x28(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq 0x28(%rcx), %rax
setb %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x19a089
jmp 0x19a225
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
jbe 0x19a0d6
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
leaq 0x3bdc15(%rip), %rsi    # 0x557cdc
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
xorl %eax, %eax
cmpl $0x0, 0x34(%rsp)
movb %al, 0xe(%rsp)
jne 0x19a102
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
setb %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
testb $0x1, %al
jne 0x19a10f
jmp 0x19a208
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq 0x40(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x20(%rsp), %rdx
cmpq (%rcx,%rdx,8), %rax
jb 0x19a181
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rdx
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rcx
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rsi
movq (%rax,%rsi,8), %r8
leaq 0x3bdbb5(%rip), %rsi    # 0x557d27
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq 0x40(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x20(%rsp), %rdx
cmpq (%rcx,%rdx,8), %rax
jbe 0x19a1f3
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rdx
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rcx
movq 0x40(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rsp), %rsi
movq (%rax,%rsi,8), %r8
leaq 0x3bdbaf(%rip), %rsi    # 0x557d93
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x34(%rsp) # imm = 0xFFFFFFFF
jmp 0x19a1f5
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x19a0e4
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x19a05a
movl 0x34(%rsp), %eax
addq $0x48, %rsp
retq
nop