// File: Albuso0[P]entropy/main.cpp
// Function: main
int main(int argc, char *argv[])
{
    int k =0 , L = 0, N = 0;
    double M = 0;
    std::string fin = "", hist = "";
    
    std::CommandLine cmd;
    cmd.AddValue ("k",  "Alphabet size", k);
    cmd.AddValue ("L",  "Polynoimal degree. Default c0*log(k)", L);
    cmd.AddValue ("M",  "M/n is the right-end of approximation interval. Default c1*log(k)", M);
    cmd.AddValue ("N",  "Threshold to apply polynomial estimator. Default c2*log(k)", N);
    cmd.AddValue ("fin",  "fingerprint data file", fin);
    cmd.AddValue ("hist",  "histogram data file", hist);
    cmd.Parse (argc, argv);
    if( k == 0 ) { std::cerr<<"Please input k!\n"; exit(1); }
    if( L == 0 ) L = 1.6*log(k); // Default value
    if( M == 0 ) M = 3.5*log(k); // Default value
    if( N == 0 ) N = 1.6*log(k); // Default value
    if( (hist=="") && (fin=="") ) { std::cerr<<"Please input fingerprint or histogram!\n"; exit(1); }

    printf("\n");
    // Set estimator
    Entropy entropy( k );
    entropy.setDegree( L ); 
    entropy.setInterval( M ); 
    entropy.setThreshold( N ); 
    print_param(entropy);

    // Input fingerprint from file
    if ( fin!="")
        entropy.setFin(fin);
    else
        entropy.setHist(hist);
    print_results(entropy);
    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x3490
movq -0x320(%rbp), %rdx
leaq 0x3b2f(%rip), %rsi      # 0xb193
leaq -0x48(%rbp), %rdi
callq 0x8170
jmp 0x766f
leaq -0x49(%rbp), %rdi
callq 0x3320
leaq -0x81(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x3490
movq -0x328(%rbp), %rdx
leaq 0x3afa(%rip), %rsi      # 0xb193
leaq -0x80(%rbp), %rdi
callq 0x8170
jmp 0x76a4
leaq -0x81(%rbp), %rdi
callq 0x3320
leaq -0xa0(%rbp), %rdi
callq 0x8220
jmp 0x76be
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x3490
movq -0x330(%rbp), %rdx
leaq 0x39b9(%rip), %rsi      # 0xb098
leaq -0xc0(%rbp), %rdi
callq 0x8170
jmp 0x76ed
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x3490
movq -0x338(%rbp), %rdx
leaq 0x398c(%rip), %rsi      # 0xb09a
leaq -0xe8(%rbp), %rdi
callq 0x8170
jmp 0x771c
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
leaq -0x14(%rbp), %rcx
callq 0x8240
jmp 0x773c
leaq -0xe8(%rbp), %rdi
callq 0x31b0
leaq -0xe9(%rbp), %rdi
callq 0x3320
leaq -0xc0(%rbp), %rdi
callq 0x31b0
leaq -0xc1(%rbp), %rdi
callq 0x3320
leaq -0x111(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x3490
movq -0x340(%rbp), %rdx
leaq 0x391b(%rip), %rsi      # 0xb0a8
leaq -0x110(%rbp), %rdi
callq 0x8170
jmp 0x779b
leaq -0x139(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x3490
movq -0x348(%rbp), %rdx
leaq 0x38ee(%rip), %rsi      # 0xb0aa
leaq -0x138(%rbp), %rdi
callq 0x8170
jmp 0x77ca
leaq -0xa0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x138(%rbp), %rdx
leaq -0x18(%rbp), %rcx
callq 0x8240
jmp 0x77ea
leaq -0x138(%rbp), %rdi
callq 0x31b0
leaq -0x139(%rbp), %rdi
callq 0x3320
leaq -0x110(%rbp), %rdi
callq 0x31b0
leaq -0x111(%rbp), %rdi
callq 0x3320
leaq -0x161(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x3490
movq -0x350(%rbp), %rdx
leaq 0x3894(%rip), %rsi      # 0xb0cf
leaq -0x160(%rbp), %rdi
callq 0x8170
jmp 0x7849
leaq -0x189(%rbp), %rdi
movq %rdi, -0x358(%rbp)
callq 0x3490
movq -0x358(%rbp), %rdx
leaq 0x3867(%rip), %rsi      # 0xb0d1
leaq -0x188(%rbp), %rdi
callq 0x8170
jmp 0x7878
leaq -0xa0(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x188(%rbp), %rdx
leaq -0x28(%rbp), %rcx
callq 0x82e0
jmp 0x7898
leaq -0x188(%rbp), %rdi
callq 0x31b0
leaq -0x189(%rbp), %rdi
callq 0x3320
leaq -0x160(%rbp), %rdi
callq 0x31b0
leaq -0x161(%rbp), %rdi
callq 0x3320
leaq -0x1b1(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x3490
movq -0x360(%rbp), %rdx
leaq 0x382a(%rip), %rsi      # 0xb113
leaq -0x1b0(%rbp), %rdi
callq 0x8170
jmp 0x78f7
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0x3490
movq -0x368(%rbp), %rdx
leaq 0x37fd(%rip), %rsi      # 0xb115
leaq -0x1d8(%rbp), %rdi
callq 0x8170
jmp 0x7926
leaq -0xa0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
leaq -0x1d8(%rbp), %rdx
leaq -0x1c(%rbp), %rcx
callq 0x8240
jmp 0x7946
leaq -0x1d8(%rbp), %rdi
callq 0x31b0
leaq -0x1d9(%rbp), %rdi
callq 0x3320
leaq -0x1b0(%rbp), %rdi
callq 0x31b0
leaq -0x1b1(%rbp), %rdi
callq 0x3320
leaq -0x201(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x3490
movq -0x370(%rbp), %rdx
leaq 0x37b9(%rip), %rsi      # 0xb150
leaq -0x200(%rbp), %rdi
callq 0x8170
jmp 0x79a5
leaq -0x229(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x3490
movq -0x378(%rbp), %rdx
leaq 0x378e(%rip), %rsi      # 0xb154
leaq -0x228(%rbp), %rdi
callq 0x8170
jmp 0x79d4
leaq -0xa0(%rbp), %rdi
leaq -0x200(%rbp), %rsi
leaq -0x228(%rbp), %rdx
leaq -0x48(%rbp), %rcx
callq 0x8380
jmp 0x79f4
leaq -0x228(%rbp), %rdi
callq 0x31b0
leaq -0x229(%rbp), %rdi
callq 0x3320
leaq -0x200(%rbp), %rdi
callq 0x31b0
leaq -0x201(%rbp), %rdi
callq 0x3320
leaq -0x251(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x3490
movq -0x380(%rbp), %rdx
leaq 0x3725(%rip), %rsi      # 0xb16a
leaq -0x250(%rbp), %rdi
callq 0x8170
jmp 0x7a53
leaq -0x279(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x3490
movq -0x388(%rbp), %rdx
leaq 0x36fb(%rip), %rsi      # 0xb16f
leaq -0x278(%rbp), %rdi
callq 0x8170
jmp 0x7a82
leaq -0xa0(%rbp), %rdi
leaq -0x250(%rbp), %rsi
leaq -0x278(%rbp), %rdx
leaq -0x80(%rbp), %rcx
callq 0x8380
jmp 0x7aa2
leaq -0x278(%rbp), %rdi
callq 0x31b0
leaq -0x279(%rbp), %rdi
callq 0x3320
leaq -0x250(%rbp), %rdi
callq 0x31b0
leaq -0x251(%rbp), %rdi
callq 0x3320
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x9500
jmp 0x7ae7
cmpl $0x0, -0x14(%rbp)
jne 0x7d97
movq 0x94f8(%rip), %rdi      # 0x10ff0
leaq 0x3684(%rip), %rsi      # 0xb183
callq 0x32b0
jmp 0x7b06
movl $0x1, %edi
callq 0x3390
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x3320
jmp 0x8029
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x81(%rbp), %rdi
callq 0x3320
jmp 0x8020
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x8017
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7ba4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7b8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x31b0
leaq -0xe9(%rbp), %rdi
callq 0x3320
leaq -0xc0(%rbp), %rdi
callq 0x31b0
leaq -0xc1(%rbp), %rdi
callq 0x3320
jmp 0x800b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7c01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7be9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x31b0
leaq -0x139(%rbp), %rdi
callq 0x3320
leaq -0x110(%rbp), %rdi
callq 0x31b0
leaq -0x111(%rbp), %rdi
callq 0x3320
jmp 0x800b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7c5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7c46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x31b0
leaq -0x189(%rbp), %rdi
callq 0x3320
leaq -0x160(%rbp), %rdi
callq 0x31b0
leaq -0x161(%rbp), %rdi
callq 0x3320
jmp 0x800b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7cbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7ca3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x31b0
leaq -0x1d9(%rbp), %rdi
callq 0x3320
leaq -0x1b0(%rbp), %rdi
callq 0x31b0
leaq -0x1b1(%rbp), %rdi
callq 0x3320
jmp 0x800b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7d18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7d00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x31b0
leaq -0x229(%rbp), %rdi
callq 0x3320
leaq -0x200(%rbp), %rdi
callq 0x31b0
leaq -0x201(%rbp), %rdi
callq 0x3320
jmp 0x800b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7d75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7d5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x31b0
leaq -0x279(%rbp), %rdi
callq 0x3320
leaq -0x250(%rbp), %rdi
callq 0x31b0
leaq -0x251(%rbp), %rdi
callq 0x3320
jmp 0x800b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x800b
cmpl $0x0, -0x18(%rbp)
jne 0x7dbd
cvtsi2sdl -0x14(%rbp), %xmm0
callq 0x3250
movaps %xmm0, %xmm1
movsd 0x32d6(%rip), %xmm0     # 0xb088
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x18(%rbp)
movsd -0x28(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x7deb
jp 0x7deb
cvtsi2sdl -0x14(%rbp), %xmm0
callq 0x3250
movaps %xmm0, %xmm1
movsd 0x32ae(%rip), %xmm0     # 0xb090
mulsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x7e11
cvtsi2sdl -0x14(%rbp), %xmm0
callq 0x3250
movaps %xmm0, %xmm1
movsd 0x3282(%rip), %xmm0     # 0xb088
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
leaq 0x337b(%rip), %rsi      # 0xb193
leaq -0x80(%rbp), %rdi
callq 0x8420
movb %al, -0x389(%rbp)
jmp 0x7e29
movb -0x389(%rbp), %al
testb $0x1, %al
jne 0x7e35
jmp 0x7e78
leaq 0x3357(%rip), %rsi      # 0xb193
leaq -0x48(%rbp), %rdi
callq 0x8420
movb %al, -0x38a(%rbp)
jmp 0x7e4d
movb -0x38a(%rbp), %al
testb $0x1, %al
jne 0x7e59
jmp 0x7e78
movq 0x9190(%rip), %rdi      # 0x10ff0
leaq 0x332d(%rip), %rsi      # 0xb194
callq 0x32b0
jmp 0x7e6e
movl $0x1, %edi
callq 0x3390
leaq 0x3313(%rip), %rdi      # 0xb192
xorl %eax, %eax
callq 0x3050
jmp 0x7e88
movl -0x14(%rbp), %esi
leaq -0x2d8(%rbp), %rdi
callq 0x4900
jmp 0x7e99
movl -0x18(%rbp), %esi
leaq -0x2d8(%rbp), %rdi
callq 0x46e0
jmp 0x7eaa
movsd -0x28(%rbp), %xmm0
leaq -0x2d8(%rbp), %rdi
callq 0x8450
jmp 0x7ebd
cvtsi2sdl -0x1c(%rbp), %xmm0
leaq -0x2d8(%rbp), %rdi
callq 0x8470
jmp 0x7ed0
leaq -0x2d8(%rbp), %rdi
callq 0x8040
jmp 0x7ede
leaq 0x32ae(%rip), %rsi      # 0xb193
leaq -0x48(%rbp), %rdi
callq 0x8490
movb %al, -0x38b(%rbp)
jmp 0x7ef6
movb -0x38b(%rbp), %al
testb $0x1, %al
jne 0x7f02
jmp 0x7f65
leaq -0x2f8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3130
jmp 0x7f14
leaq -0x2d8(%rbp), %rdi
leaq -0x2f8(%rbp), %rsi
callq 0x3ef0
jmp 0x7f29
leaq -0x2f8(%rbp), %rdi
callq 0x31b0
jmp 0x7fb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7fff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x31b0
jmp 0x7fff
leaq -0x318(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3130
jmp 0x7f77
leaq -0x2d8(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x43d0
jmp 0x7f8c
leaq -0x318(%rbp), %rdi
callq 0x31b0
jmp 0x7fb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x31b0
jmp 0x7fff
leaq -0x2d8(%rbp), %rdi
callq 0x80e0
jmp 0x7fc2
movl $0x0, -0x4(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x5040
leaq -0xa0(%rbp), %rdi
callq 0x9cc0
leaq -0x80(%rbp), %rdi
callq 0x31b0
leaq -0x48(%rbp), %rdi
callq 0x31b0
movl -0x4(%rbp), %eax
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
leaq -0x2d8(%rbp), %rdi
callq 0x5040
leaq -0xa0(%rbp), %rdi
callq 0x9cc0
leaq -0x80(%rbp), %rdi
callq 0x31b0
leaq -0x48(%rbp), %rdi
callq 0x31b0
movq -0x58(%rbp), %rdi
callq 0x3480
nopw %cs:(%rax,%rax)