// File: /workspace/github_cpp_makefile_star2_O1/ALSchwalm[P]entrospy/entrospy/shannon.cpp
// Function: shannon_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long, PrintingPolicy const&, DataFormat, EntropyGraph&)
void shannon_file(const std::string& path, uint64_t block_size,
                  const PrintingPolicy& policy, DataFormat format,
                  EntropyGraph& graph) {
    std::ifstream file_stream{path, std::ifstream::binary};

    if (!block_size) {
        shannon_iterator iter{file_stream, DEFAULT_BLOCK_SIZE, format, false};
        shannon_iterator end{};
        for (; iter != end; ++iter) {
        }
        auto score = *iter;

        if (score < policy.bounds.first || score > policy.bounds.second) {
            return;
        }

        print_score(path, score, policy);
    } else {
        shannon_iterator iter{file_stream, block_size, format};
        shannon_iterator end{};
        auto file_size = fs::file_size(path);
        auto addr_width = address_width(policy.addr_format, file_size);

        for (; iter != end; ++iter) {
            auto score = *iter;

            if (score < policy.bounds.first || score > policy.bounds.second) {
                continue;
            }

            if (policy.print_graph) {
                graph.insert(path, iter.position(), score);
                continue;
            }
            print_score(path, iter.position(), addr_width, score, policy);
            if (policy.print_blocks) {
                print_block_bytes(iter.block().begin(), iter.block().end(),
                                  iter.position(), addr_width, policy);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa78, %rsp            # imm = 0xA78
movq %r8, 0x10(%rsp)
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x8600
testq %r12, %r12
je 0x17143
leaq 0x240(%rsp), %rdi
leaq 0x38(%rsp), %rsi
movq %r12, %rdx
movl %ebp, %ecx
movl $0x1, %r8d
callq 0x17234
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0xabea
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x8520
movq %rax, %r12
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x1703c
callq 0x8370
movl 0x18(%rbx), %edi
movq %r12, %rsi
callq 0x16a34
movzbl %al, %r12d
leaq 0x240(%rsp), %r13
movq 0x240(%rsp), %rax
testq %rax, %rax
je 0x171b6
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x171b6
movq %r13, %rdi
callq 0x17bec
movsd 0x8(%rbx), %xmm1
ucomisd %xmm0, %xmm1
ja 0x17136
ucomisd 0x10(%rbx), %xmm0
ja 0x17136
movsd %xmm0, 0x8(%rsp)
movq 0x240(%rsp), %rdi
cmpb $0x1, 0x1(%rbx)
jne 0x170d4
callq 0x8680
movsd 0x8(%rsp), %xmm0
movq %rdx, %rcx
subq 0x250(%rsp), %rax
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x15978
jmp 0x17136
callq 0x8680
subq 0x250(%rsp), %rax
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rdx
movsd 0x8(%rsp), %xmm0
movq %rbx, %rcx
callq 0x16abe
cmpb $0x1, (%rbx)
jne 0x17136
movq 0x240(%rsp), %rdi
movq 0x258(%rsp), %rbp
movq 0x260(%rsp), %r15
callq 0x8680
subq 0x250(%rsp), %rax
movq %rbp, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x172a0
movq %r13, %rdi
callq 0x179ec
jmp 0x17053
leaq 0x240(%rsp), %rdi
leaq 0x38(%rsp), %rsi
movl $0x4000, %edx           # imm = 0x4000
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x17234
leaq 0x240(%rsp), %r15
movq 0x240(%rsp), %rax
testq %rax, %rax
je 0x1718c
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1718c
movq %r15, %rdi
callq 0x179ec
jmp 0x17167
leaq 0x240(%rsp), %rdi
callq 0x17bec
movsd 0x8(%rbx), %xmm1
ucomisd %xmm0, %xmm1
ja 0x171b6
ucomisd 0x10(%rbx), %xmm0
ja 0x171b6
movq %r14, %rdi
movq %rbx, %rsi
callq 0x16cff
movq 0x258(%rsp), %rdi
testq %rdi, %rdi
je 0x171c8
callq 0x8370
leaq 0x38(%rsp), %rdi
callq 0x80c0
addq $0xa78, %rsp            # imm = 0xA78
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17200
jmp 0x1720d
jmp 0x1720d
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x17210
callq 0x8370
jmp 0x17210
jmp 0x1720d
movq %rax, %rbx
jmp 0x17222
jmp 0x1720d
jmp 0x1720d
jmp 0x1720d
jmp 0x1720d
movq %rax, %rbx
movq 0x258(%rsp), %rdi
testq %rdi, %rdi
je 0x17222
callq 0x8370
leaq 0x38(%rsp), %rdi
callq 0x80c0
movq %rbx, %rdi
callq 0x86a0