// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_io.c
// Function: cram_write_SAM_hdr
int cram_write_SAM_hdr(cram_fd *fd, sam_hdr_t *hdr) {
    size_t header_len;
    int blank_block = (CRAM_MAJOR_VERS(fd->version) >= 3);

    /* Write CRAM MAGIC if not yet written. */
    if (fd->file_def->major_version == 0) {
        fd->file_def->major_version = CRAM_MAJOR_VERS(fd->version);
        fd->file_def->minor_version = CRAM_MINOR_VERS(fd->version);
        if (0 != cram_write_file_def(fd, fd->file_def))
            return -1;
    }

    /* 1.0 requires an UNKNOWN read-group */
    if (CRAM_MAJOR_VERS(fd->version) == 1) {
        if (!sam_hrecs_find_rg(hdr->hrecs, "UNKNOWN"))
            if (sam_hdr_add_line(hdr, "RG",
                            "ID", "UNKNOWN", "SM", "UNKNOWN", NULL))
                return -1;
    }

    if (-1 == refs_from_header(fd))
        return -1;
    if (-1 == refs2id(fd->refs, fd->header))
        return -1;

    /* Fix M5 strings */
    if (fd->refs && !fd->no_ref && fd->embed_ref <= 1) {
        int i;
        for (i = 0; i < hdr->hrecs->nref; i++) {
            sam_hrec_type_t *ty;
            char *ref;

            if (!(ty = sam_hrecs_find_type_id(hdr->hrecs, "SQ", "SN", hdr->hrecs->ref[i].name)))
                return -1;

            if (!sam_hrecs_find_key(ty, "M5", NULL)) {
                char unsigned buf[16];
                char buf2[33];
                hts_pos_t rlen;
                hts_md5_context *md5;

                if (!fd->refs ||
                    !fd->refs->ref_id ||
                    !fd->refs->ref_id[i]) {
                    return -1;
                }
                rlen = fd->refs->ref_id[i]->length;
                ref = cram_get_ref(fd, i, 1, rlen);
                if (NULL == ref) {
                    if (fd->embed_ref == -1) {
                        // auto embed-ref
                        hts_log_warning("No M5 tags present and could not "
                                        "find reference");
                        hts_log_warning("Enabling embed_ref=2 option");
                        hts_log_warning("NOTE: the CRAM file will be bigger "
                                        "than using an external reference");
                        pthread_mutex_lock(&fd->ref_lock);
                        // Best guess.  It may be unmapped data with broken
                        // headers, in which case this will get ignored.
                        fd->embed_ref = 2;
                        pthread_mutex_unlock(&fd->ref_lock);
                        break;
                    }
                    return -1;
                }
                rlen = fd->refs->ref_id[i]->length; /* In case it just loaded */
                if (!(md5 = hts_md5_init()))
                    return -1;
                if (HTS_POS_MAX <= ULONG_MAX) {
                    // Platforms with 64-bit unsigned long update in one go
                    hts_md5_update(md5, ref, rlen);
                } else {
                    // Those with 32-bit ulong (Windows) may have to loop
                    // over epic references
                    hts_pos_t pos = 0;
                    while (rlen - pos > ULONG_MAX) {
                        hts_md5_update(md5, ref + pos, ULONG_MAX);
                        pos += ULONG_MAX;
                    }
                    hts_md5_update(md5, ref + pos, (unsigned long)(rlen - pos));
                }
                hts_md5_final(buf, md5);
                hts_md5_destroy(md5);
                cram_ref_decr(fd->refs, i);

                hts_md5_hex(buf2, buf);
                fd->refs->ref_id[i]->validated_md5 = 1;
                if (sam_hdr_update_line(hdr, "SQ", "SN", hdr->hrecs->ref[i].name, "M5", buf2, NULL))
                    return -1;
            }

            if (fd->ref_fn) {
                char ref_fn[PATH_MAX];
                full_path(ref_fn, fd->ref_fn);
                if (sam_hdr_update_line(hdr, "SQ", "SN", hdr->hrecs->ref[i].name, "UR", ref_fn, NULL))
                    return -1;
            }
        }
    }

    /* Length */
    header_len = sam_hdr_length(hdr);
    if (header_len > INT32_MAX) {
        hts_log_error("Header is too long for CRAM format");
        return -1;
    }
    if (CRAM_MAJOR_VERS(fd->version) == 1) {
        if (-1 == int32_encode(fd, header_len))
            return -1;

        /* Text data */
        if (header_len != hwrite(fd->fp, sam_hdr_str(hdr), header_len))
            return -1;
    } else {
        /* Create block(s) inside a container */
        cram_block *b = cram_new_block(FILE_HEADER, 0);
        cram_container *c = cram_new_container(0, 0);
        int padded_length;
        char *pads;
        int is_cram_3 = (CRAM_MAJOR_VERS(fd->version) >= 3);

        if (!b || !c) {
            if (b) cram_free_block(b);
            if (c) cram_free_container(c);
            return -1;
        }

        if (int32_put_blk(b, header_len) < 0)
            return -1;
        if (header_len)
            BLOCK_APPEND(b, sam_hdr_str(hdr), header_len);
        BLOCK_UPLEN(b);

        // Compress header block if V3.0 and above
        if (CRAM_MAJOR_VERS(fd->version) >= 3)
            if (cram_compress_block(fd, b, NULL, -1, -1) < 0)
                return -1;

        if (blank_block) {
            c->length = b->comp_size + 2 + 4*is_cram_3 +
                fd->vv.varint_size(b->content_id)   +
                fd->vv.varint_size(b->uncomp_size)  +
                fd->vv.varint_size(b->comp_size);

            c->num_blocks = 2;
            c->num_landmarks = 2;
            if (!(c->landmark = malloc(2*sizeof(*c->landmark)))) {
                cram_free_block(b);
                cram_free_container(c);
                return -1;
            }
            c->landmark[0] = 0;
            c->landmark[1] = c->length;

            // Plus extra storage for uncompressed secondary blank block
            padded_length = MIN(c->length*.5, 10000);
            c->length += padded_length + 2 + 4*is_cram_3 +
                fd->vv.varint_size(b->content_id) +
                fd->vv.varint_size(padded_length)*2;
        } else {
            // Pad the block instead.
            c->num_blocks = 1;
            c->num_landmarks = 1;
            if (!(c->landmark = malloc(sizeof(*c->landmark))))
                return -1;
            c->landmark[0] = 0;

            padded_length = MAX(c->length*1.5, 10000) - c->length;

            c->length = b->comp_size + padded_length +
                2 + 4*is_cram_3 +
                fd->vv.varint_size(b->content_id)   +
                fd->vv.varint_size(b->uncomp_size)  +
                fd->vv.varint_size(b->comp_size);

            if (NULL == (pads = calloc(1, padded_length))) {
                cram_free_block(b);
                cram_free_container(c);
                return -1;
            }
            BLOCK_APPEND(b, pads, padded_length);
            BLOCK_UPLEN(b);
            free(pads);
        }

        if (-1 == cram_write_container(fd, c)) {
            cram_free_block(b);
            cram_free_container(c);
            return -1;
        }

        if (-1 == cram_write_block(fd, b)) {
            cram_free_block(b);
            cram_free_container(c);
            return -1;
        }

        if (blank_block) {
            BLOCK_RESIZE(b, padded_length);
            memset(BLOCK_DATA(b), 0, padded_length);
            BLOCK_SIZE(b) = padded_length;
            BLOCK_UPLEN(b);
            b->method = RAW;
            if (-1 == cram_write_block(fd, b)) {
                cram_free_block(b);
                cram_free_container(c);
                return -1;
            }
        }

        cram_free_block(b);
        cram_free_container(c);
    }

    if (0 != hflush(fd->fp))
        return -1;

    RP("=== Finishing saving header ===\n");

    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1038, %rsp           # imm = 0x1038
movq %rsi, %r12
movq %rdi, %rbx
movl 0xc(%rdi), %eax
movl %eax, %r14d
sarl $0x8, %r14d
movq 0x10(%rdi), %rsi
cmpb $0x0, 0x4(%rsi)
je 0x520dd
andl $0xffffff00, %eax       # imm = 0xFFFFFF00
cmpl $0x100, %eax            # imm = 0x100
jne 0x51d06
movq 0x38(%r12), %rdi
leaq 0x475b2(%rip), %rsi     # 0x992aa
callq 0x8a05f
testq %rax, %rax
je 0x52101
movq %rbx, %rdi
callq 0x4e1d0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x523bd
movq 0x18(%rbx), %rsi
movq 0x50(%rbx), %rdi
callq 0x4df9d
cmpl $-0x1, %eax
je 0x520d3
cmpq $0x0, 0x50(%rbx)
je 0x520a5
cmpl $0x0, 0x224(%rbx)
jne 0x520a5
cmpl $0x1, 0x220(%rbx)
jg 0x520a5
movq 0x38(%r12), %rdi
cmpl $0x0, 0x28(%rdi)
jle 0x520a5
leaq 0x47695(%rip), %r13     # 0x99402
xorl %r15d, %r15d
movq $0x0, 0x8(%rsp)
movq %r12, 0x10(%rsp)
movq 0x30(%rdi), %rax
movq (%rax,%r15), %rcx
movq %r13, %rsi
leaq 0x47675(%rip), %rdx     # 0x99405
callq 0x85b55
testq %rax, %rax
je 0x520d3
movq %rax, %rdi
leaq 0x47660(%rip), %rsi     # 0x99408
xorl %edx, %edx
callq 0x872e1
testq %rax, %rax
movq %r15, 0x18(%rsp)
jne 0x51ed4
movq 0x50(%rbx), %rax
testq %rax, %rax
je 0x520d3
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x520d3
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0x520d3
movq 0x10(%rax), %rcx
movl $0x1, %edx
movq %rbx, %rdi
movq 0x8(%rsp), %r12
movl %r12d, %esi
callq 0x4ea38
testq %rax, %rax
je 0x5255e
movq %rax, %r15
movq 0x50(%rbx), %rax
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rax), %r13
callq 0x8b777
testq %rax, %rax
je 0x520d3
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x8ad49
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x8b650
movq %r12, %rdi
callq 0x8b7a1
movq 0x50(%rbx), %rdi
movq 0x8(%rsp), %r12
movl %r12d, %esi
callq 0x4e54d
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x8b7ab
movq 0x50(%rbx), %rax
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %rax
movl $0x1, 0x4c(%rax)
movq 0x10(%rsp), %r12
movq 0x38(%r12), %rax
movq 0x30(%rax), %rax
movq 0x18(%rsp), %r15
movq (%rax,%r15), %rcx
movq $0x0, (%rsp)
movq %r12, %rdi
leaq 0x47553(%rip), %r13     # 0x99402
movq %r13, %rsi
leaq 0x4754c(%rip), %rdx     # 0x99405
leaq 0x47548(%rip), %r8      # 0x99408
leaq 0x30(%rsp), %r9
xorl %eax, %eax
callq 0x8696e
testl %eax, %eax
jne 0x520d3
movq 0x80(%rbx), %r15
testq %r15, %r15
je 0x5207d
movq %r15, %rdi
callq 0x41d0
movq %rax, %r12
movq %r15, %rdi
callq 0x101ec
testl %eax, %eax
je 0x51f32
cmpq $0x1001, %r12           # imm = 0x1001
jb 0x51f66
movl $0x1, %edi
leaq 0x4991e(%rip), %rsi     # 0x9b82e
leaq 0x49921(%rip), %rdx     # 0x9b838
movl $0x1000, %ecx           # imm = 0x1000
xorl %eax, %eax
callq 0x13de5
movq 0x10(%rsp), %r12
leaq 0x30(%rsp), %r9
jmp 0x52044
movzbl (%r15), %r13d
cmpq $0x2f, %r13
jne 0x51f90
movl $0xfff, %edx            # imm = 0xFFF
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x4250
movq %r12, %r9
movb $0x0, 0x102f(%rsp)
movq 0x10(%rsp), %r12
jmp 0x5203d
movl $0xfff, %edx            # imm = 0xFFF
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x4250
movq %r12, %r9
movb $0x0, 0x102f(%rsp)
movq 0x10(%rsp), %r12
jmp 0x52044
cmpq $0x4, %r12
jb 0x51fc2
callq 0x40a0
movq (%rax), %rax
movb (%rax,%r13,4), %al
addb $-0x41, %al
cmpb $0x19, %al
ja 0x51fc2
cmpb $0x3a, 0x1(%r15)
jne 0x51fc2
movzbl 0x2(%r15), %eax
cmpl $0x5c, %eax
je 0x51f3c
cmpl $0x2f, %eax
je 0x51f3c
movl $0x1000, %esi           # imm = 0x1000
leaq 0x30(%rsp), %r13
movq %r13, %rdi
callq 0x4240
testq %rax, %rax
je 0x51ffa
movq %r13, %rdi
callq 0x41d0
movq %rax, %r12
movq %r15, %rdi
callq 0x41d0
addq %r12, %rax
incq %rax
cmpq $0x1000, %rax           # imm = 0x1000
jb 0x52014
movl $0xfff, %edx            # imm = 0xFFF
movq %r13, %rdi
movq %r15, %rsi
callq 0x4250
movb $0x0, 0x102f(%rsp)
jmp 0x52035
leaq (%rsp,%r12), %rdi
addq $0x30, %rdi
movl $0x1000, %esi           # imm = 0x1000
subq %r12, %rsi
leaq 0x4f29a(%rip), %rdx     # 0xa12c5
movq %r15, %rcx
xorl %eax, %eax
callq 0x4800
movq 0x10(%rsp), %r12
movq %r13, %r9
leaq 0x473be(%rip), %r13     # 0x99402
movq 0x38(%r12), %rax
movq 0x30(%rax), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx), %rcx
movq $0x0, (%rsp)
movq %r12, %rdi
movq %r13, %rsi
leaq 0x4739a(%rip), %rdx     # 0x99405
leaq 0x4925f(%rip), %r8      # 0x9b2d1
xorl %eax, %eax
callq 0x8696e
testl %eax, %eax
jne 0x520d3
movq 0x8(%rsp), %rdx
incq %rdx
movq 0x38(%r12), %rdi
movslq 0x28(%rdi), %rax
movq 0x18(%rsp), %r15
addq $0x18, %r15
movq %rdx, 0x8(%rsp)
cmpq %rax, %rdx
jl 0x51d7e
movq %r12, %rdi
callq 0x84d27
testq $-0x80000000, %rax      # imm = 0x80000000
je 0x52144
leaq 0x491b2(%rip), %rsi     # 0x9b272
leaq 0x4920d(%rip), %rdx     # 0x9b2d4
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x523bd
movb %r14b, 0x4(%rsi)
movb %al, 0x5(%rsi)
movq %rbx, %rdi
callq 0x51854
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x523bd
movl 0xc(%rbx), %eax
jmp 0x51ce0
movq $0x0, (%rsp)
leaq 0x45fe8(%rip), %rsi     # 0x980f8
leaq 0x45fe4(%rip), %rdx     # 0x980fb
leaq 0x470a2(%rip), %r8      # 0x991c0
leaq 0x47185(%rip), %rcx     # 0x992aa
movq %r12, %rdi
movq %rcx, %r9
xorl %eax, %eax
callq 0x85441
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x523bd
jmp 0x51d06
movq %rax, %r13
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
andl 0xc(%rbx), %eax
cmpl $0x100, %eax            # imm = 0x100
jne 0x521e8
movq (%rbx), %rdi
movl %r13d, %esi
callq 0x4ce09
cmpl $-0x1, %eax
je 0x523bd
movq (%rbx), %r15
movq %r12, %rdi
callq 0x84e6a
movq %rax, %rbp
testb $0x2, 0x30(%r15)
movq 0x18(%r15), %r12
jne 0x521ac
movq %r12, %rax
subq 0x8(%r15), %rax
cmpq %r13, %rax
jae 0x521ac
addq %r13, %r12
subq (%r15), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xee24
movq 0x18(%r15), %r12
movq %r12, 0x10(%r15)
movq 0x8(%r15), %rdi
subq %rdi, %r12
cmpq %r13, %r12
ja 0x521c1
cmpq (%r15), %rdi
je 0x5238e
cmpq %r13, %r12
movq %r13, %r14
cmovbq %r12, %r14
movq %rbp, %rsi
movq %r14, %rdx
callq 0x43c0
addq %r14, 0x8(%r15)
cmpq %r13, %r12
jb 0x52391
jmp 0x523a5
movq %r12, %rbp
xorl %edi, %edi
xorl %esi, %esi
callq 0x4c675
movq %rax, %r12
xorl %edi, %edi
xorl %esi, %esi
callq 0x4fc97
movq %rax, %r15
testq %r12, %r12
setne %al
testq %r15, %r15
setne %cl
testb %cl, %al
je 0x52373
movl 0xc(%rbx), %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
movl %r13d, %esi
callq 0x4c3d1
testl %eax, %eax
js 0x520d3
testq %r13, %r13
je 0x52254
movq %rbp, %rdi
callq 0x84e6a
movq %r12, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x4c0b1
testl %eax, %eax
js 0x520d3
movl 0x30(%r12), %eax
movl %eax, 0x14(%r12)
movl %eax, 0x10(%r12)
cmpl $0x300, 0xc(%rbx)       # imm = 0x300
jl 0x5229b
movl $0x0, (%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %rdi
xorl %esi, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
callq 0x4d33c
testl %eax, %eax
js 0x523bd
cmpl $0x3, %r14d
jl 0x523d1
xorl %eax, %eax
cmpl $0x300, 0x8(%rsp)       # imm = 0x300
setge %al
movslq 0xc(%r12), %rdi
leal 0x2(,%rax,4), %eax
movl 0x10(%r12), %r13d
movl %eax, 0x18(%rsp)
addl %eax, %r13d
callq *0x8a08(%rbx)
movl %eax, 0x8(%rsp)
movslq 0x14(%r12), %rdi
callq *0x8a08(%rbx)
movl %eax, %ebp
movslq 0x10(%r12), %rdi
callq *0x8a08(%rbx)
addl 0x8(%rsp), %ebp
addl %eax, %ebp
addl %r13d, %ebp
movl %ebp, (%r15)
movabsq $0x200000002, %rax      # imm = 0x200000002
movq %rax, 0x2c(%r15)
movl $0x8, %edi
callq 0x4680
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x52549
movl $0x0, (%rax)
cvtsi2sd %ebp, %xmm0
mulsd 0x40cf1(%rip), %xmm0    # 0x93020
minsd 0x425b9(%rip), %xmm0    # 0x948f0
movl %ebp, 0x4(%rax)
cvttsd2si %xmm0, %r13d
movslq 0xc(%r12), %rdi
callq *0x8a08(%rbx)
movl %eax, %ebp
movl %r13d, 0x8(%rsp)
movslq %r13d, %r13
movq %r13, %rdi
callq *0x8a08(%rbx)
movl 0x18(%rsp), %ecx
addl %ebp, %ecx
addl %ecx, %r13d
leal (%r13,%rax,2), %eax
addl %eax, (%r15)
jmp 0x524c0
testq %r12, %r12
je 0x52380
movq %r12, %rdi
callq 0x4ceb6
testq %r15, %r15
jne 0x52551
jmp 0x520d3
xorl %r14d, %r14d
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0xf300
movq %rax, %r14
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq %r14, %r13
jne 0x523bd
movq (%rbx), %rdi
callq 0xf22b
xorl %ebp, %ebp
negl %eax
sbbl %ebp, %ebp
movl %ebp, %eax
addq $0x1038, %rsp           # imm = 0x1038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x2c(%r15)
movl $0x4, %edi
callq 0x4680
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x520d3
xorl %ebp, %ebp
cmpl $0x300, 0x8(%rsp)       # imm = 0x300
setge %bpl
cvtsi2sdl (%r15), %xmm0
movsd 0x4724f(%rip), %xmm1    # 0x99660
mulsd %xmm0, %xmm1
maxsd 0x424d3(%rip), %xmm1    # 0x948f0
movl $0x0, (%rax)
subsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movl %eax, 0x8(%rsp)
movslq 0xc(%r12), %rdi
shll $0x2, %ebp
addl 0x10(%r12), %ebp
callq *0x8a08(%rbx)
movl %eax, %r13d
movslq 0x14(%r12), %rdi
callq *0x8a08(%rbx)
movl %eax, 0x18(%rsp)
movslq 0x10(%r12), %rdi
callq *0x8a08(%rbx)
addl %ebp, %r13d
addl 0x18(%rsp), %r13d
movl 0x8(%rsp), %ecx
addl %ecx, %r13d
addl %r13d, %eax
addl $0x2, %eax
movl %eax, (%r15)
movslq %ecx, %r13
movl $0x1, %edi
movq %r13, %rsi
callq 0x4300
testq %rax, %rax
je 0x52549
movq %rax, %rbp
movq %r12, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x4c0b1
testl %eax, %eax
js 0x520d3
movl 0x30(%r12), %eax
movl %eax, 0x14(%r12)
movl %eax, 0x10(%r12)
movq %rbp, %rdi
callq 0x45c0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x50a28
cmpl $-0x1, %eax
je 0x52549
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4ca19
cmpl $-0x1, %eax
je 0x52549
cmpl $0x3, %r14d
jl 0x52534
movslq 0x8(%rsp), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x525df
testl %eax, %eax
js 0x520d3
movq 0x20(%r12), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x4260
movq %r14, 0x30(%r12)
movl %r14d, 0x14(%r12)
movl %r14d, 0x10(%r12)
movl $0x0, (%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4ca19
cmpl $-0x1, %eax
je 0x52549
movq %r12, %rdi
callq 0x4ceb6
movq %r15, %rdi
callq 0x4fe2e
jmp 0x523af
movq %r12, %rdi
callq 0x4ceb6
movq %r15, %rdi
callq 0x4fe2e
jmp 0x520d3
cmpl $-0x1, 0x220(%rbx)
jne 0x520d3
leaq 0x48d00(%rip), %r15     # 0x9b272
leaq 0x48d0c(%rip), %rdx     # 0x9b285
movl $0x3, %edi
movq %r15, %rsi
xorl %eax, %eax
callq 0x13de5
leaq 0x48d26(%rip), %rdx     # 0x9b2b5
movl $0x3, %edi
movq %r15, %rsi
xorl %eax, %eax
callq 0x13de5
leaq 0x4757e(%rip), %rdx     # 0x99b23
movl $0x3, %edi
movq %r15, %rsi
xorl %eax, %eax
callq 0x13de5
leaq 0x88f0(%rbx), %r15
movq %r15, %rdi
callq 0x4750
movl $0x2, 0x220(%rbx)
movq %r15, %rdi
callq 0x4340
movq 0x10(%rsp), %r12
jmp 0x520a5