// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/rcr.c
// Function: rcr_write_read_encoding
static int rcr_write_read_encoding(const bam1_t *alignment,
                                   GtRcrEncoder *rcr_enc)
{
  int had_err = 0;
  GtUchar ref,
          base;
  GtUword cigar_op,
                cigar_len;
  unsigned bits_to_write,
           one_bit = 1U;
  GtUword alpha_size,
                i,
                j,
                prev_varpos,
                qual,
                read_i,
                readlength,
                readpos,
                ref_i,
                rel_readpos = 0,
                rel_varpos,
                varpos;
  GtBitsequence code,
                one = (GtBitsequence) 1,
                zero = 0;
  uint32_t *cigar;
  uint8_t *qual_string,
          *seq_string;
  const bam1_core_t *core;
  GtAlphabet *encseq_alpha = gt_encseq_alphabet(rcr_enc->encseq);

  alpha_size = (GtUword) gt_alphabet_size(encseq_alpha);

  core = &alignment->core;
  qual_string = bam1_qual(alignment);
  seq_string = bam1_seq(alignment);
  cigar = bam1_cigar(alignment);

  /* only one option should be set */
  gt_assert(!(rcr_enc->store_all_qual && rcr_enc->store_var_qual));

  /* read is unmapped */
  if (core->flag & BAM_FUNMAP) {
    if (rcr_enc->store_unmmaped_reads)
      rcr_write_read_to_file(rcr_enc->unmapped_reads_ptr,
                             seq_string,
                             qual_string,
                             bam1_qname(alignment),
                             (GtUword) core->l_qseq);
    gt_bitoutstream_append(rcr_enc->bitstream, one, one_bit);
    return 0;
  }
  else
    gt_bitoutstream_append(rcr_enc->bitstream, zero, one_bit);

  /* encode read length */
  if (!rcr_enc->cons_readlength) {
    readlength = (GtUword) core->l_qseq;
    rcr_huff_encode_write(rcr_enc, rcr_enc->readlenghts_huff, readlength);
  }
  else
    readlength = rcr_enc->readlength;

  rcr_enc->encodedbases += readlength;

  gt_safe_assign(readpos, core->pos);
  ref_i = readpos + rcr_enc->cur_seq_startpos;
  read_i = 0;

  /* encode relative read position */
  if (!had_err) {
    gt_assert(readpos >= rcr_enc->prev_readpos);
    gt_safe_sub(rel_readpos, readpos, rcr_enc->prev_readpos);
    rcr_enc->prev_readpos = readpos;
    rcr_golomb_encode_write(rcr_enc, rcr_enc->readpos_golomb, rel_readpos);
  }

  /* write mapping qual */
  if (rcr_enc->store_mapping_qual) {
    qual = (GtUword) core->qual;
    rcr_huff_encode_write(rcr_enc, rcr_enc->qual_mapping_huff, qual);
  }
  /* encode qual string */
  if (rcr_enc->store_all_qual) {
    for (i = 0; i < readlength; i++) {
      qual = ((GtUword) qual_string[i]) + PHREDOFFSET;
      rcr_huff_encode_write(rcr_enc, rcr_enc->qual_huff, qual);
    }
  }

  /* write strand */
  if (core->flag & BAM_FREVERSE)
    gt_bitoutstream_append(rcr_enc->bitstream, one, one_bit);
  else
    gt_bitoutstream_append(rcr_enc->bitstream, zero, one_bit);
  rcr_enc->all_bits++;
  rcr_enc->strand_bits++;

  /* exact match? */
  if (gt_queue_size(rcr_enc->not_exact_matches) > 0 &&
      (void*) rcr_enc->cur_read == gt_queue_head(rcr_enc->not_exact_matches)) {
    (void) gt_queue_get(rcr_enc->not_exact_matches);
    gt_bitoutstream_append(rcr_enc->bitstream, zero, one_bit);
    rcr_enc->all_bits++;
    rcr_enc->exact_match_flag_bits++;

    prev_varpos = 0;

    for (i = 0; i < (GtUword) core->n_cigar; i++) {
      gt_safe_assign(cigar_op, (cigar[i] & 0xf));
      gt_safe_assign(cigar_len, (cigar[i]>>4));

      if (cigar_op == (GtUword) BAM_CEQUAL ||
          cigar_op == (GtUword) BAM_CDIFF)
        cigar_op = BAM_CMATCH;

      switch (cigar_op) {
        case BAM_CMATCH:
          for (j = 0; j < cigar_len; j++) {
            ref = gt_encseq_get_encoded_char(rcr_enc->encseq,
                                     (ref_i + j),
                                     GT_READMODE_FORWARD);
            base =
              rcr_bambase2gtbase((uint8_t) bam1_seqi(seq_string, read_i + j),
                                 encseq_alpha);
            if (ref != base) {
              rcr_encode_write_var_type(rcr_enc, (GtUword) cigar_op);

              /* encode variation position */
              varpos = read_i + j;

              RCR_UPDATE_VAR_POS(rel_varpos, varpos, prev_varpos);
              rcr_encode_write_var_pos(rcr_enc, rel_varpos);

              /* write transition code */
              code = rcr_transencode(ref, base, encseq_alpha);
              if (code == (GtBitsequence) GT_UNDEF_UINT)
                return -1;
              rcr_enc->all_bits += 2;
              rcr_enc->subs_bits += 2;
              bits_to_write = 2U;
              gt_bitoutstream_append(rcr_enc->bitstream, code, bits_to_write);

              if (rcr_enc->store_var_qual) {
                qual = ((GtUword) qual_string[varpos]) + PHREDOFFSET;
                rcr_huff_encode_write(rcr_enc, rcr_enc->qual_huff, qual);
              }
            }
          }
          read_i += cigar_len;
          ref_i += cigar_len;
          break;

        case BAM_CDEL:
        case BAM_CREF_SKIP:
          rcr_encode_write_var_type(rcr_enc, (GtUword) cigar_op);

          /* encode variation position */
          varpos = read_i;

          RCR_UPDATE_VAR_POS(rel_varpos, varpos, prev_varpos);
          rcr_encode_write_var_pos(rcr_enc, rel_varpos);

          /* encode length of skip/del */
          rcr_elias_encode_write(rcr_enc, cigar_len);
          ref_i += cigar_len;
          break;

        case BAM_CINS:
        case BAM_CSOFT_CLIP:
          rcr_encode_write_var_type(rcr_enc, (GtUword) cigar_op);

          /* encode varation position */
          varpos = read_i;

          RCR_UPDATE_VAR_POS(rel_varpos, varpos, prev_varpos);
          rcr_encode_write_var_pos(rcr_enc, rel_varpos);

          /* encode inserted bases */
          for (j = 0; j < cigar_len; j++) {
            base = rcr_bambase2gtbase(
                (uint8_t) bam1_seqi(seq_string, read_i + j), encseq_alpha);

            /* use alphabet_size - 1 as wildcard symbol */
            /* TODO DW change this, it doesn't matter if wildcard is in a
               continuous range with the rest */
            if (base == (GtUchar) GT_WILDCARD)
              base = (GtUchar) (alpha_size - 1);

            rcr_huff_encode_write(rcr_enc, rcr_enc->bases_huff,
                                  (GtUword) base);
          }

          /* append end symbol */
          rcr_huff_encode_write(rcr_enc, rcr_enc->bases_huff, alpha_size);

          if (rcr_enc->store_var_qual) {
            for (j = 0; j < cigar_len; j++) {
              qual = ((GtUword) qual_string[read_i + j]) + PHREDOFFSET;
              rcr_huff_encode_write(rcr_enc, rcr_enc->qual_huff, qual);
            }
          }
          read_i += cigar_len;
          break;
        default:
          /* TODO DW gt_error nutzen */
          gt_log_log("encountered funny cigar_op: " GT_WU, cigar_op);
          return -1;
          ;
      }
    }
    /* end symbol of a record */
    rcr_encode_write_var_type(rcr_enc, (GtUword) ENDOFRECORD);
    if (readlength != read_i) {
      /* TODO DW gt_error nutzen */
      gt_log_log("readlength: " GT_WU ", read_i: " GT_WU, readlength, read_i);
      return -1;
    }
  }
  else {
    gt_bitoutstream_append(rcr_enc->bitstream, one, one_bit);
    rcr_enc->all_bits++;
    rcr_enc->exact_match_flag_bits++;
  }
  rcr_enc->cur_read++;
  return 0;
}

