// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/encdesc.c
// Function: encdesc_next_desc
static int encdesc_next_desc(GtEncdesc *encdesc, GtStr *desc, GtError *err)
{
  int stat, had_err = 0;
  bool bit,
       sampled = false;
  GtWord tmp = 0;
  GtUword cur_field_num,
          fieldlen = 0,
          idx,
          numoffields,
          nearestsample,
          zero_count = 0,
          tmp_symbol = 0;
  GtBitsequence bitseq;
  GtHuffmanBitwiseDecoder *huff_bitwise_decoder;

  if (encdesc->cur_desc == encdesc->num_of_descs) {
    gt_error_set(err,"nothing done, eof?");
    return -1;
  }

  if (encdesc->sampling != NULL &&
      encdesc->cur_desc == gt_sampling_get_next_elementnum(encdesc->sampling)) {
    int sample_status;
    size_t startofnearestsample;
    gt_log_log("get next sampled description (" GT_WU ")", encdesc->cur_desc);
    sample_status = gt_sampling_get_next_sample(encdesc->sampling,
                                                &nearestsample,
                                                &startofnearestsample);
    if (sample_status == 1) {
      gt_bitinstream_reinit(encdesc->bitinstream, startofnearestsample);
      sampled = true;
    }
    else
      had_err = sample_status;
  }

  if (had_err)
    gt_error_set(err, "sampling did not work, input data corrupt?");

  if (desc != NULL)
    gt_str_reset(desc);
  if (!had_err && !encdesc->num_of_fields_is_const) {
    had_err = encdesc_read_bits(encdesc->bitinstream,
                                encdesc->bits_per_field,
                                &bitseq, err);
    numoffields = (GtUword) bitseq;
  }
  else
    numoffields = encdesc->num_of_fields;

  gt_assert(numoffields <= encdesc->num_of_fields);
  for (cur_field_num = 0;
       !had_err && cur_field_num < numoffields;
       cur_field_num++) {
    DescField *cur_field = &encdesc->fields[cur_field_num];
    if (cur_field->is_const) {
      if (desc != NULL) {
        gt_assert(cur_field->data != NULL);
        gt_str_append_cstr(desc, cur_field->data);
        gt_str_append_char(desc, cur_field->sep);
      }
      continue;
    }
    if (cur_field->is_numeric) {
      if (cur_field->has_zero_padding && !cur_field->fieldlen_is_const) {
        huff_bitwise_decoder = gt_huffman_bitwise_decoder_new(
                                            cur_field->huffman_zero_count, err);
        stat = -1;
        while (!had_err && stat != 0) {
          if (gt_bitinstream_get_next_bit(encdesc->bitinstream, &bit) != 1) {
            gt_error_set(err, "could not get next bit");
            had_err = -1;
          }
          else {
            stat = gt_huffman_bitwise_decoder_next(huff_bitwise_decoder, bit,
                                                   &zero_count, err);
            if (stat == -1) {
              had_err = -1;
              gt_assert(gt_error_is_set(err));
            }
          }
        }
        gt_huffman_bitwise_decoder_delete(huff_bitwise_decoder);
        for (idx = 0;
             !had_err && desc != NULL && idx < zero_count;
             idx++)
          gt_str_append_char(desc, '0');
      }
      /* read absolute value if description is first or sampled */
      if (!had_err && (encdesc->cur_desc == 0 || sampled)) {
        had_err = encdesc_read_bits(encdesc->bitinstream,
                                    cur_field->bits_per_value,
                                    &bitseq, err);
        if (!had_err) {
          tmp = (GtWord) bitseq + cur_field->min_value;
        }
      }
      else if (!had_err) {
        if (!cur_field->is_value_const || !cur_field->is_delta_const) {
          if (cur_field->bits_per_num) {
            if (cur_field->use_hc) {
              huff_bitwise_decoder =
                gt_huffman_bitwise_decoder_new(cur_field->huffman_num, err);
              stat = 1;
              while (!had_err && stat != 0) {
                if (gt_bitinstream_get_next_bit(encdesc->bitinstream,
                                                &bit) != 1) {
                  gt_error_set(err, "could not get next bit");
                  had_err = -1;
                }
                else {
                  stat = gt_huffman_bitwise_decoder_next(huff_bitwise_decoder,
                                                         bit, &tmp_symbol, err);
                  if (stat == -1) {
                    had_err = -1;
                    gt_assert(gt_error_is_set(err));
                  }
                  else
                    tmp = (GtWord) tmp_symbol;
                }
              }
              gt_huffman_bitwise_decoder_delete(huff_bitwise_decoder);
            }
            else {
              had_err = encdesc_read_bits(encdesc->bitinstream,
                                          cur_field->bits_per_num,
                                          &bitseq, err);
              tmp = (GtWord) bitseq;
            }
          }
          else
            tmp = 0;
        }
        else {
          if (cur_field->use_delta_coding)
            tmp = 0;
          else
            tmp = cur_field->prev_value - cur_field->min_value;
        }
        if (cur_field->use_delta_coding)
          tmp += cur_field->prev_value + cur_field->min_delta;
        else
          tmp += cur_field->min_value;
      }
      if (!had_err) {
        if (!(encdesc->cur_desc == 0) && !sampled) {
          if (cur_field->is_delta_negative)
            gt_assert(tmp < cur_field->prev_value);
          if (cur_field->is_delta_positive)
            gt_assert(tmp > cur_field->prev_value);
        }
        cur_field->prev_value = tmp;
        if (cur_field->has_zero_padding && cur_field->fieldlen_is_const) {
          zero_count = cur_field->len -
            encdesc_digits_per_value((GtUword) tmp, 10UL);
          for (idx = 0;
               desc != NULL && idx < zero_count;
               idx++)
            gt_str_append_char(desc, '0');
        }
        if (desc != NULL) {
          gt_str_append_uword(desc, (GtUword) tmp);
          gt_str_append_char(desc, cur_field->sep);
        }
        continue;
      }
    }
    /* variable cur_field len */
    if (!cur_field->fieldlen_is_const) {
      had_err = encdesc_read_bits(encdesc->bitinstream,
                                  cur_field->bits_per_len,
                                  &bitseq, err);
      fieldlen = (GtUword) bitseq + cur_field->min_len;
    }
    else
      fieldlen = cur_field->len;

    for (idx = 0; !had_err && idx < fieldlen; idx++) {
      if (idx < cur_field->len &&
          gt_bittab_bit_is_set(cur_field->bittab, idx)) {
        if (desc != NULL)
          gt_str_append_char(desc, cur_field->data[idx]);
      }
      else {
        huff_bitwise_decoder = gt_huffman_bitwise_decoder_new(
                                            cur_field->huffman_chars[idx], err);
        stat = -1;
        while (!had_err && stat != 0) {
          if (gt_bitinstream_get_next_bit(encdesc->bitinstream, &bit) != 1) {
            gt_error_set(err, "could not get next bit");
            had_err = -1;
          }
          else {
            stat = gt_huffman_bitwise_decoder_next(huff_bitwise_decoder,
                                                   bit, &tmp_symbol, err);
            if (stat == -1) {
              gt_assert(gt_error_is_set(err));
              had_err = stat;
            }
            else
              tmp = (GtWord) tmp_symbol;
          }
        }
        if (!had_err && desc != NULL) {
          gt_assert(tmp < 256L);
          gt_str_append_char(desc, (char) tmp);
        }
        gt_huffman_bitwise_decoder_delete(huff_bitwise_decoder);
      }
    }
    if (!had_err && desc != NULL)
      gt_str_append_char(desc, cur_field->sep);
  }
  if (desc != NULL && gt_str_length(desc) != 0)
    gt_str_set_length(desc, gt_str_length(desc) - 1);
  if (!had_err) {
    encdesc->cur_desc++;
  }

  if (had_err)
    gt_assert(gt_error_is_set(err));
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbx
movq %rsi, %rdx
xorl %esi, %esi
movq %rsi, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x48(%rdi), %r12
cmpq 0x38(%rdi), %r12
jne 0x13c767
leaq 0x23ff91(%rip), %rsi    # 0x37c6e4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x13cef9
movq %rdi, %r14
movq 0x28(%rdi), %rdi
movb $0x1, %r15b
testq %rdi, %rdi
movq %rdx, 0x8(%rsp)
je 0x13c7d0
callq 0x171147
movl $0x0, 0x14(%rsp)
cmpq %rax, %r12
jne 0x13c7da
movq 0x48(%r14), %rsi
leaq 0x23ff5f(%rip), %rdi    # 0x37c6f7
xorl %eax, %eax
callq 0x103d72
movq 0x28(%r14), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x1711a1
cmpl $0x1, %eax
jne 0x13c7de
movq 0x20(%r14), %rdi
movq 0x18(%rsp), %rsi
callq 0x2fad73
movb $0x1, %r15b
movb $0x1, %al
movl %eax, 0x14(%rsp)
jmp 0x13c811
movl $0x0, 0x14(%rsp)
jmp 0x13c818
xorl %esi, %esi
jmp 0x13c802
movl %eax, %ebp
testl %eax, %eax
je 0x13c809
leaq 0x23ff2f(%rip), %rsi    # 0x37c71a
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xfcb67
movl $0x0, 0x14(%rsp)
movl %ebp, %esi
movq 0x8(%rsp), %rdx
jmp 0x13c818
movl $0x0, 0x14(%rsp)
movq 0x8(%rsp), %rdx
xorl %esi, %esi
testq %rdx, %rdx
movq %r14, 0x40(%rsp)
je 0x13c83a
movq %rdx, %rdi
movq %rsi, %r14
callq 0x11b132
movq %r14, %rsi
movq 0x40(%rsp), %r14
movq 0x8(%rsp), %rdx
testb %r15b, %r15b
je 0x13c84a
cmpb $0x0, 0x6c(%r14)
je 0x13ce73
movq 0x40(%r14), %r13
testl %esi, %esi
sete %bpl
jne 0x13ceaf
movq %r13, 0x48(%rsp)
testq %r13, %r13
je 0x13ceaf
movl 0x14(%rsp), %eax
notb %al
movb %al, 0x13(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x18(%r14), %rax
imulq $0xc8, %r15, %rcx
leaq (%rax,%rcx), %r12
cmpb $0x1, 0xbb(%rax,%rcx)
jne 0x13c8ba
testq %rdx, %rdx
je 0x13ce50
movq 0x40(%r12), %rsi
testq %rsi, %rsi
je 0x13cf3c
movq %rdx, %rdi
callq 0x11acf3
movq 0x8(%rsp), %rdx
jmp 0x13ce3a
xorl %esi, %esi
cmpb $0x1, 0xbf(%r12)
movq %r12, 0x20(%rsp)
movq %r15, 0x38(%rsp)
jne 0x13cbba
cmpb $0x1, 0xba(%r12)
jne 0x13c8ef
cmpb $0x0, 0xb9(%r12)
je 0x13c9ed
cmpq $0x0, 0x48(%r14)
setne %al
testb %al, 0x13(%rsp)
jne 0x13c93c
movl 0xb0(%r12), %ebp
testl %ebp, %ebp
je 0x13ca4b
movq 0x20(%r14), %r15
xorl %r12d, %r12d
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2fae18
cmpl $0x1, %eax
jne 0x13ca6a
movzbl 0x18(%rsp), %eax
leaq (%rax,%r12,2), %r12
decl %ebp
jne 0x13c914
jmp 0x13ca4e
cmpb $0x1, 0xc0(%r12)
jne 0x13c978
cmpb $0x0, 0xbc(%r12)
je 0x13c978
movq %r12, %rax
xorl %r12d, %r12d
cmpb $0x0, 0xc1(%rax)
jne 0x13ca8d
movq 0xa0(%rax), %r13
subq 0x98(%rax), %r13
jmp 0x13cb83
movl 0xac(%r12), %ebp
testl %ebp, %ebp
je 0x13ca8a
cmpb $0x1, 0xc2(%r12)
jne 0x13ca95
movq 0x8(%r12), %rdi
movq %rbx, %rsi
callq 0x154933
movq %rax, %r15
movq 0x20(%r14), %rdi
leaq 0x7(%rsp), %rsi
callq 0x2fae18
cmpl $0x1, %eax
jne 0x13cb47
movzbl 0x7(%rsp), %esi
movq %r15, %rdi
leaq 0x30(%rsp), %rdx
movq %rbx, %rcx
callq 0x154969
cmpl $-0x1, %eax
je 0x13cb60
movq 0x30(%rsp), %r13
testl %eax, %eax
jne 0x13c9a7
xorl %r12d, %r12d
jmp 0x13cb76
movq 0x10(%r12), %rdi
movq %rbx, %rsi
callq 0x154933
movq %rax, %r15
movq 0x20(%r14), %rdi
leaq 0x7(%rsp), %rsi
callq 0x2fae18
cmpl $0x1, %eax
jne 0x13cac5
movzbl 0x7(%rsp), %esi
movq %r15, %rdi
leaq 0x28(%rsp), %rdx
movq %rbx, %rcx
callq 0x154969
testl %eax, %eax
je 0x13cae8
cmpl $-0x1, %eax
jne 0x13c9fd
movq %rbx, %rdi
callq 0xfcc32
testb %al, %al
jne 0x13cad6
jmp 0x13cf50
xorl %r12d, %r12d
movq 0x20(%rsp), %rax
addq 0x98(%rax), %r12
movq %r12, %r13
movq %rax, %r12
movq 0x8(%rsp), %rdx
jmp 0x13cc19
movq %rbx, %rdi
leaq 0x23fd21(%rip), %rsi    # 0x37c795
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq 0x20(%rsp), %r12
jmp 0x13cbba
xorl %r12d, %r12d
xorl %r13d, %r13d
jmp 0x13cb83
movq 0x20(%r14), %r15
xorl %r13d, %r13d
addq %r13, %r13
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2fae18
cmpl $0x1, %eax
jne 0x13cb2e
movzbl 0x18(%rsp), %eax
orq %rax, %r13
decl %ebp
jne 0x13ca9c
xorl %r12d, %r12d
jmp 0x13cb7e
movq %rbx, %rdi
leaq 0x23fcc6(%rip), %rsi    # 0x37c795
xorl %eax, %eax
callq 0xfcb67
movq %r15, %rdi
callq 0x1549bd
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
jmp 0x13cbba
movq %r15, %rdi
callq 0x1549bd
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0x13c8ef
cmpq $0x0, 0x28(%rsp)
je 0x13c8ef
xorl %r15d, %r15d
movq %rdx, %rdi
movl $0x30, %esi
callq 0x11af23
movq 0x8(%rsp), %rdx
incq %r15
cmpq 0x28(%rsp), %r15
jb 0x13cb0d
jmp 0x13c8ef
movq %rbx, %rdi
leaq 0x23fc5d(%rip), %rsi    # 0x37c795
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x13cb7e
movq %rbx, %rdi
leaq 0x23fc44(%rip), %rsi    # 0x37c795
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x13cb76
movq %rbx, %rdi
callq 0xfcc32
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x13cf55
movq %r15, %rdi
callq 0x1549bd
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %rcx
cmpb $0x1, 0xc1(%rcx)
jne 0x13cba1
movq 0x90(%rcx), %rax
addq 0xa0(%rcx), %rax
jmp 0x13cba8
movq 0x98(%rcx), %rax
addq %rax, %r13
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
testl %r12d, %r12d
movq 0x20(%rsp), %r12
je 0x13cc19
cmpb $0x0, 0xb9(%r12)
je 0x13cbcf
movq 0x50(%r12), %r15
jmp 0x13cd0c
movl 0xa8(%r12), %ebp
xorl %esi, %esi
testl %ebp, %ebp
je 0x13cce7
movq 0x20(%r14), %r12
xorl %r15d, %r15d
addq %r15, %r15
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
callq 0x2fae18
cmpl $0x1, %eax
jne 0x13ccec
movzbl 0x18(%rsp), %eax
orq %rax, %r15
decl %ebp
jne 0x13cbe8
movq 0x20(%rsp), %r12
xorl %esi, %esi
jmp 0x13cd07
cmpq $0x0, 0x48(%r14)
sete %al
orb 0x14(%rsp), %al
jne 0x13cc59
cmpb $0x1, 0xbe(%r12)
jne 0x13cc40
cmpq 0xa0(%r12), %r13
jge 0x13cf46
cmpb $0x1, 0xbd(%r12)
jne 0x13cc59
cmpq 0xa0(%r12), %r13
jle 0x13cf4b
movq %r13, 0xa0(%r12)
cmpb $0x1, 0xba(%r12)
jne 0x13ccc4
cmpb $0x1, 0xb9(%r12)
jne 0x13ccc4
movq 0x50(%r12), %r15
movl $0xa, %esi
movq %r13, %rdi
callq 0x13d1dc
movq 0x8(%rsp), %rdx
movl %eax, %eax
movq %r15, %rcx
subq %rax, %rcx
movq %rcx, 0x28(%rsp)
testq %rdx, %rdx
je 0x13ccc4
cmpq %rax, %r15
je 0x13ccc4
xorl %r15d, %r15d
movq %rdx, %rdi
movl $0x30, %esi
callq 0x11af23
movq 0x8(%rsp), %rdx
incq %r15
cmpq 0x28(%rsp), %r15
jb 0x13cca8
testq %rdx, %rdx
je 0x13ce6a
movq %rdx, %rdi
movq %r13, %rsi
callq 0x11ae72
movq 0x8(%rsp), %rdx
movq 0x38(%rsp), %r15
jmp 0x13ce3a
xorl %r15d, %r15d
jmp 0x13cd07
movq %rbx, %rdi
leaq 0x23fa9f(%rip), %rsi    # 0x37c795
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq 0x20(%rsp), %r12
addq 0x58(%r12), %r15
testl %esi, %esi
sete %al
jne 0x13ce24
testq %r15, %r15
je 0x13ce24
xorl %ebp, %ebp
cmpq 0x50(%r12), %rbp
jae 0x13cd5f
movq 0x18(%r12), %rdi
movq %rbp, %rsi
callq 0xd6e4a
testb %al, %al
je 0x13cd5f
xorl %esi, %esi
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x13ce11
movq 0x40(%r12), %rax
movsbl (%rax,%rbp), %esi
callq 0x11af23
xorl %esi, %esi
jmp 0x13ce11
movq (%r12), %rax
movq (%rax,%rbp,8), %rdi
movq %rbx, %rsi
callq 0x154933
movq %rax, %r12
movq 0x20(%r14), %rdi
leaq 0x7(%rsp), %rsi
callq 0x2fae18
cmpl $0x1, %eax
jne 0x13cdcd
movzbl 0x7(%rsp), %esi
movq %r12, %rdi
leaq 0x30(%rsp), %rdx
movq %rbx, %rcx
callq 0x154969
cmpl $-0x1, %eax
je 0x13cde6
movq 0x30(%rsp), %r13
testl %eax, %eax
jne 0x13cd72
movq 0x8(%rsp), %rdi
xorl %r14d, %r14d
testq %rdi, %rdi
je 0x13cdfc
cmpq $0x100, %r13            # imm = 0x100
jge 0x13cf37
movsbl %r13b, %esi
callq 0x11af23
jmp 0x13cdfc
movq %rbx, %rdi
leaq 0x23f9be(%rip), %rsi    # 0x37c795
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x13cdfc
movq %rbx, %rdi
callq 0xfcc32
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x13cf32
movq %r12, %rdi
callq 0x1549bd
movq 0x20(%rsp), %r12
movq %r14, %rsi
movq 0x40(%rsp), %r14
testl %esi, %esi
sete %al
jne 0x13ce24
incq %rbp
cmpq %r15, %rbp
jb 0x13cd22
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
sete %cl
xorb $0x1, %al
orb %cl, %al
movq 0x38(%rsp), %r15
jne 0x13ce52
movsbl 0xb8(%r12), %esi
movq %rdx, %rdi
callq 0x11af23
movq 0x8(%rsp), %rdx
xorl %esi, %esi
testl %esi, %esi
sete %bpl
jne 0x13ceaf
incq %r15
cmpq 0x48(%rsp), %r15
jb 0x13c878
jmp 0x13ceaf
xorl %esi, %esi
movq 0x38(%rsp), %r15
jmp 0x13ce52
movl 0x68(%r14), %ebp
testl %ebp, %ebp
je 0x13ceaa
movq 0x20(%r14), %r15
xorl %r13d, %r13d
leaq 0x18(%rsp), %r12
addq %r13, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x2fae18
cmpl $0x1, %eax
jne 0x13cf08
movzbl 0x18(%rsp), %eax
orq %rax, %r13
decl %ebp
jne 0x13ce87
xorl %esi, %esi
jmp 0x13cf1e
movb $0x1, %bpl
xorl %esi, %esi
movq %rsi, %r12
testq %rdx, %rdx
je 0x13cedd
movq %rdx, %rdi
callq 0x11b0ca
movq 0x8(%rsp), %r15
testq %rax, %rax
je 0x13cedd
movq %r15, %rdi
callq 0x11b0ca
leaq -0x1(%rax), %rsi
movq %r15, %rdi
callq 0x11b0d7
testb %bpl, %bpl
je 0x13ceea
incq 0x48(%r14)
xorl %eax, %eax
jmp 0x13cef9
movq %rbx, %rdi
callq 0xfcc32
testb %al, %al
movq %r12, %rax
je 0x13cf41
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x23f886(%rip), %rsi    # 0x37c795
movq %rbx, %rdi
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmpq 0x40(%r14), %r13
movq 0x8(%rsp), %rdx
jbe 0x13c84e
callq 0x4099c
callq 0x40a80
callq 0x40a47
callq 0x40b64
callq 0x40b2b
callq 0x40ab9
callq 0x40af2
callq 0x409d5
callq 0x40a0e