// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/header.c
// Function: sam_hrecs_update_hashes
static int sam_hrecs_update_hashes(sam_hrecs_t *hrecs,
                                   khint32_t type,
                                   sam_hrec_type_t *h_type) {
    /* Add to reference hash? */
    if (type == TYPEKEY("SQ")) {
        sam_hrec_tag_t *tag = h_type->tag;
        int nref = hrecs->nref;
        const char *name = NULL;
        const char *altnames = NULL;
        hts_pos_t len = -1;
        int r, invLN = 0;
        khint_t k;

        while (tag) {
            if (tag->str[0] == 'S' && tag->str[1] == 'N') {
                assert(tag->len >= 3);
                name = tag->str+3;
            } else if (tag->str[0] == 'L' && tag->str[1] == 'N') {
                assert(tag->len >= 3);
                hts_pos_t tmp = len;
                len = strtoll(tag->str+3, NULL, 10);
                if (tmp != -1 && tmp != len) {  //duplicate and different LN
                    invLN = 1;
                }
            } else if (tag->str[0] == 'A' && tag->str[1] == 'N') {
                assert(tag->len >= 3);
                altnames = tag->str+3;
            }
            tag = tag->next;
        }

        if (!name) {
            hts_log_error("Header includes @SQ line with no SN: tag");
            return -1; // SN should be present, according to spec.
        }

        if (len == -1) {
            hts_log_error("Header includes @SQ line \"%s\" with no LN: tag",
                          name);
            return -1; // LN should be present, according to spec.
        }

        if (invLN) {
            hts_log_error("Header includes @SQ line \"%s\" with multiple LN:"
            " tag with different values.", name);
            return -1; // LN should not be duplicated or be same
        }

        // Seen already?
        k = kh_get(m_s2i, hrecs->ref_hash, name);
        if (k < kh_end(hrecs->ref_hash)) {
            nref = kh_val(hrecs->ref_hash, k);
            int ref_changed_flag = 0;

            // Check for hash entry added by sam_hrecs_refs_from_targets_array()
            if (hrecs->ref[nref].ty == NULL) {
                // Attach header line to existing stub entry.
                hrecs->ref[nref].ty = h_type;
                // Check lengths match; correct if not.
                if (len != hrecs->ref[nref].len) {
                    char tmp[32];
                    snprintf(tmp, sizeof(tmp), "%" PRIhts_pos,
                             hrecs->ref[nref].len);
                    if (sam_hrecs_update(hrecs, h_type, "LN", tmp, NULL) < 0)
                        return -1;
                    ref_changed_flag = 1;
                }
                if (sam_hrecs_add_ref_altnames(hrecs, nref, altnames) < 0)
                    return -1;

                if (ref_changed_flag && (hrecs->refs_changed < 0 || hrecs->refs_changed > nref))
                    hrecs->refs_changed = nref;
                return 0;
            }

            // Check to see if an existing entry is being updated
            if (hrecs->ref[nref].ty == h_type) {
                if (hrecs->ref[nref].len != len) {
                    hrecs->ref[nref].len = len;
                    ref_changed_flag = 1;
                }
                if (!hrecs->ref[nref].name || strcmp(hrecs->ref[nref].name, name)) {
                    hrecs->ref[nref].name = name;
                    ref_changed_flag = 1;
                }
                if (sam_hrecs_add_ref_altnames(hrecs, nref, altnames) < 0)
                    return -1;

                if (ref_changed_flag && (hrecs->refs_changed < 0 || hrecs->refs_changed > nref))
                    hrecs->refs_changed = nref;
                return 0;
            }

            // If here, the name is a duplicate.
            // Check to see if it matches the SN: tag from the earlier record.
            if (strcmp(hrecs->ref[nref].name, name) == 0) {
                hts_log_error("Duplicate entry \"%s\" in sam header",
                                name);
                return -1;
            }

            // Clash with an already-seen altname
            // As SN: should be preferred to AN: add this as a new
            // record and update the hash entry to point to it.
            hts_log_warning("Ref name SN:\"%s\" is a duplicate of an existing AN key", name);
            nref = hrecs->nref;
        }

        if (nref == hrecs->ref_sz) {
            size_t new_sz = hrecs->ref_sz >= 4 ? hrecs->ref_sz + (hrecs->ref_sz / 4) : 32;
            sam_hrec_sq_t *new_ref = realloc(hrecs->ref, sizeof(*hrecs->ref) * new_sz);
            if (!new_ref)
                return -1;
            hrecs->ref = new_ref;
            hrecs->ref_sz = new_sz;
        }

        hrecs->ref[nref].name = name;
        hrecs->ref[nref].len  = len;
        hrecs->ref[nref].ty = h_type;

        k = kh_put(m_s2i, hrecs->ref_hash, hrecs->ref[nref].name, &r);
        if (-1 == r) return -1;
        kh_val(hrecs->ref_hash, k) = nref;

        if (sam_hrecs_add_ref_altnames(hrecs, nref, altnames) < 0)
            return -1;

        if (hrecs->refs_changed < 0 || hrecs->refs_changed > hrecs->nref)
            hrecs->refs_changed = hrecs->nref;
        hrecs->nref++;
    }

    /* Add to read-group hash? */
    if (type == TYPEKEY("RG")) {
        sam_hrec_tag_t *tag = sam_hrecs_find_key(h_type, "ID", NULL);
        int nrg = hrecs->nrg, r;
        khint_t k;

        if (!tag) {
            hts_log_error("Header includes @RG line with no ID: tag");
            return -1;  // ID should be present, according to spec.
        }
        assert(tag->str && tag->len >= 3);

        // Seen already?
        k = kh_get(m_s2i, hrecs->rg_hash, tag->str + 3);
        if (k < kh_end(hrecs->rg_hash)) {
            nrg = kh_val(hrecs->rg_hash, k);
            assert(hrecs->rg[nrg].ty != NULL);
            if (hrecs->rg[nrg].ty != h_type) {
                hts_log_warning("Duplicate entry \"%s\" in sam header",
                                tag->str + 3);
            } else {
                hrecs->rg[nrg].name = tag->str + 3;
                hrecs->rg[nrg].name_len = tag->len - 3;
            }
            return 0;
        }

        if (nrg == hrecs->rg_sz) {
            size_t new_sz = hrecs->rg_sz >= 4 ? hrecs->rg_sz + hrecs->rg_sz / 4 : 4;
            sam_hrec_rg_t *new_rg = realloc(hrecs->rg, sizeof(*hrecs->rg) * new_sz);
            if (!new_rg)
                return -1;
            hrecs->rg = new_rg;
            hrecs->rg_sz = new_sz;
        }

        hrecs->rg[nrg].name = tag->str + 3;
        hrecs->rg[nrg].name_len = tag->len - 3;
        hrecs->rg[nrg].ty   = h_type;
        hrecs->rg[nrg].id   = nrg;

        k = kh_put(m_s2i, hrecs->rg_hash, hrecs->rg[nrg].name, &r);
        if (-1 == r) return -1;
        kh_val(hrecs->rg_hash, k) = nrg;

        hrecs->nrg++;
    }

    /* Add to program hash? */
    if (type == TYPEKEY("PG")) {
        sam_hrec_tag_t *tag;
        sam_hrec_pg_t *new_pg;
        int npg = hrecs->npg;

        if (npg == hrecs->pg_sz) {
            size_t new_sz = hrecs->pg_sz >= 4 ? hrecs->pg_sz + hrecs->pg_sz / 4 : 4;
            new_pg = realloc(hrecs->pg, sizeof(*hrecs->pg) * new_sz);
            if (!new_pg)
                return -1;
            hrecs->pg = new_pg;
            hrecs->pg_sz = new_sz;
        }

        tag = h_type->tag;
        hrecs->pg[npg].name = NULL;
        hrecs->pg[npg].name_len = 0;
        hrecs->pg[npg].ty  = h_type;
        hrecs->pg[npg].id   = npg;
        hrecs->pg[npg].prev_id = -1;

        while (tag) {
            if (tag->str[0] == 'I' && tag->str[1] == 'D') {
                /* Avoid duplicate ID tags coming from other applications */
                if (!hrecs->pg[npg].name) {
                    assert(tag->len >= 3);
                    hrecs->pg[npg].name = tag->str + 3;
                    hrecs->pg[npg].name_len = tag->len - 3;
                } else {
                    hts_log_warning("PG line with multiple ID tags. The first encountered was preferred - ID:%s", hrecs->pg[npg].name);
                }
            } else if (tag->str[0] == 'P' && tag->str[1] == 'P') {
                // Resolve later if needed
                khint_t k;
                k = kh_get(m_s2i, hrecs->pg_hash, tag->str+3);

                if (k != kh_end(hrecs->pg_hash)) {
                    int p_id = kh_val(hrecs->pg_hash, k);
                    hrecs->pg[npg].prev_id = hrecs->pg[p_id].id;

                    /* Unmark previous entry as a PG termination */
                    if (hrecs->npg_end > 0 &&
                        hrecs->pg_end[hrecs->npg_end-1] == p_id) {
                        hrecs->npg_end--;
                    } else {
                        int i;
                        for (i = 0; i < hrecs->npg_end; i++) {
                            if (hrecs->pg_end[i] == p_id) {
                                memmove(&hrecs->pg_end[i], &hrecs->pg_end[i+1],
                                        (hrecs->npg_end-i-1)*sizeof(*hrecs->pg_end));
                                hrecs->npg_end--;
                            }
                        }
                    }
                } else {
                    hrecs->pg[npg].prev_id = -1;
                }
            }
            tag = tag->next;
        }

        if (hrecs->pg[npg].name) {
            khint_t k;
            int r;
            k = kh_put(m_s2i, hrecs->pg_hash, hrecs->pg[npg].name, &r);
            if (-1 == r) return -1;
            kh_val(hrecs->pg_hash, k) = npg;
        } else {
            return -1; // ID should be present, according to spec.
        }

        /* Add to npg_end[] array. Remove later if we find a PP line */
        if (hrecs->npg_end >= hrecs->npg_end_alloc) {
            int *new_pg_end;
            int  new_alloc = hrecs->npg_end_alloc ? hrecs->npg_end_alloc*2 : 4;

            new_pg_end = realloc(hrecs->pg_end, new_alloc * sizeof(int));
            if (!new_pg_end)
                return -1;
            hrecs->npg_end_alloc = new_alloc;
            hrecs->pg_end = new_pg_end;
        }
        hrecs->pg_end[hrecs->npg_end++] = npg;

        hrecs->npg++;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r14
movq %rdi, %r12
cmpl $0x5047, %esi           # imm = 0x5047
je 0x87693
cmpl $0x5247, %esi           # imm = 0x5247
je 0x8766a
xorl %ebp, %ebp
cmpl $0x5351, %esi           # imm = 0x5351
jne 0x87702
movq 0x20(%r14), %rbp
testq %rbp, %rbp
je 0x876e3
movl 0x28(%r12), %eax
movl %eax, 0x30(%rsp)
movq $0x0, 0x10(%rsp)
movq $-0x1, %r13
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x8(%rbp), %rdi
movzbl (%rdi), %eax
cmpl $0x41, %eax
je 0x87612
cmpl $0x4c, %eax
je 0x875d8
cmpl $0x53, %eax
jne 0x87629
cmpb $0x4e, 0x1(%rdi)
jne 0x87629
cmpl $0x2, 0x10(%rbp)
jle 0x88004
addq $0x3, %rdi
movq %rdi, 0x10(%rsp)
jmp 0x87629
cmpb $0x4e, 0x1(%rdi)
jne 0x87629
cmpl $0x2, 0x10(%rbp)
jle 0x88023
addq $0x3, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x40b0
movl %r15d, %ecx
cmpq %rax, %r13
je 0x87605
movl $0x1, %ecx
cmpq $-0x1, %r13
cmovnel %ecx, %r15d
movq %rax, %r13
jmp 0x87629
cmpb $0x4e, 0x1(%rdi)
jne 0x87629
cmpl $0x2, 0x10(%rbp)
jle 0x88042
addq $0x3, %rdi
movq %rdi, %rbx
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0x875a7
movq 0x10(%rsp), %rbp
testq %rbp, %rbp
je 0x876e3
cmpq $-0x1, %r13
je 0x879e2
testl %r15d, %r15d
je 0x87ac5
leaq 0x1af1a(%rip), %rsi     # 0xa2578
leaq 0x10ba0(%rip), %rdx     # 0x98205
jmp 0x879f0
testq %r14, %r14
je 0x876d3
movq 0x20(%r14), %r13
testq %r13, %r13
je 0x876d3
movq 0x8(%r13), %r15
cmpb $0x49, (%r15)
jne 0x8768d
cmpb $0x44, 0x1(%r15)
je 0x87a04
movq (%r13), %r13
jmp 0x87673
movl 0x58(%r12), %ebp
cmpl 0x5c(%r12), %ebp
jne 0x87716
movl %ebp, %eax
shrl $0x2, %eax
addl %ebp, %eax
cmpl $0x4, %ebp
movl $0x4, %ebx
cmovgel %eax, %ebx
movq 0x68(%r12), %rdi
movq %rbx, %rsi
shlq $0x5, %rsi
callq 0x4840
testq %rax, %rax
je 0x876fd
movq %rax, 0x68(%r12)
movl %ebx, 0x5c(%r12)
jmp 0x8771b
leaq 0x1ae9e(%rip), %rsi     # 0xa2578
leaq 0x1af5f(%rip), %rdx     # 0xa2640
jmp 0x876f1
leaq 0x1ae8e(%rip), %rsi     # 0xa2578
leaq 0x1ae9f(%rip), %rdx     # 0xa2590
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x68(%r12), %rax
movslq %ebp, %r13
movq 0x20(%r14), %r15
shlq $0x5, %r13
movq $0x0, (%rax,%r13)
movl $0x0, 0x10(%rax,%r13)
movq %r14, 0x8(%rax,%r13)
movl %ebp, 0x8(%rsp)
movl %ebp, 0x14(%rax,%r13)
movl $0xffffffff, 0x18(%rax,%r13) # imm = 0xFFFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x87702
movq %r13, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq 0x8(%r15), %rax
movzbl (%rax), %ecx
cmpl $0x50, %ecx
je 0x877ae
cmpl $0x49, %ecx
jne 0x878e8
cmpb $0x44, 0x1(%rax)
jne 0x878e8
movq 0x68(%r12), %rdx
movq (%rdx,%r13), %rcx
testq %rcx, %rcx
je 0x877f9
movl $0x3, %edi
leaq 0x1addd(%rip), %rsi     # 0xa2578
leaq 0x1aefb(%rip), %rdx     # 0xa269d
xorl %eax, %eax
callq 0x13de5
jmp 0x878e8
cmpb $0x50, 0x1(%rax)
jne 0x878e8
movq 0x70(%r12), %rcx
movq %rcx, 0x10(%rsp)
movl (%rcx), %edx
testl %edx, %edx
je 0x8781e
leaq 0x3(%rax), %rcx
movq %rcx, 0x30(%rsp)
movb (%rcx), %cl
testb %cl, %cl
je 0x87825
addq $0x4, %rax
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r14d, %ecx
imull $0x1000193, %ecx, %r14d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x877e1
jmp 0x8782b
movl 0x10(%r15), %ecx
cmpl $0x2, %ecx
jle 0x88061
leaq (%rdx,%r13), %rsi
addq $0x3, %rax
movq %rax, (%rsi)
addl $-0x3, %ecx
movl %ecx, 0x10(%rdx,%r13)
jmp 0x878e8
xorl %ebx, %ebx
jmp 0x878d6
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
movq %rdx, 0x38(%rsp)
decl %edx
andl %edx, %r14d
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r12d
movl %r14d, %ebx
movq %r15, 0x28(%rsp)
movq %rsi, 0x40(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %ebp
leal (%rbx,%rbx), %r13d
andl $0x1e, %r13d
movl %ebp, %eax
movl %r13d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x878bb
testb $0x1, %al
jne 0x8789d
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x30(%rsp), %rsi
movl %edx, %r15d
callq 0x46c0
movq 0x40(%rsp), %rsi
movl %r15d, %edx
movq 0x28(%rsp), %r15
testl %eax, %eax
je 0x878bb
addl %r12d, %ebx
andl %edx, %ebx
incl %r12d
cmpl %r14d, %ebx
jne 0x87851
movq 0x20(%rsp), %r12
movq 0x68(%r12), %rax
movq 0x18(%rsp), %r13
jmp 0x878df
movl %r13d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
movq 0x38(%rsp), %rdx
cmovnel %edx, %ebx
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r13
movq 0x68(%r12), %rax
cmpl %edx, %ebx
jne 0x878f9
movl $0xffffffff, 0x18(%rax,%r13) # imm = 0xFFFFFFFF
movq (%r15), %r15
testq %r15, %r15
jne 0x87762
jmp 0x87981
movq 0x10(%rsp), %rcx
movq 0x20(%rcx), %rcx
movl %ebx, %edx
movslq (%rcx,%rdx,4), %rbx
movq %rbx, %rcx
shlq $0x5, %rcx
movl 0x14(%rax,%rcx), %ecx
movl %ecx, 0x18(%rax,%r13)
movslq 0x60(%r12), %rax
testq %rax, %rax
jle 0x878e8
movq 0x78(%r12), %rcx
cmpl %ebx, -0x4(%rcx,%rax,4)
jne 0x87936
decl %eax
movl %eax, 0x60(%r12)
jmp 0x878e8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movq 0x78(%r12), %rcx
cmpl %ebx, (%rcx,%r14,4)
jne 0x8796f
leaq (%rcx,%r14,4), %rdi
leaq (%rcx,%r14,4), %rsi
addq $0x4, %rsi
addl %ebp, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
callq 0x4830
movl 0x60(%r12), %eax
decl %eax
movl %eax, 0x60(%r12)
incq %r14
movslq %eax, %rcx
decl %ebp
cmpq %rcx, %r14
jl 0x8793e
jmp 0x878e8
movq 0x68(%r12), %rax
movq (%rax,%r13), %rsi
testq %rsi, %rsi
je 0x876fd
movq 0x70(%r12), %rdi
leaq 0x60(%rsp), %r14
movq %r14, %rdx
callq 0x8732d
cmpl $-0x1, (%r14)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
je 0x87702
movq 0x70(%r12), %rcx
movq 0x20(%rcx), %rcx
movl %eax, %eax
movl 0x8(%rsp), %edx
movl %edx, (%rcx,%rax,4)
movl 0x60(%r12), %ecx
movl 0x64(%r12), %eax
cmpl %eax, %ecx
jge 0x87a73
movq 0x78(%r12), %rax
jmp 0x87aa9
leaq 0x1ab8f(%rip), %rsi     # 0xa2578
leaq 0x1abc9(%rip), %rdx     # 0xa25b9
movl $0x1, %edi
movq %rbp, %rcx
xorl %eax, %eax
callq 0x13de5
jmp 0x876fd
movl 0x10(%r13), %eax
movl %eax, 0x8(%rsp)
cmpl $0x2, %eax
jle 0x88080
movl 0x40(%r12), %eax
movq 0x50(%r12), %rdi
leaq 0x3(%r15), %r8
movl (%rdi), %ecx
testl %ecx, %ecx
movq %r12, 0x20(%rsp)
movq %r14, 0x18(%rsp)
movl %eax, 0x48(%rsp)
je 0x87b1c
movq %rcx, 0x50(%rsp)
leal -0x1(%rcx), %edx
movb (%r8), %cl
testb %cl, %cl
je 0x87b2a
leaq 0x4(%r15), %rax
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r14d, %ecx
imull $0x1000193, %ecx, %r14d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x87a58
jmp 0x87b30
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x4, %ebx
cmovnel %ecx, %ebx
movq 0x78(%r12), %rdi
movslq %ebx, %rsi
shlq $0x2, %rsi
callq 0x4840
testq %rax, %rax
je 0x87702
movl %ebx, 0x64(%r12)
movq %rax, 0x78(%r12)
movl 0x60(%r12), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x60(%r12)
movslq %ecx, %rcx
movl 0x8(%rsp), %edx
movl %edx, (%rax,%rcx,4)
incl 0x58(%r12)
jmp 0x87ee3
movq 0x38(%r12), %rax
movq %rax, 0x28(%rsp)
movl (%rax), %eax
testl %eax, %eax
movq %rbx, 0x8(%rsp)
je 0x87b23
movq %r14, 0x18(%rsp)
movq %rax, 0x48(%rsp)
leal -0x1(%rax), %edx
movb (%rbp), %cl
testb %cl, %cl
movq %r12, 0x20(%rsp)
je 0x87cd7
leaq 0x1(%rbp), %rax
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r15d, %ecx
imull $0x1000193, %ecx, %r15d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x87b01
jmp 0x87cdd
xorl %ebx, %ebx
jmp 0x87bc4
xorl %ebx, %ebx
jmp 0x87d8d
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
andl %edx, %r14d
movq 0x10(%rdi), %rsi
movl $0x1, %r12d
movl %r14d, %ebx
movq %rdi, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movl %edx, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r9d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r9d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x87bb3
testb $0x1, %al
jne 0x87ba4
movq 0x18(%rdi), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r8, %rsi
movl %r9d, 0x10(%rsp)
callq 0x46c0
movl 0x10(%rsp), %r9d
movq 0x38(%rsp), %rsi
movl 0x40(%rsp), %edx
movq 0x28(%rsp), %r8
movq 0x30(%rsp), %rdi
testl %eax, %eax
je 0x87bb3
addl %r12d, %ebx
andl %edx, %ebx
incl %r12d
cmpl %r14d, %ebx
jne 0x87b53
jmp 0x87c20
movl %ebp, %ecx
shrl %cl, %r9d
testb $0x3, %r9b
movq 0x50(%rsp), %rcx
cmovnel %ecx, %ebx
cmpl %ecx, %ebx
jae 0x87c20
movq 0x20(%rdi), %rax
movl %ebx, %ecx
movslq (%rax,%rcx,4), %rcx
movq 0x20(%rsp), %rax
movq 0x48(%rax), %rax
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%rax,%rcx,8), %rdx
testq %rdx, %rdx
je 0x8809f
cmpq 0x18(%rsp), %rdx
movl 0x8(%rsp), %edx
je 0x87ed6
leaq 0x1a975(%rip), %rsi     # 0xa2578
leaq 0x1a9dd(%rip), %rdx     # 0xa25e7
xorl %ebp, %ebp
movl $0x3, %edi
movq %r8, %rcx
xorl %eax, %eax
callq 0x13de5
jmp 0x87702
movq 0x20(%rsp), %r14
movl 0x48(%rsp), %ebp
cmpl 0x44(%r14), %ebp
jne 0x87c78
movl %ebp, %eax
shrl $0x2, %eax
addl %ebp, %eax
cmpl $0x4, %ebp
movl $0x4, %ebx
cmovgel %eax, %ebx
movq 0x48(%r14), %rdi
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rsi
callq 0x4840
testq %rax, %rax
je 0x876fd
movq %rax, 0x48(%r14)
movl %ebx, 0x44(%r14)
movq 0x8(%r13), %r15
movl 0x10(%r13), %edx
movq %r14, %rbx
movq 0x50(%r14), %rdi
jmp 0x87c83
movq %r14, %rbx
movq 0x48(%r14), %rax
movl 0x8(%rsp), %edx
movslq %ebp, %rcx
addq $0x3, %r15
leaq (%rcx,%rcx,2), %rcx
movq %r15, (%rax,%rcx,8)
addl $-0x3, %edx
movl %edx, 0x10(%rax,%rcx,8)
movq 0x18(%rsp), %rdx
movq %rdx, 0x8(%rax,%rcx,8)
movl %ebp, 0x14(%rax,%rcx,8)
leaq 0x60(%rsp), %r12
movq %r15, %rsi
movq %r12, %rdx
callq 0x8732d
cmpl $-0x1, (%r12)
je 0x876fd
movq 0x50(%rbx), %rcx
movq 0x20(%rcx), %rcx
movl %eax, %eax
movl %ebp, (%rcx,%rax,4)
incl 0x40(%rbx)
jmp 0x87ee3
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
andl %edx, %r15d
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r12d
movl %r15d, %ebx
movq %r13, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r14d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r14d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x87d6d
testb $0x1, %al
jne 0x87d47
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x10(%rsp), %rsi
movl %edx, %r13d
callq 0x46c0
movq 0x38(%rsp), %rsi
movl %r13d, %edx
movq 0x40(%rsp), %r13
testl %eax, %eax
je 0x87d6d
addl %r12d, %ebx
andl %edx, %ebx
incl %r12d
cmpl %r15d, %ebx
jne 0x87cfc
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %rbp
movl 0x30(%rsp), %r15d
jmp 0x87e00
movl %ebp, %ecx
shrl %cl, %r14d
testb $0x3, %r14b
movq 0x48(%rsp), %rax
cmovnel %eax, %ebx
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %rbp
movl 0x30(%rsp), %r15d
cmpl %eax, %ebx
jae 0x87e00
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rax
movl %ebx, %ecx
movl (%rax,%rcx,4), %r15d
movq 0x30(%r12), %rax
movslq %r15d, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rbx
movq 0x10(%rbx), %rdx
testq %rdx, %rdx
je 0x87eea
cmpq %r14, %rdx
je 0x87f12
movq (%rbx), %rdi
movq %rbp, %rsi
callq 0x46c0
leaq 0x1a79b(%rip), %rsi     # 0xa2578
testl %eax, %eax
je 0x87fae
leaq 0x1a81e(%rip), %rdx     # 0xa260a
movl $0x3, %edi
movq %rbp, %rcx
xorl %eax, %eax
callq 0x13de5
movl 0x28(%r12), %r15d
cmpl 0x2c(%r12), %r15d
jne 0x87e47
movl %r15d, %eax
shrl $0x2, %eax
addl %r15d, %eax
cmpl $0x4, %r15d
movl $0x20, %ebx
cmovgel %eax, %ebx
movq 0x30(%r12), %rdi
leaq (,%rbx,8), %rax
leaq (%rax,%rax,2), %rsi
callq 0x4840
testq %rax, %rax
je 0x876fd
movq %rax, 0x30(%r12)
movl %ebx, 0x2c(%r12)
jmp 0x87e4c
movq 0x30(%r12), %rax
movslq %r15d, %rcx
leaq (%rcx,%rcx,2), %rcx
movq %rbp, (%rax,%rcx,8)
movq %r13, 0x8(%rax,%rcx,8)
movq %r14, 0x10(%rax,%rcx,8)
movq 0x38(%r12), %rdi
movq %r12, %rbx
leaq 0x5c(%rsp), %r12
movq %rbp, %rsi
movq %r12, %rdx
callq 0x8732d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, (%r12)
je 0x87702
movq 0x38(%rbx), %rcx
movq 0x20(%rcx), %rcx
movl %eax, %eax
movl %r15d, (%rcx,%rax,4)
movq %rbx, %rdi
movl %r15d, %esi
movq 0x8(%rsp), %rdx
callq 0x8ac4f
testl %eax, %eax
js 0x87702
movl 0x28(%rbx), %eax
movl 0x94(%rbx), %ecx
testl %ecx, %ecx
sets %dl
cmpl %eax, %ecx
setg %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x87ecf
movl %eax, 0x94(%rbx)
incl %eax
movl %eax, 0x28(%rbx)
jmp 0x87ee3
leaq (%rax,%rcx,8), %rax
movq %r8, (%rax)
addl $-0x3, %edx
movl %edx, 0x10(%rax)
xorl %ebp, %ebp
jmp 0x87702
movq %r14, 0x10(%rbx)
movq 0x8(%rax,%rcx,8), %rcx
cmpq %rcx, %r13
jne 0x87f57
movq %r12, %rdi
movl %r15d, %esi
movq 0x8(%rsp), %rdx
callq 0x8ac4f
movl %eax, %ebp
sarl $0x1f, %ebp
jmp 0x87702
movq 0x8(%rbx), %r14
cmpq %r13, %r14
je 0x87f1f
movq %r13, 0x8(%rbx)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x87f37
movq %rbp, %rsi
callq 0x46c0
testl %eax, %eax
je 0x87fba
movq %rbp, (%rbx)
movq %r12, %rdi
movl %r15d, %esi
movq 0x8(%rsp), %rdx
callq 0x8ac4f
testl %eax, %eax
jns 0x87fe0
jmp 0x876fd
leaq 0xe653(%rip), %rdx      # 0x965b1
movq %r14, %rbx
leaq 0x60(%rsp), %r14
movl $0x20, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x4800
leaq 0x135f1(%rip), %rdx     # 0x9b56d
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8abcb
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x87702
movq %r12, %rdi
movl %r15d, %esi
movq 0x8(%rsp), %rdx
callq 0x8ac4f
jmp 0x87fd8
leaq 0x1a632(%rip), %rdx     # 0xa25e7
jmp 0x879f0
movq %r12, %rdi
movl %r15d, %esi
movq 0x8(%rsp), %rdx
callq 0x8ac4f
movl %eax, %ebp
sarl $0x1f, %ebp
cmpq %r13, %r14
je 0x87702
testl %eax, %eax
js 0x87702
movl 0x94(%r12), %eax
xorl %ebp, %ebp
testl %eax, %eax
js 0x87ff7
cmpl %r15d, %eax
jle 0x87702
movl %r15d, 0x94(%r12)
jmp 0x87702
leaq 0x1a66a(%rip), %rdi     # 0xa2675
leaq 0x19e59(%rip), %rsi     # 0xa1e6b
leaq 0x1a516(%rip), %rcx     # 0xa252f
movl $0x99, %edx
callq 0x42f0
leaq 0x1a64b(%rip), %rdi     # 0xa2675
leaq 0x19e3a(%rip), %rsi     # 0xa1e6b
leaq 0x1a4f7(%rip), %rcx     # 0xa252f
movl $0x9c, %edx
callq 0x42f0
leaq 0x1a62c(%rip), %rdi     # 0xa2675
leaq 0x19e1b(%rip), %rsi     # 0xa1e6b
leaq 0x1a4d8(%rip), %rcx     # 0xa252f
movl $0xa3, %edx
callq 0x42f0
leaq 0x1a60d(%rip), %rdi     # 0xa2675
leaq 0x19dfc(%rip), %rsi     # 0xa1e6b
leaq 0x1a4b9(%rip), %rcx     # 0xa252f
movl $0x159, %edx            # imm = 0x159
callq 0x42f0
leaq 0x1a5e2(%rip), %rdi     # 0xa2669
leaq 0x19ddd(%rip), %rsi     # 0xa1e6b
leaq 0x1a49a(%rip), %rcx     # 0xa252f
movl $0x119, %edx            # imm = 0x119
callq 0x42f0
leaq 0x1a5dd(%rip), %rdi     # 0xa2683
leaq 0x19dbe(%rip), %rsi     # 0xa1e6b
leaq 0x1a47b(%rip), %rcx     # 0xa252f
movl $0x11f, %edx            # imm = 0x11F
callq 0x42f0