// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x4058, %rsp           # imm = 0x4058
movq %rdi, 0x4048(%rsp)
movq %rsi, 0x4040(%rsp)
movq %rdx, 0x4038(%rsp)
movq %rcx, 0x4030(%rsp)
movq 0x4048(%rsp), %rax
cmpl $0x1, 0x18(%rax)
jne 0x896e
leaq 0x3810(%rsp), %rdi
leaq 0x1c9745(%rip), %rsi    # 0x1d2049
movb $0x0, %al
callq 0x5b9c0
leaq 0x3010(%rsp), %rdi
leaq 0x3810(%rsp), %rcx
leaq 0x1c9760(%rip), %rsi    # 0x1d2082
leaq 0x1c9774(%rip), %rdx    # 0x1d209d
movb $0x0, %al
callq 0x5b9c0
movq 0x4048(%rsp), %rdi
addq $0x1c, %rdi
leaq 0x3010(%rsp), %r8
leaq 0x1c96e9(%rip), %rsi    # 0x1d2034
leaq 0x1c9762(%rip), %rdx    # 0x1d20b4
movl $0x2b, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4054(%rsp)
jmp 0x8c1b
cmpq $-0x1, 0x4040(%rsp)
jne 0x898f
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x4028(%rsp)
jmp 0x899f
movq 0x4040(%rsp), %rax
movq %rax, 0x4028(%rsp)
cmpq $0x0, 0x4028(%rsp)
jge 0x8a2f
leaq 0x2810(%rsp), %rdi
movq 0x4028(%rsp), %rdx
leaq 0x1c96f6(%rip), %rsi    # 0x1d20bb
movb $0x0, %al
callq 0x5b9c0
leaq 0x2010(%rsp), %rdi
leaq 0x2810(%rsp), %rcx
leaq 0x1c969f(%rip), %rsi    # 0x1d2082
leaq 0x1c96f4(%rip), %rdx    # 0x1d20de
movb $0x0, %al
callq 0x5b9c0
movq 0x4048(%rsp), %rdi
addq $0x1c, %rdi
leaq 0x2010(%rsp), %r8
leaq 0x1c9628(%rip), %rsi    # 0x1d2034
leaq 0x1c96a1(%rip), %rdx    # 0x1d20b4
movl $0x35, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4054(%rsp)
jmp 0x8c1b
movq 0x4028(%rsp), %rax
addq 0x4030(%rsp), %rax
movq 0x4048(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jle 0x8b2a
movq 0x4048(%rsp), %rax
movq (%rax), %rdi
movq 0x4048(%rsp), %rax
movq 0x8(%rax), %rsi
shlq %rsi
callq 0x8580
movq %rax, 0x4018(%rsp)
cmpq $0x0, 0x4018(%rsp)
jne 0x8afc
leaq 0x1810(%rsp), %rdi
leaq 0x1c9653(%rip), %rsi    # 0x1d20e5
movb $0x0, %al
callq 0x5b9c0
leaq 0x1010(%rsp), %rdi
leaq 0x1810(%rsp), %rcx
leaq 0x1c95d2(%rip), %rsi    # 0x1d2082
leaq 0x1c9644(%rip), %rdx    # 0x1d20fb
movb $0x0, %al
callq 0x5b9c0
movq 0x4048(%rsp), %rdi
addq $0x1c, %rdi
leaq 0x1010(%rsp), %r8
leaq 0x1c955b(%rip), %rsi    # 0x1d2034
leaq 0x1c95d4(%rip), %rdx    # 0x1d20b4
movl $0x3c, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4054(%rsp)
jmp 0x8c1b
movq 0x4018(%rsp), %rcx
movq 0x4048(%rsp), %rax
movq %rcx, (%rax)
movq 0x4048(%rsp), %rax
movq 0x8(%rax), %rcx
shlq %rcx
movq 0x4048(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x4048(%rsp), %rax
movq (%rax), %rdi
addq 0x4028(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq 0x4038(%rsp), %rsi
movq 0x4030(%rsp), %rdx
callq 0x8300
movq 0x8(%rsp), %rax
movq %rax, 0x4020(%rsp)
movq 0x4020(%rsp), %rax
movq 0x4048(%rsp), %rcx
movq (%rcx), %rcx
addq 0x4028(%rsp), %rcx
cmpq %rcx, %rax
je 0x8bf4
leaq 0x810(%rsp), %rdi
leaq 0x1c9576(%rip), %rsi    # 0x1d2109
movb $0x0, %al
callq 0x5b9c0
leaq 0x10(%rsp), %rdi
leaq 0x810(%rsp), %rcx
leaq 0x1c94d4(%rip), %rsi    # 0x1d2082
leaq 0x1c9571(%rip), %rdx    # 0x1d2126
movb $0x0, %al
callq 0x5b9c0
movq 0x4048(%rsp), %rdi
addq $0x1c, %rdi
leaq 0x10(%rsp), %r8
leaq 0x1c9460(%rip), %rsi    # 0x1d2034
leaq 0x1c94d9(%rip), %rdx    # 0x1d20b4
movl $0x44, %ecx
movb $0x0, %al
callq 0x5b9c0
movl $0x1, 0x4054(%rsp)
jmp 0x8c1b
movq 0x4028(%rsp), %rcx
addq 0x4030(%rsp), %rcx
movq 0x4048(%rsp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, 0x4054(%rsp)
movl 0x4054(%rsp), %eax
addq $0x4058, %rsp           # imm = 0x4058
retq
nopw (%rax,%rax)