// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/md5set.c
// Function: gt_md5set_add_sequence
GtMD5SetStatus gt_md5set_add_sequence(GtMD5Set *set, const char* seq,
                                      GtUword seqlen, bool both_strands,
                                      GtError *err)
{
  md5_t md5sum, md5sum_rc;
  GtUword i;
  int retval = 0;
  bool found;

  gt_assert(set != NULL);
  gt_assert(set->table != NULL);

  md5set_prepare_buffer(set, seqlen);
  for (i = 0; i < seqlen; i++)
    set->buffer[i] = toupper(seq[i]);

  MD5SET_HASH_STRING(set->buffer, seqlen, md5sum);
  found = md5set_search(set, md5sum, true);
  if (found)
    return GT_MD5SET_FOUND;

  if (both_strands) {
    retval = gt_reverse_complement(set->buffer, seqlen, err);
    if (retval != 0) {
      gt_assert(retval < 0);
      return GT_MD5SET_ERROR;
    }

    MD5SET_HASH_STRING(set->buffer, seqlen, md5sum_rc);
    /* if the MD5 sum of the reverse complement equals the MD5 sum of the
       sequence itself we don't check if the reverse complement is in the set.
       Otherwise such sequences would never be added to the set at all. */
    if (md5sum_rc.l == md5sum.l && md5sum_rc.h == md5sum.h) {
      return GT_MD5SET_NOT_FOUND;
    }
    found = md5set_search(set, md5sum_rc, false);
    if (found)
      return GT_MD5SET_RC_FOUND;
  }

  return GT_MD5SET_NOT_FOUND;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rdi, %rdi
je 0x1003e3
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x100411
movq %r8, %r15
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r12
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x1002b2
cmpq %r14, 0x28(%rbx)
jae 0x1002d2
leaq 0x28(%rbx), %r13
leaq 0x227ba0(%rip), %rdx    # 0x327e3f
movq %r14, %rsi
movl $0xe5, %ecx
callq 0x93472
movq %rax, 0x20(%rbx)
jmp 0x1002ce
leaq 0x227b86(%rip), %rsi    # 0x327e3f
movq %r14, %rdi
movl $0xe1, %edx
callq 0x93160
movq %rax, 0x20(%rbx)
leaq 0x28(%rbx), %r13
movq %r14, (%r13)
xorl %r13d, %r13d
cmpq %r13, %r14
je 0x1002f7
callq 0x170c0
movq (%rax), %rax
movsbq (%r12,%r13), %rcx
movb (%rax,%rcx,4), %al
movq 0x20(%rbx), %rcx
movb %al, (%rcx,%r13)
incq %r13
jmp 0x1002d5
movq 0x20(%rbx), %r12
leaq 0x227b3d(%rip), %rsi    # 0x327e3f
leaq -0x5bc81(%rip), %rcx    # 0xa4688
movq %r14, %rdi
movl $0xfd, %edx
xorl %r8d, %r8d
callq 0xa477a
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x1eef58
movq (%r13), %rsi
movq 0x8(%r13), %rdx
pushq $0x1
popq %r12
movq %rbx, %rdi
movl %r12d, %ecx
callq 0x100477
testb %al, %al
jne 0x1003d1
testb %bpl, %bpl
je 0x1003ce
movq 0x20(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x111ab8
testl %eax, %eax
je 0x10036f
jns 0x100449
pushq $-0x1
popq %r12
jmp 0x1003d1
movq 0x20(%rbx), %r15
leaq 0x227ac5(%rip), %rsi    # 0x327e3f
leaq -0x5bcf9(%rip), %rcx    # 0xa4688
xorl %r12d, %r12d
movq %r14, %rdi
movl $0x109, %edx            # imm = 0x109
xorl %r8d, %r8d
callq 0xa477a
leaq 0x18(%rsp), %r14
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x1eef58
movq (%r14), %rsi
movq 0x8(%r14), %rdx
cmpq 0x8(%rsp), %rsi
jne 0x1003bc
cmpq 0x10(%rsp), %rdx
je 0x1003d1
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x100477
testb %al, %al
je 0x1003ce
pushq $0x2
jmp 0x10036b
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x337b7e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e4c1f(%rip), %rsi    # 0x2e5013
leaq 0x2500e6(%rip), %rdx    # 0x3504e1
leaq 0x227a80(%rip), %rcx    # 0x327e82
leaq 0x227a36(%rip), %r8     # 0x327e3f
movl $0xf6, %r9d
jmp 0x10043d
movq 0x337b50(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e4bf1(%rip), %rsi    # 0x2e5013
leaq 0x227a70(%rip), %rdx    # 0x327e99
leaq 0x227a52(%rip), %rcx    # 0x327e82
leaq 0x227a08(%rip), %r8     # 0x327e3f
movl $0xf7, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x337b18(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1e4bb9(%rip), %rsi    # 0x2e5013
leaq 0x227a4b(%rip), %rdx    # 0x327eac
leaq 0x227a1a(%rip), %rcx    # 0x327e82
leaq 0x2279d0(%rip), %r8     # 0x327e3f
movl $0x105, %r9d            # imm = 0x105
jmp 0x10043d