// File: dgboy2000[P]compress/compress.cpp
// Function: DATCompression::compute_diff_statistics(std::vector<int, std::allocator<int>>)
vector<int> DATCompression::compute_diff_statistics(vector<int> data) {
    vector<int> diffs = compute_diffs(data);
    map<int, int> diff_counts;

    for (vector<int>::iterator viter = diffs.begin(); viter < diffs.end(); ++viter) {
        int val = *viter;
        if (diff_counts.count(val) == 0) diff_counts[val] = 0;
        ++diff_counts[val];
    }
    
    cout << "Counts of each difference in the data:" << endl;
    for (map<int, int>::iterator miter = diff_counts.begin(); miter != diff_counts.end(); ++miter) {
        printf("%d: %d\n", (*miter).first, (*miter).second);
    }
    
    return diffs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdx, -0xc8(%rbp)
movq %rsi, %rax
movq -0xc8(%rbp), %rsi
movq %rdi, -0xb8(%rbp)
movq %rdi, %rcx
movq %rcx, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
movb $0x0, -0x19(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x8f80
movq -0xb8(%rbp), %rdi
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
callq 0x58e0
jmp 0x63c4
leaq -0x38(%rbp), %rdi
callq 0x8f20
leaq -0x78(%rbp), %rdi
callq 0x9560
movq -0xb8(%rbp), %rdi
callq 0x8dd0
movq %rax, -0x80(%rbp)
movq -0xb8(%rbp), %rdi
callq 0x8e80
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x9580
testb $0x1, %al
jne 0x6412
jmp 0x64e6
leaq -0x80(%rbp), %rdi
callq 0x8eb0
movl (%rax), %eax
movl %eax, -0x8c(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
callq 0x95c0
movq %rax, -0xd0(%rbp)
jmp 0x643c
movq -0xd0(%rbp), %rax
cmpq $0x0, %rax
jne 0x64b1
leaq -0x78(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
callq 0x9620
movq %rax, -0xd8(%rbp)
jmp 0x6462
movq -0xd8(%rbp), %rax
movl $0x0, (%rax)
jmp 0x64b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8f20
jmp 0x65cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x97e0
movq -0xb8(%rbp), %rdi
callq 0x8f20
jmp 0x65cf
leaq -0x78(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
callq 0x9620
movq %rax, -0xe0(%rbp)
jmp 0x64ca
movq -0xe0(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
leaq -0x80(%rbp), %rdi
callq 0x8f00
jmp 0x63e6
movq 0xfaeb(%rip), %rdi      # 0x15fd8
leaq 0x9bfa(%rip), %rsi      # 0x100ee
callq 0x2200
movq %rax, -0xe8(%rbp)
jmp 0x6502
movq -0xe8(%rbp), %rdi
movq 0xfab8(%rip), %rsi      # 0x15fc8
callq 0x2240
jmp 0x6517
leaq -0x78(%rbp), %rdi
callq 0x9700
movq %rax, -0x98(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x9760
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x9730
testb $0x1, %al
jne 0x6550
jmp 0x65a0
leaq -0x98(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x9790
movq -0xf8(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0xec(%rbp)
callq 0x9790
movl -0xec(%rbp), %esi
movl 0x4(%rax), %edx
leaq 0x9b8e(%rip), %rdi      # 0x10115
xorl %eax, %eax
callq 0x2040
jmp 0x6590
jmp 0x6592
leaq -0x98(%rbp), %rdi
callq 0x97b0
jmp 0x6527
movb $0x1, -0x19(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x97e0
testb $0x1, -0x19(%rbp)
jne 0x65bf
movq -0xb8(%rbp), %rdi
callq 0x8f20
movq -0xc0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x2380
nopl (%rax,%rax)