// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/htscodecs/htscodecs/arith_dynamic.c
// Function: arith_compress_to
unsigned char *arith_compress_to(unsigned char *in,  unsigned int in_size,
                                 unsigned char *out, unsigned int *out_size,
                                 int order) {
    unsigned int c_meta_len;
    uint8_t *rle = NULL, *packed = NULL;

    if (in_size > INT_MAX || (out && *out_size == 0)) {
        *out_size = 0;
        return NULL;
    }

    if (!out) {
        *out_size = arith_compress_bound(in_size, order);
        if (!(out = malloc(*out_size))) {
            *out_size = 0;
            return NULL;
        }
    }
    unsigned char *out_end = out + *out_size;

    if (in_size <= 20)
        order &= ~X_STRIPE;

    if (order & X_CAT) {
        out[0] = X_CAT;
        c_meta_len = 1 + var_put_u32(&out[1], out_end, in_size);
        if (c_meta_len + in_size > *out_size) {
            *out_size = 0;
            return NULL;
        }
        memcpy(out+c_meta_len, in, in_size);
        *out_size = in_size+c_meta_len;
    }

    if (order & X_STRIPE) {
        int N = (order>>8) & 0xff;
        if (N == 0) N = 4; // default for compatibility with old tests

        if (N > in_size)
            N = in_size;

        unsigned char *transposed = malloc(in_size);
        unsigned int part_len[256];
        unsigned int idx[256];
        if (!transposed) {
            *out_size = 0;
            return NULL;
        }

        int i, j, x;
        for (i = 0; i < N; i++) {
            part_len[i] = in_size / N + ((in_size % N) > i);
            idx[i] = i ? idx[i-1] + part_len[i-1] : 0; // cumulative index
        }

        for (i = x = 0; i < in_size-N; i += N, x++) {
            for (j = 0; j < N; j++)
                transposed[idx[j]+x] = in[i+j];
        }
        for (; i < in_size; i += N, x++) {
            for (j = 0; i+j < in_size; j++)
                transposed[idx[j]+x] = in[i+j];
        }

        unsigned int olen2;
        unsigned char *out2, *out2_start;
        c_meta_len = 1;
        *out = order & ~X_NOSZ;
        c_meta_len += var_put_u32(out+c_meta_len, out_end, in_size);
        if (c_meta_len >= *out_size) {
            free(transposed);
            *out_size = 0;
            return NULL;
        }

        out[c_meta_len++] = N;

        out2_start = out2 = out+7+5*N; // shares a buffer with c_meta
        for (i = 0; i < N; i++) {
            // Brute force try all methods.
            // FIXME: optimise this bit.  Maybe learn over time?
            int j, best_j = 0, best_sz = INT_MAX;
            uint8_t *r;

            // Works OK with read names. The first byte is the most important,
            // as it has most variability (little-endian).  After that it's
            // often quite predictable.
            //
            // Do we gain in any other context in CRAM? Aux tags maybe?
            int m[][4] = {{3, 1,64,0},
                          {2, 1,0},
                          {2, 1,128},
                          {2, 1,128}};

//          int m[][6] = {{4, 1,64,2,0},  //test of adding in an order-2 codec
//                        {3, 1,2,0},
//                        {3, 1,2,128},
//                        {3, 1,2,128}};

// Other possibilities for methods to try.
//          int m[][10] = {{8, 1,128,129,64,65,192,193,4,0},
//                         {8, 1,128,129,64,65,192,193,4,0},
//                         {8, 1,128,129,64,65,192,193,4,0},
//                         {8, 1,128,129,64,65,192,193,4,0}};

//          int m[][9] = {{5, 1,128,64,65,0},
//                        {5, 1,128,64,65,0},
//                        {5, 1,128,64,65,0},
//                        {5, 1,128,64,65,0}};

//          int m[][6] = {{4, 0,1,128,64},
//                        {5, 0,1,128,65,193},
//                        {3, 0,1,128},
//                        {3, 0,1,128}};

//          int m[][6] = {{4, 1,128,64,0},
//                        {4, 1,128,65,0},
//                        {2, 128,0},
//                        {2, 128,0}};

//          int m[][6] = {{2, 64,0},
//                        {1, 0},
//                        {1, 128},
//                        {1, 128}};

//          int m[][6] = {{1, 0},
//                        {2, 128,0},
//                        {1, 128},
//                        {1, 128}};

            for (j = 1; j <= m[MIN(i,3)][0]; j++) {
                if (out2 - out > *out_size)
                    continue; // an error, but caught in best_sz check later

                olen2 = *out_size - (out2 - out);
                //fprintf(stderr, "order=%d m=%d\n", order&3, m[MIN(i,4)][j]);
                if ((order&3) == 0 && (m[MIN(i,3)][j]&1))
                    continue;

                r = arith_compress_to(transposed+idx[i], part_len[i],
                                      out2, &olen2, m[MIN(i,3)][j] | X_NOSZ);
                if (r && olen2 && best_sz > olen2) {
                    best_sz = olen2;
                    best_j = j;
                }
            }

            if (best_sz == INT_MAX) {
                free(transposed);
                *out_size = 0;
                return NULL;
            }
            if (best_j != j-1) {
                olen2 = *out_size - (out2 - out);
                r = arith_compress_to(transposed+idx[i], part_len[i],
                                      out2, &olen2,
                                      m[MIN(i,3)][best_j] | X_NOSZ);
                if (!r) {
                    free(transposed);
                    *out_size = 0;
                    return NULL;
                }
            }
            out2 += olen2;
            c_meta_len += var_put_u32(out+c_meta_len, out_end, olen2);
        }
        memmove(out+c_meta_len, out2_start, out2-out2_start);
        free(transposed);
        *out_size = c_meta_len + out2-out2_start;
        return out;
    }

    int do_pack = order & X_PACK;
    int do_rle  = order & X_RLE;
    int no_size = order & X_NOSZ;
    int do_ext  = order & X_EXT;

    out[0] = order;
    c_meta_len = 1;

    if (!no_size)
        c_meta_len += var_put_u32(&out[1], out_end, in_size);

    order &= 0x3;

    // Format is compressed meta-data, compressed data.
    // Meta-data can be empty, pack, rle lengths, or pack + rle lengths.
    // Data is either the original data, bit-packed packed, rle literals or
    // packed + rle literals.

    if (do_pack && in_size) {
        // PACK 2, 4 or 8 symbols into one byte.
        int pmeta_len;
        uint64_t packed_len;
        if (c_meta_len + 256 > *out_size) {
            *out_size = 0;
            return NULL;
        }
        packed = hts_pack(in, in_size, out+c_meta_len, &pmeta_len, &packed_len);
        if (!packed) {
            out[0] &= ~X_PACK;
            do_pack = 0;
            free(packed);
            packed = NULL;
        } else {
            in = packed;
            in_size = packed_len;
            c_meta_len += pmeta_len;

            // Could derive this rather than storing verbatim.
            // Orig size * 8/nbits (+1 if not multiple of 8/n)
            int sz = var_put_u32(out+c_meta_len, out_end, in_size);
            c_meta_len += sz;
            *out_size -= sz;
        }
    } else if (do_pack) {
        out[0] &= ~X_PACK;
    }

    if (do_rle && !in_size) {
        out[0] &= ~X_RLE;
    }

    *out_size -= c_meta_len;
    if (order && in_size < 8) {
        out[0] &= ~3;
        order  &= ~3;
    }

    if (do_ext) {
        // Use an external compression library instead.
        // For now, bzip2
#ifdef HAVE_LIBBZ2
        if (BZ_OK != BZ2_bzBuffToBuffCompress((char *)out+c_meta_len, out_size,
                                              (char *)in, in_size, 9, 0, 30))
            *out_size = in_size; // Didn't fit with bz2; force X_CAT below instead
#else
        fprintf(stderr, "Htscodecs has been compiled without libbz2 support\n");
        free(out);
        *out_size = 0;
        return NULL;
#endif

//      // lzma doesn't help generally, at least not for the name tokeniser
//      size_t lzma_size = 0;
//      lzma_easy_buffer_encode(9, LZMA_CHECK_CRC32, NULL,
//                              in, in_size, out+c_meta_len, &lzma_size,
//                              *out_size);
//      *out_size = lzma_size;

    } else {
        uint8_t *r;
        if (do_rle) {
            if (order == 0)
                r=arith_compress_O0_RLE(in, in_size, out+c_meta_len, out_size);
            else
                r=arith_compress_O1_RLE(in, in_size, out+c_meta_len, out_size);
        } else {
            //if (order == 2)
            //  arith_compress_O2(in, in_size, out+c_meta_len, out_size);
            //else
            if (order == 1)
                r=arith_compress_O1(in, in_size, out+c_meta_len, out_size);
            else
                r=arith_compress_O0(in, in_size, out+c_meta_len, out_size);
        }

        if (!r) {
            free(rle);
            free(packed);
            *out_size = 0;
            return NULL;
        }
    }

    if (*out_size >= in_size) {
        out[0] &= ~(3|X_EXT); // no entropy encoding, but keep e.g. PACK
        out[0] |= X_CAT | no_size;

        if (out + c_meta_len + in_size > out_end) {
            free(rle);
            free(packed);
            *out_size = 0;
            return NULL;
        }
        memcpy(out+c_meta_len, in, in_size);
        *out_size = in_size;
    }

    free(rle);
    free(packed);

    *out_size += c_meta_len;

    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x898, %rsp            # imm = 0x898
testl %esi, %esi
js 0x498b0
movl %r8d, %ebp
movq %rdx, %rbx
movl %esi, %r9d
movq %rdi, %r13
testq %rdx, %rdx
movq %rcx, 0x10(%rsp)
je 0x494b8
movl (%rcx), %r12d
testq %r12, %r12
jne 0x494eb
jmp 0x498b0
movl %r9d, %edi
movl %ebp, %esi
movq %r9, %rbx
callq 0x493f4
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
movl %eax, %r12d
movq %r12, %rdi
callq 0x4680
movq %rbx, %r9
movq 0x10(%rsp), %rcx
movq %rax, %rbx
testq %rax, %rax
je 0x498b0
addq %rbx, %r12
movl %ebp, %edx
andl $-0x9, %edx
cmpl $0x15, %r9d
cmovael %ebp, %edx
movl %r9d, %r15d
testb $0x20, %dl
movl %edx, 0x18(%rsp)
je 0x49553
movb $0x20, (%rbx)
leaq 0x1(%rbx), %rdi
movq %r12, %rsi
movl %r9d, %edx
movq %r9, %rbp
callq 0x49efe
movq 0x10(%rsp), %rcx
movq %rbx, %r14
leal (%rax,%rbp), %ebx
incl %ebx
cmpl (%rcx), %ebx
ja 0x498b0
incl %eax
movl %eax, %edi
addq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x43c0
movq %rbp, %r9
movq 0x10(%rsp), %rcx
movl %ebx, (%rcx)
movq %r14, %rbx
movl 0x18(%rsp), %edx
testb $0x8, %dl
jne 0x49593
movl %edx, %eax
movb %dl, (%rbx)
andl $0x10, %eax
movl %eax, 0x80(%rsp)
jne 0x49892
leaq 0x1(%rbx), %rdi
movq %r12, %rsi
movl %r9d, %edx
movq %r9, %r14
callq 0x49efe
movl 0x18(%rsp), %edx
movq %r14, %r9
movq 0x10(%rsp), %rcx
movl %eax, %ebp
incl %ebp
jmp 0x49895
movq %r12, 0x58(%rsp)
movzbl %dh, %eax
testl %eax, %eax
pushq $0x4
popq %r12
cmovnel %eax, %r12d
cmpl %r9d, %r12d
movq %r9, 0x30(%rsp)
cmovael %r9d, %r12d
movq %r15, %rdi
callq 0x4680
testq %rax, %rax
je 0x49eb3
movq %rax, %rbp
movl %r12d, %r14d
xorl %ecx, %ecx
movq 0x30(%rsp), %r11
cmpq %rcx, %r14
je 0x4960a
movl %r11d, %eax
xorl %edx, %edx
divl %r12d
xorl %esi, %esi
cmpq %rdx, %rcx
adcl $0x0, %eax
movl %eax, 0x90(%rsp,%rcx,4)
testq %rcx, %rcx
je 0x495fe
movl 0x8c(%rsp,%rcx,4), %esi
addl 0x48c(%rsp,%rcx,4), %esi
movl %esi, 0x490(%rsp,%rcx,4)
incq %rcx
jmp 0x495cf
movl %r11d, %ecx
subl %r12d, %ecx
xorl %edx, %edx
movq %r13, %rsi
xorl %edi, %edi
xorl %eax, %eax
cmpq %rcx, %rdi
jae 0x4964c
xorl %r8d, %r8d
cmpq %r8, %r14
je 0x4963f
movb (%rsi,%r8), %r9b
movl 0x490(%rsp,%r8,4), %r10d
addl %eax, %r10d
movb %r9b, (%rbp,%r10)
incq %r8
jmp 0x49621
addq %r14, %rdi
incl %eax
addl %r12d, %edx
addq %r14, %rsi
jmp 0x49619
movl %edx, %ecx
addq %rcx, %r13
cmpq %r15, %rcx
jae 0x49683
xorl %edx, %edx
leaq (%rcx,%rdx), %rsi
cmpq %r15, %rsi
jae 0x49679
movb (%r13,%rdx), %sil
movl 0x490(%rsp,%rdx,4), %edi
addl %eax, %edi
movb %sil, (%rbp,%rdi)
incq %rdx
jmp 0x49658
addq %r14, %rcx
incl %eax
addq %r14, %r13
jmp 0x49651
movl 0x18(%rsp), %eax
andb $-0x11, %al
movb %al, (%rbx)
leaq 0x1(%rbx), %rdi
movq 0x58(%rsp), %rsi
movl %r11d, %edx
callq 0x49efe
movl %eax, %r13d
leal 0x1(%r13), %eax
movq 0x10(%rsp), %rdx
cmpl (%rdx), %eax
jae 0x498dc
addl $0x2, %r13d
movl %eax, %eax
movb %r12b, (%rbx,%rax)
leal (%r12,%r12,4), %eax
leaq (%rbx,%rax), %r12
addq $0x7, %r12
xorl %esi, %esi
movq %r12, 0x78(%rsp)
movq %rbx, 0x68(%rsp)
movl %esi, %r15d
cmpq $0x3, %r15
pushq $0x3
popq %rax
cmovaeq %rax, %r15
movl %r13d, %edi
cmpq %r14, %rsi
je 0x49945
movq %rdi, 0x60(%rsp)
movq %r13, 0x80(%rsp)
shll $0x4, %r15d
cmpl $0x3, %esi
pushq $0x3
popq %rax
cmovbl %esi, %eax
movq %rax, 0x50(%rsp)
shll $0x4, %eax
leaq 0x3410b(%rip), %rcx     # 0x7d820
movl (%rax,%rcx), %ecx
movq %r12, 0x40(%rsp)
subq %rbx, %r12
xorl %eax, %eax
testl %ecx, %ecx
movl $0x0, 0x48(%rsp)
cmovlel %eax, %ecx
movq %rcx, 0x70(%rsp)
movq %rcx, %rbx
negq %rbx
movl $0x7fffffff, 0x30(%rsp) # imm = 0x7FFFFFFF
pushq $0x1
popq %r13
movq %rsi, 0x38(%rsp)
leaq (%rbx,%r13), %rax
cmpq $0x1, %rax
je 0x497e0
movl (%rdx), %eax
cmpq %rax, %r12
jg 0x497d8
subl %r12d, %eax
leaq (%r15,%r13,4), %rcx
leaq 0x340b2(%rip), %rdi     # 0x7d820
movl (%rdi,%rcx), %r8d
movl %eax, 0x24(%rsp)
testb $0x3, 0x18(%rsp)
jne 0x49785
movl %r8d, %eax
andl $0x1, %eax
jne 0x497d8
movl 0x490(%rsp,%rsi,4), %edi
addq %rbp, %rdi
movl 0x90(%rsp,%rsi,4), %esi
orl $0x10, %r8d
movq 0x40(%rsp), %rdx
leaq 0x24(%rsp), %rcx
callq 0x4947c
testq %rax, %rax
setne %cl
movl 0x24(%rsp), %eax
testl %eax, %eax
setne %dl
andb %cl, %dl
cmpl %eax, 0x30(%rsp)
seta %cl
testb %cl, %dl
je 0x497ce
movl %r13d, 0x48(%rsp)
movl %eax, 0x30(%rsp)
movq 0x10(%rsp), %rdx
movq 0x38(%rsp), %rsi
incq %r13
jmp 0x4974b
cmpl $0x7fffffff, 0x30(%rsp) # imm = 0x7FFFFFFF
je 0x498dc
movl 0x48(%rsp), %edx
cmpl 0x70(%rsp), %edx
movq 0x68(%rsp), %rbx
movq 0x40(%rsp), %r12
je 0x4985c
movl %ebx, %eax
subl %r12d, %eax
movq 0x10(%rsp), %rcx
addl (%rcx), %eax
movl %eax, 0x24(%rsp)
movl 0x490(%rsp,%rsi,4), %edi
addq %rbp, %rdi
movq 0x38(%rsp), %rax
movl 0x90(%rsp,%rax,4), %esi
movslq %edx, %rax
movq 0x50(%rsp), %rdx
shlq $0x4, %rdx
leaq 0x33fe5(%rip), %rcx     # 0x7d820
addq %rcx, %rdx
movl (%rdx,%rax,4), %r8d
orl $0x10, %r8d
movq %r12, %rdx
leaq 0x24(%rsp), %rcx
callq 0x4947c
testq %rax, %rax
je 0x498dc
movl 0x24(%rsp), %edx
addq %rdx, %r12
movq 0x60(%rsp), %rdi
addq %rbx, %rdi
movq 0x58(%rsp), %rsi
callq 0x49efe
movq 0x38(%rsp), %rsi
movq 0x80(%rsp), %r13
addl %eax, %r13d
incq %rsi
movq 0x10(%rsp), %rdx
jmp 0x496d2
pushq $0x1
popq %rbp
testb %dl, %dl
setns %al
testl %r9d, %r9d
movl %edx, %esi
sete %dl
orb %al, %dl
jne 0x498ca
leal 0x100(%rbp), %eax
cmpl (%rcx), %eax
jbe 0x498eb
andl $0x0, (%rcx)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x898, %rsp            # imm = 0x898
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %sil, %sil
movl %esi, %edx
jns 0x498d4
andb $0x7f, (%rbx)
xorl %r15d, %r15d
jmp 0x49985
movq %rbp, %rdi
callq 0x45c0
xorl %r12d, %r12d
xorl %ebx, %ebx
jmp 0x49969
movq %r9, %r14
movl %ebp, %edx
addq %rbx, %rdx
leaq 0x490(%rsp), %rcx
leaq 0x90(%rsp), %r8
movq %r13, %rdi
movq %r15, %rsi
callq 0x4e5a4
movq %rax, %r15
testq %rax, %rax
je 0x49976
movl 0x90(%rsp), %r14d
addl 0x490(%rsp), %ebp
leaq (%rbx,%rbp), %rdi
movq %r12, %rsi
movl %r14d, %edx
callq 0x49efe
movq %r14, %r9
addl %eax, %ebp
movq 0x10(%rsp), %rcx
subl %eax, (%rcx)
movq %r15, %r13
jmp 0x49981
addq %rbx, %rdi
movq %r12, %rdx
movq 0x78(%rsp), %r14
subq %r14, %rdx
movq %r14, %rsi
callq 0x4830
movq %rbp, %rdi
callq 0x45c0
addl %r13d, %r12d
subl %r14d, %r12d
movq 0x10(%rsp), %rax
movl %r12d, (%rax)
jmp 0x498b5
andb $0x7f, (%rbx)
movq 0x10(%rsp), %rcx
movq %r14, %r9
movl 0x18(%rsp), %edx
movl %edx, %eax
andl $0x3, %eax
testb $0x40, %dl
je 0x49997
testl %r9d, %r9d
jne 0x49997
andb $-0x41, (%rbx)
subl %ebp, (%rcx)
testl %eax, %eax
je 0x499a8
cmpl $0x7, %r9d
ja 0x499a8
andb $-0x4, (%rbx)
xorl %eax, %eax
movl %ebp, %esi
leaq (%rbx,%rsi), %rdi
movl %r9d, %r8d
testb $0x4, %dl
movq %r9, 0x30(%rsp)
movq %r8, 0x38(%rsp)
movq %rsi, 0x78(%rsp)
jne 0x49a5f
movq %rdi, 0x28(%rsp)
testb $0x40, %dl
movq %rbp, 0x60(%rsp)
movq %r15, 0x50(%rsp)
jne 0x49a9a
cmpl $0x1, %eax
jne 0x49af4
cvtsi2sd %r8, %xmm0
mulsd 0x331b1(%rip), %xmm0    # 0x7cba8
addsd 0x33e11(%rip), %xmm0    # 0x7d810
addsd 0x33169(%rip), %xmm0    # 0x7cb70
addsd 0x33e09(%rip), %xmm0    # 0x7d818
cvttsd2si %xmm0, %rax
addl $-0x5, %eax
cmpl (%rcx), %eax
ja 0x49ec0
movl $0x41000, %edi          # imm = 0x41000
callq 0x6412c
movq 0x38(%rsp), %rsi
movq 0x10(%rsp), %rcx
testq %rax, %rax
je 0x49ec0
movq %rax, %r14
xorl %eax, %eax
xorl %r15d, %r15d
cmpq %rax, %rsi
je 0x49ba9
movzbl (%r13,%rax), %edx
cmpl %edx, %r15d
cmovbel %edx, %r15d
incq %rax
jmp 0x49a44
movl $0x1e, (%rsp)
pushq $0x9
popq %r8
movq %rcx, %rsi
movq %r13, %rdx
movl %r9d, %ecx
xorl %r9d, %r9d
callq 0x4280
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %r8
movq 0x10(%rsp), %rcx
testl %eax, %eax
je 0x49e83
movl %r8d, (%rcx)
jmp 0x49e83
testl %eax, %eax
je 0x49b09
cvtsi2sd %r8, %xmm0
mulsd 0x330fd(%rip), %xmm0    # 0x7cba8
addsd 0x33d5d(%rip), %xmm0    # 0x7d810
addsd 0x330b5(%rip), %xmm0    # 0x7cb70
addsd 0x33d55(%rip), %xmm0    # 0x7d818
cvttsd2si %xmm0, %rax
addl $-0x5, %eax
cmpl (%rcx), %eax
ja 0x49ec0
xorl %eax, %eax
xorl %r14d, %r14d
movq 0x28(%rsp), %rdx
cmpq %rax, %r8
je 0x49b1e
movzbl (%r13,%rax), %ecx
cmpl %ecx, %r14d
cmovbel %ecx, %r14d
incq %rax
jmp 0x49add
movq %r13, %rdi
movl %r9d, %esi
movq 0x28(%rsp), %rdx
callq 0x4a27a
jmp 0x49e6f
movq %r13, %rdi
movl %r9d, %esi
movq 0x28(%rsp), %rdx
callq 0x4a020
jmp 0x49e6f
incl %r14d
movb %r14b, (%rdx)
movl $0x41000, %edi          # imm = 0x41000
callq 0x6412c
movq 0x10(%rsp), %rcx
movq %rax, 0x48(%rsp)
testq %rax, %rax
je 0x49ec0
movq %rbx, 0x68(%rsp)
xorl %ebx, %ebx
cmpq $0x41000, %rbx          # imm = 0x41000
je 0x49b6b
movq 0x48(%rsp), %rax
leaq (%rax,%rbx), %rdi
movl %r14d, %esi
callq 0x4b089
addq $0x410, %rbx            # imm = 0x410
jmp 0x49b48
movl $0x42030, %edi          # imm = 0x42030
callq 0x6412c
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x49e11
xorl %ebx, %ebx
cmpq $0x42030, %rbx          # imm = 0x42030
je 0x49c81
movq 0x18(%rsp), %rax
leaq (%rax,%rbx), %rdi
callq 0x4b0da
addq $0x418, %rbx            # imm = 0x418
jmp 0x49b85
movq %r12, %rbp
movq %rbx, %r12
incl %r15d
movq 0x28(%rsp), %rax
movb %r15b, (%rax)
xorl %ebx, %ebx
cmpq $0x41000, %rbx          # imm = 0x41000
je 0x49be4
leaq (%r14,%rbx), %rdi
movl %r15d, %esi
callq 0x4b089
movq 0x38(%rsp), %rsi
movq 0x10(%rsp), %rcx
addq $0x410, %rbx            # imm = 0x410
jmp 0x49bbc
movq 0x28(%rsp), %rdx
leaq 0x1(%rdx), %rax
leaq 0x90(%rsp), %r15
movq %rax, 0x20(%r15)
movq %rax, 0x18(%r15)
movl (%rcx), %eax
addq %rdx, %rax
movq %rax, 0x30(%r15)
andq $0x0, 0x10(%r15)
movapd 0x2dabd(%rip), %xmm0    # 0x776d0
movapd %xmm0, (%r15)
andl $0x0, 0x38(%r15)
xorl %ebx, %ebx
xorl %eax, %eax
cmpq %rbx, %rsi
je 0x49c50
movzbl %al, %eax
imulq $0x410, %rax, %rdi      # imm = 0x410
addq %r14, %rdi
movzbl (%r13,%rbx), %edx
movq %r15, %rsi
callq 0x4b130
movb (%r13,%rbx), %al
incq %rbx
movq 0x38(%rsp), %rsi
jmp 0x49c21
leaq 0x90(%rsp), %rdi
callq 0x4b226
testl %eax, %eax
js 0x49e25
movl 0xb0(%rsp), %eax
subl 0xa8(%rsp), %eax
incl %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
jmp 0x49e2e
movq 0x28(%rsp), %rcx
leaq 0x1(%rcx), %rax
leaq 0x90(%rsp), %rdx
movq %rax, 0x20(%rdx)
movq %rax, 0x18(%rdx)
movq 0x10(%rsp), %rax
movl (%rax), %eax
addq %rcx, %rax
movq %rax, 0x30(%rdx)
andq $0x0, 0x10(%rdx)
movapd 0x2da1b(%rip), %xmm0    # 0x776d0
movapd %xmm0, (%rdx)
andl $0x0, 0x38(%rdx)
leaq 0x1(%r13), %rax
movq %rax, 0x88(%rsp)
xorl %ebx, %ebx
xorl %eax, %eax
movq %r12, 0x58(%rsp)
cmpl 0x30(%rsp), %ebx
jae 0x49de7
movzbl %al, %eax
imulq $0x410, %rax, %rdi      # imm = 0x410
addq 0x48(%rsp), %rdi
movslq %ebx, %r14
movzbl (%r13,%r14), %edx
leaq 0x90(%rsp), %rsi
callq 0x4b130
movb (%r13,%r14), %sil
movzbl %sil, %ebp
addq 0x88(%rsp), %r14
movq %rbx, 0x40(%rsp)
leal 0x1(%rbx), %eax
xorl %ebx, %ebx
movq 0x30(%rsp), %rdx
movq %rsi, 0x70(%rsp)
leal (%rax,%rbx), %ecx
cmpl %ecx, %edx
jbe 0x49d38
cmpb %sil, (%r14,%rbx)
jne 0x49d3f
incq %rbx
jmp 0x49d26
movq %rdx, 0x40(%rsp)
jmp 0x49d4d
movq 0x40(%rsp), %rax
addl %ebx, %eax
incl %eax
movq %rax, 0x40(%rsp)
movl %ebp, %eax
movslq %eax, %r14
imulq $0x418, %r14, %rdi      # imm = 0x418
addq 0x18(%rsp), %rdi
cmpl $0x3, %ebx
pushq $0x3
popq %r15
cmovll %ebx, %r15d
movzwl %r15w, %edx
setge %r12b
leaq 0x90(%rsp), %rsi
callq 0x4b1ab
xorl %eax, %eax
cmpl $0x101, %r14d           # imm = 0x101
setl %al
addl %r14d, %eax
cmpl %ebp, %r14d
movl $0x100, %ecx            # imm = 0x100
cmovel %ecx, %eax
subl %r15d, %ebx
sete %cl
andb %r12b, %cl
cmpb $0x1, %cl
je 0x49dac
testl %ebx, %ebx
jne 0x49d4f
jmp 0x49dc9
cltq
imulq $0x418, %rax, %rdi      # imm = 0x418
addq 0x18(%rsp), %rdi
leaq 0x90(%rsp), %rsi
xorl %edx, %edx
callq 0x4b1ab
movq 0x58(%rsp), %r12
movq 0x60(%rsp), %rbp
movq 0x50(%rsp), %r15
movq 0x40(%rsp), %rbx
movq 0x70(%rsp), %rax
jmp 0x49cd2
leaq 0x90(%rsp), %rdi
callq 0x4b226
testl %eax, %eax
js 0x49e48
movl 0xb0(%rsp), %eax
subl 0xa8(%rsp), %eax
incl %eax
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
jmp 0x49e51
movq 0x48(%rsp), %rdi
callq 0x64291
movq 0x10(%rsp), %rcx
jmp 0x49ec0
movq $0x0, 0x28(%rsp)
movq %r12, %rbx
movq 0x50(%rsp), %r15
movq %r14, %rdi
callq 0x64291
movq %rbp, %r12
movq 0x60(%rsp), %rbp
jmp 0x49e6a
movq $0x0, 0x28(%rsp)
movq 0x68(%rsp), %rbx
movq 0x48(%rsp), %rdi
callq 0x64291
movq 0x18(%rsp), %rdi
callq 0x64291
movq 0x28(%rsp), %rax
testq %rax, %rax
movq 0x10(%rsp), %rcx
movq 0x30(%rsp), %r8
movq 0x38(%rsp), %rdx
je 0x49ec0
cmpl %r8d, (%rcx)
jb 0x49ee6
movb (%rbx), %al
andb $-0x28, %al
movl 0x80(%rsp), %ecx
orb %al, %cl
orb $0x20, %cl
movb %cl, (%rbx)
movq 0x78(%rsp), %rdi
addq %rbx, %rdi
leaq (%rdi,%rdx), %rax
cmpq %r12, %rax
jbe 0x49ed3
movq %r15, %rdi
callq 0x45c0
movq 0x10(%rsp), %rax
andl $0x0, (%rax)
jmp 0x498b3
movq %r15, %rdi
movq %rcx, %rbx
callq 0x45c0
andl $0x0, (%rbx)
jmp 0x498b3
movq %r13, %rsi
movq %r8, %r14
callq 0x43c0
movq 0x10(%rsp), %rcx
movl %r14d, (%rcx)
movq %r15, %rdi
movq %rbx, %r14
movq %rcx, %rbx
callq 0x45c0
addl %ebp, (%rbx)
movq %r14, %rbx
jmp 0x498b5