// File: /workspace/github_c_makefile_star2_O3/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, %r13d
movq %rdi, %r14
movq 0x40(%rsp), %r12
movq %r8, %rsi
callq 0x316c40
testl %r15d, %r15d
je 0x3169a5
testq %rax, %rax
je 0x316a42
cmpq $0x0, 0x18(%rax)
jne 0x316bd1
movq (%rsp), %rcx
movq %rcx, (%rax)
movl %r13d, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r12, 0x18(%rax)
movb %bpl, 0x20(%rax)
jmp 0x316ac4
testq %rax, %rax
je 0x316bac
cmpb %bpl, 0x20(%rax)
jne 0x316bbe
movq 0x18(%rax), %r15
testb %bpl, %bpl
je 0x3169d2
movq (%r14), %r9
cmpq %r9, %r15
ja 0x316bf5
movq %r14, %rcx
jmp 0x3169e3
movq 0x8(%r14), %r9
cmpq %r9, %r15
ja 0x316c0a
leaq 0x8(%r14), %rcx
subq %r15, %r9
movq %r9, (%rcx)
testq %r12, %r12
je 0x316a85
movq %r15, %rcx
subq %r12, %rcx
leaq 0xa95a5(%rip), %rdx     # 0x3bffa4
movl %r13d, %esi
leaq 0xb13a1(%rip), %r13     # 0x3c7daa
cmovbq %rdx, %r13
negq %rcx
subq %r12, %r15
movq (%rsp), %rdx
movq %rdx, (%rax)
movl %esi, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %r12, 0x18(%rax)
movb %bpl, 0x20(%rax)
cmovbq %rcx, %r15
movl %ebp, %eax
xorb $0x1, %al
movzbl %al, %eax
addq %r12, (%r14,%rax,8)
movq %r14, %rdi
callq 0x316c79
jmp 0x316a94
movq 0x30(%r14), %rcx
cmpq 0x38(%r14), %rcx
ja 0x316c3b
jne 0x316a99
leaq 0x10(%rcx), %rax
movq %rax, 0x38(%r14)
movq 0x28(%r14), %rdi
leaq 0x80(,%rcx,8), %rax
leaq (%rax,%rax,4), %rsi
leaq 0xcb9e1(%rip), %rdx     # 0x3e2452
movl $0x7c, %ecx
callq 0x104461
movq %rax, 0x28(%r14)
movq 0x30(%r14), %rcx
jmp 0x316a9d
movq $0x0, 0x18(%rax)
leaq 0xb1316(%rip), %r13     # 0x3c7daa
movq %r15, %r12
jmp 0x316ade
movq 0x28(%r14), %rax
leaq (%rcx,%rcx,4), %rdx
movq (%rsp), %rsi
movq %rsi, (%rax,%rdx,8)
movl %r13d, 0x8(%rax,%rdx,8)
movq %rbx, 0x10(%rax,%rdx,8)
movq %r12, 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 %r12, (%r14,%rax,8)
movq %r14, %rdi
callq 0x316c79
leaq 0xa94c6(%rip), %r13     # 0x3bffa4
movq (%r14), %rdx
movq 0x8(%r14), %rcx
leaq (%rcx,%rdx), %rax
leaq 0x7cac5(%rip), %rdi     # 0x3935b5
leaq 0x44c1c(%rip), %rsi     # 0x35b713
testb %bpl, %bpl
cmovneq %rdi, %rsi
movq %r12, %xmm1
movq 0x30dd5(%rip), %xmm3    # 0x3478e0
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x30dd9(%rip), %xmm4    # 0x3478f0
subpd %xmm4, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x30dd1(%rip), %xmm5    # 0x347900
mulsd %xmm5, %xmm0
movq %rdx, %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 0xcba32(%rip), %rdi     # 0x3e25c3
movq %r13, %rdx
movq %rbx, %rcx
movb $0x4, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x103d72
movq %rbx, %rdi
movq (%rsp), %rsi
movl %r13d, %edx
movq %r14, %rcx
callq 0x91501
movq 0x1a23bb(%rip), %rax    # 0x4b8f80
movq (%rax), %rdi
leaq 0xcb995(%rip), %rsi     # 0x3e2564
jmp 0x316be2
movq 0x1a23a8(%rip), %rax    # 0x4b8f80
movq (%rax), %rdi
leaq 0xcb8e3(%rip), %rsi     # 0x3e24c5
movq %rbx, %rdx
movq (%rsp), %rcx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x17ab0
jmp 0x316c31
movq %rbx, %rdi
movq (%rsp), %rsi
movl %r13d, %edx
movq %r15, %rcx
movl $0x1, %r8d
jmp 0x316c1a
movq %rbx, %rdi
movq (%rsp), %rsi
movl %r13d, %edx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x914ba
movq 0x1a235a(%rip), %rax    # 0x4b8f80
movq (%rax), %rdi
movq %r14, %rsi
callq 0x316857
movl $0x2, %edi
callq 0x17940
callq 0x9153c