// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/link.c
// Function: inter_link_mat_from_file
inter_link_mat_t *inter_link_mat_from_file(const char *f, cov_norm_t *cov_norm, asm_dict_t *dict, re_cuts_t *re_cuts, uint32_t resolution, uint32_t radius, uint8_t mq)
{
    uint32_t i, j, k, m, n, i0, i1, b0, b1;
    uint64_t p0, p1, pair_n, pair_c, inter_c, radius_c, noise_c;
    int64_t magic_number;
    uint8_t buffer[BUFF_SIZE * 17];
    double l0, l1, c, a, na[4], nc[4];
    inter_link_mat_t *link_mat;
    inter_link_t *link;
    FILE *fp;

    fp = fopen(f, "r");
    if (fp == NULL)
        return 0;

    m = fread(&magic_number, sizeof(int64_t), 1, fp);
    if (m != 1) bin_fread_error();
    if (!is_valid_bin_header(magic_number)) {
        fprintf(stderr, "[E::%s] not a valid BIN file\n", __func__);
        return 0;
    }
    file_seek_skip_sdict(fp);
    m = fread(&pair_n, sizeof(uint64_t), 1, fp);
    if (m != 1) bin_fread_error();

    n = dict->n;
    link_mat = inter_link_mat_init(dict, resolution, radius);
    pair_c = inter_c = radius_c = 0;

    while (pair_c < pair_n) {
        m = fread(buffer, sizeof(uint8_t), BUFF_SIZE * 17, fp);

        for (i = 0; i < m && pair_c < pair_n; i += 17, ++pair_c) {
            if (*(uint8_t *) (buffer + i + 16) < mq)
                continue;
            
            sd_coordinate_conversion(dict, *(uint32_t *) (buffer + i),     *(uint32_t *) (buffer + i + 4),  &i0, &p0, 0);
            sd_coordinate_conversion(dict, *(uint32_t *) (buffer + i + 8), *(uint32_t *) (buffer + i + 12), &i1, &p1, 0);

            if (i0 != i1 && i0 != UINT32_MAX) {
                c = cov_norm->norm[*(uint32_t *) (buffer + i)][*(uint32_t *) (buffer + i + 4) / cov_norm->w] *
                    cov_norm->norm[*(uint32_t *) (buffer + i + 8)][*(uint32_t *) (buffer + i + 12) / cov_norm->w];

                if (i0 > i1) {
                    SWAP(uint32_t, i0, i1);
                    SWAP(uint64_t, p0, p1);
                }

                link = &link_mat->links[(long) (n * 2 - i0 - 3) * i0 / 2 + i1 - 1];

                if (link->n == 0)
                    continue;

                l0 = dict->s[i0].len / 2.;
                l1 = dict->s[i1].len / 2.;
                
                if (p0 >= l0 && p1 < l1) {
                    // i0(-) -> i1(+)
                    b0 = (uint32_t) ((2 * l0 - p0) / resolution);
                    b1 = (uint32_t) ((double) p1 / resolution);
                    if (b0 < link->b0 && b1 < link->b1 && b0 + b1 < radius) {
                        k = (long) (MAX(1, b0) - 1) * link->b1 + b1;
                        // link->link[0][k] += 1.;
                        link->link[0][k] += c;
                        ++radius_c;
                    }
                } else if(p0 >= l0 && p1 >= l1) {
                    // i0(-) -> i1(-)
                    b0 = (uint32_t) ((2 * l0 - p0) / resolution);
                    b1 = (uint32_t) ((2 * l1 - p1) / resolution);
                    if (b0 < link->b0 && b1 < link->b1 && b0 + b1 < radius) {
                        k = (long) (MAX(1, b0) - 1) * link->b1 + b1;
                        // link->link[1][k] += 1.;
                        link->link[1][k] += c;
                        ++radius_c;
                    }
                } else if(p0 < l0 && p1 < l1) {
                    // i0(+) -> i1(+)
                    b0 = (uint32_t) ((double) p0 / resolution);
                    b1 = (uint32_t) ((double) p1 / resolution);
                    if (b0 < link->b0 && b1 < link->b1 && b0 + b1 < radius) {
                        k = (long) (MAX(1, b0) - 1) * link->b1 + b1;
                        // link->link[2][k] += 1.;
                        link->link[2][k] += c;
                        ++radius_c;
                    }
                } else if(p0 < l0 && p1 >= l1) {
                    // i0(+) -> i1(-)
                    b0 = (uint32_t) ((double) p0 / resolution);
                    b1 = (uint32_t) ((2 * l1 - p1) / resolution);
                    if (b0 < link->b0 && b1 < link->b1 && b0 + b1 < radius) {
                        k = (long) (MAX(1, b0) - 1) * link->b1 + b1;
                        // link->link[3][k] += 1.;
                        link->link[3][k] += c;
                        ++radius_c;
                    }
                }

                ++inter_c;
            }
        }
    }

#ifdef DEBUG
    fprintf(stderr, "[DEBUG::%s] %lu read pairs processed, %lu inter links \n", __func__, pair_c, inter_c);
    fprintf(stderr, "[DEBUG::%s] within radius %d: %lu\n", __func__, radius, radius_c);
#endif
    fclose(fp);

    // TODO normalise links by cell size
    inter_link_mat_normalise(link_mat, dict, re_cuts, resolution, radius);

    // calculate noise level
    noise_c = a = 0;
    for (i = 0; i < link_mat->n; ++i) {
        memset(nc, 0, sizeof(nc));
        memset(na, 0, sizeof(na));
        link = &link_mat->links[i];
        for (j = 0; j < link->n; ++j) {
            for (k = 0; k < 4; ++k) {
                if (link->link[k][j] >= 0) {
                    nc[k] += link->link[k][j];
                    na[k] += 1.;
                }
            }
        }
        
        j = 0;
        for (k = 1; k < 4; ++k)
            if (nc[k] < nc[j])
                j = k;
        noise_c += nc[j];
        a += na[j];
    }
    link_mat->noise = a > 0? noise_c / a : 0;
#ifdef DEBUG_NOISE
    fprintf(stderr, "[DEBUG_NOISE::%s] noise links: %lu; area: %.12f; noise estimation: %.12f\n", __func__, noise_c, a, link_mat->noise);
#endif

    return link_mat;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x11160, %rsp          # imm = 0x11160
movb 0x10(%rbp), %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x23740(%rip), %rsi     # 0x32311
callq 0x23f0
movq %rax, -0x11118(%rbp)
cmpq $0x0, -0x11118(%rbp)
jne 0xebf4
movq $0x0, -0x8(%rbp)
jmp 0xf83b
movq -0x11118(%rbp), %rcx
leaq -0x98(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x20f0
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
je 0xec21
movb $0x0, %al
callq 0x2c00
movq -0x98(%rbp), %rdi
callq 0x2bc0
cmpl $0x0, %eax
jne 0xec5e
movq 0x2a3bf(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
leaq 0x225d4(%rip), %rsi     # 0x31217
leaq 0x22ab5(%rip), %rdx     # 0x316ff
movb $0x0, %al
callq 0x22c0
movq $0x0, -0x8(%rbp)
jmp 0xf83b
movq -0x11118(%rbp), %rdi
callq 0x1bac0
movq -0x11118(%rbp), %rcx
leaq -0x70(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x20f0
movl %eax, -0x40(%rbp)
cmpl $0x1, -0x40(%rbp)
je 0xec94
movb $0x0, %al
callq 0x2c00
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0xda50
movq %rax, -0x11108(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rax
jae 0xf5a7
leaq -0x110a0(%rbp), %rdi
movq -0x11118(%rbp), %rcx
movl $0x1, %esi
movl $0x11000, %edx          # imm = 0x11000
callq 0x20f0
movl %eax, -0x40(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %ecx
xorl %eax, %eax
cmpl -0x40(%rbp), %ecx
movb %al, -0x11129(%rbp)
jae 0xed24
movq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rax
setb %al
movb %al, -0x11129(%rbp)
movb -0x11129(%rbp), %al
testb $0x1, %al
jne 0xed33
jmp 0xf5a2
movl -0x34(%rbp), %eax
movzbl -0x11090(%rbp,%rax), %eax
movzbl 0x10(%rbp), %ecx
cmpl %ecx, %eax
jge 0xed4b
jmp 0xf588
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %eax
movl -0x110a0(%rbp,%rax), %esi
movl -0x34(%rbp), %eax
movl -0x1109c(%rbp,%rax), %edx
leaq -0x48(%rbp), %rcx
leaq -0x60(%rbp), %r8
xorl %r9d, %r9d
callq 0x19980
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %eax
movl -0x11098(%rbp,%rax), %esi
movl -0x34(%rbp), %eax
movl -0x11094(%rbp,%rax), %edx
leaq -0x4c(%rbp), %rcx
leaq -0x68(%rbp), %r8
xorl %r9d, %r9d
callq 0x19980
movl -0x48(%rbp), %eax
cmpl -0x4c(%rbp), %eax
je 0xf586
cmpl $-0x1, -0x48(%rbp)
je 0xf586
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
movl -0x110a0(%rbp,%rcx), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x11140(%rbp)
movl -0x34(%rbp), %eax
movl -0x1109c(%rbp,%rax), %eax
movq -0x18(%rbp), %rcx
xorl %edx, %edx
divl 0x8(%rcx)
movl %eax, %ecx
movq -0x11140(%rbp), %rax
movl %ecx, %ecx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
movl -0x11098(%rbp,%rcx), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x11138(%rbp)
movl -0x34(%rbp), %eax
movl -0x11094(%rbp,%rax), %eax
movq -0x18(%rbp), %rcx
xorl %edx, %edx
divl 0x8(%rcx)
movl %eax, %ecx
movq -0x11138(%rbp), %rax
movl %ecx, %ecx
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x110b8(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jbe 0xee77
movl -0x48(%rbp), %eax
movl %eax, -0x1111c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x1111c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x11128(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x11128(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x11108(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x11148(%rbp)
movl -0x44(%rbp), %eax
shll %eax
subl -0x48(%rbp), %eax
subl $0x3, %eax
movl %eax, %eax
movl -0x48(%rbp), %ecx
imulq %rcx, %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x11148(%rbp), %rax
movl -0x4c(%rbp), %edx
addq %rdx, %rcx
subq $0x1, %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq %rax, -0x11110(%rbp)
movq -0x11110(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0xeedb
jmp 0xf588
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x48(%rbp), %ecx
imulq $0x58, %rcx, %rcx
movq 0x8(%rax,%rcx), %xmm0
movaps 0x222a9(%rip), %xmm2    # 0x311a0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x222ad(%rip), %xmm1    # 0x311b0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm3
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm3, %xmm0
movsd 0x226e6(%rip), %xmm3    # 0x31600
mulsd %xmm3, %xmm0
movsd %xmm0, -0x110a8(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4c(%rbp), %ecx
imulq $0x58, %rcx, %rcx
movq 0x8(%rax,%rcx), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm4
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm4, %xmm0
mulsd %xmm3, %xmm0
movsd %xmm0, -0x110b0(%rbp)
movq -0x60(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
ucomisd -0x110a8(%rbp), %xmm0
jb 0xf0d6
movaps 0x22219(%rip), %xmm0    # 0x311a0
movq -0x68(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x22218(%rip), %xmm0    # 0x311b0
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd -0x110b0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xf0d6
movsd -0x110a8(%rbp), %xmm0
movq -0x60(%rbp), %xmm3
movaps 0x221d3(%rip), %xmm2    # 0x311a0
punpckldq %xmm2, %xmm3    # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
movapd 0x221d7(%rip), %xmm1    # 0x311b0
subpd %xmm1, %xmm3
movaps %xmm3, %xmm4
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
addsd %xmm4, %xmm3
addsd %xmm0, %xmm0
subsd %xmm3, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm3
divsd %xmm3, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x50(%rbp)
movq -0x68(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x54(%rbp)
movl -0x50(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0xf0d1
movl -0x54(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0xf0d1
movl -0x50(%rbp), %eax
addl -0x54(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0xf0d1
movl $0x1, %eax
cmpl -0x50(%rbp), %eax
jbe 0xf074
movl $0x1, %eax
movl %eax, -0x1114c(%rbp)
jmp 0xf07d
movl -0x50(%rbp), %eax
movl %eax, -0x1114c(%rbp)
movl -0x1114c(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movq -0x11110(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq %rcx, %rax
movl -0x54(%rbp), %ecx
addq %rcx, %rax
movl %eax, -0x3c(%rbp)
movsd -0x110b8(%rbp), %xmm0
movq -0x11110(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x3c(%rbp), %ecx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0xf57a
movaps 0x220c3(%rip), %xmm1    # 0x311a0
movq -0x60(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x220c2(%rip), %xmm1    # 0x311b0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
ucomisd -0x110a8(%rbp), %xmm0
jb 0xf26d
movaps 0x2208e(%rip), %xmm1    # 0x311a0
movq -0x68(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x2208d(%rip), %xmm1    # 0x311b0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
ucomisd -0x110b0(%rbp), %xmm0
jb 0xf26d
movsd -0x110a8(%rbp), %xmm0
movq -0x60(%rbp), %xmm1
movaps 0x2204c(%rip), %xmm3    # 0x311a0
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x22050(%rip), %xmm2    # 0x311b0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm4
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm4, %xmm1
addsd %xmm0, %xmm0
subsd %xmm1, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x50(%rbp)
movsd -0x110b0(%rbp), %xmm0
movq -0x68(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
addsd %xmm0, %xmm0
subsd %xmm1, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x54(%rbp)
movl -0x50(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0xf268
movl -0x54(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0xf268
movl -0x50(%rbp), %eax
addl -0x54(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0xf268
movl $0x1, %eax
cmpl -0x50(%rbp), %eax
jbe 0xf20b
movl $0x1, %eax
movl %eax, -0x11150(%rbp)
jmp 0xf214
movl -0x50(%rbp), %eax
movl %eax, -0x11150(%rbp)
movl -0x11150(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movq -0x11110(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq %rcx, %rax
movl -0x54(%rbp), %ecx
addq %rcx, %rax
movl %eax, -0x3c(%rbp)
movsd -0x110b8(%rbp), %xmm0
movq -0x11110(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x3c(%rbp), %ecx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0xf578
movaps 0x21f2c(%rip), %xmm0    # 0x311a0
movq -0x60(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x21f2b(%rip), %xmm0    # 0x311b0
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd -0x110a8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xf3ec
movaps 0x21ef3(%rip), %xmm0    # 0x311a0
movq -0x68(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x21ef2(%rip), %xmm0    # 0x311b0
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd -0x110b0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xf3ec
movq -0x60(%rbp), %xmm0
movaps 0x21eb5(%rip), %xmm2    # 0x311a0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x21eb9(%rip), %xmm1    # 0x311b0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm3
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm3, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm3
divsd %xmm3, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x50(%rbp)
movq -0x68(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x54(%rbp)
movl -0x50(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0xf3e7
movl -0x54(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0xf3e7
movl -0x50(%rbp), %eax
addl -0x54(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0xf3e7
movl $0x1, %eax
cmpl -0x50(%rbp), %eax
jbe 0xf38a
movl $0x1, %eax
movl %eax, -0x11154(%rbp)
jmp 0xf393
movl -0x50(%rbp), %eax
movl %eax, -0x11154(%rbp)
movl -0x11154(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movq -0x11110(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq %rcx, %rax
movl -0x54(%rbp), %ecx
addq %rcx, %rax
movl %eax, -0x3c(%rbp)
movsd -0x110b8(%rbp), %xmm0
movq -0x11110(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x3c(%rbp), %ecx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0xf576
movaps 0x21dad(%rip), %xmm0    # 0x311a0
movq -0x60(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x21dac(%rip), %xmm0    # 0x311b0
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd -0x110a8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xf574
movaps 0x21d74(%rip), %xmm1    # 0x311a0
movq -0x68(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x21d73(%rip), %xmm1    # 0x311b0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
ucomisd -0x110b0(%rbp), %xmm0
jb 0xf574
movq -0x60(%rbp), %xmm0
movaps 0x21d3a(%rip), %xmm3    # 0x311a0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x21d3e(%rip), %xmm2    # 0x311b0
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x50(%rbp)
movsd -0x110b0(%rbp), %xmm0
movq -0x68(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
addsd %xmm0, %xmm0
subsd %xmm1, %xmm0
movl -0x2c(%rbp), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x54(%rbp)
movl -0x50(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0xf572
movl -0x54(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0xf572
movl -0x50(%rbp), %eax
addl -0x54(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0xf572
movl $0x1, %eax
cmpl -0x50(%rbp), %eax
jbe 0xf515
movl $0x1, %eax
movl %eax, -0x11158(%rbp)
jmp 0xf51e
movl -0x50(%rbp), %eax
movl %eax, -0x11158(%rbp)
movl -0x11158(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movq -0x11110(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq %rcx, %rax
movl -0x54(%rbp), %ecx
addq %rcx, %rax
movl %eax, -0x3c(%rbp)
movsd -0x110b8(%rbp), %xmm0
movq -0x11110(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x3c(%rbp), %ecx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0xf574
jmp 0xf576
jmp 0xf578
jmp 0xf57a
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0xf588
movl -0x34(%rbp), %eax
addl $0x11, %eax
movl %eax, -0x34(%rbp)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0xed03
jmp 0xecce
movq -0x11118(%rbp), %rdi
callq 0x2150
movq -0x11108(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movl -0x30(%rbp), %r8d
callq 0xf850
xorps %xmm0, %xmm0
movsd %xmm0, -0x110c0(%rbp)
movq $0x0, -0x90(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x11108(%rbp), %rcx
cmpl (%rcx), %eax
jae 0xf7c2
leaq -0x11100(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x21f0
leaq -0x110e0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x21f0
movq -0x11108(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movq %rax, -0x11110(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x11110(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jae 0xf6ec
movl $0x0, -0x3c(%rbp)
cmpl $0x4, -0x3c(%rbp)
jae 0xf6dc
movq -0x11110(%rbp), %rax
movl -0x3c(%rbp), %ecx
movq 0x20(%rax,%rcx,8), %rax
movl -0x38(%rbp), %ecx
movsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0xf6cf
movq -0x11110(%rbp), %rax
movl -0x3c(%rbp), %ecx
movq 0x20(%rax,%rcx,8), %rax
movl -0x38(%rbp), %ecx
movsd (%rax,%rcx,8), %xmm0
movl -0x3c(%rbp), %eax
addsd -0x11100(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x11100(%rbp,%rax,8)
movl -0x3c(%rbp), %eax
movsd 0x21f3b(%rip), %xmm0    # 0x315f8
addsd -0x110e0(%rbp,%rax,8), %xmm0
movsd %xmm0, -0x110e0(%rbp,%rax,8)
jmp 0xf6d1
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xf660
jmp 0xf6de
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xf646
movl $0x0, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
cmpl $0x4, -0x3c(%rbp)
jae 0xf731
movl -0x3c(%rbp), %eax
movsd -0x11100(%rbp,%rax,8), %xmm1
movl -0x38(%rbp), %eax
movsd -0x11100(%rbp,%rax,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xf724
movl -0x3c(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0xf726
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xf6fa
movl -0x38(%rbp), %eax
movsd -0x11100(%rbp,%rax,8), %xmm1
movaps 0x21a5c(%rip), %xmm2    # 0x311a0
movq -0x90(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x21a58(%rip), %xmm2    # 0x311b0
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x21e9e(%rip), %xmm1    # 0x31620
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x90(%rbp)
movl -0x38(%rbp), %eax
movsd -0x110e0(%rbp,%rax,8), %xmm0
addsd -0x110c0(%rbp), %xmm0
movsd %xmm0, -0x110c0(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xf5eb
movsd -0x110c0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xf80f
movaps 0x219c6(%rip), %xmm1    # 0x311a0
movq -0x90(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x219c2(%rip), %xmm1    # 0x311b0
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
divsd -0x110c0(%rbp), %xmm0
movsd %xmm0, -0x11160(%rbp)
jmp 0xf81c
xorps %xmm0, %xmm0
movsd %xmm0, -0x11160(%rbp)
jmp 0xf81c
movsd -0x11160(%rbp), %xmm0
movq -0x11108(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x11108(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x11160, %rsp          # imm = 0x11160
popq %rbp
retq
nopl (%rax,%rax)