// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/sam.c
// Function: sam_hdr_create
static sam_hdr_t *sam_hdr_create(htsFile* fp) {
    kstring_t str = { 0, 0, NULL };
    khint_t k;
    sam_hdr_t* h = sam_hdr_init();
    const char *q, *r;
    char* sn = NULL;
    khash_t(s2i) *d = kh_init(s2i);
    khash_t(s2i) *long_refs = NULL;
    if (!h || !d)
        goto error;

    int ret, has_SQ = 0;
    int next_c = '@';
    while (next_c == '@' && (ret = hts_getline(fp, KS_SEP_LINE, &fp->line)) >= 0) {
        if (fp->line.s[0] != '@')
            break;

        if (fp->line.l > 3 && strncmp(fp->line.s, "@SQ", 3) == 0) {
            has_SQ = 1;
            hts_pos_t ln = -1;
            for (q = fp->line.s + 4;; ++q) {
                if (strncmp(q, "SN:", 3) == 0) {
                    q += 3;
                    for (r = q;*r != '\t' && *r != '\n' && *r != '\0';++r);

                    if (sn) {
                        hts_log_warning("SQ header line has more than one SN: tag");
                        free(sn);
                    }
                    sn = (char*)calloc(r - q + 1, 1);
                    if (!sn)
                        goto error;

                    strncpy(sn, q, r - q);
                    q = r;
                } else {
                    if (strncmp(q, "LN:", 3) == 0) {
                        hts_pos_t tmp = strtoll(q + 3, (char**)&q, 10);
                        if (ln != -1 && ln != tmp) { //duplicate & different LN
                            hts_log_error("Header includes @SQ line \"%s\" with"
                                " multiple LN: tag with different values.", sn);
                            goto error;
                        } else {
                            ln = tmp;
                        }
                    }
                }

                while (*q != '\t' && *q != '\n' && *q != '\0')
                    ++q;
                if (*q == '\0' || *q == '\n')
                    break;
            }
            if (sn) {
                if (ln >= 0) {
                    int absent;
                    k = kh_put(s2i, d, sn, &absent);
                    if (absent < 0)
                        goto error;

                    if (!absent) {
                        hts_log_warning("Duplicated sequence \"%s\" in file \"%s\"", sn, fp->fn);
                        free(sn);
                    } else {
                        sn = NULL;
                        if (ln >= UINT32_MAX) {
                            // Stash away ref length that
                            // doesn't fit in target_len array
                            int k2;
                            if (!long_refs) {
                                long_refs = kh_init(s2i);
                                if (!long_refs)
                                    goto error;
                            }
                            k2 = kh_put(s2i, long_refs, kh_key(d, k), &absent);
                            if (absent < 0)
                                goto error;
                            kh_val(long_refs, k2) = ln;
                            kh_val(d, k) = ((int64_t) (kh_size(d) - 1) << 32
                                            | UINT32_MAX);
                        } else {
                            kh_val(d, k) = (int64_t) (kh_size(d) - 1) << 32 | ln;
                        }
                    }
                } else {
                    hts_log_warning("Ignored @SQ SN:%s : bad or missing LN tag", sn);
                    warn_if_known_stderr(fp->line.s);
                    free(sn);
                }
            } else {
                hts_log_warning("Ignored @SQ line with missing SN: tag");
                warn_if_known_stderr(fp->line.s);
            }
            sn = NULL;
        }
        else if (!valid_sam_header_type(fp->line.s)) {
            hts_log_error("Invalid header line: must start with @HD/@SQ/@RG/@PG/@CO");
            warn_if_known_stderr(fp->line.s);
            goto error;
        }

        if (kputsn(fp->line.s, fp->line.l, &str) < 0)
            goto error;

        if (kputc('\n', &str) < 0)
            goto error;

        if (fp->is_bgzf) {
            next_c = bgzf_peek(fp->fp.bgzf);
        } else {
            unsigned char nc;
            ssize_t pret = hpeek(fp->fp.hfile, &nc, 1);
            next_c = pret > 0 ? nc : pret - 1;
        }
        if (next_c < -1)
            goto error;
    }
    if (next_c != '@')
        fp->line.l = 0;

    if (ret < -1)
        goto error;

    if (!has_SQ && fp->fn_aux) {
        kstring_t line = { 0, 0, NULL };

        /* The reference index (.fai) is actually needed here */
        char *fai_fn = fp->fn_aux;
        char *fn_delim = strstr(fp->fn_aux, HTS_IDX_DELIM);
        if (fn_delim)
            fai_fn = fn_delim + strlen(HTS_IDX_DELIM);

        hFILE* f = hopen(fai_fn, "r");
        int e = 0, absent;
        if (f == NULL)
            goto error;

        while (line.l = 0, kgetline(&line, (kgets_func*) hgets, f) >= 0) {
            char* tab = strchr(line.s, '\t');
            hts_pos_t ln;

            if (tab == NULL)
                continue;

            sn = (char*)calloc(tab-line.s+1, 1);
            if (!sn) {
                e = 1;
                break;
            }
            memcpy(sn, line.s, tab-line.s);
            k = kh_put(s2i, d, sn, &absent);
            if (absent < 0) {
                e = 1;
                break;
            }

            ln = strtoll(tab, NULL, 10);

            if (!absent) {
                hts_log_warning("Duplicated sequence \"%s\" in the file \"%s\"", sn, fai_fn);
                free(sn);
                sn = NULL;
            } else {
                sn = NULL;
                if (ln >= UINT32_MAX) {
                    // Stash away ref length that
                    // doesn't fit in target_len array
                    khint_t k2;
                    int absent = -1;
                    if (!long_refs) {
                        long_refs = kh_init(s2i);
                        if (!long_refs) {
                            e = 1;
                            break;
                        }
                    }
                    k2 = kh_put(s2i, long_refs, kh_key(d, k), &absent);
                    if (absent < 0) {
                         e = 1;
                         break;
                    }
                    kh_val(long_refs, k2) = ln;
                    kh_val(d, k) = ((int64_t) (kh_size(d) - 1) << 32
                                    | UINT32_MAX);
                } else {
                    kh_val(d, k) = (int64_t) (kh_size(d) - 1) << 32 | ln;
                }
                has_SQ = 1;
            }

            e |= kputs("@SQ\tSN:", &str) < 0;
            e |= kputsn(line.s, tab - line.s, &str) < 0;
            e |= kputs("\tLN:", &str) < 0;
            e |= kputll(ln, &str) < 0;
            e |= kputc('\n', &str) < 0;
            if (e)
                break;
        }

        ks_free(&line);
        if (hclose(f) != 0) {
            hts_log_error("Error on closing %s", fai_fn);
            e = 1;
        }
        if (e)
            goto error;
    }

    if (has_SQ) {
        // Populate the targets array
        h->n_targets = kh_size(d);

        h->target_name = (char**) malloc(sizeof(char*) * h->n_targets);
        if (!h->target_name) {
            h->n_targets = 0;
            goto error;
        }

        h->target_len = (uint32_t*) malloc(sizeof(uint32_t) * h->n_targets);
        if (!h->target_len) {
            h->n_targets = 0;
            goto error;
        }

        for (k = kh_begin(d); k != kh_end(d); ++k) {
            if (!kh_exist(d, k))
                continue;

            h->target_name[kh_val(d, k) >> 32] = (char*) kh_key(d, k);
            h->target_len[kh_val(d, k) >> 32] = kh_val(d, k) & 0xffffffffUL;
            kh_val(d, k) >>= 32;
        }
    }

    // Repurpose sdict to hold any references longer than UINT32_MAX
    h->sdict = long_refs;

    kh_destroy(s2i, d);

    if (str.l == 0)
        kputsn("", 0, &str);
    h->l_text = str.l;
    h->text = ks_release(&str);
    fp->bam_header = sam_hdr_sanitise(h);
    fp->bam_header->ref_count = 1;

    return fp->bam_header;

 error:
    if (h && d && (!h->target_name || !h->target_len)) {
        for (k = kh_begin(d); k != kh_end(d); ++k)
            if (kh_exist(d, k)) free((void *)kh_key(d, k));
    }
    sam_hdr_destroy(h);
    ks_free(&str);
    kh_destroy(s2i, d);
    kh_destroy(s2i, long_refs);
    if (sn) free(sn);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
leaq -0x28(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4250
callq 0x31e20
movq %rax, -0x38(%rbp)
movq $0x0, -0x50(%rbp)
callq 0x17390
movq %rax, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x37c8f
cmpq $0x0, -0x58(%rbp)
jne 0x37c94
jmp 0x3880b
movl $0x0, -0x68(%rbp)
movl $0x40, -0x6c(%rbp)
xorl %eax, %eax
cmpl $0x40, -0x6c(%rbp)
movb %al, -0xe9(%rbp)
jne 0x37cd5
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x10, %rdx
movl $0x2, %esi
callq 0x1dfd0
movl %eax, -0x64(%rbp)
cmpl $0x0, %eax
setge %al
movb %al, -0xe9(%rbp)
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x37ce4
jmp 0x381fa
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movsbl (%rax), %eax
cmpl $0x40, %eax
je 0x37cf9
jmp 0x381fa
movq -0x10(%rbp), %rax
cmpq $0x3, 0x10(%rax)
jbe 0x380f6
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0xba9d4(%rip), %rsi     # 0xf26eb
movl $0x3, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x380f6
movl $0x1, -0x68(%rbp)
movq $-0x1, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
addq $0x4, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq 0xba12f(%rip), %rsi     # 0xf1e83
movl $0x3, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x37e47
movq -0x40(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0xea(%rbp)
je 0x37db6
movq -0x48(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0xea(%rbp)
je 0x37db6
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0xea(%rbp)
movb -0xea(%rbp), %al
testb $0x1, %al
jne 0x37dc2
jmp 0x37dd2
jmp 0x37dc4
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x37d7b
cmpq $0x0, -0x50(%rbp)
je 0x37dfc
movl $0x3, %edi
leaq 0xba90a(%rip), %rsi     # 0xf26ef
leaq 0xba912(%rip), %rdx     # 0xf26fe
movb $0x0, %al
callq 0x1b030
movq -0x50(%rbp), %rdi
callq 0x45a0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rax
subq %rax, %rdi
addq $0x1, %rdi
movl $0x1, %esi
callq 0x42f0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x37e25
jmp 0x3880b
movq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rax
subq %rax, %rdx
callq 0x4240
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x37ebb
movq -0x40(%rbp), %rdi
leaq 0xba036(%rip), %rsi     # 0xf1e88
movl $0x3, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x37eb9
movq -0x40(%rbp), %rdi
addq $0x3, %rdi
leaq -0x40(%rbp), %rsi
movl $0xa, %edx
callq 0x40a0
movq %rax, -0x80(%rbp)
cmpq $-0x1, -0x78(%rbp)
je 0x37eaf
movq -0x78(%rbp), %rax
cmpq -0x80(%rbp), %rax
je 0x37eaf
movq -0x50(%rbp), %rcx
movl $0x1, %edi
leaq 0xba853(%rip), %rsi     # 0xf26ef
leaq 0xba884(%rip), %rdx     # 0xf2727
movb $0x0, %al
callq 0x1b030
jmp 0x3880b
movq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x37eb9
jmp 0x37ebb
jmp 0x37ebd
movq -0x40(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0xeb(%rbp)
je 0x37ef8
movq -0x40(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0xeb(%rbp)
je 0x37ef8
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0xeb(%rbp)
movb -0xeb(%rbp), %al
testb $0x1, %al
jne 0x37f04
jmp 0x37f12
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x37ebd
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x37f2a
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x37f2c
jmp 0x37f3f
jmp 0x37f2e
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x37d49
cmpq $0x0, -0x50(%rbp)
je 0x380c5
cmpq $0x0, -0x78(%rbp)
jl 0x3808f
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
leaq -0x84(%rbp), %rdx
callq 0x17b30
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x84(%rbp)
jge 0x37f7a
jmp 0x3880b
cmpl $0x0, -0x84(%rbp)
jne 0x37fb7
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %r8
movl $0x3, %edi
leaq 0xba754(%rip), %rsi     # 0xf26ef
leaq 0xba7d0(%rip), %rdx     # 0xf2772
movb $0x0, %al
callq 0x1b030
movq -0x50(%rbp), %rdi
callq 0x45a0
jmp 0x3808d
movq $0x0, -0x50(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x78(%rbp)
jl 0x38066
cmpq $0x0, -0x60(%rbp)
jne 0x37fec
callq 0x17390
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x37fea
jmp 0x3880b
jmp 0x37fec
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
leaq -0x84(%rbp), %rdx
callq 0x17b30
movl %eax, -0x88(%rbp)
cmpl $0x0, -0x84(%rbp)
jge 0x3801f
jmp 0x3880b
movq -0x78(%rbp), %rdx
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x88(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x20, %rdx
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
orq %rax, %rdx
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x3808b
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x20, %rdx
orq -0x78(%rbp), %rdx
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x3808d
jmp 0x380c3
movq -0x50(%rbp), %rcx
movl $0x3, %edi
leaq 0xba650(%rip), %rsi     # 0xf26ef
leaq 0xba6f2(%rip), %rdx     # 0xf2798
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x455f0
movq -0x50(%rbp), %rdi
callq 0x45a0
jmp 0x380ec
movl $0x3, %edi
leaq 0xba61e(%rip), %rsi     # 0xf26ef
leaq 0xba6ea(%rip), %rdx     # 0xf27c2
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x455f0
movq $0x0, -0x50(%rbp)
jmp 0x38136
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x45690
cmpl $0x0, %eax
jne 0x38134
movl $0x1, %edi
leaq 0xba5db(%rip), %rsi     # 0xf26ef
leaq 0xba6cd(%rip), %rdx     # 0xf27e8
movb $0x0, %al
callq 0x1b030
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x455f0
jmp 0x3880b
jmp 0x38136
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x28(%rbp), %rdx
callq 0x38ef0
cmpl $0x0, %eax
jge 0x38159
jmp 0x3880b
movl $0xa, %edi
leaq -0x28(%rbp), %rsi
callq 0x39080
cmpl $0x0, %eax
jge 0x38171
jmp 0x3880b
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x38194
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xe8c0
movl %eax, -0x6c(%rbp)
jmp 0x381ea
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdi
leaq -0x89(%rbp), %rsi
movl $0x1, %edx
callq 0x140b0
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x98(%rbp)
jle 0x381ce
movzbl -0x89(%rbp), %eax
movq %rax, -0xf8(%rbp)
jmp 0x381e0
movq -0x98(%rbp), %rax
subq $0x1, %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movl %eax, -0x6c(%rbp)
cmpl $-0x1, -0x6c(%rbp)
jge 0x381f5
jmp 0x3880b
jmp 0x37ca2
cmpl $0x40, -0x6c(%rbp)
je 0x3820c
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
cmpl $-0x1, -0x64(%rbp)
jge 0x38217
jmp 0x3880b
cmpl $0x0, -0x68(%rbp)
jne 0x38636
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x38636
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4250
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
leaq 0xb7eb7(%rip), %rsi     # 0xf0118
callq 0x40c0
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0x38289
movq -0xc0(%rbp), %rax
addq $0x7, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
leaq 0xba85a(%rip), %rsi     # 0xf2af1
movb $0x0, %al
callq 0x158b0
movq %rax, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
cmpq $0x0, -0xc8(%rbp)
jne 0x382be
jmp 0x3880b
jmp 0x382c0
movq $0x0, -0xb0(%rbp)
movq -0xc8(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
leaq -0x242e0(%rip), %rsi    # 0x14000
callq 0xb600
cmpl $0x0, %eax
jl 0x385de
movq -0xa0(%rbp), %rdi
movl $0x9, %esi
callq 0x4170
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
jne 0x38312
jmp 0x382c0
movq -0xd8(%rbp), %rdi
movq -0xa0(%rbp), %rax
subq %rax, %rdi
addq $0x1, %rdi
movl $0x1, %esi
callq 0x42f0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x3834b
movl $0x1, -0xcc(%rbp)
jmp 0x385de
movq -0x50(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq -0xa0(%rbp), %rax
subq %rax, %rdx
callq 0x43b0
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x17b30
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0xd0(%rbp)
jge 0x3839b
movl $0x1, -0xcc(%rbp)
jmp 0x385de
movq -0xd8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x40a0
movq %rax, -0xe0(%rbp)
cmpl $0x0, -0xd0(%rbp)
jne 0x383fb
movq -0x50(%rbp), %rcx
movq -0xb8(%rbp), %r8
movl $0x3, %edi
leaq 0xba318(%rip), %rsi     # 0xf26ef
leaq 0xba443(%rip), %rdx     # 0xf2821
movb $0x0, %al
callq 0x1b030
movq -0x50(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x50(%rbp)
jmp 0x384fc
movq $0x0, -0x50(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0xe0(%rbp)
jl 0x384cd
movl $0xffffffff, -0xe8(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, -0x60(%rbp)
jne 0x38447
callq 0x17390
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x38445
movl $0x1, -0xcc(%rbp)
jmp 0x385de
jmp 0x38447
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
leaq -0xe8(%rbp), %rdx
callq 0x17b30
movl %eax, -0xe4(%rbp)
cmpl $0x0, -0xe8(%rbp)
jge 0x38484
movl $0x1, -0xcc(%rbp)
jmp 0x385de
movq -0xe0(%rbp), %rdx
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rax
movl -0xe4(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x20, %rdx
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
orq %rax, %rdx
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x384f5
movq -0x58(%rbp), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x20, %rdx
orq -0xe0(%rbp), %rdx
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl $0x1, -0x68(%rbp)
leaq 0xb997c(%rip), %rdi     # 0xf1e7f
leaq -0x28(%rbp), %rsi
callq 0x38fa0
cmpl $0x0, %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
orl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0xa0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0xa0(%rbp), %rax
subq %rax, %rsi
leaq -0x28(%rbp), %rdx
callq 0x38ef0
cmpl $0x0, %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
orl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
leaq 0xb9925(%rip), %rdi     # 0xf1e87
leaq -0x28(%rbp), %rsi
callq 0x38fa0
cmpl $0x0, %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
orl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0xe0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x457a0
cmpl $0x0, %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
orl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movl $0xa, %edi
leaq -0x28(%rbp), %rsi
callq 0x39080
cmpl $0x0, %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
orl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
cmpl $0x0, -0xcc(%rbp)
je 0x385d9
jmp 0x385de
jmp 0x382c0
leaq -0xb0(%rbp), %rdi
callq 0x3c230
movq -0xc8(%rbp), %rdi
callq 0x14920
cmpl $0x0, %eax
je 0x38626
movq -0xb8(%rbp), %rcx
movl $0x1, %edi
leaq 0xba0e1(%rip), %rsi     # 0xf26ef
leaq 0xba236(%rip), %rdx     # 0xf284b
movb $0x0, %al
callq 0x1b030
movl $0x1, -0xcc(%rbp)
cmpl $0x0, -0xcc(%rbp)
je 0x38634
jmp 0x3880b
jmp 0x38636
cmpl $0x0, -0x68(%rbp)
je 0x38787
movq -0x58(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rax
movslq (%rax), %rdi
shlq $0x3, %rdi
callq 0x4650
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x38682
movq -0x38(%rbp), %rax
movl $0x0, (%rax)
jmp 0x3880b
movq -0x38(%rbp), %rax
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x4650
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x386b7
movq -0x38(%rbp), %rax
movl $0x0, (%rax)
jmp 0x3880b
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl (%rcx), %eax
je 0x38785
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x2c(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x386f7
jmp 0x38777
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x58(%rbp), %rcx
movq 0x20(%rcx), %rcx
movl -0x2c(%rbp), %esi
movq (%rcx,%rsi,8), %rcx
sarq $0x20, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rcx
movl -0x2c(%rbp), %eax
movl %eax, %edx
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq (%rcx,%rdx,8), %rax
movl %eax, %edx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x58(%rbp), %rcx
movq 0x20(%rcx), %rcx
movl -0x2c(%rbp), %esi
movq (%rcx,%rsi,8), %rcx
sarq $0x20, %rcx
movl %edx, (%rax,%rcx,4)
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
sarq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x386be
jmp 0x38787
movq -0x60(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x58(%rbp), %rdi
callq 0x173b0
cmpq $0x0, -0x28(%rbp)
jne 0x387b7
leaq 0xb77cb(%rip), %rdi     # 0xeff75
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdx
callq 0x38ef0
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
leaq -0x28(%rbp), %rdi
callq 0x32320
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rdi
callq 0x379b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl $0x1, 0x40(%rax)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x388c5
cmpq $0x0, -0x38(%rbp)
je 0x38889
cmpq $0x0, -0x58(%rbp)
je 0x38889
movq -0x38(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x3882f
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x38889
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl (%rcx), %eax
je 0x38887
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x2c(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x3887a
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x45a0
jmp 0x3887c
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x38836
jmp 0x38889
movq -0x38(%rbp), %rdi
callq 0x31e70
leaq -0x28(%rbp), %rdi
callq 0x3c230
movq -0x58(%rbp), %rdi
callq 0x173b0
movq -0x60(%rbp), %rdi
callq 0x173b0
cmpq $0x0, -0x50(%rbp)
je 0x388bd
movq -0x50(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)