// File: /workspace/github_c_makefile_star2_O1/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 0x9d9a
leaq 0xe72fe(%rip), %rsi     # 0xf1049
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0xe731e(%rip), %rsi     # 0xf1082
leaq 0xe7332(%rip), %rdx     # 0xf109d
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1c, %rbx
leaq 0xe72ae(%rip), %rsi     # 0xf1034
leaq 0xe7327(%rip), %rdx     # 0xf10b4
movq %rbx, %rdi
movl $0x2b, %ecx
jmp 0x9f03
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
cmpq $-0x1, %rsi
jne 0x9dad
movq 0x10(%rbx), %r14
testq %r14, %r14
js 0x9e51
leaq (%r14,%r15), %r13
movq 0x8(%rbx), %rsi
cmpq %rsi, %r13
jle 0x9dde
movq (%rbx), %rdi
addq %rsi, %rsi
callq 0x8590
testq %rax, %rax
je 0x9eb2
movq %rax, (%rbx)
shlq 0x8(%rbx)
movq (%rbx), %rbp
addq %rbp, %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x82d0
cmpq (%rbx), %rbp
je 0x9eaa
leaq 0xe7307(%rip), %rsi     # 0xf1109
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0xe7267(%rip), %rsi     # 0xf1082
leaq 0xe7304(%rip), %rdx     # 0xf1126
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1c, %rbx
leaq 0xe71f7(%rip), %rsi     # 0xf1034
leaq 0xe7270(%rip), %rdx     # 0xf10b4
movq %rbx, %rdi
movl $0x44, %ecx
jmp 0x9f03
leaq 0xe7263(%rip), %rsi     # 0xf10bb
leaq 0x800(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30c2c
leaq 0xe720e(%rip), %rsi     # 0xf1082
leaq 0xe7263(%rip), %rdx     # 0xf10de
movq %rsp, %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1c, %rbx
leaq 0xe719e(%rip), %rsi     # 0xf1034
leaq 0xe7217(%rip), %rdx     # 0xf10b4
movq %rbx, %rdi
movl $0x35, %ecx
movq %r14, %r8
jmp 0x9f06
movq %r13, 0x10(%rbx)
xorl %eax, %eax
jmp 0x9f12
leaq 0xe722c(%rip), %rsi     # 0xf10e5
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30c2c
leaq 0xe71b0(%rip), %rsi     # 0xf1082
leaq 0xe7222(%rip), %rdx     # 0xf10fb
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c2c
addq $0x1c, %rbx
leaq 0xe7140(%rip), %rsi     # 0xf1034
leaq 0xe71b9(%rip), %rdx     # 0xf10b4
movq %rbx, %rdi
movl $0x3c, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x30c2c
movl $0x1, %eax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq