// File: /workspace/github_cpp_makefile_star2_O1/junhe[P]libpatterndetector/example.cpp
// Function: main
int main()
{
    // build the vector for requests
    vector<Request> reqs;
    off_t offs[] = {0,3,7,14,17,21,28,31,35,42,46,50,54,58};
    off_t lens[] = {2,2,2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
    
    int n = sizeof(offs)/sizeof(off_t);
    int i;
    for ( i = 0 ; i < n ; i++ ) {
        reqs.push_back( Request( offs[i], lens[i] ) ); 
    }

    // check the requests, just to make sure
    cout << "*** Offset;Length ***" << endl;
    vector<Request>::iterator it;
    for ( it = reqs.begin() ; it != reqs.end() ; it++ ) {
        cout << it->offset << ";" << it->length << endl;
    }

    // OK, detect and show the patterns
    cout << endl;
    cout << "*** Pattern Found ***" << endl;
    RequestPatternList plist;
    PatternUtil::getReqPatList( reqs, plist );
    cout << plist.show() << endl;

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x60, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rbx
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
xorl %r15d, %r15d
leaq 0x3c5c(%rip), %r12      # 0x6010
leaq 0x3cc5(%rip), %r13      # 0x6080
leaq 0x20(%rsp), %r14
movq (%r15,%r12), %rsi
movq (%r15,%r13), %rdx
movq %r14, %rdi
callq 0x2b4c
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x23ec
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rsp)
jmp 0x23f7
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2848
addq $0x8, %r15
cmpq $0x70, %r15
jne 0x23c0
movq 0x6bd0(%rip), %rbx      # 0x8fd8
leaq 0x3ce1(%rip), %rsi      # 0x60f0
movl $0x15, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq 0x6b9e(%rip), %rbx      # 0x8fd8
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq (%rsp), %r13
cmpq 0x8(%rsp), %r13
je 0x24c3
movq 0x6b7c(%rip), %r14      # 0x8fd8
leaq 0x3ca3(%rip), %r15      # 0x6106
movq (%r13), %rsi
movq %r14, %rdi
callq 0x2110
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2150
movq 0x8(%r13), %rsi
movq %r12, %rdi
callq 0x2110
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
addq $0x10, %r13
cmpq 0x8(%rsp), %r13
jne 0x2463
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq 0x6af7(%rip), %rdi      # 0x8fd8
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq 0x6ae3(%rip), %rbx      # 0x8fd8
leaq 0x3c0c(%rip), %rsi      # 0x6108
movl $0x15, %edx
movq %rbx, %rdi
callq 0x2150
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq 0x6ab1(%rip), %rdi      # 0x8fd8
callq 0x2030
movq %rax, %rdi
callq 0x20d0
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq %rsp, %rdi
callq 0x32ee
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x42bc
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x6a69(%rip), %rdi      # 0x8fd8
callq 0x2150
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x25b9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x40(%rsp), %rdi
callq 0x2642
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25d9
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
xorl %eax, %eax
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x25eb
movq %rax, %rbx
jmp 0x260e
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x260e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x40(%rsp), %rdi
callq 0x2642
jmp 0x2623
jmp 0x2620
jmp 0x2620
jmp 0x2620
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2639
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x21c0
nop