// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/match/firstcodes-spacelog.c
// Function: gt_firstcodes_spacelog_add
void gt_firstcodes_spacelog_add(GtFirstcodesspacelog *fcsl,
                                int line,
                                const char *filename,
                                bool add,
                                const char *title,
                                bool work,
                                size_t size)
{
  GtFirstcodespacelogentry *entry;
  size_t logspace;

  if (add)
  {
    entry = gt_spacelog_find(fcsl,title);
    if (entry != NULL)
    {
      if (entry->size != 0)
      {
        fprintf(stderr,"existing entry for title \"%s\""
                       "(from file %s, line %d) "
                       "in spacelog entries must have size 0\n",
                       title,filename,line);
        exit(GT_EXIT_PROGRAMMING_ERROR);
      }
      gt_spacelog_updateaddentry(entry,filename,line,title,size,work);
    } else
    {
      gt_spacelog_addentry(fcsl,filename,line,title,size,work);
    }
    if (work)
    {
      fcsl->workspace += size;
    } else
    {
      fcsl->splitspace += size;
    }
    gt_firstcodes_updatemax(fcsl);
  } else
  {
    entry = gt_spacelog_find(fcsl,title);
    if (entry == NULL)
    {
      fprintf(stderr,"cannot find title \"%s\" (from file %s, line %d) "
                     "in spacelog entries\n",title,filename,line);
      (void) gt_firstcodes_spacelog_showentries(stderr,fcsl);
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
    if ((entry->work && !work) || (!entry->work && work))
    {
      fprintf(stderr,"for title \"%s\" (from file %s, line %d) "
                     "in spacelog entries: inconsistent work/splitassignment\n",
               title,filename,line);
      exit(GT_EXIT_PROGRAMMING_ERROR);
    }
    if (work)
    {
      if (entry->size > fcsl->workspace)
      {
        gt_firstcodes_subtract_error(title, filename, line, entry->size, true,
                                     fcsl->workspace);
        (void) gt_firstcodes_spacelog_showentries(stderr,fcsl);
        exit(GT_EXIT_PROGRAMMING_ERROR);
      }
      fcsl->workspace -= entry->size;
    } else
    {
      if (entry->size > fcsl->splitspace)
      {
        gt_firstcodes_subtract_error(title, filename, line, entry->size, false,
                                     fcsl->splitspace);
        (void) gt_firstcodes_spacelog_showentries(stderr,fcsl);
        exit(GT_EXIT_PROGRAMMING_ERROR);
      }
      fcsl->splitspace -= entry->size;
    }
    if (size > 0)
    {
      size_t previous_size = entry->size;
      gt_spacelog_updateaddentry(entry,filename,line,title,size,work);
      if (work)
      {
        fcsl->workspace += size;
      } else
      {
        fcsl->splitspace += size;
      }
      if (size > previous_size)
      {
        add = true;
        size -= previous_size;
      } else
      {
        size = previous_size - size;
      }
      gt_firstcodes_updatemax(fcsl);
    } else
    {
      size = entry->size;
      entry->size = 0;
    }
  }
  logspace = fcsl->workspace+fcsl->splitspace;
  gt_log_log(
#ifdef SKDEBUG
             "file %s, line %d: "
#endif
             "%s %s= %.2f, %s, w=%.2f, s=%.2f, sum=%.2f MB",
#ifdef SKDEBUG
             filename,
             line,
#endif
             work ? "w" : "s",
             add ? "+" : "-",
             GT_MEGABYTES(size),
             title,
             GT_MEGABYTES(fcsl->workspace),
             GT_MEGABYTES(fcsl->splitspace),
             GT_MEGABYTES(logspace));
#ifdef SKDEBUG
  if (gt_ma_bookkeeping_enabled())
  {
    GtUword realspace = gt_ma_get_space_current() +
                              gt_fa_get_space_current();
    gt_log_log("current space usage %.2f MB (%.2f+%.2f)",
                                GT_MEGABYTES(realspace),
                                GT_MEGABYTES(gt_ma_get_space_current()),
                                GT_MEGABYTES(gt_fa_get_space_current()));
    if (fcsl->calc_difference)
    {
      double percent_difference;

      if ((GtUword) logspace > realspace)
      {
        fprintf(stderr,"overestimating logspace\n");
        exit(GT_EXIT_PROGRAMMING_ERROR);
      }
      if (realspace >= 1000000UL)
      {
        /*
        printf("realspace="GT_WU",logspace="GT_WU"\n",realspace,
                                              (GtUword) logspace);
        */
        percent_difference = 100.0 * (double) (realspace - logspace)/realspace;
        if (gt_double_larger_double(percent_difference,3.0))
        {
          fprintf(stderr,"space difference of %.2f%% is too large\n",
                       percent_difference);
          exit(GT_EXIT_PROGRAMMING_ERROR);
        }
        if (gt_double_smaller_double(fcsl->max_percent_difference,
                                     percent_difference))
        {
          fcsl->max_percent_difference = percent_difference;
        }
      }
    }
  }
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebp
movq %r8, %rbx
movl %ecx, %r15d
movq %rdx, (%rsp)
movl %esi, %r12d
movq %rdi, %r14
movq 0x40(%rsp), %r13
movq %r8, %rsi
callq 0x320fab
testl %r15d, %r15d
je 0x320d08
testq %rax, %rax
je 0x320db1
cmpq $0x0, 0x18(%rax)
jne 0x320f42
movq (%rsp), %rcx
movq %rcx, (%rax)
movl %r12d, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r13, 0x18(%rax)
movb %bpl, 0x20(%rax)
jmp 0x320e1d
testq %rax, %rax
je 0x320f1d
cmpb %bpl, 0x20(%rax)
jne 0x320f2f
movq 0x18(%rax), %rcx
testb %bpl, %bpl
je 0x320d38
movq (%r14), %r9
cmpq %r9, %rcx
ja 0x320f66
movl %r12d, %esi
movq %r14, %rdx
jmp 0x320d4c
movq 0x8(%r14), %r9
cmpq %r9, %rcx
ja 0x320f78
movl %r12d, %esi
leaq 0x8(%r14), %rdx
subq %rcx, %r9
movq %r9, (%rdx)
movq 0x18(%rax), %r12
testq %r13, %r13
je 0x320e32
movq %r12, %rcx
subq %r13, %rcx
negq %rcx
subq %r13, %r12
movq (%rsp), %rdx
movq %rdx, (%rax)
movl %esi, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r13, 0x18(%rax)
movb %bpl, 0x20(%rax)
cmovbq %rcx, %r12
movq %rbx, (%rsp)
setb %bl
movl %ebp, %eax
xorb $0x1, %al
movzbl %al, %eax
addq %r13, (%r14,%rax,8)
orb %r15b, %bl
movq %r14, %rdi
callq 0x320fe4
movq %r12, %r13
movl %ebx, %r15d
movq (%rsp), %rbx
jmp 0x320e3d
movq 0x38(%r14), %rax
cmpq %rax, 0x30(%r14)
ja 0x320fa6
jne 0x320dee
leaq 0x10(%rax), %rcx
movq %rcx, 0x38(%r14)
movq 0x28(%r14), %rdi
leaq 0x80(,%rax,8), %rax
leaq (%rax,%rax,4), %rsi
leaq 0xcad96(%rip), %rdx     # 0x3ebb76
movl $0x7c, %ecx
callq 0x1094e6
movq %rax, 0x28(%r14)
movq 0x28(%r14), %rax
movq 0x30(%r14), %rcx
leaq (%rcx,%rcx,4), %rdx
movq (%rsp), %rsi
movq %rsi, (%rax,%rdx,8)
movl %r12d, 0x8(%rax,%rdx,8)
movq %rbx, 0x10(%rax,%rdx,8)
movq %r13, 0x18(%rax,%rdx,8)
movb %bpl, 0x20(%rax,%rdx,8)
incq %rcx
movq %rcx, 0x30(%r14)
movl %ebp, %eax
xorb $0x1, %al
movzbl %al, %eax
addq %r13, (%r14,%rax,8)
movq %r14, %rdi
callq 0x320fe4
jmp 0x320e3d
movq $0x0, 0x18(%rax)
movq %r12, %r13
movq (%r14), %rdi
movq 0x8(%r14), %rcx
leaq (%rcx,%rdi), %rax
leaq 0x7bbe2(%rip), %rdx     # 0x39ca31
leaq 0x4395d(%rip), %rsi     # 0x3647b3
testb %bpl, %bpl
cmovneq %rdx, %rsi
leaq 0xa87c0(%rip), %r8      # 0x3c9624
leaq 0xb0667(%rip), %rdx     # 0x3d14d2
testb %r15b, %r15b
cmovneq %r8, %rdx
movq %r13, %xmm1
movq 0x2fa61(%rip), %xmm3    # 0x3508e0
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x2fa65(%rip), %xmm4    # 0x3508f0
subpd %xmm4, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x2fa5d(%rip), %xmm5    # 0x350900
mulsd %xmm5, %xmm0
movq %rdi, %xmm2
punpckldq %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
subpd %xmm4, %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
mulsd %xmm5, %xmm1
movq %rcx, %xmm6
punpckldq %xmm3, %xmm6    # xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
subpd %xmm4, %xmm6
movapd %xmm6, %xmm2
unpckhpd %xmm6, %xmm2            # xmm2 = xmm2[1],xmm6[1]
addsd %xmm6, %xmm2
mulsd %xmm5, %xmm2
movq %rax, %xmm6
punpckldq %xmm3, %xmm6    # xmm6 = xmm6[0],xmm3[0],xmm6[1],xmm3[1]
subpd %xmm4, %xmm6
movapd %xmm6, %xmm3
unpckhpd %xmm6, %xmm3            # xmm3 = xmm3[1],xmm6[1]
addsd %xmm6, %xmm3
mulsd %xmm5, %xmm3
leaq 0xcade2(%rip), %rdi     # 0x3ebce7
movq %rbx, %rcx
movb $0x4, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x108e02
movq %rbx, %rdi
movq (%rsp), %rsi
movl %r12d, %edx
movq %r14, %rcx
callq 0x933a2
movq 0x1a304a(%rip), %rax    # 0x4c3f80
movq (%rax), %rdi
leaq 0xcad48(%rip), %rsi     # 0x3ebc88
jmp 0x320f53
movq 0x1a3037(%rip), %rax    # 0x4c3f80
movq (%rax), %rdi
leaq 0xcac96(%rip), %rsi     # 0x3ebbe9
movq %rbx, %rdx
movq (%rsp), %rcx
movl %r12d, %r8d
xorl %eax, %eax
callq 0x17ab0
jmp 0x320f9c
movq %rbx, %rdi
movq (%rsp), %rsi
movl %r12d, %edx
movl $0x1, %r8d
jmp 0x320f85
movq %rbx, %rdi
movq (%rsp), %rsi
movl %r12d, %edx
xorl %r8d, %r8d
callq 0x9335b
movq 0x1a2fef(%rip), %rax    # 0x4c3f80
movq (%rax), %rdi
movq %r14, %rsi
callq 0x320bbf
movl $0x2, %edi
callq 0x17940
callq 0x933dd