// File: /workspace/github_cpp_makefile_star2_O3/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 0x20(%rsp), %r14
movq (%r15,%r12), %rsi
movl $0x2, %edx
movq %r14, %rdi
callq 0x2b4e
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x23e6
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rsp)
jmp 0x23f1
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2842
addq $0x8, %r15
cmpq $0x70, %r15
jne 0x23b9
movq 0x6bd6(%rip), %rbx      # 0x8fd8
leaq 0x3c77(%rip), %rsi      # 0x6080
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 0x6ba4(%rip), %rbx      # 0x8fd8
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq (%rsp), %r13
cmpq 0x8(%rsp), %r13
je 0x24bd
movq 0x6b82(%rip), %r14      # 0x8fd8
leaq 0x3c39(%rip), %r15      # 0x6096
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 0x245d
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq 0x6afd(%rip), %rdi      # 0x8fd8
callq 0x2030
movq %rax, %rdi
callq 0x20d0
movq 0x6ae9(%rip), %rbx      # 0x8fd8
leaq 0x3ba2(%rip), %rsi      # 0x6098
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 0x6ab7(%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 0x3282
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x41e6
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x6a6f(%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 0x25b3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x40(%rsp), %rdi
callq 0x263c
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25d3
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 0x25e5
movq %rax, %rbx
jmp 0x2608
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2608
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x40(%rsp), %rdi
callq 0x263c
jmp 0x261d
jmp 0x261a
jmp 0x261a
jmp 0x261a
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x2633
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x21c0
nop