// File: /workspace/github_c_makefile_star2_O2/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, %rbx
movq %rdi, %r14
movq 0x30(%rsi), %rbp
movq %rbp, 0x18(%rsp)
andq $0x0, 0x10(%rsp)
movq 0x20(%rsi), %r15
leaq 0x5c771(%rip), %rdx     # 0x86f07
xorl %esi, %esi
callq 0x2489c
movl %eax, 0x4c(%rsp)
leaq 0x5c75d(%rip), %rdx     # 0x86f05
movq %r14, %rdi
xorl %esi, %esi
callq 0x2489c
movl %eax, 0x40(%rsp)
leaq 0x5c744(%rip), %rdx     # 0x86f01
movq %r14, 0x58(%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x2489c
movl %eax, 0x44(%rsp)
movq 0x18(%rbx), %r12
movl %r12d, %edx
shrl $0x13, %edx
incl %edx
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
callq 0x4250
movl 0xbc(%rbx), %eax
testb $0x1, %al
movq %rbx, 0x20(%rsp)
movq %rbp, (%rsp)
movq %r15, 0x50(%rsp)
jne 0x2a93e
testb $0x2, 0xb0(%rbx)
jne 0x2a93e
testq %r15, %r15
jle 0x2ac48
leaq 0x18(%rsp), %r13
movq %rbp, %rdi
leaq 0xc(%rsp), %rbp
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2855d
movslq (%rbp), %rcx
leaq 0x84ce0(%rip), %r15     # 0xaf520
movb (%rcx,%r15), %cl
shll %cl, %eax
movslq %eax, %r12
addq (%r13), %r12
movq %r12, (%r13)
xorl %r14d, %r14d
movq $0x0, 0x38(%rsp)
movl $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movzwl 0x1a(%rbx), %eax
cmpl %eax, %r14d
jae 0x2ac34
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2855d
movl %eax, %r12d
testl %r14d, %r14d
je 0x2a8db
cmpl $0x3, %r12d
je 0x2a8ff
cmpl $0x9, %r12d
je 0x2a8e5
cmpl $0x5, %r12d
jne 0x2a91d
movq 0x18(%rsp), %rdi
leaq 0x5d54d(%rip), %rsi     # 0x87dfc
pushq $0x5
popq %rdx
callq 0x4200
testl %eax, %eax
jne 0x2a91d
movl %r14d, %ecx
andb $0x7, %cl
pushq $0x1
popq %rdx
movl %edx, %eax
shll %cl, %eax
movl %r14d, %ecx
shrl $0x3, %ecx
orb %al, 0xd0(%rsp,%rcx)
movl %edx, 0x30(%rsp)
jmp 0x2a91d
movslq %r12d, %rax
movq %rax, 0x28(%rsp)
jmp 0x2a91d
movq 0x18(%rsp), %rdi
leaq 0x5d515(%rip), %rsi     # 0x87e06
pushq $0x9
popq %rdx
callq 0x4200
testl %eax, %eax
jne 0x2a91d
jmp 0x2a915
movq 0x18(%rsp), %rax
cmpb $0x3c, (%rax)
jne 0x2a91d
cmpb $0x2a, 0x1(%rax)
jne 0x2a91d
cmpb $0x3e, 0x2(%rax)
jne 0x2a91d
pushq $0x1
popq %rax
movq %rax, 0x38(%rsp)
movslq 0xc(%rsp), %rax
movb (%rax,%r15), %cl
shll %cl, %r12d
movslq %r12d, %r12
addq 0x18(%rsp), %r12
movq %r12, 0x18(%rsp)
incl %r14d
jmp 0x2a86e
movl %eax, 0x48(%rsp)
movq $0x0, 0x38(%rsp)
pushq $0x1
popq %r14
movq %r12, 0x28(%rsp)
movl %r12d, %ebp
shrl $0x10, %ebp
pushq $0x1
popq %rbx
leaq 0x5d498(%rip), %r12     # 0x87dfc
leaq 0x5d497(%rip), %r13     # 0x87e02
movl $0x0, 0x30(%rsp)
cmpq %rbp, %rbx
jae 0x2a9e2
movq 0x20(%rsp), %rax
movq 0x88(%rax), %rax
movq (%rax,%rbx,8), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x46e0
testl %eax, %eax
je 0x2a9c3
movq %r15, %rdi
movq %r13, %rsi
callq 0x46e0
testl %eax, %eax
je 0x2a9b9
movq %r15, %rdi
leaq 0x5d456(%rip), %rsi     # 0x87e06
callq 0x46e0
testl %eax, %eax
jne 0x2a9dd
movl %r14d, %eax
movq %rax, 0x38(%rsp)
jmp 0x2a9dd
movl %ebx, %ecx
andb $0x7, %cl
movb $0x1, %al
shlb %cl, %al
movl %ebx, %ecx
shrl $0x3, %ecx
orb %al, 0xd0(%rsp,%rcx)
movl %r14d, 0x30(%rsp)
incq %rbx
jmp 0x2a973
movq 0x20(%rsp), %rbx
movslq 0xc0(%rbx), %rax
movslq 0xc4(%rbx), %r12
addq %rax, %r12
movq (%rsp), %rbp
addq %rbp, %r12
movq %r12, 0x18(%rsp)
movq 0x28(%rsp), %rax
shrq $0x10, %rax
testw %ax, %ax
je 0x2aa28
movq 0x88(%rbx), %rax
movq (%rax), %rdi
callq 0x41c0
movq %rax, 0x28(%rsp)
jmp 0x2aa31
movq $0x0, 0x28(%rsp)
movq 0x50(%rsp), %r15
movl 0x48(%rsp), %eax
addq %r15, %rbp
testb $0x2, %al
jne 0x2aa79
cmpq %rbp, %r12
jae 0x2aa88
leaq 0x18(%rsp), %r15
leaq 0xc(%rsp), %r13
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x2855d
movslq (%r13), %rcx
leaq 0x84ab7(%rip), %rdx     # 0xaf520
movb (%rcx,%rdx), %cl
shll %cl, %eax
movslq %eax, %r12
addq (%r15), %r12
movq %r12, (%r15)
jmp 0x2aa88
movslq 0xc8(%rbx), %rax
addq %rax, %r12
movq %r12, 0x18(%rsp)
movl 0x44(%rsp), %eax
testl %eax, 0x40(%rsp)
js 0x2aba4
testb $0x4, 0xbc(%rbx)
jne 0x2abb1
testb $0x8, 0xb0(%rbx)
jne 0x2abb1
xorl %r15d, %r15d
cmpq %rbp, %r12
jae 0x2aba4
leaq 0xa8(%rsp), %rbp
leaq 0x80(%rsp), %r13
xorl %r14d, %r14d
movq $0x0, (%rsp)
movzwl 0x18(%rbx), %eax
cmpl %eax, %r15d
jae 0x2abe1
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2c18d
cmpl %eax, 0x44(%rsp)
jne 0x2ab30
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2b607
movq %rax, 0x10(%rsp)
cmpq $0x0, (%rsp)
jne 0x2b00c
movq %rbp, %r14
cmpl $0x0, 0x40(%rsp)
js 0x2abe1
movq %rax, %r12
movq %rbp, %r14
movq $0x0, (%rsp)
jmp 0x2ab9c
cmpl %eax, 0x40(%rsp)
jne 0x2ab6a
movq %r12, %rdi
movq %r13, %rsi
callq 0x2b607
movq %rax, 0x10(%rsp)
testq %r14, %r14
jne 0x2b014
movq %r13, (%rsp)
cmpl $0x0, 0x44(%rsp)
js 0x2abe1
movq %rax, %r12
xorl %r14d, %r14d
movq %r13, (%rsp)
jmp 0x2ab9c
movq 0x10(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x2855d
movslq 0xc(%rsp), %rcx
leaq 0x84996(%rip), %rdx     # 0xaf520
movb (%rcx,%rdx), %cl
shll %cl, %eax
movslq %eax, %r12
addq 0x10(%rsp), %r12
movq %r12, 0x10(%rsp)
incl %r15d
jmp 0x2aad7
xorl %r14d, %r14d
movq $0x0, (%rsp)
jmp 0x2abe1
leaq 0x5c349(%rip), %rdx     # 0x86f01
movq 0x58(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2fd81
movq %rax, %r14
leaq 0x5c333(%rip), %rdx     # 0x86f05
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2fd81
movq %rax, (%rsp)
cmpl $0x0, 0x4c(%rsp)
setns %al
cmpl $0x0, 0x38(%rsp)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2acf5
movq 0x48(%rbx), %r12
andq $0x0, 0x10(%rsp)
testb $0x8, 0xbc(%rbx)
jne 0x2ac18
cmpl $0x0, 0xb4(%rbx)
je 0x2ac6a
leaq 0x5c2e8(%rip), %rdx     # 0x86f07
movq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x2fcdd
movq %rax, %r15
jmp 0x2acf8
movl 0xbc(%rbx), %eax
movq (%rsp), %rbp
movq 0x50(%rsp), %r15
jmp 0x2aa3a
movq $0x0, 0x38(%rsp)
movq %rbp, %r12
movl $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
jmp 0x2aa3a
xorl %r15d, %r15d
cmpq $0x0, 0x38(%rbx)
jle 0x2acf8
movq 0x18(%rbx), %rdx
leaq 0x10(%rsp), %rbp
leaq 0xc(%rsp), %r15
leaq 0x84893(%rip), %rbx     # 0xaf520
xorl %r13d, %r13d
shrq $0x20, %rdx
movzbl %dl, %eax
cmpl %eax, %r13d
jae 0x2acf0
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2c18d
cmpl %eax, 0x4c(%rsp)
je 0x2afea
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x2855d
movq 0x20(%rsp), %rcx
movq 0x18(%rcx), %rdx
movq %rdx, %rsi
shrq $0x28, %rsi
imull %eax, %esi
movslq 0xc(%rsp), %rax
movb (%rax,%rbx), %cl
shll %cl, %esi
movslq %esi, %r12
addq 0x10(%rsp), %r12
movq %r12, 0x10(%rsp)
incl %r13d
jmp 0x2ac90
movq 0x20(%rsp), %rbx
xorl %r15d, %r15d
testq %r14, %r14
movl 0x30(%rsp), %ebp
je 0x2ad2f
cmpq $0x0, 0x10(%r14)
je 0x2ad2f
movl 0x4(%r14), %ecx
decl %ecx
cmpl $0x3, %ecx
ja 0x2ad2f
movq 0x8(%r14), %rax
leaq 0x5aece(%rip), %rdx     # 0x85bec
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %esi, %esi
cmpq $-0x80, %rax
jmp 0x2ad53
xorl %esi, %esi
jmp 0x2ad57
xorl %esi, %esi
cmpq $-0x80000000, %rax      # imm = 0x80000000
jmp 0x2ad53
xorl %esi, %esi
movq %rax, %rcx
negq %rcx
cmovnoq %rax, %rsi
jmp 0x2ad57
xorl %esi, %esi
cmpq $-0x8000, %rax          # imm = 0x8000
cmovneq %rax, %rsi
movq (%rsp), %r14
testq %r14, %r14
je 0x2ae4f
movq 0x10(%r14), %rcx
xorl %edx, %edx
testq %rcx, %rcx
je 0x2ae4f
movl 0x20(%r14), %edi
testl %edi, %edi
cmovlel %edx, %edi
leaq 0x5ae79(%rip), %r8      # 0x85bfc
xorl %r10d, %r10d
xorl %r12d, %r12d
cmpq %r10, %rdi
je 0x2ae52
movq %r10, %r9
incq %r10
movzwl 0x1a(%rbx), %eax
cmpq %rax, %r10
jae 0x2ae52
movl 0x4(%r14), %eax
decl %eax
cmpl $0x3, %eax
ja 0x2ae4f
movslq (%r8,%rax,4), %rax
addq %r8, %rax
jmpq *%rax
movzbl (%rcx,%r9), %eax
cmpb $-0x80, %al
cmovel %edx, %eax
movsbq %al, %rax
jmp 0x2ae0a
movl (%rcx,%r9,4), %eax
movl %eax, %r11d
negl %r11d
cmovol %edx, %eax
cltq
jmp 0x2ae0a
movq (%rcx,%r9,8), %r11
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, %r11
movl $0x0, %eax
cmovneq %r11, %rax
jmp 0x2ae0a
movzwl (%rcx,%r9,2), %eax
cmpw $0x8000, %ax            # imm = 0x8000
cmovel %edx, %eax
movswq %ax, %rax
testl %ebp, %ebp
je 0x2ae33
movl %r9d, %r11d
shrl $0x3, %r11d
movzbl 0xd0(%rsp,%r11), %r11d
movl %r10d, %ebx
andl $0x7, %ebx
btl %ebx, %r11d
movq 0x20(%rsp), %rbx
jb 0x2ad89
movq %rax, %r10
negq %r10
cmovsq %rax, %r10
cmpq %r10, %r12
cmovleq %r10, %r12
incq %r9
movq %r9, %r10
jmp 0x2ad89
xorl %r12d, %r12d
movq (%rbx), %rdi
testq %r15, %r15
je 0x2af57
movq 0x10(%r15), %r9
xorl %r10d, %r10d
testq %r9, %r9
je 0x2af57
movq %rdi, 0x30(%rsp)
movq %r12, 0x38(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x18(%rbx), %r11
shrq $0x28, %r11
leaq 0x5ad80(%rip), %r14     # 0x85c0c
xorl %r12d, %r12d
xorl %ebp, %ebp
xorl %r8d, %r8d
xorl %edx, %edx
cmpl %r11d, %r12d
je 0x2af5c
movl 0x4(%r15), %edi
leaq (%r9,%rdx), %rax
testl %edi, %edi
cmovlel %r10d, %edi
movq %r15, %rsi
movslq 0xc(%r15), %rcx
xorl %r13d, %r13d
cmpq %r13, %rdi
je 0x2af3a
leal -0x1(%rcx), %ebx
cmpl $0x3, %ebx
ja 0x2af31
movslq (%r14,%rbx,4), %rbx
addq %r14, %rbx
jmpq *%rbx
movzbl (%rax,%r13), %ebx
cmpb $-0x80, %bl
cmovel %r10d, %ebx
movsbq %bl, %rbx
jmp 0x2af1f
movl (%rax,%r13,4), %r15d
movl %r15d, %ebx
negl %ebx
cmovol %r10d, %r15d
movslq %r15d, %rbx
jmp 0x2af1f
movq (%rax,%r13,8), %r15
movabsq $-0x8000000000000000, %rbx # imm = 0x8000000000000000
cmpq %rbx, %r15
movl $0x0, %ebx
cmovneq %r15, %rbx
jmp 0x2af1f
movzwl (%rax,%r13,2), %ebx
cmpw $0x8000, %bx            # imm = 0x8000
cmovel %r10d, %ebx
movswq %bx, %rbx
testl %ebp, %ebp
jne 0x2af31
cmpq %rbx, %r8
cmovleq %rbx, %r8
incq %r13
xorl %ebp, %ebp
jmp 0x2aeb7
movl %r13d, %edi
pushq $0x1
popq %rbp
xorl %r8d, %r8d
leaq 0x845df(%rip), %rax     # 0xaf520
movb (%rcx,%rax), %cl
shll %cl, %edi
movslq %edi, %rax
addq %rax, %rdx
incl %r12d
movq %rsi, %r15
jmp 0x2ae96
xorl %r8d, %r8d
jmp 0x2af6f
movq (%rsp), %r14
movq 0x20(%rsp), %rsi
movq 0x38(%rsp), %r12
movq 0x30(%rsp), %rdi
movq %rdi, %rax
notq %rax
addq %rsi, %rax
xorl %ecx, %ecx
movq %rsi, %rdx
subq %rdi, %rdx
cmovleq %rcx, %rax
cmovleq %rcx, %rdx
testq %rsi, %rsi
cmoveq %r12, %rax
cmoveq %r8, %rdx
testq %r12, %r12
cmoveq %rax, %r12
testq %r14, %r14
cmoveq %rax, %r12
leaq (%rdi,%r12), %rcx
testq %r8, %r8
cmoveq %rdx, %r8
testq %r15, %r15
leaq 0x1(%rdi,%r12), %rax
cmoveq %rdx, %r8
addq %rdi, %r8
cmpq %rcx, %rsi
cmovgq %rsi, %rax
cmpq %r8, %rax
cmovleq %r8, %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
movq 0x20(%rsp), %rbx
movq 0x18(%rbx), %rsi
shrq $0x28, %rsi
leaq 0x60(%rsp), %r15
movq %r12, %rdi
movq %r15, %rdx
callq 0x2635c
jmp 0x2acf8
movq %rbp, %r14
jmp 0x2abe1
movq %r13, (%rsp)
jmp 0x2abe1