// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]yahs/link.c
// Function: cov_norm_from_file
cov_norm_t *cov_norm_from_file(const char *f, sdict_t *dict)
{
    uint32_t i;
    uint64_t m, n;
    double *norm_a, **norm;
    int64_t magic_number;
    cov_norm_t *cov_norm;
    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__);
        fclose(fp);
        return 0;
    }
    file_seek_skip_sdict(fp);
    m = fread(&n, sizeof(uint64_t), 1, fp);
    if (m != 1) bin_fread_error();
    fseek(fp, n * 17, SEEK_CUR);
    m = fread(&n, sizeof(uint64_t), 1, fp);
    if (m != 1) bin_fread_error();
    norm_a = (double *) malloc(sizeof(double) * n);
    m = fread(norm_a, sizeof(double), n, fp);
    if (m != n) bin_fread_error();
    
    norm = (double **) malloc(sizeof(double *) * dict->n);
    norm[0] = norm_a;
    for (i = 1; i < dict->n; ++i)
        norm[i] = norm[i-1] + div_ceil(dict->s[i-1].len, COV_NORM_WINDOW);
    
    fclose(fp);
    
    cov_norm = (cov_norm_t *) malloc(sizeof(cov_norm_t));
    cov_norm->n = n;
    cov_norm->w = COV_NORM_WINDOW;
    cov_norm->norm = norm;

    return cov_norm;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
leaq 0x14939(%rip), %rsi     # 0x1f311
callq 0x23e0
testq %rax, %rax
je 0xab2b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rax, %rcx
callq 0x20f0
cmpq $0x1, %rax
je 0xaa09
xorl %eax, %eax
callq 0x2986
movq 0x20(%rsp), %rdi
callq 0x2973
testl %eax, %eax
je 0xab40
movq %rbx, %rdi
callq 0x11940
leaq 0x8(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x20f0
cmpq $0x1, %rax
je 0xaa43
xorl %eax, %eax
callq 0x2986
leaq 0x8(%rsp), %r12
imulq $0x11, (%r12), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x2370
pushq $0x8
popq %rsi
pushq $0x1
popq %r15
movq %r12, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x20f0
cmpq $0x1, %rax
je 0xaa7a
xorl %eax, %eax
callq 0x2986
movq 0x8(%rsp), %r12
leaq (,%r12,8), %rdi
callq 0x2330
movq %rax, %r13
pushq $0x8
popq %rsi
movq %rax, %rdi
movq %r12, %rdx
movq %rbx, 0x18(%rsp)
movq %rbx, %rcx
callq 0x20f0
movq %r12, 0x10(%rsp)
cmpq %r12, %rax
je 0xaab6
xorl %eax, %eax
callq 0x2986
movl (%r14), %ebx
movq %rbx, %rdi
shlq $0x3, %rdi
callq 0x2330
movq %rax, %rbp
movq %r13, (%rax)
pushq $0x2
popq %r12
movl %ebx, %eax
cmpq %rax, %r15
jae 0xab00
movq 0x8(%r14), %rax
movl (%rax,%r12,8), %edi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x28ff
movl %eax, %eax
leaq (%r13,%rax,8), %r13
movq %r13, (%rbp,%r15,8)
incq %r15
movl (%r14), %ebx
addq $0x3, %r12
jmp 0xaacf
movq 0x18(%rsp), %rdi
callq 0x2150
pushq $0x18
popq %rdi
callq 0x2330
movq %rax, %r14
movq 0x10(%rsp), %rax
movq %rax, (%r14)
movl $0x3e8, 0x8(%r14)       # imm = 0x3E8
movq %rbp, 0x10(%r14)
jmp 0xab2e
xorl %r14d, %r14d
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1d4b1(%rip), %rax     # 0x27ff8
movq (%rax), %rdi
leaq 0x136e6(%rip), %rsi     # 0x1e237
leaq 0x13bd8(%rip), %rdx     # 0x1e730
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x22c0
movq %rbx, %rdi
callq 0x2150
jmp 0xab2e