// File: 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:
subq $0x2448, %rsp           # imm = 0x2448
movq %rdi, 0x2440(%rsp)
movq %rsi, 0x2438(%rsp)
movq %rdx, 0x2430(%rsp)
movl %ecx, 0x242c(%rsp)
movq %r8, 0x2420(%rsp)
movq 0x2440(%rsp), %rsi
leaq 0x2218(%rsp), %rdi
movl $0x4, %edx
callq 0xa8d0
cmpq $0x0, 0x2438(%rsp)
jne 0x322ce
movl 0x242c(%rsp), %ecx
leaq 0x19e0(%rsp), %rdi
leaq 0x2218(%rsp), %rsi
movl $0x4000, %edx           # imm = 0x4000
xorl %r8d, %r8d
callq 0x327f0
jmp 0x3215d
leaq 0x1198(%rsp), %rdi
xorl %esi, %esi
movl $0x838, %edx            # imm = 0x838
callq 0xa2d0
leaq 0x1198(%rsp), %rdi
callq 0x328e0
leaq 0x19e0(%rsp), %rdi
leaq 0x1198(%rsp), %rsi
callq 0x32900
movb %al, 0x9f(%rsp)
jmp 0x3219c
movb 0x9f(%rsp), %al
testb $0x1, %al
jne 0x321a9
jmp 0x32208
jmp 0x321ab
leaq 0x19e0(%rsp), %rdi
callq 0x32950
jmp 0x321ba
jmp 0x3217e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x19d8(%rsp)
movl %eax, 0x19d4(%rsp)
jmp 0x326a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x19d8(%rsp)
movl %eax, 0x19d4(%rsp)
leaq 0x1198(%rsp), %rdi
callq 0x329a0
leaq 0x19e0(%rsp), %rdi
callq 0x329a0
jmp 0x326a7
leaq 0x19e0(%rsp), %rdi
callq 0x32980
movsd %xmm0, 0x90(%rsp)
jmp 0x32220
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x1190(%rsp)
movsd 0x1190(%rsp), %xmm1
movq 0x2430(%rsp), %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
ja 0x32266
movsd 0x1190(%rsp), %xmm0
movq 0x2430(%rsp), %rax
ucomisd 0x10(%rax), %xmm0
jbe 0x32273
movl $0x1, 0x118c(%rsp)
jmp 0x3229e
movq 0x2440(%rsp), %rdi
movsd 0x1190(%rsp), %xmm0
movq 0x2430(%rsp), %rsi
callq 0x31620
jmp 0x32293
movl $0x0, 0x118c(%rsp)
leaq 0x1198(%rsp), %rdi
callq 0x329a0
leaq 0x19e0(%rsp), %rdi
callq 0x329a0
movl 0x118c(%rsp), %eax
testl %eax, %eax
jne 0x32692
jmp 0x322c9
jmp 0x32687
movq 0x2438(%rsp), %rdx
movl 0x242c(%rsp), %ecx
leaq 0x950(%rsp), %rdi
leaq 0x2218(%rsp), %rsi
movl $0x1, %r8d
callq 0x327f0
jmp 0x322fa
leaq 0x118(%rsp), %rdi
movq %rdi, 0x88(%rsp)
xorl %esi, %esi
movl $0x838, %edx            # imm = 0x838
callq 0xa2d0
movq 0x88(%rsp), %rdi
callq 0x328e0
movq 0x2440(%rsp), %rsi
leaq 0xf0(%rsp), %rdi
callq 0xe010
jmp 0x3233a
leaq 0xf0(%rsp), %rdi
callq 0x2f330
movq %rax, 0x80(%rsp)
jmp 0x32351
leaq 0xf0(%rsp), %rdi
callq 0xd290
movq 0x80(%rsp), %rax
movq %rax, 0x110(%rsp)
movq 0x2430(%rsp), %rax
movl 0x18(%rax), %edi
movq 0x110(%rsp), %rsi
callq 0x313b0
movb %al, 0x7f(%rsp)
jmp 0x3238c
movb 0x7f(%rsp), %al
movb %al, 0xef(%rsp)
leaq 0x950(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x32900
movb %al, 0x7e(%rsp)
jmp 0x323b2
movb 0x7e(%rsp), %al
testb $0x1, %al
jne 0x323bf
jmp 0x3264f
leaq 0x950(%rsp), %rdi
callq 0x32980
movsd %xmm0, 0x70(%rsp)
jmp 0x323d4
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0xe0(%rsp)
movsd 0xe0(%rsp), %xmm1
movq 0x2430(%rsp), %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
ja 0x32417
movsd 0xe0(%rsp), %xmm0
movq 0x2430(%rsp), %rax
ucomisd 0x10(%rax), %xmm0
jbe 0x3245b
jmp 0x3263b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x19d8(%rsp)
movl %eax, 0x19d4(%rsp)
jmp 0x3266b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x19d8(%rsp)
movl %eax, 0x19d4(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0xd290
jmp 0x3266b
movq 0x2430(%rsp), %rax
testb $0x1, 0x1(%rax)
je 0x324e5
movq 0x2420(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x2440(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x950(%rsp), %rdi
callq 0x329c0
movq %rdx, 0x60(%rsp)
movq %rax, 0x68(%rsp)
jmp 0x3249c
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x68(%rsp), %rcx
movq %rcx, 0xd0(%rsp)
movq %rax, 0xd8(%rsp)
movsd 0xe0(%rsp), %xmm0
movq 0xd0(%rsp), %rdx
movq 0xd8(%rsp), %rcx
callq 0x2e880
jmp 0x324e0
jmp 0x3263b
movq 0x2440(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x950(%rsp), %rdi
callq 0x329c0
movq %rdx, 0x40(%rsp)
movq %rax, 0x48(%rsp)
jmp 0x3250b
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
movq %rcx, 0xc0(%rsp)
movq %rax, 0xc8(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x11b70
movq %rax, 0x30(%rsp)
jmp 0x32539
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdi
movzbl 0xef(%rsp), %eax
movl %eax, %edx
movsd 0xe0(%rsp), %xmm0
movq 0x2430(%rsp), %rcx
callq 0x31450
jmp 0x32565
movq 0x2430(%rsp), %rax
testb $0x1, (%rax)
je 0x32639
leaq 0x950(%rsp), %rdi
callq 0x33230
movq %rax, 0x28(%rsp)
jmp 0x3258a
movq 0x28(%rsp), %rdi
callq 0x33240
movq %rax, 0xb8(%rsp)
leaq 0x950(%rsp), %rdi
callq 0x33230
movq %rax, 0x20(%rsp)
jmp 0x325b0
movq 0x20(%rsp), %rdi
callq 0x33270
movq %rax, 0xb0(%rsp)
leaq 0x950(%rsp), %rdi
callq 0x329c0
movq %rdx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
jmp 0x325db
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x11b70
movq %rax, 0x8(%rsp)
jmp 0x32609
movq 0x8(%rsp), %rdx
movzbl 0xef(%rsp), %eax
movl %eax, %ecx
movq 0x2430(%rsp), %r8
movq 0xb8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x32a20
jmp 0x32637
jmp 0x32639
jmp 0x3263b
leaq 0x950(%rsp), %rdi
callq 0x32950
jmp 0x3264a
jmp 0x32397
leaq 0x118(%rsp), %rdi
callq 0x329a0
leaq 0x950(%rsp), %rdi
callq 0x329a0
jmp 0x32687
leaq 0x118(%rsp), %rdi
callq 0x329a0
leaq 0x950(%rsp), %rdi
callq 0x329a0
jmp 0x326a7
movl $0x0, 0x118c(%rsp)
leaq 0x2218(%rsp), %rdi
callq 0xa0e0
addq $0x2448, %rsp           # imm = 0x2448
retq
leaq 0x2218(%rsp), %rdi
callq 0xa0e0
movq 0x19d8(%rsp), %rdi
callq 0xa9b0
nopw %cs:(%rax,%rax)