// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/tools/gt_compressedbits.c
// Function: gt_compressedbits_runner
static int gt_compressedbits_runner(GT_UNUSED int argc,
                                    GT_UNUSED const char **argv,
                                    GT_UNUSED int parsed_args,
                                    void *tool_arguments,
                                    GtError *err)
{
  GtCompressdbitsArguments *arguments = tool_arguments;
  int had_err = 0;
  GtUword idx;
  GtUint64 num_of_bits = 0ULL;
  GtBitsequence *bits = NULL;
  GtCompressedBitsequence *cbs = NULL, *read_cbs = NULL;
  GtStr *filename = gt_str_new();
  FILE *fp = NULL;

  gt_error_check(err);
  gt_assert(arguments);
  gt_assert(argc == parsed_args);

  if (gt_option_is_set(arguments->filename_op)) {
    FILE *file = NULL;
    gt_assert(arguments->filename != NULL);

    file = gt_xfopen(gt_str_get(arguments->filename), "r");
    if ((size_t) 1 != gt_xfread(&num_of_bits,
                                sizeof (num_of_bits), (size_t) 1, file)) {
      had_err = -1;
    }
    if (!had_err) {
      gt_log_log("bits to read: "GT_LLU"", num_of_bits);
      arguments->size = (GtUword) GT_NUMOFINTSFORBITS(num_of_bits);
      bits = gt_malloc(sizeof (*bits) * arguments->size);
      if ((size_t) arguments->size !=
          gt_xfread(bits, sizeof (*bits),
                    (size_t) arguments->size, file)) {
        had_err = -1;
      }
    }
    gt_xfclose(file);
  }
  else {
    bits = gt_calloc(sizeof (*bits), (size_t) arguments->size);
    num_of_bits = (GtUint64) (GT_INTWORDSIZE * arguments->size);

    if (arguments->fill_random) {
      for (idx = 0; idx < arguments->size; idx++) {
        bits[idx] =
          (GtBitsequence) (0xAAAAAAAAAAAAAAAAULL ^ gt_rand_max(ULONG_MAX));
      }
    }
    else {
      for (idx = 0; idx < arguments->size; idx++)
        bits[idx] = (GtBitsequence) (0xAAAAAAAAAAAAAAAAULL ^ idx);
    }
  }

  if (!had_err) {
    fp = gt_xtmpfp(filename);
    gt_fa_xfclose(fp);
    fp = NULL;

    gt_log_log("filename: %s", gt_str_get(filename));
    gt_log_log("size in words: "GT_WU"", arguments->size);
    cbs = gt_compressed_bitsequence_new(
                            bits, arguments->samplerate,
                            (GtUword) num_of_bits);
    gt_log_log("original size in MB: %2.3f",
               (sizeof (*bits) * arguments->size) / (1024.0 * 1024.0));
    gt_log_log("compressed size in MB: %2.3f",
               gt_compressed_bitsequence_size(cbs) / (1024.0 * 1024.0));
    gt_log_log("popcount table size thereof in MB: %2.3f",
               gt_popcount_tab_calculate_size(15U) / (1024.0 * 1024.0));
    had_err = gt_compressed_bitsequence_write(cbs, gt_str_get(filename), err);
  }
  if (!had_err)
  {
    read_cbs =
      gt_compressed_bitsequence_new_from_file(gt_str_get(filename), err);
    if (read_cbs == NULL)
      had_err = -1;
  }
  if (!had_err && bits != NULL && arguments->check_consistency) {
    for (idx = 0; (GtUint64) idx < num_of_bits; ++idx) {
      int GT_UNUSED bit = gt_compressed_bitsequence_access(read_cbs, idx);
      int GT_UNUSED original = GT_ISIBITSET(bits, idx) ? 1 : 0;
      gt_assert(gt_compressed_bitsequence_access(cbs, idx) == bit);
      gt_assert(original == bit);
    }
  }
  gt_compressed_bitsequence_delete(cbs);
  gt_compressed_bitsequence_delete(read_cbs);
  gt_free(bits);
  gt_str_delete(filename);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r15
movq %rcx, %r14
movl %edx, %ebx
movl %edi, %ebp
movq $0x0, (%rsp)
callq 0x1208f8
movq %rax, 0x8(%rsp)
testq %r15, %r15
je 0x9e832
movq %r15, %rdi
callq 0x101a9a
testb %al, %al
jne 0x9ebcf
testq %r14, %r14
je 0x9ebc5
cmpl %ebx, %ebp
jne 0x9ebca
movq 0x30(%r14), %rdi
callq 0x10fe52
testb %al, %al
je 0x9e905
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x9ebd4
callq 0x120d23
leaq 0x2c565c(%rip), %rsi    # 0x363ec9
movq %rax, %rdi
callq 0x1255be
movq %rax, %rbx
movq %rsp, %rdi
movl $0x1, %r12d
movl $0x8, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x125604
cmpq $0x1, %rax
jne 0x9e993
movq (%rsp), %rsi
leaq 0x2b2275(%rip), %rdi    # 0x350b1d
xorl %eax, %eax
callq 0x108e02
movq (%rsp), %rax
leaq -0x1(%rax), %rdi
shrq $0x6, %rdi
incq %rdi
cmpq $0x40, %rax
cmovbq %r12, %rdi
movq %rdi, 0x8(%r14)
shlq $0x3, %rdi
leaq 0x2b2033(%rip), %rsi    # 0x350908
movl $0x98, %edx
callq 0x1092b2
movq %rax, %r12
movq 0x8(%r14), %r13
movl $0x8, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x125604
cmpq %rax, %r13
sete %r13b
jmp 0x9e999
movq 0x8(%r14), %rsi
leaq 0x2b1ff8(%rip), %rdx    # 0x350908
movl $0x8, %edi
movl $0xa2, %ecx
callq 0x1093ef
movq %rax, %r12
movq 0x8(%r14), %rax
movq %rax, %rcx
shlq $0x6, %rcx
movq %rcx, (%rsp)
cmpb $0x0, 0x18(%r14)
je 0x9e96a
movb $0x1, %r13b
testq %rax, %rax
je 0x9e9a1
movabsq $-0x5555555555555556, %rbx # imm = 0xAAAAAAAAAAAAAAAA
xorl %ebp, %ebp
movq $-0x1, %rdi
callq 0x10ae3c
xorq %rbx, %rax
movq %rax, (%r12,%rbp,8)
incq %rbp
cmpq 0x8(%r14), %rbp
jb 0x9e94c
jmp 0x9e9a1
movb $0x1, %r13b
testq %rax, %rax
je 0x9e9a1
movabsq $-0x5555555555555556, %rax # imm = 0xAAAAAAAAAAAAAAAA
xorl %ecx, %ecx
movq %rcx, %rdx
xorq %rax, %rdx
movq %rdx, (%r12,%rcx,8)
incq %rcx
cmpq 0x8(%r14), %rcx
jb 0x9e97e
jmp 0x9e9a1
xorl %r12d, %r12d
xorl %r13d, %r13d
movq %rbx, %rdi
callq 0x12552d
testb %r13b, %r13b
je 0x9eae1
leaq 0x2b1f57(%rip), %rdx    # 0x350908
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movl $0xb2, %ecx
callq 0x1021c2
movq %rax, %rdi
callq 0x101f02
movq %rbx, %rdi
callq 0x120d23
leaq 0x2b2154(%rip), %rdi    # 0x350b30
movq %rax, %rsi
xorl %eax, %eax
callq 0x108e02
movq 0x8(%r14), %rsi
leaq 0x2b214c(%rip), %rdi    # 0x350b3d
xorl %eax, %eax
callq 0x108e02
movl (%r14), %esi
movq (%rsp), %rdx
movq %r12, %rdi
callq 0x12f230
movq %rax, %r13
movq 0x8(%r14), %rax
shlq $0x3, %rax
movq %rax, %xmm1
punpckldq 0x2b1ec1(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2b1ec9(%rip), %xmm1   # 0x3508f0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x2b1ec5(%rip), %xmm0   # 0x350900
leaq 0x2b210e(%rip), %rdi    # 0x350b50
movb $0x1, %al
callq 0x108e02
movq %r13, %rdi
callq 0x13092b
movq %rax, %xmm1
punpckldq 0x2b1e82(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2b1e8a(%rip), %xmm1   # 0x3508f0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x2b1e86(%rip), %xmm0   # 0x350900
leaq 0x2b20ea(%rip), %rdi    # 0x350b6b
movb $0x1, %al
callq 0x108e02
movl $0xf, %edi
callq 0x16c19d
movq %rax, %xmm1
punpckldq 0x2b1e41(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2b1e49(%rip), %xmm1   # 0x3508f0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x2b1e45(%rip), %xmm0   # 0x350900
leaq 0x2b20c6(%rip), %rdi    # 0x350b88
movb $0x1, %al
callq 0x108e02
movq %rbx, %rdi
callq 0x120d23
movq %r13, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x130960
jmp 0x9eae9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %r13d, %r13d
xorl %ebx, %ebx
testl %eax, %eax
jne 0x9eb12
movq 0x8(%rsp), %rdi
callq 0x120d23
movq %rax, %rdi
movq %r15, %rsi
callq 0x130aca
movq %rax, %rbx
cmpq $0x1, %rax
movl $0x0, %eax
sbbl %eax, %eax
movl %eax, 0x14(%rsp)
testl %eax, %eax
sete %al
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x9eb7a
cmpb $0x1, 0x19(%r14)
jne 0x9eb7a
cmpq $0x0, (%rsp)
je 0x9eb7a
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x12fb79
movl %eax, %r15d
movq %r14, %rax
shrq $0x6, %rax
movq (%r12,%rax,8), %rbp
movq %r13, %rdi
movq %r14, %rsi
callq 0x12fb79
cmpl %r15d, %eax
jne 0x9ebc0
movl %r14d, %ecx
shlq %cl, %rbp
shrq $0x3f, %rbp
cmpl %ebp, %r15d
jne 0x9ebbb
incq %r14
cmpq (%rsp), %r14
jb 0x9eb39
movq %r13, %rdi
callq 0x130eb7
movq %rbx, %rdi
callq 0x130eb7
leaq 0x2b1d77(%rip), %rsi    # 0x350908
movq %r12, %rdi
movl $0xd4, %edx
callq 0x109670
movq 0x8(%rsp), %rdi
callq 0x121b03
movl 0x14(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x18d56
callq 0x18d1d
callq 0x18dc8
callq 0x18ce4
callq 0x18cab
callq 0x18d8f
nopl (%rax)