// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/match/reads2twobit.c
// Function: gt_reads2twobit_add_library
int gt_reads2twobit_add_library(GtReads2Twobit *r2t, const GtStr *libspec,
    GtError *err)
{
  GtSplitter *s1, *s2;
  char *libspec_copy;
  int had_err = 0;

  gt_assert(r2t != NULL);
  gt_assert(libspec != NULL);
  gt_assert(gt_str_length(libspec) > 0);
  libspec_copy = gt_malloc(sizeof (*libspec_copy) *
      (gt_str_length(libspec) + 1UL));
  (void)strcpy(libspec_copy, gt_str_get(libspec));
  s1 = gt_splitter_new();
  gt_splitter_split(s1, libspec_copy, gt_str_length(libspec),
      GT_READS2TWOBIT_LIBSPECSEP);
  gt_log_log("reads2twobit add library: %s", gt_str_get(libspec));
  if (gt_splitter_size(s1) == 1UL)
  {
    gt_reads2twobit_add(r2t, false, libspec, NULL, 0, 0);
  }
  else if (gt_splitter_size(s1) < 4UL)
  {
    GtStr *filename1, *filename2;
    GtUword insertlength = 0, stdev = 0;
    char *insertspec, *insertspec_copy;
    r2t->has_paired = true;
    filename1 = gt_str_new_cstr(gt_splitter_get_token(s1, 0));
    if (gt_splitter_size(s1) == 3UL)
    {
      filename2 = gt_str_new_cstr(gt_splitter_get_token(s1, 1UL));
      insertspec = gt_splitter_get_token(s1, 2UL);
    }
    else
    {
      filename2 = NULL;
      insertspec = gt_splitter_get_token(s1, 1UL);
    }
    s2 = gt_splitter_new();
    insertspec_copy = gt_malloc(sizeof (*insertspec_copy) *
        (strlen(insertspec) + 1UL));
    (void)strcpy(insertspec_copy, insertspec);
    gt_splitter_split(s2, insertspec_copy, (GtUword)strlen(insertspec),
      GT_READS2TWOBIT_INSERTSEP);
    if (gt_splitter_size(s2) <= 2UL)
    {
      had_err = gt_parse_uword(&insertlength, gt_splitter_get_token(s2, 0));
      if (gt_splitter_size(s2) == 2UL && !had_err)
      {
        had_err = gt_parse_uword(&stdev, gt_splitter_get_token(s2, 1UL));
      }
    }
    if (gt_splitter_size(s2) > 2UL || had_err)
    {
      gt_error_set(err, "insert specification not valid: %s\nthe correct "
          "syntax is \"insertlength[%cstdev]\"", insertspec,
          GT_READS2TWOBIT_INSERTSEP);
    }
    if (!had_err)
    {
      gt_reads2twobit_add(r2t, true, filename1, filename2, insertlength, stdev);
    }
    gt_str_delete(filename1);
    gt_str_delete(filename2);
    gt_free(insertspec_copy);
    gt_splitter_delete(s2);
  }
  else
  {
    gt_error_set(err, "library specification not valid: %s\nthe correct "
        "syntax is \"filename[[%cfilename2]%cinsertlength[%cstdev]]\"\n"
        "(filenames are not allowed to contain \"%c\"",
        gt_str_get(libspec),
      GT_READS2TWOBIT_LIBSPECSEP, GT_READS2TWOBIT_LIBSPECSEP,
      GT_READS2TWOBIT_INSERTSEP, GT_READS2TWOBIT_LIBSPECSEP);
    had_err = -1;
  }
  gt_free(libspec_copy);
  gt_splitter_delete(s1);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
testq %rdi, %rdi
je 0x1db567
movq %rsi, %r12
testq %rsi, %rsi
je 0x1db56c
movq %rdx, %rbp
movq %rdi, %r15
movq %r12, %rdi
callq 0x11b0ca
testq %rax, %rax
je 0x1db571
movq %r12, %rdi
callq 0x11b0ca
leaq 0x1(%rax), %rdi
leaq 0x1d6f54(%rip), %rsi    # 0x3b21f4
movl $0xb6, %edx
callq 0x104226
movq %rax, %rbx
movq %r12, %rdi
callq 0x11b0a1
movq %rbx, %rdi
movq %rax, %rsi
callq 0x17770
callq 0x119478
movq %rax, %r14
movq %r12, %rdi
callq 0x11b0ca
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
movl $0x3a, %ecx
callq 0x119493
movq %r12, %rdi
callq 0x11b0a1
leaq 0x1d6fb5(%rip), %rdi    # 0x3b22a7
xorl %r13d, %r13d
movq %rax, %rsi
xorl %eax, %eax
callq 0x103d72
movq %r14, %rdi
callq 0x1196b0
cmpq $0x1, %rax
jne 0x1db327
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x1db182
jmp 0x1db539
movq %r14, %rdi
callq 0x1196b0
cmpq $0x3, %rax
ja 0x1db3ab
movq %rbp, 0x30(%rsp)
xorl %r13d, %r13d
movq %r13, 0x20(%rsp)
movq %r13, 0x18(%rsp)
movb $0x1, 0x90(%r15)
movq %r14, %rdi
xorl %esi, %esi
callq 0x119674
movq %rax, %rdi
callq 0x11acc9
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1196b0
movq %rax, %rbp
movl $0x1, %esi
movq %r14, %rdi
callq 0x119674
movq %rax, %r12
cmpq $0x3, %rbp
movq %r15, 0x38(%rsp)
jne 0x1db3ea
movq %r12, %rdi
callq 0x11acc9
movq %rax, 0x8(%rsp)
movl $0x2, %esi
movq %r14, %rdi
callq 0x119674
movq %rax, %r12
jmp 0x1db3f3
movq %r12, %rdi
callq 0x11b0a1
movl $0x3a, (%rsp)
leaq 0x1d6f54(%rip), %rsi    # 0x3b2315
movq %rbp, %rdi
movq %rax, %rdx
movl $0x3a, %ecx
movl $0x3a, %r8d
movl $0x2c, %r9d
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x1db539
movq $0x0, 0x8(%rsp)
callq 0x119478
movq %rax, %r15
movq %r12, %rdi
callq 0x172f0
leaq 0x1(%rax), %rdi
leaq 0x1d6de6(%rip), %rsi    # 0x3b21f4
movl $0xd3, %edx
callq 0x104226
movq %rax, %rbp
movq %rax, %rdi
movq %r12, %rsi
callq 0x17770
movq %r12, 0x28(%rsp)
movq %r12, %rdi
movq %r15, %r12
callq 0x172f0
movq %r15, %rdi
movq %rbp, 0x40(%rsp)
movq %rbp, %rsi
movq %rax, %rdx
movl $0x2c, %ecx
callq 0x119493
movq %r15, %rdi
callq 0x1196b0
cmpq $0x2, %rax
ja 0x1db4ac
movq %r12, %rdi
xorl %esi, %esi
callq 0x119674
leaq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x10b217
movl %eax, %r13d
movq %r12, %rdi
callq 0x1196b0
cmpq $0x2, %rax
setne %al
testl %r13d, %r13d
setne %cl
orb %al, %cl
jne 0x1db4ac
movl $0x1, %esi
movq %r12, %rdi
callq 0x119674
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x10b217
movl %eax, %r13d
movq %r12, %rdi
callq 0x1196b0
cmpq $0x2, %rax
movq 0x38(%rsp), %r15
ja 0x1db4c4
testl %r13d, %r13d
je 0x1db4e6
leaq 0x1d6df9(%rip), %rsi    # 0x3b22c4
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x2c, %ecx
xorl %eax, %eax
callq 0xfcb67
testl %r13d, %r13d
jne 0x1db507
movq 0x20(%rsp), %r8
movq 0x18(%rsp), %r9
movq %r15, %rdi
movl $0x1, %esi
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rcx
callq 0x1db182
movq 0x10(%rsp), %rdi
callq 0x11bdbf
movq 0x8(%rsp), %rdi
callq 0x11bdbf
leaq 0x1d6cd2(%rip), %rsi    # 0x3b21f4
movq 0x40(%rsp), %rdi
movl $0xeb, %edx
callq 0x1045eb
movq %r12, %rdi
callq 0x1196c0
leaq 0x1d6cb4(%rip), %rsi    # 0x3b21f4
movq %rbx, %rdi
movl $0xf8, %edx
callq 0x1045eb
movq %r14, %rdi
callq 0x1196c0
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x730a6
callq 0x7306d
callq 0x73034