// File: /workspace/github_c_makefile_star2_O2/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 $0x110d8, %rsp          # imm = 0x110D8
movl %r9d, 0xc(%rsp)
movq %r8, 0x40(%rsp)
movq %rcx, %rbx
movq %rdx, 0x18(%rsp)
movq %rsi, 0x48(%rsp)
leaq 0x15244(%rip), %rsi     # 0x1f311
callq 0x23e0
testq %rax, %rax
je 0xa7fd
movq %rax, %r14
leaq 0x80(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rax, %rcx
callq 0x20f0
cmpl $0x1, %eax
je 0xa100
xorl %eax, %eax
callq 0x2986
movq 0x80(%rsp), %rdi
callq 0x2973
testl %eax, %eax
je 0xa99d
movq %rbx, 0x60(%rsp)
movq %r14, %rdi
callq 0x11940
leaq 0x88(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %r14, 0x68(%rsp)
movq %r14, %rcx
callq 0x20f0
cmpl $0x1, %eax
je 0xa149
xorl %eax, %eax
callq 0x2986
movq 0x18(%rsp), %rdi
movl (%rdi), %ebx
movq 0x40(%rsp), %r14
movl %r14d, %esi
movl 0xc(%rsp), %edx
callq 0x9545
movq %rax, 0x50(%rsp)
movq 0x88(%rsp), %rcx
movl %r14d, %eax
movq %rcx, %r14
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x10(%rsp)
leal -0x3(,%rbx,2), %eax
movl %eax, 0x70(%rsp)
xorl %r12d, %r12d
cmpq %r14, %r12
movq 0x68(%rsp), %rcx
jae 0xa4d9
movl $0x11000, %edx          # imm = 0x11000
leaq 0xd0(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x20f0
movq %rax, %rbx
xorl %ebp, %ebp
cmpl %ebx, %ebp
jae 0xa18d
cmpq %r14, %r12
jae 0xa18d
movl %ebp, %r13d
movb 0x11110(%rsp), %al
cmpb %al, 0xe0(%rsp,%r13)
jb 0xa4ce
movl 0xd0(%rsp,%r13), %esi
movl 0xd4(%rsp,%r13), %edx
movq %r12, 0x30(%rsp)
movq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rsi, 0x28(%rsp)
movl %edx, 0x20(%rsp)
leaq 0x3c(%rsp), %rcx
leaq 0x78(%rsp), %r8
xorl %r9d, %r9d
callq 0x100d2
movl 0xd8(%rsp,%r13), %esi
movl 0xdc(%rsp,%r13), %r13d
movq %r15, %rdi
movq 0x30(%rsp), %r12
movq %rsi, %r15
movl %r13d, %edx
leaq 0x38(%rsp), %rcx
leaq 0x58(%rsp), %r8
xorl %r9d, %r9d
callq 0x100d2
movl 0x3c(%rsp), %esi
movl 0x38(%rsp), %ecx
cmpl %ecx, %esi
sete %al
cmpl $-0x1, %esi
sete %dl
orb %al, %dl
jne 0xa4ce
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rsp), %rdx
movq (%rdi,%rdx,8), %r8
movl 0x8(%rax), %r9d
movl 0x20(%rsp), %eax
xorl %edx, %edx
divl %r9d
movsd (%r8,%rax,8), %xmm0
movq (%rdi,%r15,8), %rdi
movl %r13d, %eax
xorl %edx, %edx
divl %r9d
mulsd (%rdi,%rax,8), %xmm0
cmpl %ecx, %esi
jbe 0xa2b3
movl %ecx, 0x3c(%rsp)
movl %esi, 0x38(%rsp)
movq 0x78(%rsp), %rax
movq 0x58(%rsp), %rdx
movq %rdx, 0x78(%rsp)
movq %rax, 0x58(%rsp)
movl %esi, %edi
jmp 0xa2b7
movl %ecx, %edi
movl %esi, %ecx
movq 0x50(%rsp), %rsi
movl 0x70(%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 0xa4ce
addq %rsi, %rax
movq 0x18(%rsp), %rsi
movq 0x8(%rsi), %rsi
imulq $0x58, %rdx, %rdx
movsd 0x8(%rsi,%rdx), %xmm1
movsd 0x13eaa(%rip), %xmm5    # 0x1e1b0
unpcklps %xmm5, %xmm1            # xmm1 = xmm1[0],xmm5[0],xmm1[1],xmm5[1]
movapd 0x13eaf(%rip), %xmm6    # 0x1e1c0
subpd %xmm6, %xmm1
movapd %xmm1, %xmm3
unpckhpd %xmm1, %xmm3            # xmm3 = xmm3[1],xmm1[1]
addsd %xmm1, %xmm3
movsd 0x13eb7(%rip), %xmm4    # 0x1e1e0
mulsd %xmm4, %xmm3
imulq $0x58, %rcx, %rcx
movsd 0x8(%rsi,%rcx), %xmm2
unpcklps %xmm5, %xmm2            # xmm2 = xmm2[0],xmm5[0],xmm2[1],xmm5[1]
subpd %xmm6, %xmm2
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
mulsd %xmm4, %xmm1
movsd 0x78(%rsp), %xmm4
unpcklps %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0],xmm4[1],xmm5[1]
subpd %xmm6, %xmm4
movapd %xmm4, %xmm2
unpckhpd %xmm4, %xmm2            # xmm2 = xmm2[1],xmm4[1]
addsd %xmm4, %xmm2
ucomisd %xmm3, %xmm2
jae 0xa3d8
ucomisd %xmm2, %xmm3
jbe 0xa4ce
movsd 0x58(%rsp), %xmm4
unpcklps 0x13e2c(%rip), %xmm4    # xmm4 = xmm4[0],mem[0],xmm4[1],mem[1]
subpd 0x13e34(%rip), %xmm4    # 0x1e1c0
movapd %xmm4, %xmm3
unpckhpd %xmm4, %xmm3            # xmm3 = xmm3[1],xmm4[1]
addsd %xmm4, %xmm3
ucomisd %xmm3, %xmm1
divsd 0x10(%rsp), %xmm2
jbe 0xa47f
cvttsd2si %xmm2, %rcx
cmpl %ecx, -0x78(%rax)
jbe 0xa4ce
divsd 0x10(%rsp), %xmm3
cvttsd2si %xmm3, %rdx
leal (%rdx,%rcx), %esi
cmpl 0xc(%rsp), %esi
jae 0xa4ce
movl -0x74(%rax), %esi
pushq $-0x50
jmp 0xa4b0
movsd 0x58(%rsp), %xmm5
unpcklps 0x13dcb(%rip), %xmm5    # xmm5 = xmm5[0],mem[0],xmm5[1],mem[1]
subpd 0x13dd3(%rip), %xmm5    # 0x1e1c0
movapd %xmm5, %xmm4
unpckhpd %xmm5, %xmm4            # xmm4 = xmm4[1],xmm5[1]
addsd %xmm5, %xmm4
ucomisd %xmm4, %xmm1
movapd %xmm3, %xmm5
addsd %xmm3, %xmm5
jbe 0xa43e
subsd %xmm2, %xmm5
divsd 0x10(%rsp), %xmm5
cvttsd2si %xmm5, %rcx
cmpl %ecx, -0x78(%rax)
jbe 0xa4ce
divsd 0x10(%rsp), %xmm4
cvttsd2si %xmm4, %rdx
leal (%rdx,%rcx), %esi
cmpl 0xc(%rsp), %esi
jae 0xa4ce
movl -0x74(%rax), %esi
pushq $-0x60
jmp 0xa4b0
ucomisd %xmm1, %xmm4
jb 0xa36d
subsd %xmm2, %xmm5
divsd 0x10(%rsp), %xmm5
cvttsd2si %xmm5, %rcx
cmpl %ecx, -0x78(%rax)
jbe 0xa4ce
addsd %xmm1, %xmm1
subsd %xmm4, %xmm1
divsd 0x10(%rsp), %xmm1
cvttsd2si %xmm1, %rdx
leal (%rdx,%rcx), %esi
cmpl 0xc(%rsp), %esi
jae 0xa4ce
movl -0x74(%rax), %esi
pushq $-0x58
jmp 0xa4b0
ucomisd %xmm1, %xmm3
jb 0xa4ce
cvttsd2si %xmm2, %rcx
cmpl %ecx, -0x78(%rax)
jbe 0xa4ce
addsd %xmm1, %xmm1
subsd %xmm3, %xmm1
divsd 0x10(%rsp), %xmm1
cvttsd2si %xmm1, %rdx
leal (%rdx,%rcx), %esi
cmpl 0xc(%rsp), %esi
jae 0xa4ce
movl -0x74(%rax), %esi
pushq $-0x48
popq %rdi
cmpl %edx, %esi
jbe 0xa4ce
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)
addl $0x11, %ebp
incq %r12
jmp 0xa1b5
movq %rcx, %rdi
callq 0x2150
movq 0x18(%rsp), %rdx
movl (%rdx), %ebx
movq 0x40(%rsp), %rsi
leal (%rsi,%rsi), %eax
movq %rax, 0x20(%rsp)
movq 0x60(%rsp), %rdi
callq 0x1971a
movq %rbx, %rcx
movq %rax, %rbx
leal -0x3(,%rcx,2), %eax
xorl %edx, %edx
movabsq $-0x10000000000001, %rbp # imm = 0xFFEFFFFFFFFFFFFF
movl %eax, 0x60(%rsp)
movl %eax, %r9d
movq %rcx, 0x28(%rsp)
cmpq %rcx, %rdx
je 0xa7dd
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movq %rdx, 0x30(%rsp)
imulq $0x58, %rdx, %r15
movq 0x8(%rax,%r15), %rdi
movq 0x20(%rsp), %rsi
cmpq %rsi, %rdi
jae 0xa55b
movq 0x30(%rsp), %rdx
incq %rdx
decl %r9d
jmp 0xa524
movl %r9d, 0x48(%rsp)
callq 0x28ff
movl 0xc(%rsp), %ecx
movl %ecx, %r12d
cmpl %ecx, %eax
ja 0xa58b
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax,%r15), %rdi
movq 0x20(%rsp), %rsi
callq 0x28ff
movl %eax, %r12d
movl 0x48(%rsp), %r9d
movl %r9d, %eax
movq 0x30(%rsp), %rcx
imulq %rcx, %rax
shlq $0x6, %rax
andq $-0x80, %rax
movq %rax, 0x70(%rsp)
movq 0x18(%rsp), %rax
movq 0x8(%rax), %r8
movsd 0x8(%r8,%r15), %xmm0
unpcklps 0x13bf0(%rip), %xmm0    # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x13bf8(%rip), %xmm0    # 0x1e1c0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
decl %r12d
cvtsi2sd %r12, %xmm0
mulsd 0x13bfc(%rip), %xmm1    # 0x1e1e0
movsd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd 0x14019(%rip), %xmm8    # 0x1e618
minsd %xmm1, %xmm8
movl 0x60(%rsp), %eax
subl %ecx, %eax
imulq %rcx, %rax
shrq %rax
shlq $0x7, %rax
movq %rax, 0x68(%rsp)
movl %ecx, %r13d
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rsi
incl %r13d
cmpl %ecx, %r13d
jae 0xa54e
movl %r13d, %r15d
imulq $0x58, %r15, %r14
movq 0x8(%r8,%r14), %rdi
cmpq %rsi, %rdi
jb 0xa627
movsd %xmm8, 0x40(%rsp)
callq 0x28ff
movl 0xc(%rsp), %edx
movl %edx, %ecx
cmpl %edx, %eax
ja 0xa674
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax,%r14), %rdi
movq 0x20(%rsp), %rsi
callq 0x28ff
movl %eax, %ecx
movq 0x18(%rsp), %rax
movq 0x8(%rax), %r8
movsd 0x8(%r8,%r14), %xmm0
unpcklps 0x13b25(%rip), %xmm0    # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x13b2d(%rip), %xmm0    # 0x1e1c0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
leal -0x1(%rcx), %edi
cvtsi2sd %rdi, %xmm0
movsd 0x13b31(%rip), %xmm4    # 0x1e1e0
mulsd %xmm4, %xmm1
movsd 0x10(%rsp), %xmm2
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd 0x13f4b(%rip), %xmm5    # 0x1e618
movapd %xmm5, %xmm0
minsd %xmm1, %xmm0
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x68(%rsp), %rdx
addq %rax, %rdx
movq %r15, %rsi
shlq $0x7, %rsi
movl -0x6c(%rsi,%rdx), %r9d
movq 0x70(%rsp), %rdx
addq %rdx, %rax
addq $-0x60, %rax
movq %r15, %r10
shlq $0x7, %r10
addq %rax, %r10
xorl %esi, %esi
movq 0x30(%rsp), %r14
movsd 0x13f09(%rip), %xmm6    # 0x1e620
movsd 0x13f09(%rip), %xmm7    # 0x1e628
movsd 0x40(%rsp), %xmm8
cmpq %r9, %rsi
je 0xa7c9
movl %esi, %eax
xorl %edx, %edx
divl %ecx
movapd %xmm8, %xmm1
cmpl %r12d, %eax
je 0xa743
movapd %xmm5, %xmm1
cmpl %edi, %edx
jne 0xa74b
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm2
cmpltsd %xmm4, %xmm2
movapd %xmm5, %xmm3
testq %rbx, %rbx
je 0xa774
movq (%rbx,%r14,8), %r11
movl %eax, %eax
movsd (%r11,%rax,8), %xmm3
movq (%rbx,%r15,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 0xa7a4
cmpq $0x4, %rax
je 0xa7c1
movq (%r10,%rax,8), %rdx
movq %rbp, (%rdx,%rsi,8)
incq %rax
jmp 0xa791
cmpq $0x4, %rax
je 0xa7c1
movq (%r10,%rax,8), %rdx
movsd (%rdx,%rsi,8), %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, (%rdx,%rsi,8)
incq %rax
jmp 0xa7a4
incq %rsi
jmp 0xa726
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %rsi
movl 0x48(%rsp), %r9d
jmp 0xa627
testq %rbx, %rbx
je 0xa80c
xorl %r14d, %r14d
cmpq %r14, %rcx
je 0xa804
movq (%rbx,%r14,8), %rdi
callq 0x2060
movq 0x28(%rsp), %rcx
incq %r14
jmp 0xa7e5
xorl %ebx, %ebx
jmp 0xa988
movq %rbx, %rdi
callq 0x2060
movq 0x50(%rsp), %rbx
movl (%rbx), %eax
xorpd %xmm1, %xmm1
pushq $0x20
popq %rcx
xorl %edx, %edx
xorpd %xmm2, %xmm2
movsd 0x13e10(%rip), %xmm3    # 0x1e638
movsd 0x13de8(%rip), %xmm4    # 0x1e618
xorl %edi, %edi
xorpd %xmm0, %xmm0
movq %rdi, %xmm5
cmpq %rax, %rdx
je 0xa956
movapd %xmm2, 0xa0(%rsp)
movapd %xmm2, 0x90(%rsp)
movapd %xmm2, 0xb0(%rsp)
movapd %xmm2, 0xc0(%rsp)
movq 0x10(%rbx), %rsi
movq %rdx, %rdi
shlq $0x7, %rdi
movl 0x14(%rsi,%rdi), %edi
addq %rcx, %rsi
xorl %r8d, %r8d
cmpq %rdi, %r8
je 0xa8d1
xorl %r9d, %r9d
cmpq $0x4, %r9
je 0xa8cc
movq (%rsi,%r9,8), %r10
movsd (%r10,%r8,8), %xmm6
ucomisd %xmm1, %xmm6
jb 0xa8c7
addsd 0x90(%rsp,%r9,8), %xmm6
movsd %xmm6, 0x90(%rsp,%r9,8)
movsd 0xb0(%rsp,%r9,8), %xmm6
addsd %xmm4, %xmm6
movsd %xmm6, 0xb0(%rsp,%r9,8)
incq %r9
jmp 0xa885
incq %r8
jmp 0xa87d
xorl %r8d, %r8d
pushq $0x1
popq %rdi
movl %r8d, %esi
cmpq $0x4, %rdi
je 0xa901
movsd 0x90(%rsp,%rsi,8), %xmm6
ucomisd 0x90(%rsp,%rdi,8), %xmm6
movl %edi, %esi
ja 0xa8f9
movl %r8d, %esi
incq %rdi
movl %esi, %r8d
jmp 0xa8d7
punpckldq 0x138a7(%rip), %xmm5 # xmm5 = xmm5[0],mem[0],xmm5[1],mem[1]
subpd 0x138af(%rip), %xmm5    # 0x1e1c0
movapd %xmm5, %xmm6
unpckhpd %xmm5, %xmm6            # xmm6 = xmm6[1],xmm5[1]
addsd %xmm5, %xmm6
addsd 0x90(%rsp,%rsi,8), %xmm6
cvttsd2si %xmm6, %r8
movq %r8, %r9
sarq $0x3f, %r9
subsd %xmm3, %xmm6
cvttsd2si %xmm6, %rdi
andq %r9, %rdi
orq %r8, %rdi
addsd 0xb0(%rsp,%rsi,8), %xmm0
incq %rdx
subq $-0x80, %rcx
jmp 0xa836
punpckldq 0x13852(%rip), %xmm5 # xmm5 = xmm5[0],mem[0],xmm5[1],mem[1]
subpd 0x1385a(%rip), %xmm5    # 0x1e1c0
movapd %xmm5, %xmm1
unpckhpd %xmm5, %xmm1            # xmm1 = xmm1[1],xmm5[1]
addsd %xmm5, %xmm1
divsd %xmm0, %xmm1
xorpd %xmm2, %xmm2
cmpltsd %xmm0, %xmm2
andpd %xmm1, %xmm2
movlpd %xmm2, 0x8(%rbx)
movq %rbx, %rax
addq $0x110d8, %rsp          # imm = 0x110D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1d654(%rip), %rax     # 0x27ff8
movq (%rax), %rdi
leaq 0x13889(%rip), %rsi     # 0x1e237
leaq 0x13d62(%rip), %rdx     # 0x1e717
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22c0
jmp 0xa988