// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/vcf.c
// Function: get_rlen
static int64_t get_rlen(const bcf_hdr_t *h, bcf1_t *v)
{
    uint8_t *f = (uint8_t*)v->shared.s, *t = NULL,
        *e = (uint8_t*)v->shared.s + v->shared.l;
    int size, type, id, lenid, endid, svlenid, i, bad, gvcf = 0, haveins = 0;
    bcf_info_t *endinfo = NULL, *svleninfo = NULL, end_lcl, svlen_lcl;
    bcf_fmt_t *lenfmt = NULL, len_lcl;

    //holds <ins> allele status for the max no of alleles
    uint8_t insals[8192];
    //pos from info END, fmt LEN, info SVLEN
    hts_pos_t end = 0, end_fmtlen = 0, end_svlen = 0, hpos;
    int64_t len_ref = 0, len = 0, tmp;
    lenid = bcf_hdr_id2int(h, BCF_DT_ID, "LEN");
    svlenid = bcf_hdr_id2int(h, BCF_DT_ID, "SVLEN");
    endid = bcf_hdr_id2int(h, BCF_DT_ID, "END");

    //initialise bytes which are to be used
    memset(insals, 0, 1 + v->n_allele / 8);

    //use decoded data where ever available and where not, get from stream
    if (v->unpacked & BCF_UN_STR || v->d.shared_dirty & BCF1_DIRTY_ALS) {
        for (i = 1; i < v->n_allele; ++i) {
            //checks only alt alleles, with NUL
            if (!strcmp(v->d.allele[i], "<INS>")) {
                //ins allele, note to skip corresponding svlen val
                insals[i >> 3] |= 1 << (i & 7);
                haveins = 1;
            } else if (!strcmp(v->d.allele[i], "<*>") ||
                         !strcmp(v->d.allele[i], "<NON_REF>")) {
                gvcf = 1;   //gvcf present, have to check for LEN field
            }
        }
        f += v->unpack_size[0] + v->unpack_size[1];
        len_ref = v->n_allele ? strlen(v->d.allele[0]) : 0;
    } else if (f < e) {
        //skip ID
        size = bcf_dec_size(f, &f, &type);
        f += size << bcf_type_shift[type];
        // REF, ALT
        for (i = 0; i < v->n_allele; ++i) {
            //check all alleles, w/o NUL
            size = bcf_dec_size(f, &f, &type);
            if (!i) {   //REF length
                len_ref = size;
            } else {
                if (size == 5 && !strncmp((char*)f, "<INS>", size)) {
                    //ins allele, note to skip corresponding svlen val
                    insals[i >> 3] |= 1 << (i & 7);
                    haveins = 1;
                } else if ((size == 3 && !strncmp((char*)f, "<*>", size)) ||
                    (size == 9 && !strncmp((char*)f, "<NON_REF>", size))) {
                    gvcf = 1;   //gvcf present, have to check for LEN field
                }
            }
            f += size << bcf_type_shift[type];
        }
    }
    // FILTER
    if (v->unpacked & BCF_UN_FLT) {
        f += v->unpack_size[2];
    } else if (f < e) {
        size = bcf_dec_size(f, &f, &type);
        f += size << bcf_type_shift[type];
    }
    // INFO
    if (svlenid >= 0 || endid >= 0 ) {  //only if end/svlen present
        if (v->unpacked & BCF_UN_INFO || v->d.shared_dirty & BCF1_DIRTY_INF) {
            endinfo = bcf_get_info(h, v, "END");
            svleninfo = bcf_get_info(h, v, "SVLEN");
        } else if (f < e) {
            for (i = 0; i < v->n_info; ++i) {
                id = bcf_dec_typed_int1(f, &t);
                if (id == endid) {  //END
                    t = bcf_unpack_info_core1(f, &end_lcl);
                    endinfo = &end_lcl;
                    if (svleninfo || svlenid < 0) {
                        break;  //already got svlen or no need to search further
                    }
                } else if (id == svlenid) { //SVLEN
                    t = bcf_unpack_info_core1(f, &svlen_lcl);
                    svleninfo = &svlen_lcl;
                    if (endinfo || endid < 0 ) {
                        break;  //already got end or no need to search further
                    }
                } else {
                    f = t;
                    size = bcf_dec_size(f, &t, &type);
                    t += size << bcf_type_shift[type];
                }
                f = t;
            }
        }
    }
    // FORMAT
    if (lenid >= 0 && gvcf) {
        //with LEN and has gvcf allele
        f = (uint8_t*)v->indiv.s; t = NULL; e = (uint8_t*)v->indiv.s + v->indiv.l;
        if (v->unpacked & BCF_UN_FMT || v->d.indiv_dirty) {
            lenfmt = bcf_get_fmt(h, v, "LEN");
        } else if (f < e) {
            for (i = 0; i < v->n_fmt; ++i) {
                id = bcf_dec_typed_int1(f, &t);
                if (id == lenid) {
                        t = bcf_unpack_fmt_core1(f, v->n_sample, &len_lcl);
                    lenfmt = &len_lcl;
                    break;  //that's all needed
                } else {
                    f = t;
                    size = bcf_dec_size(f, &t, &type);
                    t += size * v->n_sample << bcf_type_shift[type];
                }
                f = t;
            }
        }
    }
    //got required data, find end and rlen
    if (endinfo && endinfo->vptr) { //end position given by info END
        //end info exists, not being deleted
        end = endinfo->v1.i;
        switch(endinfo->type) {
            case BCF_BT_INT8:  end = end == bcf_int8_missing ? 0 : end;  break;
            case BCF_BT_INT16: end = end == bcf_int16_missing ? 0 : end; break;
            case BCF_BT_INT32: end = end == bcf_int32_missing ? 0 : end; break;
            case BCF_BT_INT64: end = end == bcf_int64_missing ? 0 : end; break;
            default: end = 0; break; //invalid
        }
    }

    if (svleninfo && svleninfo->vptr) {
        //svlen info exists, not being deleted
        bad = 0;
        //get largest svlen, except <ins>; expects to be . for non SV alleles
        for (i = 0; i < svleninfo->len && i + 1 < v->n_allele; ++i) {
            switch(svleninfo->type) {
                case BCF_BT_INT8:
                    tmp = ((int8_t*)svleninfo->vptr)[i];
                    tmp = tmp == bcf_int8_missing ? 0 : tmp;
                break;
                case BCF_BT_INT16:
                    tmp = ((int16_t*)svleninfo->vptr)[i];
                    tmp = tmp == bcf_int16_missing ? 0 : tmp;
                break;
                case BCF_BT_INT32:
                    tmp = ((int32_t*)svleninfo->vptr)[i];
                    tmp = tmp == bcf_int32_missing ? 0 : tmp;
                break;
                case BCF_BT_INT64:
                    tmp = ((int64_t*)svleninfo->vptr)[i];
                    tmp = tmp == bcf_int64_missing ? 0 : tmp;
                break;
                default: //invalid
                    tmp = 0;
                    bad = 1;
                break;
            }
            if (bad) {  //stop svlen check
                len = 0;
                break;
            }
            //expects only SV will have valid svlen and rest have '.'
            if ((haveins) && (insals[i >> 3] & (1 << ((i + 1) & 7)))) {
                continue;   //skip svlen for <ins>
            }
            tmp = tmp < 0 ? llabs(tmp) : tmp;
            if (len < tmp) len = tmp;
        }
    }
    if ((!svleninfo || !len) && end) { //no svlen, infer from end
        len = end > v->pos ? end - v->pos - 1 : 0;
    }
    end_svlen = v->pos + len + 1;   //end position found from SVLEN

    len = 0;
    if (lenfmt && lenfmt->p) {
        //fmt len exists, not being deleted, has gvcf and version >= 4.5
        int j = 0;
        int64_t offset = 0;
        bad = 0;
        for (i = 0; i < v->n_sample; ++i) {
            for (j = 0; j < lenfmt->n; ++j) {
                switch(lenfmt->type) {
                case BCF_BT_INT8:
                    tmp = (((int8_t*)lenfmt->p + offset))[j];
                    tmp = tmp == bcf_int8_missing ? 0 : tmp;
                break;
                case BCF_BT_INT16:
                    tmp = ((int16_t*)(lenfmt->p + offset))[j];
                    tmp = tmp == bcf_int16_missing ? 0 : tmp;
                break;
                case BCF_BT_INT32:
                    tmp = ((int32_t*)(lenfmt->p + offset))[j];
                    tmp = tmp == bcf_int32_missing ? 0 : tmp;
                break;
                case BCF_BT_INT64:
                    tmp = ((int64_t*)(lenfmt->p + offset))[j];
                    tmp = tmp == bcf_int64_missing ? 0 : tmp;
                break;
                default: //invalid
                    bad = 1;
                break;
                }
                if (bad) {  //stop LEN check
                    len = 0;
                    break;
                }
                //assumes only gvcf have valid LEN
                if (len < tmp) len = tmp;
            }
            offset += j << bcf_type_shift[lenfmt->type];
        }
    }
    if ((!lenfmt || !len) && end) { //no fmt len, infer from end
        len = end > v->pos ? end - v->pos : 0;
    }
    end_fmtlen = v->pos + len;  //end position found from LEN

    //get largest pos, based on END, SVLEN, fmt LEN and length using it
    hpos = end < end_svlen ?
            end_svlen < end_fmtlen ? end_fmtlen : end_svlen :
            end < end_fmtlen ? end_fmtlen : end;
    len = hpos - v->pos;

    //NOTE: 'end' calculation be in sync with tbx.c:tbx_parse1

    /* rlen to be calculated based on version, END, SVLEN, fmt LEN, ref len.
    Relevance of these fields vary across different vcf versions.
    Many times, these info/fmt fields are used without version updates;
    hence these fields are used for calculation disregarding vcf version */
    return len < len_ref ? len_ref : len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20d8, %rsp           # imm = 0x20D8
movq %rsi, %r15
movq %rdi, %r14
movq 0x20(%rsi), %r13
movq 0x30(%rsi), %r12
leaq 0x77440(%rip), %rdx     # 0xaf1fb
xorl %esi, %esi
callq 0x2e585
movl %eax, %ebx
leaq 0x7742e(%rip), %rdx     # 0xaf1f9
movq %r14, %rdi
xorl %esi, %esi
callq 0x2e585
movl %eax, 0x24(%rsp)
leaq 0x77415(%rip), %rdx     # 0xaf1f5
movq %r14, 0x48(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x2e585
movl %eax, 0x38(%rsp)
movq 0x18(%r15), %r14
movl %r14d, %edx
shrl $0x13, %edx
incl %edx
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
callq 0x4250
movl 0xbc(%r15), %edi
testb $0x1, %dil
movq %r15, 0x30(%rsp)
movl %ebx, 0x44(%rsp)
movq %r14, 0x8(%rsp)
movq %r12, 0x50(%rsp)
movl %edi, 0x40(%rsp)
movq %r13, 0xa8(%rsp)
jne 0x37e94
testb $0x2, 0xb0(%r15)
jne 0x37e94
testq %r13, %r13
jle 0x37fc3
movzbl (%r12), %edx
movl %edx, %eax
andl $0xf, %eax
cmpb $-0x11, %dl
jbe 0x37f9c
movzbl 0x1(%r12), %ecx
andl $0xf, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x38c0e
leaq 0x75e85(%rip), %rdx     # 0xadd00
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x3(%r12), %rsi
movsbq 0x2(%r12), %rdx
jmp 0x37fa4
movq $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
cmpl $0x20000, %r14d         # imm = 0x20000
jb 0x37f5d
movq 0x8(%rsp), %rax
shrl $0x10, %eax
movq 0x30(%rsp), %rcx
movq 0x88(%rcx), %rbx
cmpl $0x3, %eax
movl $0x2, %r15d
cmovael %eax, %r15d
movl $0x0, 0x18(%rsp)
movl $0x1, %ebp
leaq 0x78209(%rip), %r14     # 0xb00f0
leaq 0x78208(%rip), %r12     # 0xb00f6
movq $0x0, 0x10(%rsp)
movq (%rbx,%rbp,8), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x46e0
testl %eax, %eax
je 0x37f38
movq %r13, %rdi
movq %r12, %rsi
callq 0x46e0
testl %eax, %eax
je 0x37f2c
movq %r13, %rdi
leaq 0x781d7(%rip), %rsi     # 0xb00fa
callq 0x46e0
testl %eax, %eax
jne 0x37f55
movl $0x1, %eax
movq %rax, 0x10(%rsp)
jmp 0x37f55
movl %ebp, %ecx
andb $0x7, %cl
movb $0x1, %al
shlb %cl, %al
movl %ebp, %ecx
shrl $0x3, %ecx
orb %al, 0xd0(%rsp,%rcx)
movl $0x1, 0x18(%rsp)
incq %rbp
cmpq %rbp, %r15
jne 0x37ef7
movq 0x30(%rsp), %r15
movslq 0xc0(%r15), %rax
movslq 0xc4(%r15), %r12
addq %rax, %r12
addq 0x50(%rsp), %r12
movq 0x8(%rsp), %rax
shrq $0x10, %rax
testw %ax, %ax
je 0x37fd4
movq 0x88(%r15), %rax
movq (%rax), %rdi
callq 0x41c0
movq %rax, 0x28(%rsp)
jmp 0x37fdd
leaq 0x1(%r12), %rsi
shrl $0x4, %edx
leaq 0x97575(%rip), %rcx     # 0xcf520
movb (%rax,%rcx), %cl
shll %cl, %edx
movslq %edx, %r12
addq %rsi, %r12
cmpl $0x10000, %r14d         # imm = 0x10000
jae 0x389f2
movq $0x0, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x50(%rsp), %rsi
addq 0xa8(%rsp), %rsi
movl 0x40(%rsp), %edi
testb $0x2, %dil
jne 0x38038
cmpq %rsi, %r12
jae 0x38059
movzbl (%r12), %edx
movl %edx, %eax
andl $0xf, %eax
cmpb $-0x11, %dl
jbe 0x38041
movzbl 0x1(%r12), %ecx
andl $0xf, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x38bb4
leaq 0x75cfd(%rip), %rdx     # 0xadd20
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movsbq 0x2(%r12), %rdx
addq $0x3, %r12
jmp 0x38047
movslq 0xc8(%r15), %rax
jmp 0x38056
incq %r12
shrl $0x4, %edx
leaq 0x974d2(%rip), %rcx     # 0xcf520
movb (%rax,%rcx), %cl
shll %cl, %edx
movslq %edx, %rax
addq %rax, %r12
movl 0x38(%rsp), %eax
testl %eax, 0x24(%rsp)
js 0x3850f
testb $0x4, %dil
jne 0x38516
testb $0x8, 0xb0(%r15)
jne 0x38516
cmpq %rsi, %r12
jae 0x3850f
movq 0x8(%rsp), %rax
andl $0xffff, %eax           # imm = 0xFFFF
movq %rax, 0x8(%rsp)
je 0x3850f
xorl %ebp, %ebp
leaq 0x75cf6(%rip), %rax     # 0xadd9c
leaq 0x75cff(%rip), %rsi     # 0xaddac
leaq 0x80(%rsp), %rdx
leaq 0x97464(%rip), %rdi     # 0xcf520
leaq 0x75cc9(%rip), %r8      # 0xadd8c
leaq 0x75ca6(%rip), %r11     # 0xadd70
leaq 0x58(%rsp), %r9
leaq 0x75c7a(%rip), %r15     # 0xadd50
leaq 0x75c53(%rip), %r10     # 0xadd30
xorl %r14d, %r14d
xorl %r13d, %r13d
movzbl (%r12), %ecx
andl $0xf, %ecx
leal -0x1(%rcx), %ebx
cmpl $0x3, %ebx
ja 0x3812e
movslq (%r10,%rbx,4), %rbx
addq %r10, %rbx
jmpq *%rbx
leaq 0x2(%r12), %r13
movsbq 0x1(%r12), %rbx
jmp 0x38130
leaq 0x5(%r12), %r13
movl 0x1(%r12), %ebx
jmp 0x38130
leaq 0x9(%r12), %r13
movq 0x1(%r12), %rbx
jmp 0x38130
leaq 0x3(%r12), %r13
movswq 0x1(%r12), %rbx
jmp 0x38130
xorl %ebx, %ebx
cmpl %ebx, 0x38(%rsp)
jne 0x3815d
movzbl %cl, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x38202
movslq (%r8,%rcx,4), %rcx
addq %r8, %rcx
jmpq *%rcx
leaq 0x2(%r12), %r13
movsbq 0x1(%r12), %rcx
jmp 0x38207
cmpl %ebx, 0x24(%rsp)
jne 0x3818a
movzbl %cl, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x38310
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
leaq 0x2(%r12), %r13
movsbq 0x1(%r12), %rcx
jmp 0x38315
movzbl (%r13), %ecx
cmpb $-0x11, %cl
jbe 0x381c2
movzbl 0x1(%r13), %ebx
andl $0xf, %ebx
decl %ebx
cmpl $0x3, %ebx
ja 0x3848d
leaq 0x75b92(%rip), %r12     # 0xadd40
movslq (%r12,%rbx,4), %rbx
addq %r12, %rbx
jmpq *%rbx
movsbq 0x2(%r13), %rbx
addq $0x3, %r13
jmp 0x381ca
incq %r13
movl %ecx, %ebx
shrl $0x4, %ebx
andl $0xf, %ecx
movb (%rcx,%rdi), %cl
shll %cl, %ebx
movslq %ebx, %rcx
addq %rcx, %r13
jmp 0x384f8
leaq 0x5(%r12), %r13
movl 0x1(%r12), %ecx
jmp 0x38207
leaq 0x9(%r12), %r13
movq 0x1(%r12), %rcx
jmp 0x38207
leaq 0x3(%r12), %r13
movswq 0x1(%r12), %rcx
jmp 0x38207
movq %r12, %r13
xorl %ecx, %ecx
movl %ecx, 0x80(%rsp)
movzbl (%r13), %ecx
andl $0xf, %ecx
movl %ecx, 0x84(%rsp)
movzbl (%r13), %ebx
cmpl $0xef, %ebx
jbe 0x38251
movzbl 0x1(%r13), %ebx
andl $0xf, %ebx
decl %ebx
cmpl $0x3, %ebx
ja 0x383c2
movslq (%rax,%rbx,4), %rbx
addq %rax, %rbx
jmpq *%rbx
movsbq 0x2(%r13), %rbx
addq $0x3, %r13
jmp 0x38257
incq %r13
shrl $0x4, %ebx
movl %ebx, 0xa0(%rsp)
movslq %ebx, %rbx
movq %r13, 0x90(%rsp)
movl %r13d, %r14d
subl %r12d, %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl %r14d, 0x9c(%rsp)
movq $0x0, 0x88(%rsp)
cmpl $0x1, %ebx
jne 0x382b8
movzbl %cl, %ecx
decl %ecx
cmpl $0x6, %ecx
ja 0x38412
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
movsbq (%r13), %rcx
movq %rcx, 0x88(%rsp)
jmp 0x38412
movb (%rcx,%rdi), %cl
shlq %cl, %rbx
jmp 0x38412
leaq 0x5(%r12), %r13
movl 0x1(%r12), %ecx
jmp 0x38315
movl 0x2(%r13), %ebx
addq $0x6, %r13
jmp 0x38257
leaq 0x9(%r12), %r13
movq 0x1(%r12), %rcx
jmp 0x38315
movq 0x2(%r13), %rbx
addq $0xa, %r13
jmp 0x38257
leaq 0x3(%r12), %r13
movswq 0x1(%r12), %rcx
jmp 0x38315
movswq 0x2(%r13), %rbx
addq $0x4, %r13
jmp 0x38257
movq %r12, %r13
xorl %ecx, %ecx
movl %ecx, 0x58(%rsp)
movzbl (%r13), %ecx
andl $0xf, %ecx
movl %ecx, 0x5c(%rsp)
movzbl (%r13), %ebx
cmpl $0xef, %ebx
jbe 0x38361
movzbl 0x1(%r13), %ebx
andl $0xf, %ebx
decl %ebx
cmpl $0x3, %ebx
ja 0x38494
leaq 0x75a14(%rip), %rbp     # 0xadd60
movslq (%rbp,%rbx,4), %rbx
addq %rbp, %rbx
jmpq *%rbx
movsbq 0x2(%r13), %rbx
addq $0x3, %r13
jmp 0x38367
incq %r13
shrl $0x4, %ebx
movl %ebx, 0x78(%rsp)
movslq %ebx, %rbx
movq %r13, 0x68(%rsp)
movl %r13d, %ebp
subl %r12d, %ebp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, 0x74(%rsp)
movq $0x0, 0x60(%rsp)
cmpl $0x1, %ebx
jne 0x383b7
movzbl %cl, %ecx
decl %ecx
cmpl $0x6, %ecx
ja 0x384d8
movslq (%r11,%rcx,4), %rcx
addq %r11, %rcx
jmpq *%rcx
movsbq (%r13), %rcx
movq %rcx, 0x60(%rsp)
jmp 0x384d8
movb (%rcx,%rdi), %cl
shlq %cl, %rbx
jmp 0x384d8
xorl %ebx, %ebx
jmp 0x38257
movswq (%r13), %rcx
movq %rcx, 0x88(%rsp)
movl $0x2, %ebx
jmp 0x38412
movss (%r13), %xmm0
movss %xmm0, 0x88(%rsp)
jmp 0x383fa
movslq (%r13), %rcx
movq %rcx, 0x88(%rsp)
movl $0x4, %ebx
jmp 0x38412
movq (%r13), %rcx
movq %rcx, 0x88(%rsp)
movl $0x8, %ebx
movl %ebx, 0x98(%rsp)
testq %rbp, %rbp
jne 0x38c18
movq %rdx, %r14
cmpl $0x0, 0x24(%rsp)
js 0x38545
addq %rbx, %r13
movq %rdx, %r14
xorl %ebp, %ebp
jmp 0x384f8
movl 0x2(%r13), %ebx
addq $0x6, %r13
jmp 0x381ca
movl 0x2(%r13), %ebx
addq $0x6, %r13
jmp 0x38367
movq 0x2(%r13), %rbx
addq $0xa, %r13
jmp 0x381ca
movq 0x2(%r13), %rbx
addq $0xa, %r13
jmp 0x38367
movswq 0x2(%r13), %rbx
addq $0x4, %r13
jmp 0x381ca
movswq 0x2(%r13), %rbx
addq $0x4, %r13
jmp 0x38367
xorl %ebx, %ebx
jmp 0x381ca
xorl %ebx, %ebx
jmp 0x38367
movswq (%r13), %rcx
movq %rcx, 0x60(%rsp)
movl $0x2, %ebx
jmp 0x384d8
movss (%r13), %xmm0
movss %xmm0, 0x60(%rsp)
jmp 0x384c3
movslq (%r13), %rcx
movq %rcx, 0x60(%rsp)
movl $0x4, %ebx
jmp 0x384d8
movq (%r13), %rcx
movq %rcx, 0x60(%rsp)
movl $0x8, %ebx
movl %ebx, 0x70(%rsp)
testq %r14, %r14
jne 0x38ccb
movq %r9, %rbp
cmpl $0x0, 0x38(%rsp)
js 0x38545
addq %rbx, %r13
xorl %r14d, %r14d
movq %r9, %rbp
movq %r13, %r12
movq 0x8(%rsp), %rcx
decl %ecx
movq %rcx, 0x8(%rsp)
jne 0x380e3
jmp 0x38545
xorl %r14d, %r14d
xorl %ebp, %ebp
jmp 0x38545
leaq 0x76cd8(%rip), %rdx     # 0xaf1f5
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x412fd
movq %rax, %r14
leaq 0x76cc2(%rip), %rdx     # 0xaf1f9
movq %rbx, %rdi
movq %r15, %rsi
callq 0x412fd
movq %rax, %rbp
xorl %r13d, %r13d
movl 0x44(%rsp), %ebx
testl %ebx, %ebx
js 0x3858e
cmpl $0x0, 0x10(%rsp)
movq 0x30(%rsp), %r15
movl 0x18(%rsp), %r12d
je 0x38598
testb $0x8, 0xbc(%r15)
jne 0x38575
cmpl $0x0, 0xb4(%r15)
je 0x385dc
leaq 0x76c7f(%rip), %rdx     # 0xaf1fb
movq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x4125e
movq %rax, %r13
jmp 0x38598
movq 0x30(%rsp), %r15
movl 0x18(%rsp), %r12d
testq %r14, %r14
je 0x385ce
cmpq $0x0, 0x10(%r14)
je 0x385ce
movl 0x4(%r14), %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x385ce
movq 0x8(%r14), %rax
leaq 0x7584e(%rip), %rdx     # 0xade08
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %ecx, %ecx
cmpq $-0x80, %rax
jmp 0x38709
movq $0x0, 0x8(%rsp)
jmp 0x38712
cmpq $0x0, 0x38(%r15)
jle 0x38b81
movq 0x18(%r15), %rdx
movq %rdx, %r8
shrq $0x20, %r8
andl $0xff, %r8d
je 0x38b81
movq 0x48(%r15), %rdi
shrq $0x28, %rdx
xorl %r13d, %r13d
leaq 0x757c7(%rip), %r9      # 0xaddd8
leaq 0x96f08(%rip), %rsi     # 0xcf520
leaq 0x757a9(%rip), %r10     # 0xaddc8
xorl %r11d, %r11d
movzbl (%rdi), %eax
andl $0xf, %eax
leal -0x1(%rax), %ecx
cmpl $0x3, %ecx
ja 0x38662
movslq (%r10,%rcx,4), %rcx
addq %r10, %rcx
jmpq *%rcx
leaq 0x2(%rdi), %r11
movsbq 0x1(%rdi), %rcx
jmp 0x38664
leaq 0x5(%rdi), %r11
movl 0x1(%rdi), %ecx
jmp 0x38664
leaq 0x9(%rdi), %r11
movq 0x1(%rdi), %rcx
jmp 0x38664
leaq 0x3(%rdi), %r11
movswq 0x1(%rdi), %rcx
jmp 0x38664
xorl %ecx, %ecx
cmpl %ecx, %ebx
je 0x38bbb
movzbl (%r11), %eax
cmpb $-0x11, %al
jbe 0x38697
movzbl 0x1(%r11), %ecx
andl $0xf, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x386e0
movslq (%r9,%rcx,4), %rcx
addq %r9, %rcx
jmpq *%rcx
movsbq 0x2(%r11), %rdi
addq $0x3, %r11
jmp 0x3869f
incq %r11
movl %eax, %edi
shrl $0x4, %edi
andl $0xf, %eax
imull %edx, %edi
movb (%rax,%rsi), %cl
shll %cl, %edi
movslq %edi, %rax
addq %rax, %r11
movq %r11, %rdi
decl %r8d
jne 0x38622
jmp 0x38598
movl 0x2(%r11), %edi
addq $0x6, %r11
jmp 0x3869f
movq 0x2(%r11), %rdi
addq $0xa, %r11
jmp 0x3869f
movswq 0x2(%r11), %rdi
addq $0x4, %r11
jmp 0x3869f
xorl %edi, %edi
jmp 0x3869f
xorl %ecx, %ecx
cmpq $-0x80000000, %rax      # imm = 0x80000000
jmp 0x38709
xorl %edx, %edx
movq %rax, %rcx
negq %rcx
cmovnoq %rax, %rdx
movq %rdx, 0x8(%rsp)
jmp 0x38712
xorl %ecx, %ecx
cmpq $-0x8000, %rax          # imm = 0x8000
cmovneq %rax, %rcx
movq %rcx, 0x8(%rsp)
testq %rbp, %rbp
je 0x3882e
movq 0x10(%rbp), %rcx
testq %rcx, %rcx
je 0x3882e
movslq 0x20(%rbp), %r8
testq %r8, %r8
jle 0x3882e
movzwl 0x1a(%r15), %r9d
xorl %r10d, %r10d
cmpl $0x1, %r9d
adcl $-0x1, %r9d
je 0x3882e
movl 0x4(%rbp), %r11d
decq %r9
decq %r8
decl %r11d
leaq 0x756b9(%rip), %rbx     # 0xade18
xorl %r14d, %r14d
xorl %esi, %esi
cmpl $0x3, %r11d
ja 0x38828
movslq (%rbx,%r11,4), %rax
addq %rbx, %rax
jmpq *%rax
movzbl (%rcx,%r14), %eax
cmpb $-0x80, %al
cmovel %r10d, %eax
movsbq %al, %rdi
jmp 0x387cd
movl (%rcx,%r14,4), %eax
movq %rsi, %rdx
movl %eax, %esi
negl %esi
movq %rdx, %rsi
cmovol %r10d, %eax
movslq %eax, %rdi
jmp 0x387cd
movq (%rcx,%r14,8), %rax
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
cmpq %rdx, %rax
movl $0x0, %edi
cmovneq %rax, %rdi
jmp 0x387cd
movzwl (%rcx,%r14,2), %eax
cmpl $0x8000, %eax           # imm = 0x8000
cmovel %r10d, %eax
movswq %ax, %rdi
movb $0x1, %al
testb %al, %al
je 0x38b7a
testl %r12d, %r12d
je 0x38800
movl %r14d, %eax
shrl $0x3, %eax
movzbl 0xd0(%rsp,%rax), %eax
movq %rsi, %rdx
leal 0x1(%r14), %esi
movzbl %sil, %esi
andl $0x7, %esi
btl %esi, %eax
movq %rdx, %rsi
jb 0x38811
movq %rdi, %rax
negq %rax
cmovnsq %rax, %rdi
cmpq %rdi, %rsi
cmovleq %rdi, %rsi
cmpq %r14, %r8
je 0x38830
leaq 0x1(%r14), %rax
cmpq %r14, %r9
movq %rax, %r14
jne 0x38764
jmp 0x38830
xorl %eax, %eax
xorl %edi, %edi
jmp 0x387cf
xorl %esi, %esi
testq %rbp, %rbp
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x38865
cmpq $0x0, 0x8(%rsp)
je 0x38865
movq (%r15), %rax
movq %rax, %rcx
notq %rcx
movq 0x8(%rsp), %rdx
addq %rdx, %rcx
xorl %esi, %esi
cmpq %rax, %rdx
cmovgq %rcx, %rsi
movq (%r15), %rax
testq %r13, %r13
movq %r13, 0x10(%rsp)
movq %rsi, 0x30(%rsp)
movq %rax, 0x38(%rsp)
je 0x38896
movq 0x10(%r13), %rcx
movq %rcx, 0x18(%rsp)
testq %rcx, %rcx
je 0x38896
movq 0x18(%r15), %r11
xorl %ebx, %ebx
shrq $0x28, %r11
jne 0x38907
xorl %r9d, %r9d
xorl %ecx, %ecx
movq 0x8(%rsp), %rsi
movq %rsi, %rax
movq 0x38(%rsp), %rdi
subq %rdi, %rax
cmovgq %rax, %rcx
testq %rsi, %rsi
cmoveq %r9, %rcx
movq 0x30(%rsp), %rax
leaq (%rdi,%rax), %rdx
testq %r9, %r9
cmoveq %rcx, %r9
cmpq $0x0, 0x10(%rsp)
leaq 0x1(%rdi,%rax), %rax
cmoveq %rcx, %r9
addq %rdi, %r9
cmpq %rdx, %rsi
cmovgq %rsi, %rax
cmpq %r9, %rax
cmovleq %r9, %rax
subq %rdi, %rax
movq 0x28(%rsp), %rcx
cmpq %rcx, %rax
cmovleq %rcx, %rax
addq $0x20d8, %rsp           # imm = 0x20D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movl 0x4(%r13), %r8d
movslq 0xc(%r13), %rax
leaq 0x96c00(%rip), %rcx     # 0xcf520
movzbl (%rax,%rcx), %ecx
leaq 0x754fd(%rip), %r12     # 0xade28
xorl %r13d, %r13d
xorl %r9d, %r9d
xorl %edx, %edx
xorl %ebp, %ebp
testl %r8d, %r8d
jle 0x389cc
movq 0x10(%rsp), %rax
movl 0xc(%rax), %esi
movq 0x18(%rsp), %rax
addq %r13, %rax
decl %esi
xorl %r15d, %r15d
cmpl $0x3, %esi
ja 0x389ab
movslq (%r12,%rsi,4), %rdi
addq %r12, %rdi
jmpq *%rdi
movzbl (%rax,%r15), %edi
cmpb $-0x80, %dil
cmovel %ebx, %edi
movsbq %dil, %rdi
jmp 0x389b0
movl (%rax,%r15,4), %r10d
movl %r10d, %edi
negl %edi
cmovol %ebx, %r10d
movslq %r10d, %rdi
jmp 0x389b0
movq (%rax,%r15,8), %r10
cmpq %r14, %r10
movl $0x0, %edi
cmovneq %r10, %rdi
jmp 0x389b0
movzwl (%rax,%r15,2), %edi
cmpl $0x8000, %edi           # imm = 0x8000
cmovel %ebx, %edi
movswq %di, %rdi
jmp 0x389b0
movl $0x1, %edx
testl %edx, %edx
jne 0x389d1
cmpq %rdi, %r9
cmovleq %rdi, %r9
incq %r15
xorl %edx, %edx
cmpq %r15, %r8
jne 0x38953
xorl %edx, %edx
movl %r8d, %r15d
jmp 0x389d9
xorl %r15d, %r15d
jmp 0x389d9
movl $0x1, %edx
xorl %r9d, %r9d
shll %cl, %r15d
movslq %r15d, %rax
addq %rax, %r13
incl %ebp
cmpl %r11d, %ebp
jne 0x38935
jmp 0x38899
shrl $0x10, %r14d
cmpl $0x1, %r14d
adcl $0x0, %r14d
movq $0x0, 0x28(%rsp)
movl $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
xorl %ebp, %ebp
movzbl (%r12), %ebx
cmpb $-0x11, %bl
jbe 0x38a54
movzbl 0x1(%r12), %eax
andl $0xf, %eax
decl %eax
cmpl $0x3, %eax
ja 0x38b20
leaq 0x752d1(%rip), %rcx     # 0xadd10
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsbq 0x2(%r12), %r13
addq $0x3, %r12
jmp 0x38a5e
incq %r12
movl %ebx, %r13d
shrl $0x4, %r13d
testl %ebp, %ebp
je 0x38aeb
cmpl $0x3, %r13d
je 0x38aa8
cmpl $0x9, %r13d
je 0x38ac6
cmpl $0x5, %r13d
jne 0x38b32
movl $0x5, %edx
movq %r12, %rdi
leaq 0x77665(%rip), %rsi     # 0xb00f0
callq 0x4200
testl %eax, %eax
je 0x38b58
cmpl $0x9, %r13d
je 0x38ac6
cmpl $0x3, %r13d
jne 0x38b32
movl $0x3, %edx
movq %r12, %rdi
leaq 0x7763f(%rip), %rsi     # 0xb00f6
callq 0x4200
testl %eax, %eax
je 0x38b28
cmpl $0x9, %r13d
jne 0x38b32
movl $0x9, %edx
movq %r12, %rdi
leaq 0x77625(%rip), %rsi     # 0xb00fa
callq 0x4200
testl %eax, %eax
movq 0x10(%rsp), %rax
movl $0x1, %ecx
cmovel %ecx, %eax
jmp 0x38b2d
movslq %r13d, %rax
movq %rax, 0x28(%rsp)
jmp 0x38b32
movl 0x2(%r12), %r13d
addq $0x6, %r12
jmp 0x38a5e
movq 0x2(%r12), %r13
addq $0xa, %r12
jmp 0x38a5e
movswq 0x2(%r12), %r13
addq $0x4, %r12
jmp 0x38a5e
xorl %r13d, %r13d
jmp 0x38a5e
movl $0x1, %eax
movq %rax, 0x10(%rsp)
andl $0xf, %ebx
leaq 0x969e4(%rip), %rax     # 0xcf520
movb (%rbx,%rax), %cl
shll %cl, %r13d
movslq %r13d, %rax
addq %rax, %r12
incl %ebp
cmpl %ebp, %r14d
jne 0x38a1a
jmp 0x37fdd
movl %ebp, %ecx
andb $0x7, %cl
movl $0x1, 0x18(%rsp)
movl $0x1, %eax
shll %cl, %eax
movl %ebp, %ecx
shrl $0x3, %ecx
orb %al, 0xd0(%rsp,%rcx)
jmp 0x38b32
xorl %esi, %esi
jmp 0x38830
xorl %r13d, %r13d
jmp 0x38598
movl 0x2(%r12), %edx
addq $0x6, %r12
jmp 0x38047
movq 0x2(%r12), %rdx
addq $0xa, %r12
jmp 0x38047
movswq 0x2(%r12), %rdx
addq $0x4, %r12
jmp 0x38047
xorl %edx, %edx
jmp 0x38047
movzbl %al, %eax
decl %eax
cmpl $0x3, %eax
ja 0x38c3e
leaq 0x7521c(%rip), %rcx     # 0xadde8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x2(%rdi), %r8
movsbq 0x1(%rdi), %rax
jmp 0x38c43
leaq 0x6(%r12), %rsi
movl 0x2(%r12), %edx
jmp 0x37fa4
leaq 0xa(%r12), %rsi
movq 0x2(%r12), %rdx
jmp 0x37fa4
leaq 0x4(%r12), %rsi
movswq 0x2(%r12), %rdx
jmp 0x37fa4
xorl %edx, %edx
movq %r12, %rsi
jmp 0x37fa4
movq %rdx, %r14
jmp 0x38545
leaq 0x5(%rdi), %r8
movl 0x1(%rdi), %eax
jmp 0x38c43
leaq 0x9(%rdi), %r8
movq 0x1(%rdi), %rax
jmp 0x38c43
leaq 0x3(%rdi), %r8
movswq 0x1(%rdi), %rax
jmp 0x38c43
xorl %eax, %eax
movq %rdi, %r8
movl %eax, 0xb0(%rsp)
movzbl (%r8), %eax
andl $0xf, %eax
movl %eax, 0xbc(%rsp)
movzbl (%r8), %r9d
cmpl $0xef, %r9d
jbe 0x38c8f
movzbl 0x1(%r8), %ecx
andl $0xf, %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x38cf2
leaq 0x7517d(%rip), %r9      # 0xaddf8
movslq (%r9,%rcx,4), %rcx
addq %r9, %rcx
jmpq *%rcx
movsbq 0x2(%r8), %r9
addq $0x3, %r8
jmp 0x38c96
incq %r8
shrl $0x4, %r9d
leaq 0xb0(%rsp), %r13
movl %r9d, 0x4(%r13)
movb (%rax,%rsi), %cl
shll %cl, %r9d
movl %r9d, 0x8(%r13)
movq %r8, 0x10(%r13)
subl %edi, %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movl %r8d, 0x1c(%r13)
imull %edx, %r9d
movl %r9d, 0x18(%r13)
jmp 0x38598
movq %r9, %rbp
jmp 0x38545
movl 0x2(%r8), %r9d
addq $0x6, %r8
jmp 0x38c96
movq 0x2(%r8), %r9
addq $0xa, %r8
jmp 0x38c96
movswq 0x2(%r8), %r9
addq $0x4, %r8
jmp 0x38c96
xorl %r9d, %r9d
jmp 0x38c96