// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/link.c
// Function: dump_links_from_bed_file
void dump_links_from_bed_file(const char *f, const char *fai, uint32_t ml, uint8_t mq, double q_drop, const char *out)
{
    FILE *fo;
    iostream_t *fp;
    char *line;
    char cname0[4096], cname1[4096], rname0[4096], rname1[4096];
    uint32_t s0, s1, e0, e1, i0, i1, p0, p1;
    uint8_t q, q0, q1;
    int8_t buff;
    uint64_t rec_c, pair_c, inter_c, intra_c, sd_l, n, m, max_m;
    cov_t *cov;

    khash_t(str) *hmseq; // for absent sequences
    khint_t k;
    int absent;
    hmseq = kh_init(str);

    sdict_t *dict = make_sdict_from_index(fai, ml);

    fp = iostream_open(f);
    if (fp == NULL) {
        fprintf(stderr, "[E::%s] cannot open file %s for reading\n", __func__, f);
        exit(EXIT_FAILURE);
    }

    fo = fopen(out, "w");
    if (fo == NULL) {
        fprintf(stderr, "[E::%s] cannot open file %s for writing\n", __func__, out);
        exit(EXIT_FAILURE);
    }
    write_bin_header(fo);
    sd_l = write_sequence_dictionary(fo, dict);

    rec_c = pair_c = inter_c = intra_c = 0;
    buff = 0;
    cov = cov_init(dict->n);
    n = 0;
    max_m = 0x7FFFFFFULL; // 128MB - ~1GB mem for covs

    fwrite(&pair_c, sizeof(uint64_t), 1, fo);

    while ((line = iostream_getline(fp)) != NULL) {
        if (is_empty_line(line))
            continue;
    
        if (buff == 0) {
            cname0[0] = rname0[0] = '\0';
            s0 = e0 = UINT32_MAX;
            q0 = 255;
            sscanf(line, "%s %u %u %s %hhu", cname0, &s0, &e0, rname0, &q0);
            ++buff;
        } else if (buff == 1) {
            cname1[0] = rname1[0] = '\0';
            s1 = e1 = UINT32_MAX;
            q1 = 255;
            sscanf(line, "%s %u %u %s %hhu", cname1, &s1, &e1, rname1, &q1);
            if (is_read_pair(rname0, rname1)) {
                buff = 0;

                i0 = sd_get(dict, cname0);
                i1 = sd_get(dict, cname1);
                q = MIN(q0, q1);

                if (i0 == UINT32_MAX) {
                    k = kh_put(str, hmseq, cname0, &absent);
                    if (absent) {
                        kh_key(hmseq, k) = strdup(cname0);
                        fprintf(stderr, "[W::%s] sequence \"%s\" not found \n", __func__, cname0);
                    }
                } else if (i1 == UINT32_MAX) {
                    k = kh_put(str, hmseq, cname1, &absent);
                    if (absent) {
                        kh_key(hmseq, k) = strdup(cname1);
                        fprintf(stderr, "[W::%s] sequence \"%s\" not found \n", __func__, cname1);
                    }
                } else if (q >= mq) {
                   // update read coverage
                   // fix bad alignments
                   s0 = MIN_MAX(s0, 0, dict->s[i0].len - 1);
                   e0 = MIN_MAX(e0, 0, dict->s[i0].len - 1);
                   s1 = MIN_MAX(s1, 0, dict->s[i1].len - 1);
                   e1 = MIN_MAX(e1, 0, dict->s[i1].len - 1);
                   kv_push(uint64_t, cov->p[i0], (uint64_t) s0 << 32 | (uint32_t) 1);
                   kv_push(uint64_t, cov->p[i0], (uint64_t) e0 << 32 | (uint32_t) -1);
                   kv_push(uint64_t, cov->p[i1], (uint64_t) s1 << 32 | (uint32_t) 1);
                   kv_push(uint64_t, cov->p[i1], (uint64_t) e1 << 32 | (uint32_t) -1);
                   n += 4;
                   if (n > max_m) {
                       m = pos_compression(cov); // m is the position size after compression
                       fprintf(stderr, "[I::%s] position compression n = %lu, m = %lu, max_m = %lu\n", __func__, n, m, max_m);
                       if (m > n>>1) {
                           max_m <<= 1; // increase m limit if compression ratio smaller than 0.5
                           fprintf(stderr, "[I::%s] position memory buffer expanded max_m = %lu\n", __func__, max_m);
                       }
                       n = m;
                   }

                    p0 = s0 / 2 + e0 / 2 + (s0 & 1 && e0 & 1);
                    p1 = s1 / 2 + e1 / 2 + (s1 & 1 && e1 & 1);
                    if (i0 > i1) {
                        SWAP(uint32_t, i0, i1);
                        SWAP(uint32_t, p0, p1);
                    }
                    fwrite(&i0, sizeof(uint32_t), 1, fo);
                    fwrite(&p0, sizeof(uint32_t), 1, fo);
                    fwrite(&i1, sizeof(uint32_t), 1, fo);
                    fwrite(&p1, sizeof(uint32_t), 1, fo);
                    fwrite(&q, sizeof(uint8_t), 1, fo);
                
                    if (i0 == i1)
                        ++intra_c;
                    else
                        ++inter_c;

                    ++pair_c;
                }
            } else {
                buff = 1;

                strcpy(cname0, cname1);
                s0 = s1;
                e0 = e1;
                q0 = q1;
                strcpy(rname0, rname1);
            }
        }

        if (++rec_c % 1000000 == 0)
            fprintf(stderr, "[I::%s] %lu million records processed, %lu read pairs \n", __func__, rec_c / 1000000, pair_c);
    }

    m = pos_compression(cov);
    fprintf(stderr, "[I::%s] position compression n = %lu, m = %lu, max_m = %lu\n", __func__, n, m, max_m);

    for (k = 0; k < kh_end(hmseq); ++k)
        if (kh_exist(hmseq, k))
            free((char *) kh_key(hmseq, k));
    kh_destroy(str, hmseq);

    iostream_close(fp);
    // write pair number
    fseek(fo, sizeof(uint64_t) + sd_l, SEEK_SET);
    fwrite(&pair_c, sizeof(uint64_t), 1, fo);
    fseek(fo, pair_c * 17, SEEK_CUR);

    fprintf(stderr, "[I::%s] dumped %lu read pairs from %lu records: %lu intra links + %lu inter links \n", __func__, pair_c, rec_c, intra_c, inter_c);

    // cov_t *cov = bed_cstats(f, dict);
    cov_norm_t *cov_norm = calc_cov_norms(cov, dict, q_drop);
    fwrite(&cov_norm->n, sizeof(uint64_t), 1, fo);
    fwrite(cov_norm->norm[0], sizeof(double), cov_norm->n, fo);
    cov_destroy(cov);
    cov_norm_destroy(cov_norm);

    sd_destroy(dict);
    fclose(fo);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4150, %rsp           # imm = 0x4150
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb %al, -0x15(%rbp)
movsd %xmm0, -0x20(%rbp)
movq %r8, -0x28(%rbp)
callq 0x13630
movq %rax, -0x40b8(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x17660
movq %rax, -0x40c8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2d80
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x13c64
movq 0x253ba(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x8(%rbp), %rcx
leaq 0x1d584(%rip), %rsi     # 0x311d0
leaq 0x1de97(%rip), %rdx     # 0x31aea
movb $0x0, %al
callq 0x22c0
movl $0x1, %edi
callq 0x24c0
movq -0x28(%rbp), %rdi
leaq 0x1d3a1(%rip), %rsi     # 0x31010
callq 0x23f0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x13cac
movq 0x25372(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
leaq 0x1dcb2(%rip), %rsi     # 0x31946
leaq 0x1de4f(%rip), %rdx     # 0x31aea
movb $0x0, %al
callq 0x22c0
movl $0x1, %edi
callq 0x24c0
movq -0x30(%rbp), %rdi
callq 0x2b70
movq -0x30(%rbp), %rdi
movq -0x40c8(%rbp), %rsi
callq 0x1b950
movq %rax, -0x4090(%rbp)
movq $0x0, -0x4088(%rbp)
movq $0x0, -0x4080(%rbp)
movq $0x0, -0x4078(%rbp)
movq $0x0, -0x4070(%rbp)
movb $0x0, -0x4064(%rbp)
movq -0x40c8(%rbp), %rax
movl (%rax), %edi
callq 0x1cee0
movq %rax, -0x40b0(%rbp)
movq $0x0, -0x4098(%rbp)
movq $0x7ffffff, -0x40a8(%rbp) # imm = 0x7FFFFFF
movq -0x30(%rbp), %rcx
leaq -0x4078(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x24e0
movq -0x38(%rbp), %rdi
callq 0x3000
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x14bbb
movq -0x40(%rbp), %rdi
callq 0x2d20
cmpl $0x0, %eax
je 0x13d6b
jmp 0x13d44
movsbl -0x4064(%rbp), %eax
cmpl $0x0, %eax
jne 0x13dec
movb $0x0, -0x3040(%rbp)
movb $0x0, -0x1040(%rbp)
movl $0xffffffff, -0x404c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4044(%rbp) # imm = 0xFFFFFFFF
movb $-0x1, -0x4062(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x1040(%rbp), %rdx
leaq -0x3040(%rbp), %r9
leaq 0x1dd4a(%rip), %rsi     # 0x31b03
leaq -0x4044(%rbp), %rcx
leaq -0x404c(%rbp), %r8
leaq -0x4062(%rbp), %rax
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2360
movb -0x4064(%rbp), %al
addb $0x1, %al
movb %al, -0x4064(%rbp)
jmp 0x14b5a
movsbl -0x4064(%rbp), %eax
cmpl $0x1, %eax
jne 0x14b58
movb $0x0, -0x4040(%rbp)
movb $0x0, -0x2040(%rbp)
movl $0xffffffff, -0x4050(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4048(%rbp) # imm = 0xFFFFFFFF
movb $-0x1, -0x4063(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x2040(%rbp), %rdx
leaq -0x4040(%rbp), %r9
leaq 0x1dcc5(%rip), %rsi     # 0x31b03
leaq -0x4048(%rbp), %rcx
leaq -0x4050(%rbp), %r8
leaq -0x4063(%rbp), %rax
movq %rax, (%rsp)
movb $0x0, %al
callq 0x2360
leaq -0x3040(%rbp), %rdi
leaq -0x4040(%rbp), %rsi
callq 0x29c0
cmpb $0x0, %al
je 0x14b05
movb $0x0, -0x4064(%rbp)
movq -0x40c8(%rbp), %rdi
leaq -0x1040(%rbp), %rsi
callq 0x16e10
movl %eax, -0x4054(%rbp)
movq -0x40c8(%rbp), %rdi
leaq -0x2040(%rbp), %rsi
callq 0x16e10
movl %eax, -0x4058(%rbp)
movzbl -0x4062(%rbp), %eax
movzbl -0x4063(%rbp), %ecx
cmpl %ecx, %eax
jge 0x13ed3
movzbl -0x4062(%rbp), %eax
movl %eax, -0x40dc(%rbp)
jmp 0x13ee0
movzbl -0x4063(%rbp), %eax
movl %eax, -0x40dc(%rbp)
movl -0x40dc(%rbp), %eax
movb %al, -0x4061(%rbp)
cmpl $-0x1, -0x4054(%rbp)
jne 0x13f6d
movq -0x40b8(%rbp), %rdi
leaq -0x1040(%rbp), %rsi
leaq -0x40c0(%rbp), %rdx
callq 0x13720
movl %eax, -0x40bc(%rbp)
cmpl $0x0, -0x40c0(%rbp)
je 0x13f68
leaq -0x1040(%rbp), %rdi
callq 0x2520
movq %rax, %rdx
movq -0x40b8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x40bc(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq 0x250af(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
leaq -0x1040(%rbp), %rcx
leaq 0x1da15(%rip), %rsi     # 0x3196f
leaq 0x1db89(%rip), %rdx     # 0x31aea
movb $0x0, %al
callq 0x22c0
jmp 0x14b03
cmpl $-0x1, -0x4058(%rbp)
jne 0x13fee
movq -0x40b8(%rbp), %rdi
leaq -0x2040(%rbp), %rsi
leaq -0x40c0(%rbp), %rdx
callq 0x13720
movl %eax, -0x40bc(%rbp)
cmpl $0x0, -0x40c0(%rbp)
je 0x13fe9
leaq -0x2040(%rbp), %rdi
callq 0x2520
movq %rax, %rdx
movq -0x40b8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x40bc(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq 0x2502e(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
leaq -0x2040(%rbp), %rcx
leaq 0x1d994(%rip), %rsi     # 0x3196f
leaq 0x1db08(%rip), %rdx     # 0x31aea
movb $0x0, %al
callq 0x22c0
jmp 0x14b01
movzbl -0x4061(%rbp), %eax
movzbl -0x15(%rbp), %ecx
cmpl %ecx, %eax
jl 0x14aff
cmpl $0x0, -0x4044(%rbp)
jbe 0x14018
movl -0x4044(%rbp), %eax
movl %eax, -0x40e0(%rbp)
jmp 0x14022
xorl %eax, %eax
movl %eax, -0x40e0(%rbp)
jmp 0x14022
movl -0x40e0(%rbp), %eax
movq -0x40c8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x4054(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x14079
cmpl $0x0, -0x4044(%rbp)
jbe 0x14061
movl -0x4044(%rbp), %eax
movl %eax, -0x40e4(%rbp)
jmp 0x1406b
xorl %eax, %eax
movl %eax, -0x40e4(%rbp)
jmp 0x1406b
movl -0x40e4(%rbp), %eax
movl %eax, -0x40e8(%rbp)
jmp 0x1409d
movq -0x40c8(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x40e8(%rbp)
movl -0x40e8(%rbp), %eax
movl %eax, -0x4044(%rbp)
cmpl $0x0, -0x404c(%rbp)
jbe 0x140c0
movl -0x404c(%rbp), %eax
movl %eax, -0x40ec(%rbp)
jmp 0x140ca
xorl %eax, %eax
movl %eax, -0x40ec(%rbp)
jmp 0x140ca
movl -0x40ec(%rbp), %eax
movq -0x40c8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x4054(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x14121
cmpl $0x0, -0x404c(%rbp)
jbe 0x14109
movl -0x404c(%rbp), %eax
movl %eax, -0x40f0(%rbp)
jmp 0x14113
xorl %eax, %eax
movl %eax, -0x40f0(%rbp)
jmp 0x14113
movl -0x40f0(%rbp), %eax
movl %eax, -0x40f4(%rbp)
jmp 0x14145
movq -0x40c8(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x40f4(%rbp)
movl -0x40f4(%rbp), %eax
movl %eax, -0x404c(%rbp)
cmpl $0x0, -0x4048(%rbp)
jbe 0x14168
movl -0x4048(%rbp), %eax
movl %eax, -0x40f8(%rbp)
jmp 0x14172
xorl %eax, %eax
movl %eax, -0x40f8(%rbp)
jmp 0x14172
movl -0x40f8(%rbp), %eax
movq -0x40c8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x4058(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x141c9
cmpl $0x0, -0x4048(%rbp)
jbe 0x141b1
movl -0x4048(%rbp), %eax
movl %eax, -0x40fc(%rbp)
jmp 0x141bb
xorl %eax, %eax
movl %eax, -0x40fc(%rbp)
jmp 0x141bb
movl -0x40fc(%rbp), %eax
movl %eax, -0x4100(%rbp)
jmp 0x141ed
movq -0x40c8(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x4100(%rbp)
movl -0x4100(%rbp), %eax
movl %eax, -0x4048(%rbp)
cmpl $0x0, -0x4050(%rbp)
jbe 0x14210
movl -0x4050(%rbp), %eax
movl %eax, -0x4104(%rbp)
jmp 0x1421a
xorl %eax, %eax
movl %eax, -0x4104(%rbp)
jmp 0x1421a
movl -0x4104(%rbp), %eax
movq -0x40c8(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x4058(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x14271
cmpl $0x0, -0x4050(%rbp)
jbe 0x14259
movl -0x4050(%rbp), %eax
movl %eax, -0x4108(%rbp)
jmp 0x14263
xorl %eax, %eax
movl %eax, -0x4108(%rbp)
jmp 0x14263
movl -0x4108(%rbp), %eax
movl %eax, -0x410c(%rbp)
jmp 0x14295
movq -0x40c8(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
movl %eax, -0x410c(%rbp)
movl -0x410c(%rbp), %eax
movl %eax, -0x4050(%rbp)
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x40b0(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x4054(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0x143b6
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x14325
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x4118(%rbp)
jmp 0x14333
movl $0x2, %eax
movq %rax, -0x4118(%rbp)
jmp 0x14333
movq -0x4118(%rbp), %rcx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x23a0
movq %rax, %rcx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x4044(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
orq $0x1, %rdx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x40b0(%rbp), %rcx
movq 0x8(%rcx), %rsi
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x1440d
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x40b0(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x4054(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0x14522
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x14491
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x4120(%rbp)
jmp 0x1449f
movl $0x2, %eax
movq %rax, -0x4120(%rbp)
jmp 0x1449f
movq -0x4120(%rbp), %rcx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x23a0
movq %rax, %rcx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x404c(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
orq %rax, %rdx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x40b0(%rbp), %rcx
movq 0x8(%rcx), %rsi
movl -0x4054(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x14582
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x40b0(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x4058(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0x14697
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x14606
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x4128(%rbp)
jmp 0x14614
movl $0x2, %eax
movq %rax, -0x4128(%rbp)
jmp 0x14614
movq -0x4128(%rbp), %rcx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x23a0
movq %rax, %rcx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x4048(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
orq $0x1, %rdx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x40b0(%rbp), %rcx
movq 0x8(%rcx), %rsi
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x146ee
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x40b0(%rbp), %rcx
movq 0x8(%rcx), %rcx
movl -0x4058(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0x14803
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x14772
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x4130(%rbp)
jmp 0x14780
movl $0x2, %eax
movq %rax, -0x4130(%rbp)
jmp 0x14780
movq -0x4130(%rbp), %rcx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x23a0
movq %rax, %rcx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movl -0x4050(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
orq %rax, %rdx
movq -0x40b0(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x40b0(%rbp), %rcx
movq 0x8(%rcx), %rsi
movl -0x4058(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
movq -0x4098(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x4098(%rbp)
movq -0x4098(%rbp), %rax
cmpq -0x40a8(%rbp), %rax
jbe 0x14929
movq -0x40b0(%rbp), %rdi
callq 0x1d050
movq %rax, -0x40a0(%rbp)
movq 0x24757(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x4098(%rbp), %rcx
movq -0x40a0(%rbp), %r8
movq -0x40a8(%rbp), %r9
leaq 0x1d0d1(%rip), %rsi     # 0x31991
leaq 0x1d223(%rip), %rdx     # 0x31aea
movb $0x0, %al
callq 0x22c0
movq -0x40a0(%rbp), %rax
movq -0x4098(%rbp), %rcx
shrq %rcx
cmpq %rcx, %rax
jbe 0x1491b
movq -0x40a8(%rbp), %rax
shlq %rax
movq %rax, -0x40a8(%rbp)
movq 0x246fc(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x40a8(%rbp), %rcx
leaq 0x1d0c0(%rip), %rsi     # 0x319cd
leaq 0x1d1d6(%rip), %rdx     # 0x31aea
movb $0x0, %al
callq 0x22c0
movq -0x40a0(%rbp), %rax
movq %rax, -0x4098(%rbp)
movl -0x4044(%rbp), %eax
shrl %eax
movl -0x404c(%rbp), %ecx
shrl %ecx
addl %ecx, %eax
movl %eax, -0x4138(%rbp)
movl -0x4044(%rbp), %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x4131(%rbp)
je 0x1496c
movl -0x404c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x4131(%rbp)
movl -0x4138(%rbp), %eax
movb -0x4131(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x405c(%rbp)
movl -0x4048(%rbp), %eax
shrl %eax
movl -0x4050(%rbp), %ecx
shrl %ecx
addl %ecx, %eax
movl %eax, -0x4140(%rbp)
movl -0x4048(%rbp), %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x4139(%rbp)
je 0x149c9
movl -0x4050(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x4139(%rbp)
movl -0x4140(%rbp), %eax
movb -0x4139(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x4060(%rbp)
movl -0x4054(%rbp), %eax
cmpl -0x4058(%rbp), %eax
jbe 0x14a39
movl -0x4054(%rbp), %eax
movl %eax, -0x40cc(%rbp)
movl -0x4058(%rbp), %eax
movl %eax, -0x4054(%rbp)
movl -0x40cc(%rbp), %eax
movl %eax, -0x4058(%rbp)
movl -0x405c(%rbp), %eax
movl %eax, -0x40d0(%rbp)
movl -0x4060(%rbp), %eax
movl %eax, -0x405c(%rbp)
movl -0x40d0(%rbp), %eax
movl %eax, -0x4060(%rbp)
movq -0x30(%rbp), %rcx
leaq -0x4054(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x24e0
movq -0x30(%rbp), %rcx
leaq -0x405c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x24e0
movq -0x30(%rbp), %rcx
leaq -0x4058(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x24e0
movq -0x30(%rbp), %rcx
leaq -0x4060(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x24e0
movq -0x30(%rbp), %rcx
leaq -0x4061(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x24e0
movl -0x4054(%rbp), %eax
cmpl -0x4058(%rbp), %eax
jne 0x14adb
movq -0x4088(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4088(%rbp)
jmp 0x14aed
movq -0x4080(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4080(%rbp)
movq -0x4078(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4078(%rbp)
jmp 0x14b01
jmp 0x14b03
jmp 0x14b56
movb $0x1, -0x4064(%rbp)
leaq -0x1040(%rbp), %rdi
leaq -0x2040(%rbp), %rsi
callq 0x20b0
movl -0x4048(%rbp), %eax
movl %eax, -0x4044(%rbp)
movl -0x4050(%rbp), %eax
movl %eax, -0x404c(%rbp)
movb -0x4063(%rbp), %al
movb %al, -0x4062(%rbp)
leaq -0x3040(%rbp), %rdi
leaq -0x4040(%rbp), %rsi
callq 0x20b0
jmp 0x14b58
jmp 0x14b5a
movq -0x4070(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4070(%rbp)
movl $0xf4240, %ecx          # imm = 0xF4240
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
jne 0x14bb6
movq 0x24475(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x4070(%rbp), %rax
movl $0xf4240, %ecx          # imm = 0xF4240
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq -0x4078(%rbp), %r8
leaq 0x1ce5a(%rip), %rsi     # 0x31a02
leaq 0x1cf3b(%rip), %rdx     # 0x31aea
movb $0x0, %al
callq 0x22c0
jmp 0x13d44
movq -0x40b0(%rbp), %rdi
callq 0x1d050
movq %rax, -0x40a0(%rbp)
movq 0x24423(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x4098(%rbp), %rcx
movq -0x40a0(%rbp), %r8
movq -0x40a8(%rbp), %r9
leaq 0x1cd9d(%rip), %rsi     # 0x31991
leaq 0x1ceef(%rip), %rdx     # 0x31aea
movb $0x0, %al
callq 0x22c0
movl $0x0, -0x40bc(%rbp)
movl -0x40bc(%rbp), %eax
movq -0x40b8(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x14c78
movq -0x40b8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x40bc(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x40bc(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x14c65
movq -0x40b8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x40bc(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x2050
jmp 0x14c67
movl -0x40bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40bc(%rbp)
jmp 0x14c0c
movq -0x40b8(%rbp), %rdi
callq 0x13b80
movq -0x38(%rbp), %rdi
callq 0x2f20
movq -0x30(%rbp), %rdi
movq -0x4090(%rbp), %rsi
addq $0x8, %rsi
xorl %edx, %edx
callq 0x2380
movq -0x30(%rbp), %rcx
leaq -0x4078(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x24e0
movq -0x30(%rbp), %rdi
imulq $0x11, -0x4078(%rbp), %rsi
movl $0x1, %edx
callq 0x2380
movq 0x2431e(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq -0x4078(%rbp), %rcx
movq -0x4070(%rbp), %r8
movq -0x4088(%rbp), %r9
movq -0x4080(%rbp), %rax
leaq 0x1cd96(%rip), %rsi     # 0x31a96
leaq 0x1cde3(%rip), %rdx     # 0x31aea
movq %rax, (%rsp)
movb $0x0, %al
callq 0x22c0
movq -0x40b0(%rbp), %rdi
movq -0x40c8(%rbp), %rsi
movsd -0x20(%rbp), %xmm0
callq 0x1ea90
movq %rax, -0x40d8(%rbp)
movq -0x40d8(%rbp), %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x24e0
movq -0x40d8(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq -0x40d8(%rbp), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rcx
movl $0x8, %esi
callq 0x24e0
movq -0x40b0(%rbp), %rdi
callq 0x1cf90
movq -0x40d8(%rbp), %rdi
callq 0x1d000
movq -0x40c8(%rbp), %rdi
callq 0x16650
movq -0x30(%rbp), %rdi
callq 0x2150
addq $0x4150, %rsp           # imm = 0x4150
popq %rbp
retq
nopw (%rax,%rax)