// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/match/sfx-sain.c
// Function: gt_sainbuffer_new
static GtSainbuffer *gt_sainbuffer_new(GtUsainindextype *suftab,
                                       GtUsainindextype *fillptr,
                                       GtUword numofchars,
                                       GtUword totallength,
                                       GtLogger *logger)
{
  if (numofchars <= UCHAR_MAX+1)
  {
    GtSainbuffer *buf = (GtSainbuffer *) gt_malloc(sizeof (*buf));

    buf->size = sizeof (*buf);
    buf->fillptr = fillptr;
    buf->suftab = suftab;
    buf->log_bufsize = 18 - (sizeof (GtUsainindextype) == (size_t) 4 ? 1 : 2) -
                             (int) gt_determinebitspervalue(numofchars);
    buf->buf_size = 1UL << buf->log_bufsize;
    buf->numofchars = numofchars;
    gt_assert(buf->buf_size <= UINT16_MAX);
    buf->cachesize = numofchars << buf->log_bufsize;
    buf->size += sizeof (*buf->values) * buf->cachesize;
    buf->size += sizeof (*buf->nextidx) * numofchars;
    if ((GtUword) buf->size * 10UL >= totallength)
    {
      gt_free(buf);
      buf = NULL;
    } else
    {
      buf->values = (GtUsainindextype *)
                    gt_malloc(sizeof (*buf->values) * buf->cachesize);
      buf->nextidx = gt_calloc((size_t) numofchars,sizeof (*buf->nextidx));
      gt_logger_log(logger,"used buffer of "GT_WU" bytes (bufsize="GT_WU")",
                         (GtUword) buf->size,buf->buf_size);
    }
    return buf;
  } else
  {
    return NULL;
  }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq %r8, 0x8(%rsp)
cmpq $0x100, 0x18(%rsp)      # imm = 0x100
ja 0x2d4d53
movl $0x48, %edi
leaq 0x2b74c0(%rip), %rsi    # 0x58c068
movl $0x17d, %edx            # imm = 0x17D
callq 0xe80f0
movq %rax, (%rsp)
movq (%rsp), %rax
movq $0x48, 0x40(%rax)
movq 0x20(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x28(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, 0x28(%rax)
movq 0x18(%rsp), %rdi
callq 0xec660
movl $0x11, %ecx
subl %eax, %ecx
movq (%rsp), %rax
movl %ecx, 0x38(%rax)
movq (%rsp), %rax
movl 0x38(%rax), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, (%rax)
movq 0x18(%rsp), %rcx
movq (%rsp), %rax
movq %rcx, 0x8(%rax)
movq (%rsp), %rax
cmpq $0xffff, (%rax)         # imm = 0xFFFF
jbe 0x2d4c61
movq 0x367370(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x2413d9(%rip), %rsi    # 0x516013
leaq 0x2b77d3(%rip), %rdx    # 0x58c414
leaq 0x2b77e8(%rip), %rcx    # 0x58c430
leaq 0x2b7419(%rip), %r8     # 0x58c068
movl $0x186, %r9d            # imm = 0x186
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x2d4c63
movq 0x18(%rsp), %rax
movq (%rsp), %rcx
movl 0x38(%rcx), %ecx
shlq %cl, %rax
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x10(%rax)
movq (%rsp), %rax
movq 0x10(%rax), %rcx
shlq $0x2, %rcx
movq (%rsp), %rax
addq 0x40(%rax), %rcx
movq %rcx, 0x40(%rax)
movq 0x18(%rsp), %rcx
shlq %rcx
movq (%rsp), %rax
addq 0x40(%rax), %rcx
movq %rcx, 0x40(%rax)
movq (%rsp), %rax
imulq $0xa, 0x40(%rax), %rax
cmpq 0x10(%rsp), %rax
jb 0x2d4cd8
movq (%rsp), %rdi
leaq 0x2b73a4(%rip), %rsi    # 0x58c068
movl $0x18c, %edx            # imm = 0x18C
callq 0xe88c0
movq $0x0, (%rsp)
jmp 0x2d4d48
movq (%rsp), %rax
movq 0x10(%rax), %rdi
shlq $0x2, %rdi
leaq 0x2b737d(%rip), %rsi    # 0x58c068
movl $0x191, %edx            # imm = 0x191
callq 0xe80f0
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rdi
movl $0x2, %esi
leaq 0x2b7357(%rip), %rdx    # 0x58c068
movl $0x192, %ecx            # imm = 0x192
callq 0xe83c0
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x30(%rax)
movq 0x8(%rsp), %rdi
movq (%rsp), %rax
movq 0x40(%rax), %rdx
movq (%rsp), %rax
movq (%rax), %rcx
leaq 0x2b7701(%rip), %rsi    # 0x58c442
movb $0x0, %al
callq 0xe7cd0
movq (%rsp), %rax
movq %rax, 0x30(%rsp)
jmp 0x2d4d5c
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)