// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/rANS_static4x16pr.c
// Function: rans_compress_to_4x16
unsigned char *rans_compress_to_4x16(unsigned char *in, unsigned int in_size,
                                     unsigned char *out,unsigned int *out_size,
                                     int order) {
    if (in_size > INT_MAX || (out && *out_size == 0)) {
        *out_size = 0;
        return NULL;
    }

#ifdef VALIDATE_RANS
    int orig_order = order;
    int orig_in_size = in_size;
    unsigned char *orig_in = in;
#endif

    unsigned int c_meta_len;
    uint8_t *meta = NULL, *rle = NULL, *packed = NULL;
    uint8_t *out_free = NULL;

    if (!out) {
        *out_size = rans_compress_bound_4x16(in_size, order);
        if (*out_size == 0)
            return NULL;
        if (!(out_free = out = malloc(*out_size))) {
            *out_size = 0;
            return NULL;
        }
    }

    unsigned char *out_end = out + *out_size;

    // Permit 32-way unrolling for large blocks, paving the way for
    // AVX2 and AVX512 SIMD variants.
    if ((order & RANS_ORDER_SIMD_AUTO) && in_size >= 50000
        && !(order & RANS_ORDER_STRIPE))
        order |= X_32;

    if (in_size <= 20)
        order &= ~RANS_ORDER_STRIPE;
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
    if (in_size <= 1000)
        order &= ~RANS_ORDER_X32;
#endif
    if (order & RANS_ORDER_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) {
            free(out_free);
            *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
        }

#define KN 8
        i = x = 0;
        if (in_size >= N*KN) {
            for (; i < in_size-N*KN;) {
                int k;
                unsigned char *ink = in+i;
                for (j = 0; j < N; j++)
                    for (k = 0; k < KN; k++)
                        transposed[idx[j]+x+k] = ink[j+N*k];
                x += KN; i+=N*KN;
            }
        }
#undef KN
        for (; 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 & ~RANS_ORDER_NOSZ;
        c_meta_len += var_put_u32(out+c_meta_len, out_end, in_size);
        if (c_meta_len >= *out_size) {
            free(out_free);
            free(transposed);
            *out_size = 0;
            return NULL;
        }

        out[c_meta_len++] = N;
        
        unsigned char *out_best = NULL;
        unsigned int out_best_len = 0;

        out2_start = out2 = out+7+5*N; // shares a buffer with c_meta
        for (i = 0; i < N; i++) {
            // Brute force try all methods.
            uint8_t *r;
            int j, m[] = {1,64,128,0}, best_j = 0, best_sz = INT_MAX;
            for (j = 0; j < sizeof(m)/sizeof(*m); j++) {
                if ((order & m[j]) != m[j])
                    continue;

                // order-1 *only*; bit check above cannot elide order-0
                if ((order & RANS_ORDER_STRIPE_NO0) && (m[j]&1) == 0)
                    continue;

                if (out2 - out > *out_size)
                    continue; // an error, but caught in best_sz check later

                olen2 = *out_size - (out2 - out);
                r = rans_compress_to_4x16(transposed+idx[i], part_len[i],
                                          out2, &olen2,
                                          m[j] | RANS_ORDER_NOSZ
                                          | (order&RANS_ORDER_X32));
                if (r && olen2 && best_sz > olen2) {
                    best_sz = olen2;
                    best_j = j;
                    if (j < sizeof(m)/sizeof(*m) && olen2 > out_best_len) {
                        unsigned char *tmp = realloc(out_best, olen2);
                        if (!tmp) {
                            free(out_free);
                            free(transposed);
                            *out_size = 0;
                            return NULL;
                        }
                        out_best = tmp;
                        out_best_len = olen2;
                    }

                    // Cache a copy of the best so far
                    memcpy(out_best, out2, olen2);
                }
            }

            if (best_sz == INT_MAX) {
                free(out_best);
                free(out_free);
                free(transposed);
                *out_size = 0;
                return NULL;
            }

            if (best_j < sizeof(m)/sizeof(*m)) {
                // Copy the best compression to output buffer if not current
                memcpy(out2, out_best, best_sz);
                olen2 = best_sz;
            }

            out2 += olen2;
            c_meta_len += var_put_u32(out+c_meta_len, out_end, olen2);
        }
        if (out_best)
            free(out_best);

        memmove(out+c_meta_len, out2_start, out2-out2_start);
        free(transposed);
        *out_size = c_meta_len + out2-out2_start;
        return out;
    }

    if (order & RANS_ORDER_CAT) {
        out[0] = RANS_ORDER_CAT;
        c_meta_len = 1;
        c_meta_len += var_put_u32(&out[1], out_end, in_size);

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

    int do_pack = order & RANS_ORDER_PACK;
    int do_rle  = order & RANS_ORDER_RLE;
    int no_size = order & RANS_ORDER_NOSZ;
    int do_simd = order & RANS_ORDER_X32;

    out[0] = order;
    c_meta_len = 1;

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

    order &= 3;

    // 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) {
            free(out_free);
            *out_size = 0;
            return NULL;
        }
        packed = hts_pack(in, in_size, out+c_meta_len, &pmeta_len, &packed_len);
        if (!packed) {
            out[0] &= ~RANS_ORDER_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;

            if (do_simd && in_size < 32) {
                do_simd = 0;
                out[0] &= ~RANS_ORDER_X32;
            }
        }
    } else if (do_pack) {
        out[0] &= ~RANS_ORDER_PACK;
    }

    if (do_rle && in_size) {
        // RLE 'in' -> rle_length + rle_literals arrays
        unsigned int rmeta_len, c_rmeta_len;
        uint64_t rle_len;
        c_rmeta_len = in_size+257;
        if (!(meta = malloc(c_rmeta_len))) {
            free(out_free);
            *out_size = 0;
            return NULL;
        }

        uint8_t rle_syms[256];
        int rle_nsyms = 0;
        uint64_t rmeta_len64;
        rle = hts_rle_encode(in, in_size, meta, &rmeta_len64,
                             rle_syms, &rle_nsyms, NULL, &rle_len);
        memmove(meta+1+rle_nsyms, meta, rmeta_len64);
        meta[0] = rle_nsyms;
        memcpy(meta+1, rle_syms, rle_nsyms);
        rmeta_len = rmeta_len64 + rle_nsyms+1;

        if (!rle || rle_len + rmeta_len >= .99*in_size) {
            // Not worth the speed hit.
            out[0] &= ~RANS_ORDER_RLE;
            do_rle = 0;
            free(rle);
            rle = NULL;
        } else {
            // Compress lengths with O0 and literals with O0/O1 ("order" param)
            int sz = var_put_u32(out+c_meta_len, out_end, rmeta_len*2), sz2;
            sz += var_put_u32(out+c_meta_len+sz, out_end, rle_len);
            if ((c_meta_len+sz+5) > *out_size) {
                free(out_free);
                free(rle);
                free(meta);
                free(packed);
                *out_size = 0;
                return NULL;
            }
            c_rmeta_len = *out_size - (c_meta_len+sz+5);
            if (do_simd && (rmeta_len < 32 || rle_len < 32)) {
                do_simd = 0;
                out[0] &= ~RANS_ORDER_X32;
            }
            if (!rans_enc_func(do_simd, 0)(meta, rmeta_len, out+c_meta_len+sz+5, &c_rmeta_len)) {
                free(out_free);
                free(rle);
                free(meta);
                free(packed);
                *out_size = 0;
                return NULL;
            }
            if (c_rmeta_len < rmeta_len) {
                sz2 = var_put_u32(out+c_meta_len+sz, out_end, c_rmeta_len);
                memmove(out+c_meta_len+sz+sz2, out+c_meta_len+sz+5, c_rmeta_len);
            } else {
                // Uncompressed RLE meta-data as too small
                sz = var_put_u32(out+c_meta_len, out_end, rmeta_len*2+1);
                sz2 = var_put_u32(out+c_meta_len+sz, out_end, rle_len);
                memcpy(out+c_meta_len+sz+sz2, meta, rmeta_len);
                c_rmeta_len = rmeta_len;
            }

            c_meta_len += sz + sz2 + c_rmeta_len;

            in = rle;
            in_size = rle_len;
        }

        free(meta);
    } else if (do_rle) {
        out[0] &= ~RANS_ORDER_RLE;
    }

    if (c_meta_len > *out_size) {
        free(out_free);
        free(rle);
        free(packed);
        *out_size = 0;
        return NULL;
    }

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

    if (!rans_enc_func(do_simd, order)(in, in_size, out+c_meta_len, out_size)) {
        free(out_free);
        free(rle);
        free(packed);
        *out_size = 0;
        return NULL;
    }

    if (*out_size >= in_size) {
        out[0] &= ~3;
        out[0] |= RANS_ORDER_CAT | no_size;

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

    free(rle);
    free(packed);

    *out_size += c_meta_len;

// Validation mode
#ifdef VALIDATE_RANS
    unsigned int decoded_size = orig_in_size;
    unsigned char *decoded = malloc(decoded_size);
    decoded = rans_uncompress_to_4x16(out, *out_size,
                                      decoded, &decoded_size);
    if (!decoded ||
        decoded_size != orig_in_size ||
        memcmp(orig_in, decoded, orig_in_size) != 0) {
        fprintf(stderr, "rans round trip failed for order %d. Written to fd 5\n", orig_order);
        if (write(5, orig_in, orig_in_size) < 0)
            abort();
        abort();
    }
    free(decoded);
#endif


    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x888, %rsp            # imm = 0x888
movq %rcx, %r14
testl %esi, %esi
js 0x6429f
movl %r8d, %r15d
movq %rdx, %rbp
movl %esi, %r13d
movq %rdi, %r12
testq %rdx, %rdx
je 0x633b5
movl (%r14), %eax
testq %rax, %rax
je 0x6429f
movq $0x0, 0x30(%rsp)
movq %rax, 0x28(%rsp)
movl %eax, %ebx
jmp 0x633ea
movl %r13d, %edi
movl %r15d, %esi
callq 0x61e28
movl %eax, (%r14)
testl %eax, %eax
je 0x642a6
movl %eax, %ebx
movl %eax, %edi
movq %rdi, 0x28(%rsp)
callq 0x4680
testq %rax, %rax
je 0x6429f
movq %rax, 0x30(%rsp)
movq %rax, %rbp
movl %r15d, %eax
andl $0x20008, %eax          # imm = 0x20008
movl %r15d, %ecx
orl $0x4, %ecx
cmpl $0x20000, %eax          # imm = 0x20000
cmovnel %r15d, %ecx
cmpl $0xc350, %r13d          # imm = 0xC350
cmovbl %r15d, %ecx
movl %ecx, %edx
andl $-0xd, %edx
cmpl $0x15, %r13d
cmovael %ecx, %edx
andl $-0x5, %edx
cmpl $0x3e9, %r13d           # imm = 0x3E9
cmovael %ecx, %edx
testb $0x8, %dl
movl %edx, 0x4(%rsp)
jne 0x634dd
testb $0x20, %dl
jne 0x63757
movl %edx, %eax
movb %dl, (%rbp)
movl $0x1, %r15d
andl $0x10, %eax
movl %eax, 0x40(%rsp)
jne 0x63ede
cmpl $0x5, %ebx
ja 0x6383c
movq $-0x1, %rdx
xorl %ecx, %ecx
movl %r13d, %esi
movl %r13d, %eax
shrl $0x7, %eax
incq %rdx
addq $0x7, %rcx
cmpl $0x7f, %esi
movl %eax, %esi
ja 0x6346b
movq 0x28(%rsp), %rsi
leaq (,%rsi,8), %rax
subq %rsi, %rax
addq $-0x7, %rax
cmpq %rcx, %rax
jl 0x63ede
addq $-0x7, %rcx
cmpq $0x4, %rdx
movl $0x4, %eax
cmovbq %rdx, %rax
incq %rax
xorl %r15d, %r15d
movl %r13d, %edx
shrl %cl, %edx
xorl %esi, %esi
testl %ecx, %ecx
setne %sil
andl $0x7f, %edx
shll $0x7, %esi
orl %edx, %esi
movb %sil, 0x1(%rbp,%r15)
incq %r15
addl $-0x7, %ecx
cmpl %r15d, %eax
jne 0x634b0
incl %r15d
jmp 0x63ede
movl %ebx, 0x40(%rsp)
movl %edx, %ebx
movzbl %dh, %eax
testl %eax, %eax
movl $0x4, %ecx
cmovnel %eax, %ecx
cmpl %r13d, %ecx
movl %r13d, %eax
movq %rcx, 0x20(%rsp)
cmovbl %ecx, %eax
movq %rax, 0x38(%rsp)
movl %r13d, %edi
callq 0x4680
testq %rax, %rax
je 0x641cc
movq %rax, %r15
testl %r13d, %r13d
movq 0x38(%rsp), %r8
movq 0x20(%rsp), %r9
je 0x6356d
movl %r13d, %eax
xorl %edx, %edx
divl %r8d
xorl %ecx, %ecx
cmpl $0x1, %r8d
movl %r8d, %esi
adcl $0x0, %esi
cmpq %rdx, %rcx
movl %eax, %edi
adcl $0x0, %edi
movl %edi, 0x480(%rsp,%rcx,4)
movl $0x0, %edi
testq %rcx, %rcx
je 0x6355e
movl 0x47c(%rsp,%rcx,4), %edi
addl 0x7c(%rsp,%rcx,4), %edi
movl %edi, 0x80(%rsp,%rcx,4)
incq %rcx
cmpq %rcx, %rsi
jne 0x6353a
leal (,%r8,8), %edx
xorl %ecx, %ecx
movl %r13d, %esi
movl $0x0, %eax
subl %edx, %esi
movq %rsi, 0x10(%rsp)
jbe 0x63622
movq %rbp, 0x50(%rsp)
movq %r14, 0x68(%rsp)
movl %r8d, %esi
cmpl $0x1, %r8d
movl %r8d, %edi
adcl $0x0, %edi
leaq (,%rsi,8), %rax
movq %rax, 0x8(%rsp)
xorl %ecx, %ecx
movq %r12, %rbp
xorl %eax, %eax
testl %r13d, %r13d
je 0x635f4
movq %rbp, %r9
xorl %r11d, %r11d
movl 0x80(%rsp,%r11,4), %r14d
addl %eax, %r14d
movq %r9, %r10
xorl %edx, %edx
movb (%r10), %bl
leal (%r14,%rdx), %r8d
movb %bl, (%r15,%r8)
incq %rdx
addq %rsi, %r10
cmpq $0x8, %rdx
jne 0x635d2
incq %r11
incq %r9
cmpq %rdi, %r11
jne 0x635c2
addq $0x8, %rax
movq 0x8(%rsp), %rdx
addq %rdx, %rcx
addq %rdx, %rbp
cmpq 0x10(%rsp), %rcx
jb 0x635b7
movq 0x68(%rsp), %r14
movq 0x50(%rsp), %rbp
movl 0x4(%rsp), %ebx
movq 0x38(%rsp), %r8
movq 0x20(%rsp), %r9
movl %r13d, %edx
subl %r8d, %edx
cmpl %edx, %ecx
jae 0x63676
cmpl $0x1, %r8d
movl %r8d, %esi
adcl $0x0, %esi
movslq %ecx, %rcx
cmpl %r13d, %r9d
movl %r13d, %edi
cmovbl %r9d, %edi
leaq (%r12,%rcx), %r8
testl %r13d, %r13d
je 0x6366a
xorl %r9d, %r9d
movb (%r8,%r9), %r10b
movl 0x80(%rsp,%r9,4), %r11d
addl %eax, %r11d
movb %r10b, (%r15,%r11)
incq %r9
cmpq %r9, %rsi
jne 0x6364f
addq %rdi, %rcx
incl %eax
addq %rdi, %r8
cmpl %ecx, %edx
ja 0x63647
cmpl %r13d, %ecx
movq 0x20(%rsp), %r9
jae 0x636bf
movslq %ecx, %rdx
cmpl %r13d, %r9d
cmovael %r13d, %r9d
addq %rdx, %r12
movl %ecx, %ecx
xorl %esi, %esi
movb (%r12,%rsi), %dil
movl 0x80(%rsp,%rsi,4), %r8d
addl %eax, %r8d
movb %dil, (%r15,%r8)
incq %rsi
leal (%rcx,%rsi), %edi
cmpl %r13d, %edi
jb 0x63691
addq %r9, %rdx
incl %eax
addq %r9, %r12
addq %r9, %rcx
cmpl %r13d, %edx
jb 0x6368f
movl %ebx, %eax
andb $-0x11, %al
movb %al, (%rbp)
cmpl $0x5, 0x40(%rsp)
ja 0x637e7
movq $-0x1, %rdx
xorl %ecx, %ecx
movl %r13d, %esi
movl %r13d, %eax
movq 0x38(%rsp), %r8
shrl $0x7, %eax
incq %rdx
addq $0x7, %rcx
cmpl $0x7f, %esi
movl %eax, %esi
ja 0x636e5
movq 0x28(%rsp), %rsi
leaq (,%rsi,8), %rax
subq %rsi, %rax
addq $-0x7, %rax
xorl %r12d, %r12d
cmpq %rcx, %rax
jl 0x639ec
addq $-0x7, %rcx
cmpq $0x4, %rdx
movl $0x4, %eax
cmovbq %rdx, %rax
incq %rax
xorl %r12d, %r12d
movl %r13d, %edx
shrl %cl, %edx
xorl %esi, %esi
testl %ecx, %ecx
setne %sil
andl $0x7f, %edx
shll $0x7, %esi
orl %edx, %esi
movb %sil, 0x1(%rbp,%r12)
incq %r12
addl $-0x7, %ecx
cmpl %r12d, %eax
jne 0x6372d
jmp 0x639ec
movb $0x20, (%rbp)
cmpl $0x5, %ebx
ja 0x63801
movq $-0x1, %rsi
xorl %ecx, %ecx
movl %r13d, %edx
movl %r13d, %eax
shrl $0x7, %eax
incq %rsi
addq $0x7, %rcx
cmpl $0x7f, %edx
movl %eax, %edx
ja 0x63773
movq 0x28(%rsp), %rax
leaq (,%rax,8), %rdx
subq %rax, %rdx
addq $-0x7, %rdx
movl $0x1, %eax
cmpq %rcx, %rdx
jl 0x63e7d
addq $-0x7, %rcx
cmpq $0x4, %rsi
movl $0x4, %edx
cmovbq %rsi, %rdx
incq %rdx
xorl %eax, %eax
movl %r13d, %esi
shrl %cl, %esi
xorl %edi, %edi
testl %ecx, %ecx
setne %dil
andl $0x7f, %esi
shll $0x7, %edi
orl %esi, %edi
movb %dil, 0x1(%rbp,%rax)
incq %rax
addl $-0x7, %ecx
cmpl %eax, %edx
jne 0x637bc
incl %eax
jmp 0x63e7d
cmpl $0x7f, %r13d
movq 0x38(%rsp), %r8
ja 0x63815
movb %r13b, 0x1(%rbp)
movl $0x1, %r12d
jmp 0x639ec
cmpl $0x7f, %r13d
ja 0x63851
movb %r13b, 0x1(%rbp)
movl $0x2, %eax
jmp 0x63e7d
movl %r13d, %eax
cmpl $0x3fff, %r13d          # imm = 0x3FFF
ja 0x63877
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x2(%rbp)
movl $0x2, %r12d
jmp 0x639ec
cmpl $0x7f, %r13d
ja 0x638aa
movb %r13b, 0x1(%rbp)
movl $0x2, %r15d
jmp 0x63ede
movl %r13d, %eax
cmpl $0x3fff, %r13d          # imm = 0x3FFF
ja 0x638d5
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x2(%rbp)
movl $0x3, %eax
jmp 0x63e7d
cmpl $0x1fffff, %r13d        # imm = 0x1FFFFF
ja 0x63907
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x3(%rbp)
movl $0x3, %r12d
jmp 0x639ec
movl %r13d, %eax
cmpl $0x3fff, %r13d          # imm = 0x3FFF
ja 0x63945
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x2(%rbp)
movl $0x3, %r15d
jmp 0x63ede
cmpl $0x1fffff, %r13d        # imm = 0x1FFFFF
ja 0x63978
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x3(%rbp)
movl $0x4, %eax
jmp 0x63e7d
cmpl $0xfffffff, %r13d       # imm = 0xFFFFFFF
ja 0x639b5
shrl $0x15, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x3(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x4(%rbp)
movl $0x4, %r12d
jmp 0x639ec
cmpl $0x1fffff, %r13d        # imm = 0x1FFFFF
ja 0x63e09
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x3(%rbp)
movl $0x4, %r15d
jmp 0x63ede
cmpl $0xfffffff, %r13d       # imm = 0xFFFFFFF
ja 0x63e47
shrl $0x15, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x3(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x4(%rbp)
movl $0x5, %eax
jmp 0x63e7d
shrl $0x1c, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0x15, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x3(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x4(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x5(%rbp)
movl $0x5, %r12d
leal 0x1(%r12), %eax
cmpl (%r14), %eax
jae 0x63deb
addl $0x2, %r12d
movl %eax, %eax
movb %r8b, (%rbp,%rax)
leal (%r8,%r8,4), %eax
addq %rbp, %rax
addq $0x7, %rax
testl %r13d, %r13d
je 0x63d95
movl %ebx, %edx
movl %ebx, %ecx
andl $0x4, %ecx
movl %ecx, 0x40(%rsp)
cmpl $0x1, %r8d
adcl $0x0, %r8d
movq $0x0, 0x10(%rsp)
notl %ebx
movl $0x0, 0x58(%rsp)
movq $0x0, 0x8(%rsp)
movq %rax, 0x70(%rsp)
movq %rax, %r11
movl %ebx, 0x20(%rsp)
movq %r14, 0x68(%rsp)
movq %rbp, 0x50(%rsp)
movq %r8, 0x38(%rsp)
movl %r12d, 0x48(%rsp)
movq %r11, %r12
subq %rbp, %r12
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
leaq 0x383c5(%rip), %r13     # 0x9be40
xorl %ebp, %ebp
movl $0x0, 0x18(%rsp)
btl $0x10, %edx
setae %al
movl (%r13), %r8d
testq %rbp, %rbp
sete %cl
testl %ebx, %r8d
jne 0x63b75
orb %cl, %al
je 0x63b75
movl (%r14), %eax
cmpq %rax, %r12
jg 0x63b75
subl %r12d, %eax
movl %eax, 0x60(%rsp)
movq 0x10(%rsp), %rax
movl 0x80(%rsp,%rax,4), %edi
addq %r15, %rdi
movl 0x480(%rsp,%rax,4), %esi
orl 0x40(%rsp), %r8d
orl $0x10, %r8d
movq %r11, %rbx
movq %r11, %rdx
leaq 0x60(%rsp), %rcx
movl %r9d, %r14d
callq 0x6336a
movl %r14d, %r9d
testq %rax, %rax
setne %al
movl 0x60(%rsp), %r14d
testl %r14d, %r14d
setne %cl
cmpl %r14d, %r9d
seta %dl
andb %cl, %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x63b39
cmpl 0x58(%rsp), %r14d
jbe 0x63b47
movl %r14d, %esi
movq 0x8(%rsp), %rdi
callq 0x4840
testq %rax, %rax
je 0x63dc4
movq %rax, %rdi
movl 0x60(%rsp), %eax
movl %eax, 0x58(%rsp)
jmp 0x63b4f
movq 0x68(%rsp), %r14
movl 0x4(%rsp), %edx
movq %rbx, %r11
jmp 0x63b71
movl %r14d, %eax
movq 0x8(%rsp), %rdi
movl %eax, %edx
movq %rdi, 0x8(%rsp)
movq %rbx, %rsi
callq 0x43c0
movq %rbx, %r11
movl %ebp, 0x18(%rsp)
movl %r14d, %r9d
movq 0x68(%rsp), %r14
movl 0x4(%rsp), %edx
movl 0x20(%rsp), %ebx
incq %rbp
addq $0x4, %r13
cmpq $0x4, %rbp
jne 0x63a85
cmpl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
je 0x63de1
cmpl $0x3, 0x18(%rsp)
ja 0x63bc5
movl %r9d, %edx
movq %r11, %rdi
movq 0x8(%rsp), %rsi
movq %rdx, 0x18(%rsp)
movq %r11, %rbx
movl %r9d, %ebp
callq 0x43c0
movl %ebp, %r10d
movq %rbx, %r11
movl 0x20(%rsp), %ebx
movl %ebp, 0x60(%rsp)
jmp 0x63bd1
movl 0x60(%rsp), %eax
movq %rax, 0x18(%rsp)
movl %eax, %r10d
movq 0x50(%rsp), %rbp
movl 0x48(%rsp), %ecx
leaq (%rcx,%rbp), %rax
movq 0x28(%rsp), %rsi
subq %rcx, %rsi
cmpq $0x4, %rsi
jg 0x63c72
xorl %r9d, %r9d
xorl %edi, %edi
movl %r10d, %r13d
movl %r10d, %r8d
movq %rdi, %rcx
movq %r9, %rdx
shrl $0x7, %r8d
addq $0x7, %rdi
incq %r9
cmpl $0x7f, %r10d
movl %r8d, %r10d
ja 0x63bfb
leaq (,%rsi,8), %r8
subq %rsi, %r8
xorl %r12d, %r12d
cmpq %rdi, %r8
movq 0x38(%rsp), %r8
movq 0x18(%rsp), %r10
jl 0x63d57
cmpq $0x4, %rdx
movl $0x4, %esi
cmovaeq %rsi, %rdx
incq %rdx
xorl %r12d, %r12d
movl %r13d, %esi
shrl %cl, %esi
xorl %edi, %edi
testl %ecx, %ecx
setne %dil
andl $0x7f, %esi
shll $0x7, %edi
orl %esi, %edi
movb %dil, (%rax,%r12)
incq %r12
addl $-0x7, %ecx
cmpl %r12d, %edx
jne 0x63c49
jmp 0x63d57
cmpl $0x7f, %r10d
movq 0x38(%rsp), %r8
ja 0x63c8b
movb %r10b, (%rax)
movl $0x1, %r12d
jmp 0x63d52
movl %r10d, %ecx
cmpl $0x3fff, %r10d          # imm = 0x3FFF
ja 0x63cb2
shrl $0x7, %ecx
orb $-0x80, %cl
movb %cl, (%rax)
andb $0x7f, %r10b
movb %r10b, 0x1(%rax)
movl $0x2, %r12d
jmp 0x63d52
cmpl $0x1fffff, %r10d        # imm = 0x1FFFFF
ja 0x63cdf
shrl $0xe, %ecx
orb $-0x80, %cl
movb %cl, (%rax)
movl %r10d, %ecx
shrl $0x7, %ecx
orb $-0x80, %cl
movb %cl, 0x1(%rax)
andb $0x7f, %r10b
movb %r10b, 0x2(%rax)
movl $0x3, %r12d
jmp 0x63d52
cmpl $0xfffffff, %r10d       # imm = 0xFFFFFFF
ja 0x63d18
shrl $0x15, %ecx
orb $-0x80, %cl
movb %cl, (%rax)
movl %r10d, %ecx
shrl $0xe, %ecx
orb $-0x80, %cl
movb %cl, 0x1(%rax)
movl %r10d, %ecx
shrl $0x7, %ecx
orb $-0x80, %cl
movb %cl, 0x2(%rax)
andb $0x7f, %r10b
movb %r10b, 0x3(%rax)
movl $0x4, %r12d
jmp 0x63d52
shrl $0x1c, %ecx
orb $-0x80, %cl
movb %cl, (%rax)
movl %r10d, %ecx
shrl $0x15, %ecx
orb $-0x80, %cl
movb %cl, 0x1(%rax)
movl %r10d, %ecx
shrl $0xe, %ecx
orb $-0x80, %cl
movb %cl, 0x2(%rax)
movl %r10d, %ecx
shrl $0x7, %ecx
orb $-0x80, %cl
movb %cl, 0x3(%rax)
andb $0x7f, %r10b
movb %r10b, 0x4(%rax)
movl $0x5, %r12d
movq 0x18(%rsp), %r10
addq %r10, %r11
addl 0x48(%rsp), %r12d
movq 0x10(%rsp), %rcx
incq %rcx
movq %rcx, 0x10(%rsp)
cmpq %r8, %rcx
movl 0x4(%rsp), %edx
jne 0x63a63
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x63d8e
movq %r11, %rbx
callq 0x45c0
movq %rbx, %r11
movq 0x70(%rsp), %rbx
jmp 0x63d9b
movq %rax, %r11
movq %rax, %rbx
movl %r12d, %edi
addq %rbp, %rdi
movq %r11, %rdx
subq %rbx, %rdx
movq %rbx, %rsi
movq %r11, %r13
callq 0x4830
movq %r15, %rdi
callq 0x45c0
movq %r13, %rax
addl %r12d, %eax
subl %ebx, %eax
jmp 0x63e01
movq 0x30(%rsp), %rdi
callq 0x45c0
movq %r15, %rdi
callq 0x45c0
xorl %eax, %eax
xorl %ebp, %ebp
movq 0x68(%rsp), %r14
jmp 0x63e01
movq 0x8(%rsp), %rdi
callq 0x45c0
movq 0x30(%rsp), %rdi
callq 0x45c0
movq %r15, %rdi
callq 0x45c0
xorl %eax, %eax
xorl %ebp, %ebp
movl %eax, (%r14)
jmp 0x642a8
cmpl $0xfffffff, %r13d       # imm = 0xFFFFFFF
ja 0x63ea7
shrl $0x15, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x3(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x4(%rbp)
movl $0x5, %r15d
jmp 0x63ede
shrl $0x1c, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0x15, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x3(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x4(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x5(%rbp)
movl $0x6, %eax
leal (%rax,%r13), %ebx
cmpl (%r14), %ebx
ja 0x641cc
testl %r13d, %r13d
je 0x63e9f
movl %eax, %edi
addq %rbp, %rdi
movl %r13d, %edx
movq %r12, %rsi
callq 0x43c0
movl %ebx, (%r14)
jmp 0x642a8
shrl $0x1c, %eax
orb $-0x80, %al
movb %al, 0x1(%rbp)
movl %r13d, %eax
shrl $0x15, %eax
orb $-0x80, %al
movb %al, 0x2(%rbp)
movl %r13d, %eax
shrl $0xe, %eax
orb $-0x80, %al
movb %al, 0x3(%rbp)
movl %r13d, %eax
shrl $0x7, %eax
orb $-0x80, %al
movb %al, 0x4(%rbp)
movl %r13d, %eax
andb $0x7f, %al
movb %al, 0x5(%rbp)
movl $0x6, %r15d
movq 0x28(%rsp), %rbx
addq %rbp, %rbx
movl 0x4(%rsp), %ecx
movl %ecx, %edi
andl $0x4, %edi
testl %r13d, %r13d
je 0x63f88
movl %ecx, %eax
andl $0x80, %eax
je 0x63f88
leal 0x100(%r15), %eax
cmpl (%r14), %eax
ja 0x641cc
movl %edi, 0x20(%rsp)
movl %r13d, %esi
movl %r15d, %edx
addq %rbp, %rdx
leaq 0x80(%rsp), %rcx
leaq 0x480(%rsp), %r8
movq %r12, %rdi
callq 0x61528
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x63f9b
movl 0x480(%rsp), %r13d
addl 0x80(%rsp), %r15d
leaq (%r15,%rbp), %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x64379
addl %eax, %r15d
subl %eax, (%r14)
movl 0x20(%rsp), %edi
testl %edi, %edi
sete %al
cmpl $0x20, %r13d
setae %cl
orb %al, %cl
jne 0x63fa6
xorl %edi, %edi
movb $-0x5, %al
movq 0x8(%rsp), %r12
jmp 0x63fa1
testb %cl, %cl
jns 0x63f90
andb $0x7f, (%rbp)
movq $0x0, 0x8(%rsp)
jmp 0x63fab
movb $0x7f, %al
movl 0x20(%rsp), %edi
andb %al, (%rbp)
jmp 0x63fab
movq 0x8(%rsp), %r12
testb $0x40, 0x4(%rsp)
je 0x641d6
testl %r13d, %r13d
je 0x641d6
movl %edi, 0x20(%rsp)
movq %rbx, 0x28(%rsp)
leal 0x101(%r13), %edi
movl %edi, 0x44(%rsp)
callq 0x4680
testq %rax, %rax
je 0x641cc
leaq 0x7c(%rsp), %rcx
movl $0x0, (%rcx)
movq %rcx, %r9
movl %r13d, %esi
leaq 0x80(%rsp), %r10
leaq 0x60(%rsp), %rcx
leaq 0x480(%rsp), %r8
movq %r12, %rdi
movq %rsi, 0x38(%rsp)
movq %rax, %rbx
movq %rax, %rdx
pushq %r10
pushq $0x0
callq 0x7a9d0
addq $0x10, %rsp
movq %rax, 0x10(%rsp)
leaq 0x7c(%rsp), %rax
movslq (%rax), %rax
movq %rax, 0x48(%rsp)
leaq (%rbx,%rax), %rdi
incq %rdi
movq %rbx, %rax
incq %rax
movq %rax, 0x18(%rsp)
leaq 0x60(%rsp), %rax
movq (%rax), %rdx
movq %rbx, %rsi
movq %rdx, 0x70(%rsp)
callq 0x4830
movq %rbx, 0x58(%rsp)
movq 0x48(%rsp), %rax
movb %al, (%rbx)
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x480(%rsp), %rsi
movq %rax, %rdx
callq 0x43c0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x641ec
movq 0x70(%rsp), %rax
leal (%rbx,%rax), %edx
incl %edx
movl %edx, %ecx
movq 0x80(%rsp), %rax
addq %rcx, %rax
movq %rax, %xmm0
punpckldq 0x316ff(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x31707(%rip), %xmm0    # 0x957c0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x38(%rsp), %xmm0
mulsd 0x37ce9(%rip), %xmm0    # 0x9bdc0
ucomisd %xmm0, %xmm1
jae 0x641ec
movq %rcx, 0x18(%rsp)
movl %r15d, %r13d
movq %rbp, 0x50(%rsp)
addq %rbp, %r13
movq %rdx, %r12
addl %edx, %edx
movq %r13, %rdi
movq 0x28(%rsp), %rbx
movq %rbx, %rsi
movl %edx, 0x48(%rsp)
callq 0x64379
movslq %eax, %rbp
movq %r13, %rdi
addq %rbp, %rdi
movl 0x80(%rsp), %edx
movq %rbx, %rsi
callq 0x64379
addl %eax, %ebp
leal (%r15,%rbp), %ecx
addl $0x5, %ecx
movl (%r14), %eax
subl %ecx, %eax
jb 0x642bd
movl %eax, 0x44(%rsp)
movl 0x20(%rsp), %edi
testl %edi, %edi
je 0x6415b
cmpl $0x20, %r12d
jb 0x64153
cmpq $0x1f, 0x80(%rsp)
ja 0x6415d
movq 0x50(%rsp), %rax
andb $-0x5, (%rax)
xorl %edi, %edi
movl %edi, 0x20(%rsp)
xorl %esi, %esi
callq 0x644ae
movslq %ebp, %rbx
leaq (%rbx,%r13), %rdx
addq $0x5, %rdx
leaq 0x44(%rsp), %rcx
movq 0x58(%rsp), %rdi
movl %r12d, %esi
movq %rdx, 0x38(%rsp)
callq *%rax
testq %rax, %rax
je 0x642bd
movl 0x44(%rsp), %edx
cmpl %r12d, %edx
jae 0x64304
addq %rbx, %r13
movq %r13, %rdi
movq 0x28(%rsp), %rsi
callq 0x64379
movl %eax, %r12d
movslq %eax, %rdi
addq %r13, %rdi
movl 0x44(%rsp), %ebx
movq 0x38(%rsp), %rsi
movq %rbx, %rdx
callq 0x4830
jmp 0x64357
movq 0x30(%rsp), %rdi
jmp 0x6429a
testb $0x40, 0x4(%rsp)
je 0x641e1
andb $-0x41, (%rbp)
movq $0x0, 0x10(%rsp)
jmp 0x64211
andb $-0x41, (%rbp)
callq 0x45c0
movq $0x0, 0x10(%rsp)
movq 0x58(%rsp), %rdi
callq 0x45c0
movq 0x28(%rsp), %rbx
movl 0x20(%rsp), %edi
movl (%r14), %eax
subl %r15d, %eax
jb 0x64281
movl 0x4(%rsp), %esi
movl %eax, (%r14)
andl $0x3, %esi
movq %rbx, 0x28(%rsp)
je 0x6423b
cmpl $0x7, %r13d
ja 0x6423b
andb $-0x2, (%rbp)
movl 0x4(%rsp), %esi
andl $0x2, %esi
callq 0x644ae
movl %r15d, %ebx
addq %rbp, %rbx
movq %r12, %rdi
movl %r13d, %esi
movq %rbx, %rdx
movq %r14, %rcx
callq *%rax
testq %rax, %rax
je 0x64281
cmpl %r13d, (%r14)
jb 0x642eb
movb (%rbp), %al
andb $-0x24, %al
movl 0x40(%rsp), %ecx
orb %al, %cl
orb $0x20, %cl
movb %cl, (%rbp)
movl %r13d, %edx
leaq (%rbx,%rdx), %rax
cmpq 0x28(%rsp), %rax
jbe 0x642d8
movq 0x30(%rsp), %rdi
callq 0x45c0
movq 0x10(%rsp), %rdi
callq 0x45c0
movq 0x8(%rsp), %rdi
callq 0x45c0
movl $0x0, (%r14)
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x888, %rsp            # imm = 0x888
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rsp), %rdi
callq 0x45c0
movq 0x10(%rsp), %rdi
callq 0x45c0
movq 0x58(%rsp), %rdi
jmp 0x64290
testl %r13d, %r13d
je 0x642e8
movq %rbx, %rdi
movq %r12, %rsi
callq 0x43c0
movl %r13d, (%r14)
movq 0x10(%rsp), %rdi
callq 0x45c0
movq 0x8(%rsp), %rdi
callq 0x45c0
addl %r15d, (%r14)
jmp 0x642a8
movl 0x48(%rsp), %edx
orl $0x1, %edx
movq %r13, %rdi
movq 0x28(%rsp), %rbx
movq %rbx, %rsi
callq 0x64379
movl %eax, %ebp
movq %r12, 0x48(%rsp)
movslq %eax, %r12
addq %r13, %r12
movl 0x80(%rsp), %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x64379
movslq %eax, %rdi
addq %r12, %rdi
movl %eax, %r12d
movq 0x48(%rsp), %rbx
movq 0x58(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x43c0
addl %r15d, %ebp
addl %ebx, %ebp
addl %r12d, %ebp
movl 0x80(%rsp), %r13d
movl %ebp, %r15d
movq 0x10(%rsp), %r12
movq 0x50(%rsp), %rbp
jmp 0x641fe