// File: /workspace/github_c_makefile_star2_O3/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 0x9d7a
leaq 0xe431e(%rip), %rsi     # 0xee049
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0xe433e(%rip), %rsi     # 0xee082
leaq 0xe4352(%rip), %rdx     # 0xee09d
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1c, %rbx
leaq 0xe42ce(%rip), %rsi     # 0xee034
leaq 0xe4347(%rip), %rdx     # 0xee0b4
movq %rbx, %rdi
movl $0x2b, %ecx
jmp 0x9ee6
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
cmpq $-0x1, %rsi
jne 0x9d8d
movq 0x10(%rbx), %r14
testq %r14, %r14
js 0x9e34
leaq (%r14,%r15), %rbp
movq (%rbx), %r13
movq 0x8(%rbx), %rsi
cmpq %rsi, %rbp
jle 0x9dc4
addq %rsi, %rsi
movq %r13, %rdi
callq 0x8590
testq %rax, %rax
je 0x9e95
movq %rax, %r13
movq %rax, (%rbx)
shlq 0x8(%rbx)
addq %r13, %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x82d0
cmpq (%rbx), %r13
je 0x9e8d
leaq 0xe4324(%rip), %rsi     # 0xee109
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0xe4284(%rip), %rsi     # 0xee082
leaq 0xe4321(%rip), %rdx     # 0xee126
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1c, %rbx
leaq 0xe4214(%rip), %rsi     # 0xee034
leaq 0xe428d(%rip), %rdx     # 0xee0b4
movq %rbx, %rdi
movl $0x44, %ecx
jmp 0x9ee6
leaq 0xe4280(%rip), %rsi     # 0xee0bb
leaq 0x800(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x30af0
leaq 0xe422b(%rip), %rsi     # 0xee082
leaq 0xe4280(%rip), %rdx     # 0xee0de
movq %rsp, %r14
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1c, %rbx
leaq 0xe41bb(%rip), %rsi     # 0xee034
leaq 0xe4234(%rip), %rdx     # 0xee0b4
movq %rbx, %rdi
movl $0x35, %ecx
movq %r14, %r8
jmp 0x9ee9
movq %rbp, 0x10(%rbx)
xorl %eax, %eax
jmp 0x9ef5
leaq 0xe4249(%rip), %rsi     # 0xee0e5
leaq 0x800(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x30af0
leaq 0xe41cd(%rip), %rsi     # 0xee082
leaq 0xe423f(%rip), %rdx     # 0xee0fb
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30af0
addq $0x1c, %rbx
leaq 0xe415d(%rip), %rsi     # 0xee034
leaq 0xe41d6(%rip), %rdx     # 0xee0b4
movq %rbx, %rdi
movl $0x3c, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x30af0
movl $0x1, %eax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq