// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x224b6(%rip), %rsi     # 0x32311
callq 0x23f0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0xfe78
movq $0x0, -0x8(%rbp)
jmp 0x1005e
movq -0x58(%rbp), %rcx
leaq -0x48(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x20f0
movq %rax, -0x28(%rbp)
cmpq $0x1, -0x28(%rbp)
je 0xfea1
movb $0x0, %al
callq 0x2c00
movq -0x48(%rbp), %rdi
callq 0x2bc0
cmpl $0x0, %eax
jne 0xfee4
movq 0x29142(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
leaq 0x21357(%rip), %rsi     # 0x31217
leaq 0x21851(%rip), %rdx     # 0x31718
movb $0x0, %al
callq 0x22c0
movq -0x58(%rbp), %rdi
callq 0x2150
movq $0x0, -0x8(%rbp)
jmp 0x1005e
movq -0x58(%rbp), %rdi
callq 0x1bac0
movq -0x58(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x20f0
movq %rax, -0x28(%rbp)
cmpq $0x1, -0x28(%rbp)
je 0xff16
movb $0x0, %al
callq 0x2c00
movq -0x58(%rbp), %rdi
imulq $0x11, -0x30(%rbp), %rsi
movl $0x1, %edx
callq 0x2380
movq -0x58(%rbp), %rcx
leaq -0x30(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x20f0
movq %rax, -0x28(%rbp)
cmpq $0x1, -0x28(%rbp)
je 0xff52
movb $0x0, %al
callq 0x2c00
movq -0x30(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2340
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq -0x58(%rbp), %rcx
movl $0x8, %esi
callq 0x20f0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0xff8e
movb $0x0, %al
callq 0x2c00
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2340
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x1001d
movq -0x40(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, %edi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2aa0
movq -0x60(%rbp), %rdx
movl %eax, %eax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x40(%rbp), %rax
movl -0x1c(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xffb5
movq -0x58(%rbp), %rdi
callq 0x2150
movl $0x18, %edi
callq 0x2340
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rax
movl $0x3e8, 0x8(%rax)       # imm = 0x3E8
movq -0x40(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)