// File: /workspace/github_c_makefile_star2_O2/PoulinV[P]AxiCLASS/build/../tools/growTable.c
// Function: gt_add
int gt_add(
  growTable* self, /**< a growTable*/
  long idx,        /**< index at wich to add the data (in bytes). #_GT_END_ means the end of the currently written data*/
  void* data,      /**< data to be added*/
  long sz          /**< size of the data (in bytes)*/
  ) {
  long ridx;
  void *res;
  void *nbuffer;

  /** - assumes the growTable is correctly initialized */

  class_test(self->freeze == _TRUE_,
	     self->error_message,
	     "cannot add any more data in the growTable (freeze is on)");

  if (idx==_GT_END_) {
    ridx=self->csz;
  }
  else {
    ridx=idx;
  }
  class_test(ridx<0,
	     self->error_message,
	     "Don't know what to do with idx=%ld",ridx);

  if (ridx+sz>self->sz) {
    /** - test -> pass -> ok we need to grow */
    nbuffer=realloc(self->buffer,self->sz*_GT_FACTOR_);
    class_test(nbuffer==NULL,
	       self->error_message,
	       "Cannot grow growTable");
    self->buffer=nbuffer;
    self->sz=self->sz*_GT_FACTOR_;
  }

  res=memcpy((void*) (self->buffer+ridx),(void*) data,(size_t) sz);
  class_test(res!=self->buffer+ridx,
	     self->error_message,
	     "Cannot add data to growTable");
  self->csz=ridx+sz;

  return _SUCCESS_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdi, %rbx
cmpl $0x1, 0x18(%rdi)
jne 0x890a
leaq 0xdc788(%rip), %rsi     # 0xe5049
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0xdc7a8(%rip), %rsi     # 0xe5082
leaq 0xdc7bc(%rip), %rdx     # 0xe509d
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1c, %rbx
leaq 0xdc738(%rip), %rsi     # 0xe5034
leaq 0xdc7b1(%rip), %rdx     # 0xe50b4
pushq $0x2b
jmp 0x8a68
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
cmpq $-0x1, %rsi
jne 0x891d
movq 0x10(%rbx), %r14
testq %r14, %r14
js 0x89be
leaq (%r14,%r15), %rbp
movq (%rbx), %r13
movq 0x8(%rbx), %rsi
cmpq %rsi, %rbp
jle 0x8954
addq %rsi, %rsi
movq %r13, %rdi
callq 0x85c0
testq %rax, %rax
je 0x8a1d
movq %rax, %r13
movq %rax, (%rbx)
shlq 0x8(%rbx)
addq %r13, %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x82f0
cmpq (%rbx), %r13
je 0x8a15
leaq 0xdc794(%rip), %rsi     # 0xe5109
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0xdc6f4(%rip), %rsi     # 0xe5082
leaq 0xdc791(%rip), %rdx     # 0xe5126
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1c, %rbx
leaq 0xdc684(%rip), %rsi     # 0xe5034
leaq 0xdc6fd(%rip), %rdx     # 0xe50b4
pushq $0x44
jmp 0x8a68
leaq 0xdc6f6(%rip), %rsi     # 0xe50bb
leaq 0x800(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2e014
leaq 0xdc6a1(%rip), %rsi     # 0xe5082
leaq 0xdc6f6(%rip), %rdx     # 0xe50de
movq %rsp, %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1c, %rbx
leaq 0xdc631(%rip), %rsi     # 0xe5034
leaq 0xdc6aa(%rip), %rdx     # 0xe50b4
pushq $0x35
popq %rcx
movq %rbx, %rdi
movq %r14, %r8
jmp 0x8a6f
movq %rbp, 0x10(%rbx)
xorl %eax, %eax
jmp 0x8a79
leaq 0xdc6c1(%rip), %rsi     # 0xe50e5
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2e014
leaq 0xdc645(%rip), %rsi     # 0xe5082
leaq 0xdc6b7(%rip), %rdx     # 0xe50fb
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2e014
addq $0x1c, %rbx
leaq 0xdc5d5(%rip), %rsi     # 0xe5034
leaq 0xdc64e(%rip), %rdx     # 0xe50b4
pushq $0x3c
popq %rcx
movq %rbx, %rdi
movq %r15, %r8
xorl %eax, %eax
callq 0x2e014
pushq $0x1
popq %rax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq