// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x110e8, %rsp          # imm = 0x110E8
movl %r9d, 0xc(%rsp)
movl %r8d, %ebp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, 0x70(%rsp)
leaq 0x15532(%rip), %rsi     # 0x23449
callq 0x23e0
testq %rax, %rax
je 0xe8a2
movq %rax, %r15
leaq 0x90(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x20f0
cmpl $0x1, %eax
je 0xdf4e
xorl %eax, %eax
callq 0x4b91
movq 0x90(%rsp), %rdi
callq 0x4b7e
testl %eax, %eax
je 0xe89d
movq %rbx, 0x68(%rsp)
movq %r15, %rdi
callq 0x166b8
leaq 0x98(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rcx
callq 0x20f0
cmpl $0x1, %eax
je 0xdf96
xorl %eax, %eax
callq 0x4b91
movl (%r14), %ebx
movq %r14, 0x38(%rsp)
movq %r14, %rdi
movl %ebp, %esi
movl 0xc(%rsp), %edx
callq 0xd1de
movq %rax, 0x58(%rsp)
movq 0x98(%rsp), %rcx
movl %ebp, 0x1c(%rsp)
movl %ebp, %eax
movq %rax, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
testq %rcx, %rcx
je 0xe377
leal -0x3(,%rbx,2), %eax
movl %eax, 0x50(%rsp)
cvtsi2sdq 0x28(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
xorl %r14d, %r14d
movq %r15, 0x40(%rsp)
movl $0x1, %esi
movl $0x11000, %edx          # imm = 0x11000
leaq 0xe0(%rsp), %rdi
movq %r15, %rcx
callq 0x20f0
movq %rax, %rbx
testl %ebx, %ebx
je 0xe367
movl $0x11, %r12d
leal -0x11(%r12), %r13d
movb 0x11120(%rsp), %al
cmpb %al, 0xf0(%rsp,%r13)
jb 0xe350
movl 0xe0(%rsp,%r13), %esi
movl 0xe4(%rsp,%r13), %edx
movq 0x38(%rsp), %r15
movq %r15, %rdi
movq %rsi, 0x78(%rsp)
movl %edx, 0x30(%rsp)
leaq 0x4c(%rsp), %rcx
leaq 0x80(%rsp), %r8
xorl %r9d, %r9d
callq 0x14b8d
movl 0xe8(%rsp,%r13), %ebp
movl 0xec(%rsp,%r13), %r13d
movq %r15, %rdi
movl %ebp, %esi
movl %r13d, %edx
leaq 0x48(%rsp), %rcx
leaq 0x60(%rsp), %r8
xorl %r9d, %r9d
callq 0x14b8d
movl 0x4c(%rsp), %esi
movl 0x48(%rsp), %ecx
cmpl %ecx, %esi
sete %al
cmpl $-0x1, %esi
sete %dl
orb %al, %dl
jne 0xe350
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x78(%rsp), %rdx
movq (%rdi,%rdx,8), %r8
movl 0x8(%rax), %r9d
movl 0x30(%rsp), %eax
xorl %edx, %edx
divl %r9d
movsd (%r8,%rax,8), %xmm0
movq (%rdi,%rbp,8), %rdi
movl %r13d, %eax
xorl %edx, %edx
divl %r9d
mulsd (%rdi,%rax,8), %xmm0
cmpl %ecx, %esi
jbe 0xe112
movl %ecx, 0x4c(%rsp)
movl %esi, 0x48(%rsp)
movq 0x80(%rsp), %rax
movq 0x60(%rsp), %rdx
movq %rdx, 0x80(%rsp)
movq %rax, 0x60(%rsp)
movl %esi, %edi
jmp 0xe116
movl %ecx, %edi
movl %esi, %ecx
movq 0x58(%rsp), %rsi
movl 0x50(%rsp), %eax
subl %ecx, %eax
movl %ecx, %edx
imulq %rdx, %rax
movl %edi, %ecx
shlq $0x6, %rax
andq $-0x80, %rax
addq 0x10(%rsi), %rax
movq %rcx, %rsi
shlq $0x7, %rsi
cmpl $0x0, -0x6c(%rsi,%rax)
je 0xe350
addq %rsi, %rax
movq 0x38(%rsp), %rsi
movq 0x8(%rsi), %rsi
imulq $0x58, %rdx, %rdx
movsd 0x8(%rsi,%rdx), %xmm1
movsd 0x1407b(%rip), %xmm5    # 0x221e0
unpcklps %xmm5, %xmm1            # xmm1 = xmm1[0],xmm5[0],xmm1[1],xmm5[1]
movapd 0x14080(%rip), %xmm6    # 0x221f0
subpd %xmm6, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
movsd 0x14090(%rip), %xmm4    # 0x22218
mulsd %xmm4, %xmm2
imulq $0x58, %rcx, %rcx
movsd 0x8(%rsi,%rcx), %xmm3
unpcklps %xmm5, %xmm3            # xmm3 = xmm3[0],xmm5[0],xmm3[1],xmm5[1]
subpd %xmm6, %xmm3
movapd %xmm3, %xmm1
unpckhpd %xmm3, %xmm1            # xmm1 = xmm1[1],xmm3[1]
addsd %xmm3, %xmm1
mulsd %xmm4, %xmm1
movsd 0x80(%rsp), %xmm4
unpcklps %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
subpd %xmm6, %xmm4
movapd %xmm4, %xmm3
unpckhpd %xmm4, %xmm3            # xmm3 = xmm3[1],xmm4[1]
addsd %xmm4, %xmm3
ucomisd %xmm2, %xmm3
jae 0xe23f
ucomisd %xmm3, %xmm2
jbe 0xe350
movsd 0x60(%rsp), %xmm4
unpcklps 0x13ffa(%rip), %xmm4    # xmm4 = xmm4[0],mem[0],xmm4[1],mem[1]
subpd 0x14002(%rip), %xmm4    # 0x221f0
movapd %xmm4, %xmm2
unpckhpd %xmm4, %xmm2            # xmm2 = xmm2[1],xmm4[1]
addsd %xmm4, %xmm2
ucomisd %xmm2, %xmm1
jbe 0xe2f7
divsd 0x10(%rsp), %xmm3
cvttsd2si %xmm3, %rcx
cmpl %ecx, -0x78(%rax)
jbe 0xe350
divsd 0x10(%rsp), %xmm2
cvttsd2si %xmm2, %rdx
leal (%rdx,%rcx), %esi
cmpl 0xc(%rsp), %esi
jae 0xe350
movl -0x74(%rax), %esi
movq $-0x50, %rdi
jmp 0xe333
movsd 0x60(%rsp), %xmm5
unpcklps 0x13f94(%rip), %xmm5    # xmm5 = xmm5[0],mem[0],xmm5[1],mem[1]
subpd 0x13f9c(%rip), %xmm5    # 0x221f0
movapd %xmm5, %xmm4
unpckhpd %xmm5, %xmm4            # xmm4 = xmm4[1],xmm5[1]
addsd %xmm5, %xmm4
ucomisd %xmm4, %xmm1
jbe 0xe2a9
addsd %xmm2, %xmm2
subsd %xmm3, %xmm2
divsd 0x10(%rsp), %xmm2
cvttsd2si %xmm2, %rcx
cmpl %ecx, -0x78(%rax)
jbe 0xe350
divsd 0x10(%rsp), %xmm4
cvttsd2si %xmm4, %rdx
leal (%rdx,%rcx), %esi
cmpl 0xc(%rsp), %esi
jae 0xe350
movl -0x74(%rax), %esi
movq $-0x60, %rdi
jmp 0xe333
ucomisd %xmm1, %xmm4
jb 0xe1cf
addsd %xmm2, %xmm2
subsd %xmm3, %xmm2
divsd 0x10(%rsp), %xmm2
cvttsd2si %xmm2, %rcx
cmpl %ecx, -0x78(%rax)
jbe 0xe350
addsd %xmm1, %xmm1
subsd %xmm4, %xmm1
divsd 0x10(%rsp), %xmm1
cvttsd2si %xmm1, %rdx
leal (%rdx,%rcx), %esi
cmpl 0xc(%rsp), %esi
jae 0xe350
movl -0x74(%rax), %esi
movq $-0x58, %rdi
jmp 0xe333
ucomisd %xmm1, %xmm2
jb 0xe350
divsd 0x10(%rsp), %xmm3
cvttsd2si %xmm3, %rcx
cmpl %ecx, -0x78(%rax)
jbe 0xe350
addsd %xmm1, %xmm1
subsd %xmm2, %xmm1
divsd 0x10(%rsp), %xmm1
cvttsd2si %xmm1, %rdx
leal (%rdx,%rcx), %esi
cmpl 0xc(%rsp), %esi
jae 0xe350
movl -0x74(%rax), %esi
movq $-0x48, %rdi
cmpl %edx, %esi
jbe 0xe350
cmpl $0x1, %ecx
adcl $-0x1, %ecx
imull %esi, %ecx
addl %edx, %ecx
movq (%rax,%rdi), %rax
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
incq %r14
cmpl %ebx, %r12d
jae 0xe367
addl $0x11, %r12d
cmpq 0x20(%rsp), %r14
jb 0xe01d
cmpq 0x20(%rsp), %r14
movq 0x40(%rsp), %r15
jb 0xdff2
movq %r15, %rdi
callq 0x2150
movq 0x38(%rsp), %r13
movl (%r13), %r14d
movq 0x68(%rsp), %rdi
movl 0x1c(%rsp), %r12d
movl %r12d, %esi
movq %r13, %rdx
callq 0x1e208
movq %rax, %rbx
testq %r14, %r14
je 0xe6f0
movq %r14, %rax
addl %r12d, %r12d
movl %r12d, %ecx
xorps %xmm0, %xmm0
cvtsi2sdq 0x28(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
leal -0x3(%r14,%r14), %edx
movl %edx, 0x8c(%rsp)
movq 0x8(%r13), %r8
movl $0x1, %edx
movl $0x20, %esi
xorl %r9d, %r9d
movabsq $-0x10000000000001, %rbp # imm = 0xFFEFFFFFFFFFFFFF
movq %r14, 0x20(%rsp)
movl %r12d, 0x1c(%rsp)
movq %rcx, 0x30(%rsp)
imulq $0x58, %r9, %r15
movq 0x8(%r8,%r15), %rdi
cmpq %rcx, %rdi
jae 0xe411
incq %r9
movq %r9, %rdi
jmp 0xe6c0
movq %r9, 0x50(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x40(%rsp)
movl %r12d, %esi
callq 0x4b01
movl 0xc(%rsp), %ecx
movl %ecx, %r14d
cmpl %ecx, %eax
ja 0xe447
movq 0x8(%r13), %rax
movq 0x8(%rax,%r15), %rdi
movl %r12d, %esi
callq 0x4b01
movl %eax, %r14d
movq 0x8(%r13), %r8
movsd 0x8(%r8,%r15), %xmm1
unpcklps 0x13d87(%rip), %xmm1    # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x13d8f(%rip), %xmm1    # 0x221f0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x13da3(%rip), %xmm1    # 0x22218
mulsd %xmm1, %xmm0
movq 0x50(%rsp), %rdx
leaq 0x1(%rdx), %rdi
movq 0x20(%rsp), %rax
cmpq %rax, %rdi
jae 0xe6b1
movq %rdi, 0x68(%rsp)
decl %r14d
xorps %xmm1, %xmm1
cvtsi2sd %r14, %xmm1
movsd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
divsd %xmm2, %xmm0
movsd 0x141a5(%rip), %xmm8    # 0x22660
minsd %xmm0, %xmm8
movl 0x8c(%rsp), %ecx
movl %ecx, %esi
subl %edx, %esi
imulq %rdx, %rsi
shrq %rsi
shlq $0x7, %rsi
movq 0x28(%rsp), %rcx
movq %rsi, 0x70(%rsp)
leaq (%rcx,%rsi), %r15
movq 0x40(%rsp), %r12
movq 0x30(%rsp), %rcx
movsd %xmm8, 0x78(%rsp)
imulq $0x58, %r12, %r13
movq 0x8(%r8,%r13), %rdi
cmpq %rcx, %rdi
jb 0xe686
movl 0x1c(%rsp), %esi
callq 0x4b01
movl 0xc(%rsp), %edx
movl %edx, %ecx
cmpl %edx, %eax
ja 0xe533
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax,%r13), %rdi
movl 0x1c(%rsp), %esi
callq 0x4b01
movl %eax, %ecx
movq 0x38(%rsp), %rax
movq 0x8(%rax), %r8
movsd 0x8(%r8,%r13), %xmm0
unpcklps 0x13c96(%rip), %xmm0    # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x13c9e(%rip), %xmm0    # 0x221f0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x13cb2(%rip), %xmm4    # 0x22218
mulsd %xmm4, %xmm1
movq 0x58(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x70(%rsp), %rax
addq %rdi, %rax
movq %r12, %rdx
shlq $0x7, %rdx
movl -0x6c(%rdx,%rax), %r9d
testq %r9, %r9
movsd 0x140d6(%rip), %xmm6    # 0x22668
movsd 0x140de(%rip), %xmm7    # 0x22678
movsd 0x78(%rsp), %xmm8
je 0xe67c
leal -0x1(%rcx), %r10d
xorps %xmm0, %xmm0
cvtsi2sd %r10, %xmm0
movsd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd 0x14093(%rip), %xmm5    # 0x22660
movapd %xmm5, %xmm0
minsd %xmm1, %xmm0
addq %r15, %rdi
xorl %esi, %esi
movq 0x50(%rsp), %r13
movl %esi, %eax
xorl %edx, %edx
divl %ecx
movapd %xmm8, %xmm1
cmpl %r14d, %eax
je 0xe5f3
movapd %xmm5, %xmm1
cmpl %r10d, %edx
jne 0xe5fc
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm2
cmpltsd %xmm4, %xmm2
movapd %xmm5, %xmm3
testq %rbx, %rbx
je 0xe625
movq (%rbx,%r13,8), %r11
movl %eax, %eax
movsd (%r11,%rax,8), %xmm3
movq (%rbx,%r12,8), %rax
movl %edx, %edx
mulsd (%rax,%rdx,8), %xmm3
andnpd %xmm1, %xmm2
movapd %xmm3, %xmm1
cmpltsd %xmm6, %xmm1
andnpd %xmm3, %xmm1
mulsd %xmm2, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm7
jbe 0xe655
movq (%rdi,%rax,8), %rdx
movq %rbp, (%rdx,%rsi,8)
incq %rax
cmpq $0x4, %rax
jne 0xe642
jmp 0xe670
movq (%rdi,%rax,8), %rdx
movsd (%rdx,%rsi,8), %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, (%rdx,%rsi,8)
incq %rax
cmpq $0x4, %rax
jne 0xe655
incq %rsi
cmpq %r9, %rsi
jne 0xe5df
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rcx
incq %r12
subq $-0x80, %r15
cmpl %r12d, %eax
jne 0xe4f5
movl 0x1c(%rsp), %r12d
movq 0x38(%rsp), %r13
movq 0x40(%rsp), %rdx
movq 0x28(%rsp), %rsi
movq 0x68(%rsp), %rdi
jmp 0xe6c0
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rdx
movq 0x28(%rsp), %rsi
incq %rdx
subq $-0x80, %rsi
movq %rdi, %r9
cmpq %rax, %rdi
jne 0xe3f8
testq %rbx, %rbx
je 0xe6fd
xorl %r14d, %r14d
movq (%rbx,%r14,8), %rdi
callq 0x2060
incq %r14
cmpq %r14, 0x20(%rsp)
jne 0xe6db
jmp 0xe6f5
testq %rbx, %rbx
je 0xe6fd
movq %rbx, %rdi
callq 0x2060
movq 0x58(%rsp), %rax
movl (%rax), %ebx
xorpd %xmm0, %xmm0
xorpd %xmm2, %xmm2
xorpd %xmm1, %xmm1
testq %rbx, %rbx
je 0xe889
movq 0x10(%rax), %rcx
leaq 0x20(%rcx), %rdx
xorl %esi, %esi
xorpd %xmm3, %xmm3
movq 0x13ab1(%rip), %xmm4    # 0x221e0
movapd 0x13ab9(%rip), %xmm5    # 0x221f0
movsd 0x13f41(%rip), %xmm6    # 0x22680
movsd 0x13f19(%rip), %xmm7    # 0x22660
xorl %edi, %edi
movapd %xmm3, 0xb0(%rsp)
movapd %xmm3, 0xa0(%rsp)
movapd %xmm3, 0xc0(%rsp)
movapd %xmm3, 0xd0(%rsp)
movq %rsi, %r8
shlq $0x7, %r8
movl 0x14(%rcx,%r8), %r8d
testq %r8, %r8
je 0xe7d3
xorl %r9d, %r9d
xorl %r10d, %r10d
movq (%rdx,%r10,8), %r11
movsd (%r11,%r9,8), %xmm8
ucomisd %xmm2, %xmm8
jb 0xe7c2
addsd 0xa0(%rsp,%r10,8), %xmm8
movsd %xmm8, 0xa0(%rsp,%r10,8)
movsd 0xc0(%rsp,%r10,8), %xmm8
addsd %xmm7, %xmm8
movsd %xmm8, 0xc0(%rsp,%r10,8)
incq %r10
cmpq $0x4, %r10
jne 0xe784
incq %r9
cmpq %r8, %r9
jne 0xe781
xorl %r9d, %r9d
movl $0x1, %r8d
movl %r9d, %r10d
movsd 0xa0(%rsp,%r10,8), %xmm8
ucomisd 0xa0(%rsp,%r8,8), %xmm8
movl %r8d, %r10d
ja 0xe7fb
movl %r9d, %r10d
incq %r8
movl %r10d, %r9d
cmpq $0x4, %r8
jne 0xe7dc
movl %r10d, %r8d
movq %rdi, %xmm8
punpckldq %xmm4, %xmm8    # xmm8 = xmm8[0],xmm4[0],xmm8[1],xmm4[1]
subpd %xmm5, %xmm8
movapd %xmm8, %xmm9
unpckhpd %xmm8, %xmm9            # xmm9 = xmm9[1],xmm8[1]
addsd %xmm8, %xmm9
addsd 0xa0(%rsp,%r8,8), %xmm9
cvttsd2si %xmm9, %r9
movq %r9, %r10
subsd %xmm6, %xmm9
cvttsd2si %xmm9, %rdi
sarq $0x3f, %r10
andq %r10, %rdi
addsd 0xc0(%rsp,%r8,8), %xmm1
orq %r9, %rdi
incq %rsi
subq $-0x80, %rdx
cmpq %rbx, %rsi
jne 0xe749
movq %rdi, %xmm3
punpckldq 0x1396b(%rip), %xmm3 # xmm3 = xmm3[0],mem[0],xmm3[1],mem[1]
subpd 0x13973(%rip), %xmm3    # 0x221f0
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
divsd %xmm1, %xmm2
cmpltsd %xmm1, %xmm0
andpd %xmm2, %xmm0
movlpd %xmm0, 0x8(%rax)
jmp 0xe8a4
callq 0x28f5
xorl %eax, %eax
addq $0x110e8, %rsp          # imm = 0x110E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq