// File: Albuso0[P]entropy/main_test.cpp
// Function: main
int main()
{
    int k = 100000;

    // Set estimator
    Entropy entropy( k );
    entropy.setDegree( 18 ); // L = 1.6 log k
    entropy.setInterval( 40 ); // M = 3.5 log k
    entropy.setThreshold( 18 ); // N = 1.6 log k
    print_param(entropy); // print parameters

    // Input fingerprint from file
    entropy.setFin("fin_sample.txt"); // fingerprint of 3000 samples generated from uniform[100000]
    print_results(entropy); // print estimation results

    // Input fingerprint inline
    std::vector<int> freq, cnt;
    freq.push_back(1); cnt.push_back(2910); 
    freq.push_back(2); cnt.push_back(45);
    entropy.setFin(freq, cnt);
    print_results(entropy);

    // Input histogram from file
    entropy.setHist("hist_sample.txt"); // histogram of 3000 samples generated from uniform[100000]
    print_results(entropy);
    
    // Input histogram inline
    std::vector<int> hist;
    for (int i = 0; i < 2910; i++) hist.push_back(1);
    for (int i = 0; i < 45; i++) hist.push_back(2);
    entropy.setHist(hist);
    print_results(entropy);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movl $0x0, -0x4(%rbp)
movl $0x186a0, -0x8(%rbp)    # imm = 0x186A0
movl -0x8(%rbp), %esi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x3740
movq -0x130(%rbp), %rdi
movl $0x12, %esi
callq 0x3520
jmp 0x648f
leaq -0x60(%rbp), %rdi
movsd 0x1bed(%rip), %xmm0     # 0x8088
callq 0x6950
jmp 0x64a2
leaq -0x60(%rbp), %rdi
movsd 0x1be2(%rip), %xmm0     # 0x8090
callq 0x6970
jmp 0x64b5
leaq -0x60(%rbp), %rdi
callq 0x6820
jmp 0x64c0
leaq -0x91(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x2340
movq -0x138(%rbp), %rdx
leaq 0x1bb7(%rip), %rsi      # 0x8098
leaq -0x90(%rbp), %rdi
callq 0x6990
jmp 0x64ef
leaq -0x60(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x2d30
jmp 0x6501
leaq -0x90(%rbp), %rdi
callq 0x2120
leaq -0x91(%rbp), %rdi
callq 0x2240
leaq -0x60(%rbp), %rdi
callq 0x68c0
jmp 0x6524
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x6a40
leaq -0xc8(%rbp), %rdi
callq 0x6a40
movq -0x140(%rbp), %rdi
movl $0x1, -0xcc(%rbp)
leaq -0xcc(%rbp), %rsi
callq 0x6a60
jmp 0x6562
movl $0xb5e, -0xd0(%rbp)     # imm = 0xB5E
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x6a60
jmp 0x6581
movl $0x2, -0xd4(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0x6a60
jmp 0x65a0
movl $0x2d, -0xd8(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x6a60
jmp 0x65bf
leaq -0x60(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0xc8(%rbp), %rdx
callq 0x2ec0
jmp 0x65d8
leaq -0x60(%rbp), %rdi
callq 0x68c0
jmp 0x65e3
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x2340
movq -0x148(%rbp), %rdx
leaq 0x1aa3(%rip), %rsi      # 0x80a7
leaq -0xf8(%rbp), %rdi
callq 0x6990
jmp 0x6612
leaq -0x60(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x3210
jmp 0x6624
leaq -0xf8(%rbp), %rdi
callq 0x2120
leaq -0xf9(%rbp), %rdi
callq 0x2240
leaq -0x60(%rbp), %rdi
callq 0x68c0
jmp 0x6647
leaq -0x118(%rbp), %rdi
callq 0x6a40
movl $0x0, -0x11c(%rbp)
cmpl $0xb5e, -0x11c(%rbp)    # imm = 0xB5E
jge 0x674c
movl $0x1, -0x120(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x6a60
jmp 0x668c
jmp 0x668e
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x665d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x6806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x66d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2120
leaq -0x91(%rbp), %rdi
callq 0x2240
jmp 0x6806
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x67ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x671e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x2120
leaq -0xf9(%rbp), %rdi
callq 0x2240
jmp 0x67ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x6a90
jmp 0x67ee
movl $0x0, -0x124(%rbp)
cmpl $0x2d, -0x124(%rbp)
jge 0x6791
movl $0x2, -0x128(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x6a60
jmp 0x677e
jmp 0x6780
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x6756
leaq -0x60(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x2f90
jmp 0x67a3
leaq -0x60(%rbp), %rdi
callq 0x68c0
jmp 0x67ae
movl $0x0, -0x4(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x6a90
leaq -0xc8(%rbp), %rdi
callq 0x6a90
leaq -0xb0(%rbp), %rdi
callq 0x6a90
leaq -0x60(%rbp), %rdi
callq 0x3e80
movl -0x4(%rbp), %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0xc8(%rbp), %rdi
callq 0x6a90
leaq -0xb0(%rbp), %rdi
callq 0x6a90
leaq -0x60(%rbp), %rdi
callq 0x3e80
movq -0x68(%rbp), %rdi
callq 0x2330
nopl (%rax,%rax)