// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x1110, %rsp           # imm = 0x1110
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x3, %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
jne 0x77d33
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb %cl, 0x4(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movb %cl, 0x5(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x776f0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x77d31
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
jmp 0x77d33
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0x77da5
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
leaq 0x7bab4(%rip), %rsi     # 0xf3805
callq 0xde7a0
cmpq $0x0, %rax
jne 0x77da3
movq -0x18(%rbp), %rdi
leaq 0x7a8af(%rip), %rsi     # 0xf2616
leaq 0x7a8ab(%rip), %rdx     # 0xf2619
leaq 0x7ba90(%rip), %r9      # 0xf3805
leaq 0x7b99f(%rip), %r8      # 0xf371b
xorl %eax, %eax
movq %r9, %rcx
movq $0x0, (%rsp)
movb $0x0, %al
callq 0xd8ea0
cmpl $0x0, %eax
je 0x77da1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
jmp 0x77da3
jmp 0x77da5
movq -0x10(%rbp), %rdi
callq 0x71cf0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x77dc5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x719c0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x77df1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x78160
movq -0x10(%rbp), %rax
cmpl $0x0, 0x224(%rax)
jne 0x78160
movq -0x10(%rbp), %rax
cmpl $0x1, 0x220(%rax)
jg 0x78160
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x38(%rcx), %rcx
cmpl 0x28(%rcx), %eax
jge 0x7815e
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
leaq 0x7a886(%rip), %rsi     # 0xf26ec
leaq 0x7baf0(%rip), %rdx     # 0xf395d
callq 0xd9960
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x77e88
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x30(%rbp), %rdi
leaq 0x7bacd(%rip), %rsi     # 0xf3960
xorl %eax, %eax
movl %eax, %edx
callq 0xdaf50
cmpq $0x0, %rax
jne 0x780cb
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x77ed7
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x77ed7
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x10(%rax), %rax
movslq -0x28(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x77ee3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x10(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
movq -0x88(%rbp), %rcx
movl $0x1, %edx
callq 0x72ae0
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq -0x38(%rbp), %rax
jne 0x77fc8
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x220(%rax)
jne 0x77fbc
movl $0x3, %edi
leaq 0x7dafe(%rip), %rsi     # 0xf5a45
leaq 0x7db0a(%rip), %rdx     # 0xf5a58
movb $0x0, %al
callq 0x1b030
movl $0x3, %edi
leaq 0x7dae4(%rip), %rsi     # 0xf5a45
leaq 0x7db20(%rip), %rdx     # 0xf5a88
movb $0x0, %al
callq 0x1b030
movl $0x3, %edi
leaq 0x7daca(%rip), %rsi     # 0xf5a45
leaq 0x7c451(%rip), %rdx     # 0xf43d3
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rdi
addq $0x88f0, %rdi           # imm = 0x88F0
callq 0x4730
movq -0x10(%rbp), %rax
movl $0x2, 0x220(%rax)
movq -0x10(%rbp), %rdi
addq $0x88f0, %rdi           # imm = 0x88F0
callq 0x4330
jmp 0x7815e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x10(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
callq 0xe18c0
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
jne 0x78005
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x90(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x88(%rbp), %rdx
callq 0xe04d0
leaq -0x50(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0xe1630
movq -0x90(%rbp), %rdi
callq 0xe1910
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movl -0x28(%rbp), %esi
callq 0x721a0
leaq -0x80(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xe1940
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x10(%rax), %rax
movslq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl $0x1, 0x4c(%rax)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
leaq -0x80(%rbp), %r9
leaq 0x7a653(%rip), %rsi     # 0xf26ec
leaq 0x7b8bd(%rip), %rdx     # 0xf395d
leaq 0x7b8b9(%rip), %r8      # 0xf3960
xorl %eax, %eax
movq $0x0, (%rsp)
movb $0x0, %al
callq 0xda4f0
cmpl $0x0, %eax
je 0x780c9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
jmp 0x780cb
movq -0x10(%rbp), %rax
cmpq $0x0, 0x80(%rax)
je 0x7814e
leaq -0x1090(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rsi
callq 0x78900
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x30(%rax), %rax
movslq -0x28(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
leaq -0x1090(%rbp), %r9
leaq 0x7a5d0(%rip), %rsi     # 0xf26ec
leaq 0x7b83a(%rip), %rdx     # 0xf395d
leaq 0x7d97a(%rip), %r8      # 0xf5aa4
xorl %eax, %eax
movq $0x0, (%rsp)
movb $0x0, %al
callq 0xda4f0
cmpl $0x0, %eax
je 0x7814c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
jmp 0x7814e
jmp 0x78150
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x77e29
jmp 0x78160
movq -0x18(%rbp), %rdi
callq 0xd8590
movq %rax, -0x20(%rbp)
cmpq $0x7fffffff, -0x20(%rbp) # imm = 0x7FFFFFFF
jbe 0x7819d
movl $0x1, %edi
leaq 0x7d8c2(%rip), %rsi     # 0xf5a45
leaq 0x7d91d(%rip), %rdx     # 0xf5aa7
movb $0x0, %al
callq 0x1b030
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0x78227
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %esi
callq 0x6f8f0
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x781d2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x20(%rbp), %rax
movq %rax, -0x10c0(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10c8(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd8770
movq -0x10c8(%rbp), %rdi
movq %rax, %rsi
movq -0x20(%rbp), %rdx
callq 0x6d1e0
movq %rax, %rcx
movq -0x10c0(%rbp), %rax
cmpq %rcx, %rax
je 0x78222
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
jmp 0x788c1
xorl %esi, %esi
movl %esi, %edi
callq 0x6ede0
movq %rax, -0x1098(%rbp)
xorl %esi, %esi
movl %esi, %edi
callq 0x74730
movq %rax, -0x10a0(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x3, %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x10b4(%rbp)
cmpq $0x0, -0x1098(%rbp)
je 0x78276
cmpq $0x0, -0x10a0(%rbp)
jne 0x782ae
cmpq $0x0, -0x1098(%rbp)
je 0x7828c
movq -0x1098(%rbp), %rdi
callq 0x6f940
cmpq $0x0, -0x10a0(%rbp)
je 0x782a2
movq -0x10a0(%rbp), %rdi
callq 0x74a70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x1098(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %esi
callq 0x6ea80
cmpl $0x0, %eax
jge 0x782d1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
cmpq $0x0, -0x20(%rbp)
je 0x7830e
movq -0x1098(%rbp), %rax
movq %rax, -0x10d0(%rbp)
movq -0x18(%rbp), %rdi
callq 0xd8770
movq -0x10d0(%rbp), %rdi
movq %rax, %rsi
movq -0x20(%rbp), %rdx
callq 0x6e270
cmpl $0x0, %eax
jge 0x7830c
jmp 0x788e7
jmp 0x7830e
movq -0x1098(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %ecx
movq -0x1098(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x1098(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x3, %eax
jl 0x7836e
movq -0x10(%rbp), %rdi
movq -0x1098(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl %r8d, %ecx
callq 0x71460
cmpl $0x0, %eax
jge 0x7836c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
jmp 0x7836e
cmpl $0x0, -0x24(%rbp)
je 0x7856c
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
addl $0x2, %eax
movl -0x10b4(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
movl %eax, -0x10dc(%rbp)
movq -0x10(%rbp), %rax
movq 0x8a08(%rax), %rax
movq -0x1098(%rbp), %rcx
movslq 0xc(%rcx), %rdi
callq *%rax
movl %eax, %ecx
movl -0x10dc(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x10d8(%rbp)
movq -0x10(%rbp), %rax
movq 0x8a08(%rax), %rax
movq -0x1098(%rbp), %rcx
movslq 0x14(%rcx), %rdi
callq *%rax
movl %eax, %ecx
movl -0x10d8(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x10d4(%rbp)
movq -0x10(%rbp), %rax
movq 0x8a08(%rax), %rax
movq -0x1098(%rbp), %rcx
movslq 0x10(%rcx), %rdi
callq *%rax
movl -0x10d4(%rbp), %ecx
addl %eax, %ecx
movq -0x10a0(%rbp), %rax
movl %ecx, (%rax)
movq -0x10a0(%rbp), %rax
movl $0x2, 0x2c(%rax)
movq -0x10a0(%rbp), %rax
movl $0x2, 0x30(%rax)
movl $0x8, %edi
callq 0x4650
movq -0x10a0(%rbp), %rcx
movq %rax, 0x38(%rcx)
cmpq $0x0, %rax
jne 0x7846a
movq -0x1098(%rbp), %rdi
callq 0x6f940
movq -0x10a0(%rbp), %rdi
callq 0x74a70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x10a0(%rbp), %rax
movq 0x38(%rax), %rax
movl $0x0, (%rax)
movq -0x10a0(%rbp), %rax
movl (%rax), %ecx
movq -0x10a0(%rbp), %rax
movq 0x38(%rax), %rax
movl %ecx, 0x4(%rax)
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm1
movsd 0x74b73(%rip), %xmm0    # 0xed018
mulsd %xmm0, %xmm1
movsd 0x7653f(%rip), %xmm0    # 0xee9f0
ucomisd %xmm1, %xmm0
jbe 0x784d8
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm0
movsd 0x74b4e(%rip), %xmm1    # 0xed018
mulsd %xmm1, %xmm0
movsd %xmm0, -0x10e8(%rbp)
jmp 0x784ea
movsd 0x76510(%rip), %xmm0    # 0xee9f0
movsd %xmm0, -0x10e8(%rbp)
jmp 0x784ea
movsd -0x10e8(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10a4(%rbp)
movl -0x10a4(%rbp), %eax
addl $0x2, %eax
movl -0x10b4(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
movl %eax, -0x10f0(%rbp)
movq -0x10(%rbp), %rax
movq 0x8a08(%rax), %rax
movq -0x1098(%rbp), %rcx
movslq 0xc(%rcx), %rdi
callq *%rax
movl %eax, %ecx
movl -0x10f0(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x10ec(%rbp)
movq -0x10(%rbp), %rax
movq 0x8a08(%rax), %rax
movslq -0x10a4(%rbp), %rdi
callq *%rax
movl -0x10ec(%rbp), %ecx
shll %eax
addl %eax, %ecx
movq -0x10a0(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x7876d
movq -0x10a0(%rbp), %rax
movl $0x1, 0x2c(%rax)
movq -0x10a0(%rbp), %rax
movl $0x1, 0x30(%rax)
movl $0x4, %edi
callq 0x4650
movq -0x10a0(%rbp), %rcx
movq %rax, 0x38(%rcx)
cmpq $0x0, %rax
jne 0x785af
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x10a0(%rbp), %rax
movq 0x38(%rax), %rax
movl $0x0, (%rax)
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm0
movsd 0x7bb9d(%rip), %xmm1    # 0xf4170
mulsd %xmm1, %xmm0
movsd 0x76411(%rip), %xmm1    # 0xee9f0
ucomisd %xmm1, %xmm0
jbe 0x78606
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm0
movsd 0x7bb78(%rip), %xmm1    # 0xf4170
mulsd %xmm1, %xmm0
movsd %xmm0, -0x10f8(%rbp)
jmp 0x78618
movsd 0x763e2(%rip), %xmm0    # 0xee9f0
movsd %xmm0, -0x10f8(%rbp)
jmp 0x78618
movsd -0x10f8(%rbp), %xmm0
movq -0x10a0(%rbp), %rax
cvtsi2sdl (%rax), %xmm1
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10a4(%rbp)
movq -0x1098(%rbp), %rax
movl 0x10(%rax), %eax
addl -0x10a4(%rbp), %eax
addl $0x2, %eax
movl -0x10b4(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
movl %eax, -0x1104(%rbp)
movq -0x10(%rbp), %rax
movq 0x8a08(%rax), %rax
movq -0x1098(%rbp), %rcx
movslq 0xc(%rcx), %rdi
callq *%rax
movl %eax, %ecx
movl -0x1104(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x1100(%rbp)
movq -0x10(%rbp), %rax
movq 0x8a08(%rax), %rax
movq -0x1098(%rbp), %rcx
movslq 0x14(%rcx), %rdi
callq *%rax
movl %eax, %ecx
movl -0x1100(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x10fc(%rbp)
movq -0x10(%rbp), %rax
movq 0x8a08(%rax), %rax
movq -0x1098(%rbp), %rcx
movslq 0x10(%rcx), %rdi
callq *%rax
movl -0x10fc(%rbp), %ecx
addl %eax, %ecx
movq -0x10a0(%rbp), %rax
movl %ecx, (%rax)
movslq -0x10a4(%rbp), %rsi
movl $0x1, %edi
callq 0x42f0
movq %rax, %rcx
movq %rcx, -0x10b0(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x7871c
movq -0x1098(%rbp), %rdi
callq 0x6f940
movq -0x10a0(%rbp), %rdi
callq 0x74a70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x1098(%rbp), %rdi
movq -0x10b0(%rbp), %rsi
movslq -0x10a4(%rbp), %rdx
callq 0x6e270
cmpl $0x0, %eax
jge 0x78740
jmp 0x788e7
movq -0x1098(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %ecx
movq -0x1098(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x1098(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10b0(%rbp), %rdi
callq 0x45a0
movq -0x10(%rbp), %rdi
movq -0x10a0(%rbp), %rsi
callq 0x76030
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x787ac
movq -0x1098(%rbp), %rdi
callq 0x6f940
movq -0x10a0(%rbp), %rdi
callq 0x74a70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movq -0x10(%rbp), %rdi
movq -0x1098(%rbp), %rsi
callq 0x6f400
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x787eb
movq -0x1098(%rbp), %rdi
callq 0x6f940
movq -0x10a0(%rbp), %rdi
callq 0x74a70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
cmpl $0x0, -0x24(%rbp)
je 0x788a9
movq -0x1098(%rbp), %rdi
movslq -0x10a4(%rbp), %rsi
callq 0x78a90
cmpl $0x0, %eax
jge 0x78812
jmp 0x788e7
movq -0x1098(%rbp), %rax
movq 0x20(%rax), %rdi
movslq -0x10a4(%rbp), %rdx
xorl %esi, %esi
callq 0x4250
movslq -0x10a4(%rbp), %rcx
movq -0x1098(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x1098(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %ecx
movq -0x1098(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x1098(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x1098(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rdi
movq -0x1098(%rbp), %rsi
callq 0x6f400
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x788a7
movq -0x1098(%rbp), %rdi
callq 0x6f940
movq -0x10a0(%rbp), %rdi
callq 0x74a70
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
jmp 0x788a9
movq -0x1098(%rbp), %rdi
callq 0x6f940
movq -0x10a0(%rbp), %rdi
callq 0x74a70
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x143b0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x788de
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x788ee
movl $0x0, -0x4(%rbp)
jmp 0x788ee
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x1110, %rsp           # imm = 0x1110
popq %rbp
retq
nopw (%rax,%rax)