// File: /workspace/github_cpp_makefile_star2_O3/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 0x170c3
leaq 0x240(%rsp), %rdi
leaq 0x38(%rsp), %rsi
movq %r12, %rdx
movl %ebp, %ecx
movl $0x1, %r8d
callq 0x171b4
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0xab6e
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x8520
movq %rax, %r12
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x16fbc
callq 0x8370
movl 0x18(%rbx), %edi
movq %r12, %rsi
callq 0x169b9
movzbl %al, %r12d
leaq 0x240(%rsp), %r13
movq 0x240(%rsp), %rax
testq %rax, %rax
je 0x17136
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x17136
movq %r13, %rdi
callq 0x17b5a
movsd 0x8(%rbx), %xmm1
ucomisd %xmm0, %xmm1
ja 0x170b6
ucomisd 0x10(%rbx), %xmm0
ja 0x170b6
movsd %xmm0, 0x8(%rsp)
movq 0x240(%rsp), %rdi
cmpb $0x1, 0x1(%rbx)
jne 0x17054
callq 0x8680
movsd 0x8(%rsp), %xmm0
movq %rdx, %rcx
subq 0x250(%rsp), %rax
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x15930
jmp 0x170b6
callq 0x8680
subq 0x250(%rsp), %rax
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rdx
movsd 0x8(%rsp), %xmm0
movq %rbx, %rcx
callq 0x16a43
cmpb $0x1, (%rbx)
jne 0x170b6
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 0x17220
movq %r13, %rdi
callq 0x17968
jmp 0x16fd3
leaq 0x240(%rsp), %rdi
leaq 0x38(%rsp), %rsi
movl $0x4000, %edx           # imm = 0x4000
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0x171b4
leaq 0x240(%rsp), %r15
movq 0x240(%rsp), %rax
testq %rax, %rax
je 0x1710c
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1710c
movq %r15, %rdi
callq 0x17968
jmp 0x170e7
leaq 0x240(%rsp), %rdi
callq 0x17b5a
movsd 0x8(%rbx), %xmm1
ucomisd %xmm0, %xmm1
ja 0x17136
ucomisd 0x10(%rbx), %xmm0
ja 0x17136
movq %r14, %rdi
movq %rbx, %rsi
callq 0x16c84
movq 0x258(%rsp), %rdi
testq %rdi, %rdi
je 0x17148
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 0x17180
jmp 0x1718d
jmp 0x1718d
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x17190
callq 0x8370
jmp 0x17190
jmp 0x1718d
movq %rax, %rbx
jmp 0x171a2
jmp 0x1718d
jmp 0x1718d
jmp 0x1718d
jmp 0x1718d
movq %rax, %rbx
movq 0x258(%rsp), %rdi
testq %rdi, %rdi
je 0x171a2
callq 0x8370
leaq 0x38(%rsp), %rdi
callq 0x80c0
movq %rbx, %rdi
callq 0x86a0