// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/condenseq_creator.c
// Function: ces_c_sparse_diags_add
static inline void ces_c_sparse_diags_add(CesCSparseDiags *diags)
{
  CesCDiag *d_src, *d_dest;
  CesCDiag *diag;

  if (diags->add_iterator == NULL)
    diags->add_iterator = gt_rbtree_iter_new_from_last(diags->add_tree);
  gt_rbtree_iter_reset_from_last(diags->add_iterator);

  GT_CES_C_SPARSE_DIAGS_RESIZE(diags, diags->add_nextfree);
  d_src = diags->space + diags->nextfree - 1;
  d_dest = d_src + diags->add_nextfree;

  diags->nextfree += diags->add_nextfree;

  gt_assert(diags->nextfree < diags->allocated);

  if (diags->max < diags->nextfree)
    diags->max = diags->nextfree;

  gt_assert(diags->add_nextfree == (GtUword) gt_rbtree_size(diags->add_tree));
  diag = gt_rbtree_iter_data(diags->add_iterator);
  while (diag != NULL) {
    while (d_src >= diags->space && d_src->d > diag->d) {
      *d_dest = *d_src;
      d_dest--;
      d_src--;
    }
    gt_assert(d_src < diags->space || d_src->d < diag->d);
    /* insert */
    d_dest->d = diag->d;
    d_dest->j = diag->j;
    d_dest--;
    diags->add_nextfree--;
    diag = gt_rbtree_iter_prev(diags->add_iterator);
  }
  gt_assert(d_dest == d_src);
  gt_assert(diags->add_nextfree == 0);
  /* TODO DW: this might be time consuming. could this be done in a seperate
     process, while we just start with a new one? */
  gt_rbtree_clear(diags->add_tree);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1472af
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1ba320
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1ba410
movq 0x30(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rsp), %rcx
addq 0x20(%rcx), %rax
movq 0x30(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jb 0x147389
movq 0x30(%rsp), %rax
movq 0x30(%rax), %xmm0
movaps 0x3d1641(%rip), %xmm1   # 0x518930
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x3d1645(%rip), %xmm1   # 0x518940
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x3d1a56(%rip), %xmm1   # 0x518d68
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rsi
sarq $0x3f, %rsi
movsd 0x3d1a43(%rip), %xmm1   # 0x518d70
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rdx
andq %rsi, %rdx
orq %rdx, %rcx
movq %rcx, 0x30(%rax)
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x30(%rsp), %rax
addq 0x30(%rax), %rcx
movq %rcx, 0x30(%rax)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rsi
shlq $0x4, %rsi
leaq 0x40467b(%rip), %rdx    # 0x54b9ee
movl $0xec, %ecx
callq 0xe8540
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rsp), %rcx
movq 0x48(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
addq $-0x10, %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
movq 0x20(%rcx), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x30(%rsp), %rax
addq 0x48(%rax), %rcx
movq %rcx, 0x48(%rax)
movq 0x30(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x30(%rsp), %rcx
cmpq 0x30(%rcx), %rax
jb 0x147427
movq 0x4f4baa(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3cec13(%rip), %rsi    # 0x516013
leaq 0x404dd5(%rip), %rdx    # 0x54c1dc
leaq 0x404df1(%rip), %rcx    # 0x54c1ff
leaq 0x4045d9(%rip), %r8     # 0x54b9ee
movl $0xf2, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x147429
movq 0x30(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x30(%rsp), %rcx
cmpq 0x48(%rcx), %rax
jae 0x14744f
movq 0x30(%rsp), %rax
movq 0x48(%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x40(%rax)
jmp 0x147451
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1b90e0
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
je 0x1474b2
movq 0x4f4b1f(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3ceb88(%rip), %rsi    # 0x516013
leaq 0x404d84(%rip), %rdx    # 0x54c216
leaq 0x404d66(%rip), %rcx    # 0x54c1ff
leaq 0x40454e(%rip), %r8     # 0x54b9ee
movl $0xf7, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1474b4
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1ba6d0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x1475f9
jmp 0x1474d5
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, 0xf(%rsp)
jb 0x147502
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rsp), %rcx
cmpq (%rcx), %rax
seta %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x14750c
jmp 0x147542
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rax
addq $-0x10, %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
addq $-0x10, %rax
movq %rax, 0x28(%rsp)
jmp 0x1474d5
jmp 0x147544
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jb 0x14759e
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rsp), %rcx
cmpq (%rcx), %rax
jb 0x14759e
movq 0x4f4a33(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3cea9c(%rip), %rsi    # 0x516013
leaq 0x404cd9(%rip), %rdx    # 0x54c257
leaq 0x404c7a(%rip), %rcx    # 0x54c1ff
leaq 0x404462(%rip), %r8     # 0x54b9ee
movl $0xff, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1475a0
movq 0x18(%rsp), %rax
movq (%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x20(%rsp), %rax
addq $-0x10, %rax
movq %rax, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x20(%rax)
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x1ba670
movq %rax, 0x18(%rsp)
jmp 0x1474c7
jmp 0x1475fb
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
je 0x14763f
movq 0x4f4992(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3ce9fb(%rip), %rsi    # 0x516013
leaq 0x404c63(%rip), %rdx    # 0x54c282
leaq 0x404bd9(%rip), %rcx    # 0x54c1ff
leaq 0x4043c1(%rip), %r8     # 0x54b9ee
movl $0x107, %r9d            # imm = 0x107
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x147641
jmp 0x147643
movq 0x30(%rsp), %rax
cmpq $0x0, 0x20(%rax)
je 0x147687
movq 0x4f494a(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3ce9b3(%rip), %rsi    # 0x516013
leaq 0x404c2b(%rip), %rdx    # 0x54c292
leaq 0x404b91(%rip), %rcx    # 0x54c1ff
leaq 0x404379(%rip), %r8     # 0x54b9ee
movl $0x108, %r9d            # imm = 0x108
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x147689
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x1b7f80
addq $0x38, %rsp
retq
nopl (%rax)