// File: /workspace/github_c_makefile_star2_O2/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 0x188d9c
movq %rsi, %r12
testq %rsi, %rsi
je 0x188dca
movq %rdx, %rbp
movq %rdi, %r15
movq %r12, %rdi
callq 0xad289
testq %rax, %rax
je 0x188df8
movq %r12, %rdi
callq 0xad289
leaq 0x1(%rax), %rdi
leaq 0x1c9b6c(%rip), %rsi    # 0x352656
movl $0xb6, %edx
callq 0x93160
movq %rax, %rbx
movq %r12, %rdi
callq 0xad1fa
movq %rbx, %rdi
movq %rax, %rsi
callq 0x17730
callq 0xab2f4
movq %rax, %r14
movq %r12, %rdi
callq 0xad289
pushq $0x3a
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0xab309
movq %r12, %rdi
callq 0xad1fa
leaq 0x1c9bcf(%rip), %rdi    # 0x352709
xorl %r13d, %r13d
movq %rax, %rsi
xorl %eax, %eax
callq 0x92a82
movq %r14, %rdi
callq 0xab625
cmpq $0x1, %rax
jne 0x188b6f
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x188975
jmp 0x188d6e
movq %r14, %rdi
callq 0xab625
cmpq $0x3, %rax
ja 0x188bf1
movq %rbp, 0x30(%rsp)
andq $0x0, 0x20(%rsp)
andq $0x0, 0x18(%rsp)
movb $0x1, 0x90(%r15)
xorl %r13d, %r13d
movq %r14, %rdi
xorl %esi, %esi
callq 0xab58d
movq %rax, %rdi
callq 0xacbd1
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0xab625
movq %rax, %rbp
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xab58d
movq %rax, %r12
cmpq $0x3, %rbp
movq %r15, 0x38(%rsp)
jne 0x188c27
movq %r12, %rdi
callq 0xacbd1
movq %rax, 0x8(%rsp)
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0xab58d
movq %rax, %r12
jmp 0x188c30
movq %r12, %rdi
callq 0xad1fa
movl $0x3a, (%rsp)
leaq 0x1c9b70(%rip), %rsi    # 0x352777
pushq $0x3a
popq %rcx
pushq $0x2c
popq %r9
movq %rbp, %rdi
movq %rax, %rdx
movl %ecx, %r8d
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r13
jmp 0x188d6e
movq $0x0, 0x8(%rsp)
callq 0xab2f4
movq %rax, %r15
movq %r12, %rdi
callq 0x172d0
leaq 0x1(%rax), %rdi
leaq 0x1c9a0b(%rip), %rsi    # 0x352656
movl $0xd3, %edx
callq 0x93160
movq %rax, %rbp
movq %rax, %rdi
movq %r12, %rsi
callq 0x17730
movq %r12, 0x28(%rsp)
movq %r12, %rdi
movq %r15, %r12
callq 0x172d0
pushq $0x2c
popq %rcx
movq %r15, %rdi
movq %rbp, 0x40(%rsp)
movq %rbp, %rsi
movq %rax, %rdx
callq 0xab309
movq %r15, %rdi
callq 0xab625
cmpq $0x2, %rax
ja 0x188ce5
movq %r12, %rdi
xorl %esi, %esi
callq 0xab58d
leaq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x9bd05
movl %eax, %r13d
movq %r12, %rdi
callq 0xab625
cmpq $0x2, %rax
setne %al
testl %r13d, %r13d
setne %cl
orb %al, %cl
jne 0x188ce5
pushq $0x1
popq %rsi
movq %r12, %rdi
callq 0xab58d
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x9bd05
movl %eax, %r13d
movq %r12, %rdi
callq 0xab625
cmpq $0x2, %rax
movq 0x38(%rsp), %r15
ja 0x188cfd
testl %r13d, %r13d
je 0x188d1d
leaq 0x1c9a22(%rip), %rsi    # 0x352726
pushq $0x2c
popq %rcx
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rdx
xorl %eax, %eax
callq 0x89dbb
testl %r13d, %r13d
jne 0x188d3c
movq 0x20(%rsp), %r8
movq 0x18(%rsp), %r9
pushq $0x1
popq %rsi
movq %r15, %rdi
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rcx
callq 0x188975
movq 0x10(%rsp), %rdi
callq 0xae103
movq 0x8(%rsp), %rdi
callq 0xae103
leaq 0x1c98ff(%rip), %rsi    # 0x352656
movq 0x40(%rsp), %rdi
movl $0xeb, %edx
callq 0x936f9
movq %r12, %rdi
callq 0xab666
leaq 0x1c98e1(%rip), %rsi    # 0x352656
movq %rbx, %rdi
movl $0xf8, %edx
callq 0x936f9
movq %r14, %rdi
callq 0xab666
movl %r13d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2af1c5(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x15c266(%rip), %rsi    # 0x2e5013
leaq 0x1c98bb(%rip), %rdx    # 0x35266f
leaq 0x1c9907(%rip), %rcx    # 0x3526c2
leaq 0x1c9894(%rip), %r8     # 0x352656
movl $0xb2, %r9d
jmp 0x188e24
movq 0x2af197(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x15c238(%rip), %rsi    # 0x2e5013
leaq 0x1c98fc(%rip), %rdx    # 0x3526de
leaq 0x1c98d9(%rip), %rcx    # 0x3526c2
leaq 0x1c9866(%rip), %r8     # 0x352656
movl $0xb3, %r9d
jmp 0x188e24
movq 0x2af169(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x15c20a(%rip), %rsi    # 0x2e5013
leaq 0x1c98de(%rip), %rdx    # 0x3526ee
leaq 0x1c98ab(%rip), %rcx    # 0x3526c2
leaq 0x1c9838(%rip), %r8     # 0x352656
movl $0xb4, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390