// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/link.c
// Function: estimate_inter_link_mat_init_rss
long estimate_inter_link_mat_init_rss(asm_dict_t *dict, uint32_t resolution, uint32_t radius)
{
    long bytes, p, m;
    uint32_t i, j, b0, b1, n, r, r2;

    n = dict->n;
    m = (long) n * (n - 1) / 2;
    if (m > UINT32_MAX)
        return -1;

    r2 = resolution * 2;

    bytes = 0;
    bytes += sizeof(inter_link_mat_t);
    bytes += m * sizeof(inter_link_t);

    for (i = 0; i < n; ++i) {
        if (dict->s[i].len < r2)
            continue;

        b0 = MIN(radius, div_ceil(dict->s[i].len, r2));
        for (j = i + 1; j < n; ++j) {
            if (dict->s[j].len < r2)
                continue;

            b1 = MIN(radius, div_ceil(dict->s[j].len, r2));
            p = b0 * b1;
            if (p > UINT32_MAX)
                return -1;
            r = MIN(radius, (uint32_t) (b0 + b1 - 1));

            bytes += (p + r) * 4 * sizeof(double);
        }
    }

    return bytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl -0x44(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
imulq %rcx, %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, -0x30(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x30(%rbp)
jle 0xde90
movq $-0x1, -0x8(%rbp)
jmp 0xe06e
movl -0x14(%rbp), %eax
shll %eax
movl %eax, -0x4c(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
shlq $0x7, %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x44(%rbp), %eax
jae 0xe066
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x4c(%rbp), %ecx
cmpq %rcx, %rax
jae 0xdef2
jmp 0xe058
movl -0x18(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movl -0x4c(%rbp), %esi
callq 0x2aa0
movl %eax, %ecx
movl -0x50(%rbp), %eax
cmpl %ecx, %eax
jae 0xdf27
movl -0x18(%rbp), %eax
movl %eax, -0x54(%rbp)
jmp 0xdf48
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movl -0x4c(%rbp), %esi
callq 0x2aa0
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x44(%rbp), %eax
jae 0xe056
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x4c(%rbp), %ecx
cmpq %rcx, %rax
jae 0xdf86
jmp 0xe048
movl -0x18(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movl -0x4c(%rbp), %esi
callq 0x2aa0
movl %eax, %ecx
movl -0x58(%rbp), %eax
cmpl %ecx, %eax
jae 0xdfbb
movl -0x18(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0xdfdc
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x38(%rbp), %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movl -0x4c(%rbp), %esi
callq 0x2aa0
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
imull -0x40(%rbp), %eax
movl %eax, %eax
movq %rax, -0x28(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x28(%rbp)
jle 0xe004
movq $-0x1, -0x8(%rbp)
jmp 0xe06e
movl -0x18(%rbp), %eax
movl -0x3c(%rbp), %ecx
addl -0x40(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0xe01c
movl -0x18(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0xe028
movl -0x3c(%rbp), %eax
addl -0x40(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movl -0x48(%rbp), %ecx
addq %rcx, %rax
shlq $0x2, %rax
shlq $0x3, %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xdf57
jmp 0xe058
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xdec3
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)