// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/dynalloc.c
// Function: gt_dynalloc
void* gt_dynalloc(void *ptr, size_t *allocated, size_t size)
{
  size_t size_to_alloc = 0;
  void *rptr;
  gt_assert(allocated && size);
  if (size <= *allocated)
    return ptr;
  if (*allocated == 0) {
    gt_assert(ptr == NULL);
    /* if nothing has been allocated already, we allocate what was asked for */
    size_to_alloc = size;
  }
  else {
    /* XXX: no overflow */
    gt_assert(*allocated != SIZE_MAX);
    /* otherwise we double the allocated space, if possible */
    size_to_alloc = *allocated;
    while (size_to_alloc < size) {
      if (size_to_alloc > SIZE_MAX / 2) size_to_alloc = SIZE_MAX;
      else size_to_alloc *= 2;
    }
  }
  gt_assert(size_to_alloc);
  rptr = gt_realloc(ptr, size_to_alloc);
  *allocated = size_to_alloc;
  return rptr;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x7f2dc
cmpq $0x0, 0x18(%rsp)
jne 0x7f314
movq 0x134cf5(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xded79(%rip), %rsi     # 0x15e066
leaq 0xee906(%rip), %rdx     # 0x16dbfa
leaq 0xee911(%rip), %rcx     # 0x16dc0c
leaq 0xee916(%rip), %r8      # 0x16dc18
movl $0x19, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x7f316
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpq (%rcx), %rax
ja 0x7f334
movq 0x28(%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x7f49a
movq 0x20(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x7f392
jmp 0x7f341
cmpq $0x0, 0x28(%rsp)
je 0x7f381
movq 0x134c88(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xded0c(%rip), %rsi     # 0x15e066
leaq 0xee8cb(%rip), %rdx     # 0x16dc2c
leaq 0xee8a4(%rip), %rcx     # 0x16dc0c
leaq 0xee8a9(%rip), %r8      # 0x16dc18
movl $0x1d, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x7f383
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
jmp 0x7f41f
jmp 0x7f394
movq 0x20(%rsp), %rax
cmpq $-0x1, (%rax)
jne 0x7f3d7
movq 0x134c32(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xdecb6(%rip), %rsi     # 0x15e066
leaq 0xee881(%rip), %rdx     # 0x16dc38
leaq 0xee84e(%rip), %rcx     # 0x16dc0c
leaq 0xee853(%rip), %r8      # 0x16dc18
movl $0x23, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x7f3d9
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x7f41d
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
cmpq %rax, 0x10(%rsp)
jbe 0x7f40e
movq $-0x1, 0x10(%rsp)
jmp 0x7f41b
movq 0x10(%rsp), %rax
shlq %rax
movq %rax, 0x10(%rsp)
jmp 0x7f3e6
jmp 0x7f41f
jmp 0x7f421
cmpq $0x0, 0x10(%rsp)
jne 0x7f461
movq 0x134ba8(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0xdec2c(%rip), %rsi     # 0x15e066
leaq 0xee80e(%rip), %rdx     # 0x16dc4f
leaq 0xee7c4(%rip), %rcx     # 0x16dc0c
leaq 0xee7c9(%rip), %r8      # 0x16dc18
movl $0x2b, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x7f463
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0xee7a4(%rip), %rdx     # 0x16dc18
movl $0x2c, %ecx
callq 0xd730
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, (%rax)
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
nop