// Assembly:
subq $0x188, %rsp            # imm = 0x188
movq %rdi, 0x178(%rsp)
movq %rsi, 0x170(%rsp)
movl $0x0, 0x16c(%rsp)
movl $0x1, 0x150(%rsp)
movq $0x0, 0x100(%rsp)
movq $0x1, 0xe0(%rsp)
movq $0x0, 0xd8(%rsp)
movq 0x170(%rsp), %rax
movq 0x98(%rax), %rdi
callq 0xb0f00
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
callq 0x7e920
movl %eax, %eax
movq %rax, 0x148(%rsp)
movq 0x178(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x178(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x178(%rsp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq 0x178(%rsp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq 0x178(%rsp), %rcx
movl 0x10(%rcx), %ecx
addl $0x1, %ecx
sarl %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0xc8(%rsp)
movq 0x178(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x178(%rsp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq 0x178(%rsp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0xc0(%rsp)
movq 0x178(%rsp), %rax
movq 0x30(%rax), %rax
movq 0x178(%rsp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0xd0(%rsp)
movq 0x170(%rsp), %rax
testb $0x1, 0x1bb(%rax)
je 0x1c1009
movq 0x170(%rsp), %rax
testb $0x1, 0x1be(%rax)
je 0x1c1009
movq 0x47afc8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x355031(%rip), %rsi    # 0x516013
leaq 0x3a0aaa(%rip), %rdx    # 0x561a93
leaq 0x3a0ad9(%rip), %rcx    # 0x561ac9
leaq 0x3a04e8(%rip), %r8     # 0x5614df
movl $0x1d7, %r9d            # imm = 0x1D7
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c100b
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1c10a3
movq 0x170(%rsp), %rax
testb $0x1, 0x1bd(%rax)
je 0x1c1073
movq 0x170(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
movq 0x178(%rsp), %rax
movq 0x30(%rax), %rcx
movq 0xb8(%rsp), %rax
movslq 0x10(%rax), %r8
callq 0x1c1ef0
movq 0x170(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xe0(%rsp), %rsi
movl 0x150(%rsp), %edx
callq 0x489fa0
movl $0x0, 0x184(%rsp)
jmp 0x1c1ed3
movq 0x170(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xd8(%rsp), %rsi
movl 0x150(%rsp), %edx
callq 0x489fa0
movq 0x170(%rsp), %rax
testb $0x1, 0x1b8(%rax)
jne 0x1c110b
movq 0xb8(%rsp), %rax
movslq 0x10(%rax), %rax
movq %rax, 0x118(%rsp)
movq 0x170(%rsp), %rdi
movq 0x170(%rsp), %rax
movq 0x60(%rax), %rsi
movq 0x118(%rsp), %rdx
callq 0x1c2090
jmp 0x1c1122
movq 0x170(%rsp), %rax
movq 0x1b0(%rax), %rax
movq %rax, 0x118(%rsp)
movq 0x118(%rsp), %rcx
movq 0x170(%rsp), %rax
addq 0xc8(%rax), %rcx
movq %rcx, 0xc8(%rax)
movq 0xb8(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0xac(%rsp)
movslq 0xac(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl 0xac(%rsp), %eax
movq 0xa0(%rsp), %rcx
cmpl %ecx, %eax
jne 0x1c11b3
cmpl $0x1, 0xac(%rsp)
setl %al
andb $0x1, %al
movzbl %al, %eax
cmpq $0x1, 0xa0(%rsp)
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x1c11b3
movq 0xa0(%rsp), %rax
movq %rax, 0x110(%rsp)
xorl %eax, %eax
movl %eax, 0x30(%rsp)
jmp 0x1c11be
movl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x1c11be
movl 0x30(%rsp), %eax
movl %eax, 0x9c(%rsp)
cmpl $0x0, 0x9c(%rsp)
je 0x1c1201
movq 0x47adc6(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x356e41(%rip), %rsi    # 0x518025
leaq 0x3a02f4(%rip), %rdx    # 0x5614df
movl $0x1f1, %ecx            # imm = 0x1F1
movb $0x0, %al
callq 0x199f0
movl $0x1, %edi
callq 0x19890
jmp 0x1c1203
movq 0x110(%rsp), %rax
movq 0x170(%rsp), %rcx
addq 0x188(%rcx), %rax
movq %rax, 0x108(%rsp)
movq $0x0, 0x120(%rsp)
cmpl $0x0, 0x16c(%rsp)
jne 0x1c1499
jmp 0x1c123e
movq 0x110(%rsp), %rax
movq 0x170(%rsp), %rcx
cmpq 0x1a8(%rcx), %rax
jae 0x1c128f
movq 0x47ad42(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x354dab(%rip), %rsi    # 0x516013
leaq 0x3a0872(%rip), %rdx    # 0x561ae1
leaq 0x3a0853(%rip), %rcx    # 0x561ac9
leaq 0x3a0262(%rip), %r8     # 0x5614df
movl $0x1f7, %r9d            # imm = 0x1F7
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1c1291
jmp 0x1c1293
movq 0x110(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x170(%rsp), %rax
movq 0x1a8(%rax), %rax
movq %rax, 0x88(%rsp)
cmpq $0x1, 0x88(%rsp)
jae 0x1c1375
movq 0x88(%rsp), %rax
addq $-0x1, %rax
cmpq 0x90(%rsp), %rax
jb 0x1c135d
movq 0x90(%rsp), %rax
subq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x78(%rsp), %rax
cmpq 0x70(%rsp), %rax
jne 0x1c1340
cmpq $0x1, 0x78(%rsp)
setb %al
andb $0x1, %al
movzbl %al, %eax
cmpq $0x1, 0x70(%rsp)
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x1c1340
movq 0x70(%rsp), %rax
movq %rax, 0x100(%rsp)
xorl %eax, %eax
movl %eax, 0x2c(%rsp)
jmp 0x1c134b
movl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x1c134b
movl 0x2c(%rsp), %eax
movl %eax, 0x6c(%rsp)
movl 0x6c(%rsp), %eax
movl %eax, 0x28(%rsp)
jmp 0x1c1368
movl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x1c1368
movl 0x28(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x1c141c
movq 0x88(%rsp), %rax
addq $0x0, %rax
cmpq 0x90(%rsp), %rax
ja 0x1c1409
movq 0x90(%rsp), %rax
subq 0x88(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x60(%rsp), %rax
cmpq 0x58(%rsp), %rax
jne 0x1c13ec
cmpq $0x1, 0x60(%rsp)
setb %al
andb $0x1, %al
movzbl %al, %eax
cmpq $0x1, 0x58(%rsp)
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x1c13ec
movq 0x58(%rsp), %rax
movq %rax, 0x100(%rsp)
xorl %eax, %eax
movl %eax, 0x20(%rsp)
jmp 0x1c13f7
movl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x1c13f7
movl 0x20(%rsp), %eax
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x1c1414
movl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x1c1414
movl 0x1c(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
movl %eax, 0x84(%rsp)
cmpl $0x0, 0x84(%rsp)
je 0x1c145f
movq 0x47ab68(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x380193(%rip), %rsi    # 0x5415d5
leaq 0x3a0096(%rip), %rdx    # 0x5614df
movl $0x1f8, %ecx            # imm = 0x1F8
movb $0x0, %al
callq 0x199f0
movl $0x1, %edi
callq 0x19890
jmp 0x1c1461
movq 0x110(%rsp), %rcx
movq 0x170(%rsp), %rax
movq %rcx, 0x1a8(%rax)
movq 0x170(%rsp), %rdi
movq 0x170(%rsp), %rax
movq 0x50(%rax), %rsi
movq 0x100(%rsp), %rdx
callq 0x1c2110
movq 0x170(%rsp), %rax
testb $0x1, 0x1bc(%rax)
je 0x1c14eb
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
shrq $0x10, %rax
andq $0xff, %rax
movl %eax, %eax
movq %rax, 0x128(%rsp)
movq 0x170(%rsp), %rdi
movq 0x170(%rsp), %rax
movq 0x70(%rax), %rsi
movq 0x128(%rsp), %rdx
callq 0x1c2090
movq 0x170(%rsp), %rax
testb $0x1, 0x1bb(%rax)
je 0x1c1573
movq $0x0, 0x140(%rsp)
movq 0x140(%rsp), %rax
cmpq 0x118(%rsp), %rax
jae 0x1c1571
movq 0xc8(%rsp), %rax
movq 0x140(%rsp), %rcx
movzbl (%rax,%rcx), %eax
addq $0x21, %rax
movq %rax, 0x128(%rsp)
movq 0x170(%rsp), %rdi
movq 0x170(%rsp), %rax
movq 0x68(%rax), %rsi
movq 0x128(%rsp), %rdx
callq 0x1c2090
movq 0x140(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x140(%rsp)
jmp 0x1c1508
jmp 0x1c1573
movq 0xb8(%rsp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
andq $0xffff, %rax           # imm = 0xFFFF
andl $0x10, %eax
cmpl $0x0, %eax
je 0x1c15b3
movq 0x170(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xe0(%rsp), %rsi
movl 0x150(%rsp), %edx
callq 0x489fa0
jmp 0x1c15d3
movq 0x170(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xd8(%rsp), %rsi
movl 0x150(%rsp), %edx
callq 0x489fa0
movq 0x170(%rsp), %rax
movq 0xb8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xb8(%rax)
movq 0x170(%rsp), %rax
movq 0x160(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x160(%rax)
movq 0x170(%rsp), %rax
movq 0xb0(%rax), %rdi
callq 0xfd4d0
cmpq $0x0, %rax
jbe 0x1c1e5a
movq 0x170(%rsp), %rax
movq 0x180(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x170(%rsp), %rax
movq 0xb0(%rax), %rdi
callq 0xfd590
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jne 0x1c1e5a
movq 0x170(%rsp), %rax
movq 0xb0(%rax), %rdi
callq 0xfd3f0
movq 0x170(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xd8(%rsp), %rsi
movl 0x150(%rsp), %edx
callq 0x489fa0
movq 0x170(%rsp), %rax
movq 0xb8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xb8(%rax)
movq 0x170(%rsp), %rax
movq 0xd0(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xd0(%rax)
movq $0x0, 0x130(%rsp)
movq $0x0, 0x140(%rsp)
movq 0x140(%rsp), %rax
movq 0xb8(%rsp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x1c1e09
jmp 0x1c1703
movq 0xd0(%rsp), %rax
movq 0x140(%rsp), %rcx
movl (%rax,%rcx,4), %eax
andl $0xf, %eax
movl %eax, 0x50(%rsp)
movl 0x50(%rsp), %eax
movq %rax, 0x48(%rsp)
movl 0x50(%rsp), %eax
movq 0x48(%rsp), %rcx
cmpl %ecx, %eax
jne 0x1c1768
cmpl $0x1, 0x50(%rsp)
setb %al
andb $0x1, %al
movzbl %al, %eax
cmpq $0x1, 0x48(%rsp)
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x1c1768
movq 0x48(%rsp), %rax
movq %rax, 0x160(%rsp)
xorl %eax, %eax
movl %eax, 0xc(%rsp)
jmp 0x1c1773
movl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1c1773
movl 0xc(%rsp), %eax
movl %eax, 0x44(%rsp)
cmpl $0x0, 0x44(%rsp)
je 0x1c17b0
movq 0x47a817(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x356892(%rip), %rsi    # 0x518025
leaq 0x39fd45(%rip), %rdx    # 0x5614df
movl $0x21d, %ecx            # imm = 0x21D
movb $0x0, %al
callq 0x199f0
movl $0x1, %edi
callq 0x19890
jmp 0x1c17b2
jmp 0x1c17b4
movq 0xd0(%rsp), %rax
movq 0x140(%rsp), %rcx
movl (%rax,%rcx,4), %eax
shrl $0x4, %eax
movl %eax, 0x40(%rsp)
movl 0x40(%rsp), %eax
movq %rax, 0x38(%rsp)
movl 0x40(%rsp), %eax
movq 0x38(%rsp), %rcx
cmpl %ecx, %eax
jne 0x1c1819
cmpl $0x1, 0x40(%rsp)
setb %al
andb $0x1, %al
movzbl %al, %eax
cmpq $0x1, 0x38(%rsp)
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x1c1819
movq 0x38(%rsp), %rax
movq %rax, 0x158(%rsp)
xorl %eax, %eax
movl %eax, 0x8(%rsp)
jmp 0x1c1824
movl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x1c1824
movl 0x8(%rsp), %eax
movl %eax, 0x34(%rsp)
cmpl $0x0, 0x34(%rsp)
je 0x1c1861
movq 0x47a766(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3567e1(%rip), %rsi    # 0x518025
leaq 0x39fc94(%rip), %rdx    # 0x5614df
movl $0x21e, %ecx            # imm = 0x21E
movb $0x0, %al
callq 0x199f0
movl $0x1, %edi
callq 0x19890
jmp 0x1c1863
cmpq $0x7, 0x160(%rsp)
je 0x1c1879
cmpq $0x8, 0x160(%rsp)
jne 0x1c1885
movq $0x0, 0x160(%rsp)
movq 0x160(%rsp), %rax
movq %rax, (%rsp)
subq $0x4, %rax
ja 0x1c1dc8
movq (%rsp), %rax
leaq 0x39fbee(%rip), %rcx    # 0x561494
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, 0x138(%rsp)
movq 0x138(%rsp), %rax
cmpq 0x158(%rsp), %rax
jae 0x1c1af1
movq 0x170(%rsp), %rax
movq 0x98(%rax), %rdi
movq 0x108(%rsp), %rsi
addq 0x138(%rsp), %rsi
xorl %edx, %edx
callq 0xa9da0
movb %al, 0x16b(%rsp)
movq 0xc0(%rsp), %rax
movq 0x120(%rsp), %rcx
addq 0x138(%rsp), %rcx
shrq %rcx
movzbl (%rax,%rcx), %eax
movq 0x120(%rsp), %rdx
addq 0x138(%rsp), %rdx
andq $0x1, %rdx
movl $0x1, %ecx
subq %rdx, %rcx
shlq $0x2, %rcx
sarl %cl, %eax
andl $0xf, %eax
movq 0xb0(%rsp), %rsi
movzbl %al, %edi
callq 0x1bfef0
movb %al, 0x16a(%rsp)
movzbl 0x16b(%rsp), %eax
movzbl 0x16a(%rsp), %ecx
cmpl %ecx, %eax
je 0x1c1ad6
movq 0x170(%rsp), %rdi
movq 0x160(%rsp), %rsi
callq 0x1c21a0
movq 0x120(%rsp), %rax
addq 0x138(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
subq 0x130(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0x170(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x1c21d0
movb 0x16b(%rsp), %cl
movb 0x16a(%rsp), %al
movq 0xb0(%rsp), %rdx
movzbl %cl, %edi
movzbl %al, %esi
callq 0x1c2200
movq %rax, 0xe8(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, 0xe8(%rsp)
jne 0x1c1a23
movl $0xffffffff, 0x184(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c1ed3
movq 0x170(%rsp), %rax
movq 0xb8(%rax), %rcx
addq $0x2, %rcx
movq %rcx, 0xb8(%rax)
movq 0x170(%rsp), %rax
movq 0x168(%rax), %rcx
addq $0x2, %rcx
movq %rcx, 0x168(%rax)
movl $0x2, 0x154(%rsp)
movq 0x170(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xe8(%rsp), %rsi
movl 0x154(%rsp), %edx
callq 0x489fa0
movq 0x170(%rsp), %rax
testb $0x1, 0x1be(%rax)
je 0x1c1ad4
movq 0xc8(%rsp), %rax
movq 0xf0(%rsp), %rcx
movzbl (%rax,%rcx), %eax
addq $0x21, %rax
movq %rax, 0x128(%rsp)
movq 0x170(%rsp), %rdi
movq 0x170(%rsp), %rax
movq 0x68(%rax), %rsi
movq 0x128(%rsp), %rdx
callq 0x1c2090
jmp 0x1c1ad6
jmp 0x1c1ad8
movq 0x138(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x138(%rsp)
jmp 0x1c18bb
movq 0x158(%rsp), %rax
addq 0x120(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x158(%rsp), %rax
addq 0x108(%rsp), %rax
movq %rax, 0x108(%rsp)
jmp 0x1c1dee
movq 0x170(%rsp), %rdi
movq 0x160(%rsp), %rsi
callq 0x1c21a0
movq 0x120(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
subq 0x130(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0x170(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x1c21d0
movq 0x170(%rsp), %rdi
movq 0x158(%rsp), %rsi
callq 0x1c2490
movq 0x158(%rsp), %rax
addq 0x108(%rsp), %rax
movq %rax, 0x108(%rsp)
jmp 0x1c1dee
movq 0x170(%rsp), %rdi
movq 0x160(%rsp), %rsi
callq 0x1c21a0
movq 0x120(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rax
subq 0x130(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0x170(%rsp), %rdi
movq 0xf8(%rsp), %rsi
callq 0x1c21d0
movq $0x0, 0x138(%rsp)
movq 0x138(%rsp), %rax
cmpq 0x158(%rsp), %rax
jae 0x1c1cfa
movq 0xc0(%rsp), %rax
movq 0x120(%rsp), %rcx
addq 0x138(%rsp), %rcx
shrq %rcx
movzbl (%rax,%rcx), %eax
movq 0x120(%rsp), %rdx
addq 0x138(%rsp), %rdx
andq $0x1, %rdx
movl $0x1, %ecx
subq %rdx, %rcx
shlq $0x2, %rcx
sarl %cl, %eax
andl $0xf, %eax
movq 0xb0(%rsp), %rsi
movzbl %al, %edi
callq 0x1bfef0
movb %al, 0x16a(%rsp)
movzbl 0x16a(%rsp), %eax
cmpl $0xfe, %eax
jne 0x1c1cbb
movq 0x148(%rsp), %rax
subq $0x1, %rax
movb %al, 0x16a(%rsp)
movq 0x170(%rsp), %rdi
movq 0x170(%rsp), %rax
movq 0x80(%rax), %rsi
movzbl 0x16a(%rsp), %eax
movl %eax, %edx
callq 0x1c2090
movq 0x138(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x138(%rsp)
jmp 0x1c1c28
movq 0x170(%rsp), %rdi
movq 0x170(%rsp), %rax
movq 0x80(%rax), %rsi
movq 0x148(%rsp), %rdx
callq 0x1c2090
movq 0x170(%rsp), %rax
testb $0x1, 0x1be(%rax)
je 0x1c1dae
movq $0x0, 0x138(%rsp)
movq 0x138(%rsp), %rax
cmpq 0x158(%rsp), %rax
jae 0x1c1dac
movq 0xc8(%rsp), %rax
movq 0x120(%rsp), %rcx
addq 0x138(%rsp), %rcx
movzbl (%rax,%rcx), %eax
addq $0x21, %rax
movq %rax, 0x128(%rsp)
movq 0x170(%rsp), %rdi
movq 0x170(%rsp), %rax
movq 0x68(%rax), %rsi
movq 0x128(%rsp), %rdx
callq 0x1c2090
movq 0x138(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x138(%rsp)
jmp 0x1c1d3b
jmp 0x1c1dae
movq 0x158(%rsp), %rax
addq 0x120(%rsp), %rax
movq %rax, 0x120(%rsp)
jmp 0x1c1dee
movq 0x160(%rsp), %rsi
leaq 0x39fd2b(%rip), %rdi    # 0x561b02
movb $0x0, %al
callq 0xe7740
movl $0xffffffff, 0x184(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c1ed3
jmp 0x1c1df0
movq 0x140(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x140(%rsp)
jmp 0x1c16de
movq 0x170(%rsp), %rdi
movl $0x9, %esi
callq 0x1c21a0
movq 0x118(%rsp), %rax
cmpq 0x120(%rsp), %rax
je 0x1c1e58
movq 0x118(%rsp), %rsi
movq 0x120(%rsp), %rdx
leaq 0x39fcde(%rip), %rdi    # 0x561b22
movb $0x0, %al
callq 0xe7740
movl $0xffffffff, 0x184(%rsp) # imm = 0xFFFFFFFF
jmp 0x1c1ed3
jmp 0x1c1eae
movq 0x170(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0xe0(%rsp), %rsi
movl 0x150(%rsp), %edx
callq 0x489fa0
movq 0x170(%rsp), %rax
movq 0xb8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xb8(%rax)
movq 0x170(%rsp), %rax
movq 0xd0(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0xd0(%rax)
movq 0x170(%rsp), %rax
movq 0x180(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x180(%rax)
movl $0x0, 0x184(%rsp)
movl 0x184(%rsp), %eax
addq $0x188, %rsp            # imm = 0x188
retq
nopw %cs:(%rax,%rax)