// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_encode.c
// Function: cram_encode_slice
static int cram_encode_slice(cram_fd *fd, cram_container *c,
                             cram_block_compression_hdr *h, cram_slice *s,
                             int embed_ref) {
    int rec, r = 0;
    int64_t last_pos;
    enum cram_DS_ID id;

    /*
     * Slice external blocks:
     * ID 0 => base calls (insertions, soft-clip)
     * ID 1 => qualities
     * ID 2 => names
     * ID 3 => TS (insert size), NP (next frag)
     * ID 4 => tag values
     * ID 6 => tag IDs (TN), if CRAM_V1.0
     * ID 7 => TD tag dictionary, if !CRAM_V1.0
     */

    /* Create cram slice header */
    s->hdr->ref_base_id = embed_ref>0 && s->hdr->ref_seq_span > 0
        ? DS_ref
        : (CRAM_MAJOR_VERS(fd->version) >= 4 ? 0 : -1);
    s->hdr->record_counter = c->num_records + c->record_counter;
    c->num_records += s->hdr->num_records;

    int ntags = c->tags_used ? c->tags_used->n_occupied : 0;
    s->block = calloc(DS_END + ntags*2, sizeof(s->block[0]));
    s->hdr->block_content_ids = malloc(DS_END * sizeof(int32_t));
    if (!s->block || !s->hdr->block_content_ids)
        return -1;

    // Create first fixed blocks, always external.
    // CORE
    if (!(s->block[0] = cram_new_block(CORE, 0)))
        return -1;

    // TN block for CRAM v1
    if (CRAM_MAJOR_VERS(fd->version) == 1) {
        if (h->codecs[DS_TN]->codec == E_EXTERNAL) {
            if (!(s->block[DS_TN] = cram_new_block(EXTERNAL,DS_TN))) return -1;
            h->codecs[DS_TN]->u.external.content_id = DS_TN;
        } else {
            s->block[DS_TN] = s->block[0];
        }
    }

    // Embedded reference
    if (embed_ref>0) {
        if (!(s->block[DS_ref] = cram_new_block(EXTERNAL, DS_ref)))
            return -1;
        s->ref_id = DS_ref; // needed?
        BLOCK_APPEND(s->block[DS_ref],
                     c->ref + s->hdr->ref_seq_start - c->ref_start,
                     s->hdr->ref_seq_span);
    }

    /*
     * All the data-series blocks if appropriate.
     */
    for (id = DS_QS; id < DS_TN; id++) {
        if (cram_allocate_block(h->codecs[id], s, id) < 0)
            return -1;
    }

    /*
     * Add in the external tag blocks too.
     */
    if (c->tags_used) {
        int n;
        s->hdr->num_blocks = DS_END;
        for (n = 0; n < s->naux_block; n++) {
            s->block[s->hdr->num_blocks++] = s->aux_block[n];
            s->aux_block[n] = NULL;
        }
    }

    /* Encode reads */
    last_pos = s->hdr->ref_seq_start;
    for (rec = 0; rec < s->hdr->num_records; rec++) {
        cram_record *cr = &s->crecs[rec];
        if (cram_encode_slice_read(fd, c, h, s, cr, &last_pos) == -1)
            return -1;
    }

    s->block[0]->uncomp_size = s->block[0]->byte + (s->block[0]->bit < 7);
    s->block[0]->comp_size = s->block[0]->uncomp_size;

    // Make sure the fixed blocks point to the correct sources
    if (s->block[DS_IN]) cram_free_block(s->block[DS_IN]);
    s->block[DS_IN] = s->base_blk; s->base_blk = NULL;
    if (s->block[DS_QS]) cram_free_block(s->block[DS_QS]);
    s->block[DS_QS] = s->qual_blk; s->qual_blk = NULL;
    if (s->block[DS_RN]) cram_free_block(s->block[DS_RN]);
    s->block[DS_RN] = s->name_blk; s->name_blk = NULL;
    if (s->block[DS_SC]) cram_free_block(s->block[DS_SC]);
    s->block[DS_SC] = s->soft_blk; s->soft_blk = NULL;

    // Finalise any data transforms.
    for (id = DS_QS; id < DS_TN; id++) {
       if (h->codecs[id] && h->codecs[id]->flush)
           h->codecs[id]->flush(h->codecs[id]);
    }

    // Ensure block sizes are up to date.
    for (id = 1; id < s->hdr->num_blocks; id++) {
        if (!s->block[id] || s->block[id] == s->block[0])
            continue;

        if (s->block[id]->uncomp_size == 0)
            BLOCK_UPLEN(s->block[id]);
    }

    // Compress it all
    if (cram_compress_slice(fd, c, s) == -1)
        return -1;

    // Collapse empty blocks and create hdr_block
    {
        int i, j;

        s->hdr->block_content_ids = realloc(s->hdr->block_content_ids,
                                            s->hdr->num_blocks * sizeof(int32_t));
        if (!s->hdr->block_content_ids)
            return -1;

        for (i = j = 1; i < s->hdr->num_blocks; i++) {
            if (!s->block[i] || s->block[i] == s->block[0])
                continue;
            if (s->block[i]->uncomp_size == 0) {
                cram_free_block(s->block[i]);
                s->block[i] = NULL;
                continue;
            }
            s->block[j] = s->block[i];
            s->hdr->block_content_ids[j-1] = s->block[i]->content_id;
            j++;
        }
        s->hdr->num_content_ids = j-1;
        s->hdr->num_blocks = j;

        if (!(s->hdr_block = cram_encode_slice_header(fd, s)))
            return -1;
    }

    return r ? -1 : 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, %ebp
movq %rcx, %r12
testl %r8d, %r8d
jle 0x48dd3
movq (%r12), %rcx
movl $0xa, %eax
cmpq $0x0, 0x10(%rcx)
jg 0x48de1
xorl %eax, %eax
cmpl $0x400, 0xc(%rdi)       # imm = 0x400
setl %al
negl %eax
movq %rdi, 0x20(%rsp)
movq (%r12), %rbx
movl %eax, 0x38(%rbx)
movslq 0x28(%rsi), %rax
movq %rax, %rcx
addq 0x18(%rsi), %rcx
movq %rcx, 0x20(%rbx)
movl 0x18(%rbx), %ecx
addl %eax, %ecx
movl %ecx, 0x28(%rsi)
movq 0x270(%rsi), %rax
testq %rax, %rax
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
je 0x48e28
movslq 0x8(%rax), %rax
leaq 0x2f(,%rax,2), %rdi
jmp 0x48e2d
movl $0x2f, %edi
movl $0x8, %esi
callq 0x4300
movq %rax, %r14
movq %rax, 0x10(%r12)
movl $0xbc, %edi
callq 0x4680
movq %rax, 0x30(%rbx)
testq %r14, %r14
sete %cl
testq %rax, %rax
sete %al
orb %cl, %al
jne 0x48ecb
movl $0x5, %edi
xorl %esi, %esi
callq 0x4ee42
movq 0x10(%r12), %rcx
movq %rax, (%rcx)
testq %rax, %rax
je 0x48ecb
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
movq 0x20(%rsp), %rcx
andl 0xc(%rcx), %eax
cmpl $0x100, %eax            # imm = 0x100
jne 0x48ef5
movq 0x48(%rsp), %rbx
movq 0x3b8(%rbx), %rax
cmpl $0x1, (%rax)
jne 0x48ee6
movl $0x4, %edi
movl $0x27, %esi
callq 0x4ee42
movq 0x10(%r12), %rcx
movq %rax, 0x138(%rcx)
testq %rax, %rax
je 0x48ecb
movq 0x3b8(%rbx), %rax
movl $0x27, 0x60(%rax)
jmp 0x48ef5
movl $0xffffffff, 0x38(%rsp) # imm = 0xFFFFFFFF
movl 0x38(%rsp), %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r12), %rax
movq (%rax), %rcx
movq %rcx, 0x138(%rax)
movl $0xffffffff, 0x38(%rsp) # imm = 0xFFFFFFFF
testl %ebp, %ebp
jle 0x48fba
movl $0x4, %edi
movl $0xa, %esi
callq 0x4ee42
movq 0x10(%r12), %rcx
movq %rax, 0x50(%rcx)
testq %rax, %rax
je 0x48ed3
movl $0xa, 0xc8(%r12)
movq (%r12), %rax
movq 0x10(%r12), %rcx
movq 0x50(%rsp), %rdx
movq 0xe0(%rdx), %r14
addq 0x8(%rax), %r14
movq 0x50(%rcx), %rbx
subq 0xc0(%rdx), %r14
movq 0x10(%rax), %r15
movq 0x30(%rbx), %r13
addq %r15, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x48f9e
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x48ed3
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r15, %r15
je 0x48fba
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
xorl %ebx, %ebx
movq 0x48(%rsp), %r14
movq 0x2e0(%r14,%rbx,8), %rdi
leal 0xc(%rbx), %edx
movq %r12, %rsi
callq 0x4ac42
testl %eax, %eax
js 0x48ed3
incq %rbx
cmpq $0x1b, %rbx
jne 0x48fc1
movq 0x50(%rsp), %rax
cmpq $0x0, 0x270(%rax)
je 0x4904b
movq (%r12), %rax
movl $0x2f, 0x28(%rax)
movslq 0xcc(%r12), %rax
testq %rax, %rax
jle 0x4904b
xorl %ecx, %ecx
movq 0xd0(%r12), %rdx
movq (%rdx,%rcx,8), %rdx
movq (%r12), %rsi
movq 0x10(%r12), %rdi
movslq 0x28(%rsi), %r8
leal 0x1(%r8), %r9d
movl %r9d, 0x28(%rsi)
movq %rdx, (%rdi,%r8,8)
movq 0xd0(%r12), %rdx
movq $0x0, (%rdx,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x4900e
movq (%r12), %rax
cmpl $0x0, 0x18(%rax)
movq %r12, 0x10(%rsp)
jle 0x49691
movq (%r12), %rax
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
xorl %ecx, %ecx
movq 0x30(%r12), %rbx
movq %rcx, 0x68(%rsp)
leaq (%rcx,%rcx,8), %r14
shlq $0x4, %r14
leaq (%rbx,%r14), %rax
movq %rax, 0x18(%rsp)
movl 0xc(%rbx,%r14), %eax
movl $0xfff, %ecx            # imm = 0xFFF
andl %ecx, %eax
movq 0x20(%rsp), %r15
movl 0x4270(%r15,%rax,4), %eax
movl %eax, 0xc(%rsp)
movq 0x48(%rsp), %r13
movq 0x2f8(%r13), %rsi
movq %r12, %rdi
leaq 0xc(%rsp), %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %ebp
movl 0x10(%rbx,%r14), %eax
movq %r13, %r14
andl $0x1f, %eax
movl %eax, 0xc(%rsp)
movq 0x300(%r13), %rsi
movq %r12, %rdi
leaq 0xc(%rsp), %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r13d
orl %ebp, %r13d
movl 0xc(%r15), %eax
movl $0xffffff00, %ecx       # imm = 0xFFFFFF00
andl %ecx, %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x49129
movq (%r12), %rax
cmpl $-0x2, 0x4(%rax)
jne 0x49129
movq 0x388(%r14), %rsi
movq 0x18(%rsp), %rax
leaq 0x8(%rax), %rdx
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
orl %eax, %r13d
movq 0x348(%r14), %rsi
movq 0x18(%rsp), %rbx
leaq 0x14(%rbx), %rdx
movq %r12, %rdi
movq %rdx, 0x30(%rsp)
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %ebp
movq 0x50(%rsp), %rax
cmpl $0x0, 0x98(%rax)
movl 0xc(%r15), %ecx
movq 0x18(%rbx), %rax
je 0x4917a
subq 0x60(%rsp), %rax
cmpl $0x400, %ecx            # imm = 0x400
jl 0x49198
movq %rax, 0x58(%rsp)
leaq 0x58(%rsp), %rdx
jmp 0x491a1
cmpl $0x400, %ecx            # imm = 0x400
jl 0x491c6
movq %rax, 0x58(%rsp)
movq 0x308(%r14), %rsi
movq %r12, %rdi
leaq 0x58(%rsp), %rdx
jmp 0x491d9
movl %eax, 0xc(%rsp)
leaq 0xc(%rsp), %rdx
movq 0x308(%r14), %rsi
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r15d
movq 0x18(%rsp), %rbx
movq 0x18(%rbx), %rax
movq %rax, 0x60(%rsp)
jmp 0x491e9
movl %eax, 0xc(%rsp)
movq 0x308(%r14), %rsi
movq %r12, %rdi
leaq 0xc(%rsp), %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r15d
movq 0x18(%rsp), %rbx
orl %r13d, %ebp
movq 0x310(%r14), %rsi
leaq 0x20(%rbx), %rdx
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r13d
orl %r15d, %r13d
orl %ebp, %r13d
movl 0x10(%rbx), %eax
testb $0x2, %al
jne 0x49229
testb $0x4, %al
jne 0x4929b
leaq 0x3c(%rsp), %r15
movq 0x18(%rsp), %rbx
jmp 0x492be
movl 0x8c(%rbx), %eax
movl %eax, 0xc(%rsp)
movq 0x328(%r14), %rsi
movq %r12, %rdi
leaq 0xc(%rsp), %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r15d
movq 0x320(%r14), %rsi
leaq 0x30(%rbx), %rdx
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %ebp
orl %r15d, %ebp
orl %r13d, %ebp
movq 0x20(%rsp), %rax
cmpl $0x400, 0xc(%rax)       # imm = 0x400
jl 0x492f2
leaq 0x40(%rbx), %r13
movq 0x338(%r14), %rsi
leaq 0x38(%rbx), %rdx
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r15d
jmp 0x4931d
movq 0x340(%r14), %rsi
movq 0x18(%rsp), %rbx
leaq 0x2c(%rbx), %rdx
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
orl %eax, %r13d
leaq 0x3c(%rsp), %r15
testb $0x10, 0x10(%rbx)
je 0x49340
movq 0x20(%rsp), %rax
cmpl $0x400, 0xc(%rax)       # imm = 0x400
jl 0x49340
movq 0x330(%r14), %rsi
movq 0x18(%rsp), %rax
leaq 0x40(%rax), %rdx
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
orl %eax, %r13d
jmp 0x49340
movl 0x38(%rbx), %eax
movl %eax, 0xc(%rsp)
movq 0x338(%r14), %rsi
movq %r12, %rdi
leaq 0xc(%rsp), %r13
movq %r13, %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r15d
movl 0x40(%rbx), %eax
movl %eax, 0xc(%rsp)
movq 0x330(%r14), %rsi
movq %r12, %rdi
movq %r13, %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r13d
orl %r15d, %r13d
orl %ebp, %r13d
leaq 0x3c(%rsp), %r15
movq 0x20(%rsp), %rax
movl 0xc(%rax), %eax
movl $0xffffff00, %ecx       # imm = 0xFFFFFF00
andl %ecx, %eax
cmpl $0x100, %eax            # imm = 0x100
jne 0x493be
movq 0x18(%rsp), %rbx
movb 0x50(%rbx), %al
movb %al, 0xb(%rsp)
movq 0x3e0(%r14), %rsi
movq %r12, %rdi
leaq 0xb(%rsp), %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %ebp
orl %r13d, %ebp
movq %rbx, %r13
cmpl $0x0, 0x50(%rbx)
jle 0x493e1
xorl %ebx, %ebx
movq 0x58(%r12), %rax
movslq 0x5c(%r13), %rcx
addq %rbx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x3c(%rsp)
movq 0x3b8(%r14), %rsi
movq %r12, %rdi
movq %r15, %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
orl %eax, %ebp
incq %rbx
cmpl 0x50(%r13), %ebx
jl 0x49389
jmp 0x493e1
movq 0x380(%r14), %rsi
movq 0x18(%rsp), %rbx
leaq 0x60(%rbx), %rdx
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %ebp
orl %r13d, %ebp
movq %rbx, %r13
testb $0x4, 0xc(%r13)
jne 0x4960d
movq 0x350(%r14), %rsi
leaq 0x88(%r13), %rdx
movq %r12, %rdi
movq %rdx, 0x70(%rsp)
movl $0x1, %ecx
callq *0x30(%rsi)
movl %eax, %r15d
orl %ebp, %r15d
cmpl $0x0, 0x88(%r13)
setne %bl
je 0x49636
xorl %ecx, %ecx
movb $0x1, %bl
xorl %ebp, %ebp
movb %bl, 0x2f(%rsp)
movq 0x10(%rsp), %rbx
movq 0x48(%rbx), %r13
movl %r15d, %r12d
movq %r14, %r15
movq 0x18(%rsp), %rax
movl 0x84(%rax), %r14d
movl %ecx, 0x30(%rsp)
addl %ecx, %r14d
shlq $0x4, %r14
leaq (%r14,%r13), %rax
movq %rax, 0x40(%rsp)
movb 0x4(%r13,%r14), %al
movb %al, 0xb(%rsp)
movq 0x358(%r15), %rsi
movq %rbx, %rdi
leaq 0xb(%rsp), %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
movl %ebp, %ecx
movl %eax, %ebp
movl (%r13,%r14), %eax
subl %ecx, %eax
movl %eax, 0xc(%rsp)
movq 0x360(%r15), %rsi
movl %r12d, %r15d
movq %rbx, %rdi
leaq 0xc(%rsp), %rbx
movq %rbx, %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
orl %ebp, %r15d
orl %eax, %r15d
movl (%r13,%r14), %ebp
movl 0x4(%r13,%r14), %ecx
cmpl $0x57, %ecx
jg 0x494ed
leal -0x42(%rcx), %eax
cmpl $0x11, %eax
movq 0x48(%rsp), %r14
ja 0x495ef
leaq 0x531c5(%rip), %rdx     # 0x9c698
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x40(%rsp), %rax
movb 0x8(%rax), %al
movb %al, 0xb(%rsp)
jmp 0x4958f
cmpl $0x69, %ecx
je 0x4957e
cmpl $0x62, %ecx
movq 0x48(%rsp), %r14
je 0x495cd
cmpl $0x58, %ecx
jne 0x495ef
movq 0x40(%rsp), %rax
movb 0x8(%rax), %al
movb %al, 0xb(%rsp)
movq 0x378(%r14), %rsi
jmp 0x49596
movq 0x40(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0xc(%rsp)
movq 0x390(%r14), %rsi
jmp 0x49574
movq 0x40(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0xc(%rsp)
movq 0x398(%r14), %rsi
jmp 0x49574
movq 0x40(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0xc(%rsp)
movq 0x368(%r14), %rsi
jmp 0x49574
movq 0x40(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0xc(%rsp)
movq 0x3a0(%r14), %rsi
movq 0x10(%rsp), %rdi
movq %rbx, %rdx
jmp 0x495a0
movq 0x40(%rsp), %rax
movb 0x8(%rax), %al
movb %al, 0xb(%rsp)
movq 0x48(%rsp), %r14
movq 0x370(%r14), %rsi
movq 0x10(%rsp), %rdi
leaq 0xb(%rsp), %rdx
movl $0x1, %ecx
callq *0x30(%rsi)
orl %eax, %r15d
movb $0x1, %bl
movl 0x30(%rsp), %ecx
testb %bl, %bl
je 0x4965b
incl %ecx
movq 0x70(%rsp), %rax
cmpl (%rax), %ecx
setb %bl
jb 0x49427
jmp 0x49636
movq 0x3a8(%r14), %rsi
movq 0x10(%rsp), %rdi
movq 0x70(%rdi), %rax
movq 0x40(%rsp), %rcx
movslq 0x8(%rcx), %rdx
addq 0x20(%rax), %rdx
movl 0xc(%rcx), %ecx
jmp 0x495a5
xorl %ebx, %ebx
movl $0x1, %edi
leaq 0x537ff(%rip), %rsi     # 0x9cdfc
leaq 0x5380f(%rip), %rdx     # 0x9ce13
xorl %eax, %eax
callq 0x14378
jmp 0x495ad
movq 0x30(%rsp), %rax
movl (%rax), %ecx
testl %ecx, %ecx
je 0x49670
movq 0x70(%r12), %rax
movl 0x64(%r13), %edx
addq 0x20(%rax), %rdx
movq 0x370(%r14), %rsi
movq %r12, %rdi
callq *0x30(%rsi)
orl %eax, %ebp
jmp 0x49670
movq 0x318(%r14), %rsi
movq 0x18(%rsp), %rdx
subq $-0x80, %rdx
movq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x1, %ecx
callq *0x30(%rsi)
orl %eax, %r15d
jmp 0x49664
movq 0x10(%rsp), %r12
movb 0x2f(%rsp), %bl
movl %r15d, %ebp
testb $0x1, %bl
jne 0x48ed3
testl %ebp, %ebp
jne 0x48ed3
movq 0x68(%rsp), %rcx
incq %rcx
movq (%r12), %rax
movslq 0x18(%rax), %rax
cmpq %rax, %rcx
jl 0x4906d
movq 0x10(%r12), %rax
movq (%rax), %rcx
xorl %edx, %edx
cmpl $0x7, 0x38(%rcx)
setl %dl
addl 0x30(%rcx), %edx
movl %edx, 0x14(%rcx)
movl %edx, 0x10(%rcx)
movq 0x68(%rax), %rdi
testq %rdi, %rdi
je 0x496b9
callq 0x4f82d
movq 0x10(%r12), %rax
movq 0x80(%r12), %rcx
movq %rcx, 0x68(%rax)
movq $0x0, 0x80(%r12)
movq 0x10(%r12), %rax
movq 0x60(%rax), %rdi
testq %rdi, %rdi
movq 0x48(%rsp), %r14
je 0x496ee
callq 0x4f82d
movq 0x10(%r12), %rax
movq 0x78(%r12), %rcx
movq %rcx, 0x60(%rax)
movq $0x0, 0x78(%r12)
movq 0x10(%r12), %rax
movq 0x58(%rax), %rdi
testq %rdi, %rdi
je 0x49718
callq 0x4f82d
movq 0x10(%r12), %rax
movq 0x68(%r12), %rcx
movq %rcx, 0x58(%rax)
movq $0x0, 0x68(%r12)
movq 0x10(%r12), %rax
movq 0x70(%rax), %rdi
testq %rdi, %rdi
je 0x49742
callq 0x4f82d
movq 0x10(%r12), %rax
movq 0x88(%r12), %rcx
movq %rcx, 0x70(%rax)
movq $0x0, 0x88(%r12)
xorl %ebx, %ebx
movq 0x2e0(%r14,%rbx,8), %rdi
testq %rdi, %rdi
je 0x49779
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x49779
callq *%rax
incq %rbx
cmpq $0x1b, %rbx
jne 0x49761
movq (%r12), %rax
movl 0x28(%rax), %eax
cmpq $0x2, %rax
movq 0x20(%rsp), %r15
jb 0x497c3
movq 0x10(%r12), %rcx
movl $0x1, %edx
movq (%rcx,%rdx,8), %rsi
testq %rsi, %rsi
je 0x497bb
cmpq (%rcx), %rsi
je 0x497bb
cmpl $0x0, 0x14(%rsi)
jne 0x497bb
movl 0x30(%rsi), %edi
movl %edi, 0x14(%rsi)
movl %edi, 0x10(%rsi)
incq %rdx
cmpq %rdx, %rax
jne 0x4979e
movl 0xc(%r15), %ebx
movl 0x88(%r15), %ebp
cmpl $0x6, %ebp
jl 0x497fd
movq 0x10(%r12), %rax
movq (%rax), %rdx
cmpl $0x1f5, 0x14(%rdx)      # imm = 0x1F5
jl 0x497fd
movq %r15, %rdi
movq %r12, %rsi
xorl %ecx, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
callq 0x4fc99
xorl %ecx, %ecx
cmpl $0x2, %ebp
setl %cl
movl $0x9e0020, %eax         # imm = 0x9E0020
movl $0x20020, %edx          # imm = 0x20020
cmovgel %eax, %edx
movl %ebp, %edi
leal 0x600000(%rdx), %r13d
cmpl $0x6, %ebp
cmovll %edx, %r13d
movl 0x234(%r15), %edx
testl %edx, %edx
movl $0x10010, %eax          # imm = 0x10010
cmovel %eax, %r13d
shll $0x1a, %ecx
addl $0xfe000040, %ecx       # imm = 0xFE000040
xorl %esi, %esi
cmpl $0x301, %ebx            # imm = 0x301
cmovgel %r13d, %eax
cmovgel %ecx, %esi
testl %edx, %edx
cmovel %edx, %eax
xorl %ecx, %ecx
cmpl $0x0, 0x230(%r15)
movl 0x244(%r15), %edx
setne %cl
shll $0x2, %ecx
testl %edx, %edx
cmovel %edx, %esi
orl %ecx, %esi
xorl %r14d, %r14d
cmpl $0x0, 0x238(%r15)
setne %r14b
shll $0x3, %r14d
orl %esi, %r14d
orl %eax, %r14d
movl %r14d, %ebp
orl $0x802, %ebp            # imm = 0x802
movl %ebp, %eax
andl $-0xf, %eax
orl $0x1802, %r14d          # imm = 0x1802
cmpl $0x5, %edi
cmovgel %r14d, %ebp
cmovgel %r14d, %eax
andl $-0x3, %r14d
movl %edi, 0x18(%rsp)
cmpl $0x1, %edi
cmovel %r14d, %ebp
cmovnel %eax, %r14d
movl %ebp, %r12d
cmpl $0x301, %ebx            # imm = 0x301
movq %r15, %rbx
jl 0x498fe
cmpl $0x0, 0x23c(%rbx)
movl %ebp, %r12d
je 0x498fe
movl 0x88(%rbx), %eax
xorl %ecx, %ecx
cmpl $0x5, %eax
setge %cl
shll $0xd, %ecx
cmpl $0x7, %eax
movl $0xc080, %eax           # imm = 0xC080
movl $0x80, %r12d
cmovgel %eax, %r12d
orl %ecx, %r12d
orl %ebp, %r12d
leaq 0x88c8(%rbx), %r15
movq %r15, %rdi
callq 0x4750
movl $0x1f, %eax
movq 0x50(%rsp), %rdx
movq (%rdx,%rax,8), %rcx
testq %rcx, %rcx
je 0x49938
cmpl $0x11, 0x100c(%rcx)
jl 0x49938
movq -0x68(%rbx,%rax,8), %rcx
movl $0x1, 0x220(%rcx)
incq %rax
cmpq $0x4e, %rax
jne 0x49917
movq %r15, %rdi
callq 0x4340
movq 0x10(%rsp), %rsi
movq 0x10(%rsi), %rax
movq 0x68(%rax), %rdx
movq 0xf8(%rbx), %rcx
movq %rbx, %rdi
movl %ebp, %r8d
movl 0x18(%rsp), %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
movl 0x88(%rbx), %eax
testl %eax, %eax
je 0x499f8
cmpl $0x1, %eax
jne 0x49c2c
movq 0x10(%rsp), %rsi
movq 0x10(%rsi), %rax
movq 0x60(%rax), %rdx
movq 0x20(%rsp), %rdi
movq 0xf0(%rdi), %rcx
movl %r12d, %r8d
movl $0x1, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
xorl %ebx, %ebx
movq 0x10(%rsp), %rsi
movq 0x10(%rsi), %rax
movq 0x8(%rax,%rbx,8), %rdx
testq %rdx, %rdx
je 0x499ef
movq 0x20(%rsp), %rdi
movq 0x98(%rdi,%rbx,8), %rcx
movl %ebp, %r8d
movl $0x1, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
incq %rbx
cmpq $0x9, %rbx
jne 0x499b9
andl $0xfe0020, %r13d        # imm = 0xFE0020
xorl $0xfffef7ef, %r13d      # imm = 0xFFFEF7EF
andl %ebp, %r13d
movq 0x20(%rsp), %rbx
cmpl $0x301, 0xc(%rbx)       # imm = 0x301
jl 0x49a37
cmpl $0x0, 0x240(%rbx)
je 0x49a37
cmpl $0x0, 0x244(%rbx)
movl $0x100, %eax            # imm = 0x100
movl $0x1000000, %ecx        # imm = 0x1000000
cmovel %eax, %ecx
orl %ecx, %r13d
movq 0x10(%rsp), %r15
movq 0x10(%r15), %rax
movq 0x58(%rax), %rdx
movq 0xe8(%rbx), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %r8d
movl 0x18(%rsp), %r12d
movl %r12d, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
movq 0x10(%r15), %rax
movq 0xa0(%rax), %rdx
testq %rdx, %rdx
je 0x49a9e
cmpq (%rax), %rdx
je 0x49a9e
movq 0x130(%rbx), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %r8d
movl %r12d, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
movq (%r15), %rax
cmpl $0x30, 0x28(%rax)
jl 0x49af1
movl $0x2f, %ebx
movq 0x10(%r15), %rax
movq (%rax,%rbx,8), %rdx
testq %rdx, %rdx
je 0x49ae2
cmpq (%rax), %rdx
je 0x49ae2
cmpl $0x0, (%rdx)
jne 0x49ae2
movq 0x40(%rdx), %rcx
movq 0x20(%rsp), %rdi
movq %r15, %rsi
movl %ebp, %r8d
movl %r12d, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
incq %rbx
movq (%r15), %rax
movslq 0x28(%rax), %rax
cmpq %rax, %rbx
jl 0x49aac
movq (%r15), %rax
cmpl $0x2, 0x28(%rax)
setge %bpl
jl 0x49b61
movl $0x13, %ebx
movq 0x10(%r15), %rax
movq -0x90(%rax,%rbx,8), %rdx
testq %rdx, %rdx
je 0x49b39
cmpq (%rax), %rdx
je 0x49b39
cmpl $0x0, (%rdx)
jne 0x49b39
movq 0x20(%rsp), %rdi
movq (%rdi,%rbx,8), %rcx
movq %r15, %rsi
movl %r14d, %r8d
movl %r12d, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x49b61
leaq -0x12(%rbx), %rax
leaq -0x11(%rbx), %rcx
movq (%r15), %rdx
movslq 0x28(%rdx), %rdx
cmpq %rdx, %rcx
setl %cl
cmpq $0x2e, %rax
setb %bpl
andb %cl, %bpl
incq %rbx
testb %bpl, %bpl
jne 0x49b03
testb $0x1, %bpl
jne 0x48ed3
movq (%r15), %rax
movq 0x30(%rax), %rdi
movslq 0x28(%rax), %rsi
shlq $0x2, %rsi
callq 0x4840
movq (%r15), %rcx
movq %rax, 0x30(%rcx)
testq %rax, %rax
je 0x48ed3
movq (%r15), %rax
movl $0x1, %ebx
cmpl $0x2, 0x28(%rax)
jl 0x49c01
movl $0x1, %ebx
movl $0x1, %r14d
movq 0x10(%r15), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x49bf2
cmpq (%rax), %rdi
je 0x49bf2
cmpl $0x0, 0x14(%rdi)
je 0x49be1
movslq %ebx, %rbx
movq %rdi, (%rax,%rbx,8)
movq (%r15), %rax
movq 0x10(%r15), %rcx
movq (%rcx,%r14,8), %rcx
movl 0xc(%rcx), %ecx
movq 0x30(%rax), %rax
movl %ecx, -0x4(%rax,%rbx,4)
incl %ebx
jmp 0x49bf2
callq 0x4f82d
movq 0x10(%r15), %rax
movq $0x0, (%rax,%r14,8)
incq %r14
movq (%r15), %rax
movslq 0x28(%rax), %rcx
cmpq %rcx, %r14
jl 0x49ba8
leal -0x1(%rbx), %ecx
movl %ecx, 0x2c(%rax)
movl %ebx, 0x28(%rax)
movq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x42014
movq %rax, 0x8(%r15)
xorl %ecx, %ecx
cmpq $0x1, %rax
sbbl %ecx, %ecx
movl %ecx, 0x38(%rsp)
jmp 0x48ed3
movq 0x10(%rsp), %rbx
movq 0x10(%rbx), %rcx
movq 0x60(%rcx), %rdx
movq 0x20(%rsp), %r15
movq 0xf0(%r15), %rcx
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %r8d
cmpl $0x2, %eax
jg 0x49d12
movl $0x1, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
movq 0x10(%rbx), %rax
movq 0xf0(%rax), %rdx
movq 0x180(%r15), %rcx
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %r8d
movl $0x1, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
movq 0x10(%rbx), %rax
movq 0x128(%rax), %rdx
testq %rdx, %rdx
je 0x49ccd
movq 0x20(%rsp), %rdi
movq 0x1b8(%rdi), %rcx
movq %rbx, %rsi
movl %ebp, %r8d
movl $0x1, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
xorl %ebx, %ebx
movq 0x10(%rsp), %rsi
movq 0x10(%rsi), %rax
movq 0x8(%rax,%rbx,8), %rdx
testq %rdx, %rdx
je 0x49d04
movq 0x20(%rsp), %rdi
movq 0x98(%rdi,%rbx,8), %rcx
movl %ebp, %r8d
movl 0x18(%rsp), %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
incq %rbx
cmpq $0x9, %rbx
jne 0x49ccf
jmp 0x499f8
movl 0x18(%rsp), %r12d
movl %r12d, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
movq 0x10(%rbx), %rax
movq 0xf0(%rax), %rdx
movq 0x180(%r15), %rcx
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %r8d
movl %r12d, %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
movq 0x10(%rbx), %rax
movq 0x128(%rax), %rdx
testq %rdx, %rdx
je 0x49d86
movq 0x20(%rsp), %rdi
movq 0x1b8(%rdi), %rcx
movq %rbx, %rsi
movl %ebp, %r8d
movl 0x18(%rsp), %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
xorl %ebx, %ebx
movq 0x10(%rsp), %rsi
movq 0x10(%rsi), %rax
movq 0x8(%rax,%rbx,8), %rdx
testq %rdx, %rdx
je 0x49dbd
movq 0x20(%rsp), %rdi
movq 0x98(%rdi,%rbx,8), %rcx
movl %ebp, %r8d
movl 0x18(%rsp), %r9d
callq 0x4fc99
testl %eax, %eax
jne 0x48ed3
incq %rbx
cmpq $0x9, %rbx
jne 0x49d88
jmp 0x499f8