// File: /workspace/github_cpp_makefile_star2_O3/derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/cps-tss.cc
// Function: remove_redund_pkg(std::vector<pc_rule, std::allocator<pc_rule>>&, std::vector<pc_rule, std::allocator<pc_rule>>&)
vector<pc_rule*> remove_redund_pkg(vector<pc_rule> &pc, vector<pc_rule> &pc_prefix) 
{
    rule_boundary rb;
    init_boundary(rb);
    
    //pc_prefix = pc;
    
    vector<pc_rule*> pcr;
    for_each(pc.begin(), pc.end(), [&pcr](pc_rule &r){pcr.push_back(&r);});
    cout<<"Orignal ruleset "<<pc.size()<<endl;

    remove_redund_rt(pcr, rb, false);
    extend_rules(pcr, pc_prefix);
    
    cout<<"After prefix explanation: "<< pc_prefix.size()<<endl;

    vector<pc_rule*> pc_pprefix;
    for_each(pc_prefix.begin(), pc_prefix.end(), [&pc_pprefix](pc_rule &r){pc_pprefix.push_back(&r);});

    return move(pc_pprefix);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, -0x70(%rbp)
movq %rsi, %r15
movq %rdi, -0x68(%rbp)
xorps %xmm0, %xmm0
leaq -0xd0(%rbp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
callq 0x31e8
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movq (%r15), %rbx
movq 0x8(%r15), %r14
cmpq %r14, %rbx
je 0x2566
leaq -0x60(%rbp), %r12
leaq -0x40(%rbp), %r13
movq %rbx, -0x40(%rbp)
movq -0x58(%rbp), %rsi
cmpq -0x50(%rbp), %rsi
je 0x254f
movq %rbx, (%rsi)
addq $0x8, -0x58(%rbp)
jmp 0x255a
movq %r12, %rdi
movq %r13, %rdx
callq 0x2de2
addq $0x88, %rbx
cmpq %r14, %rbx
jne 0x2537
movq 0x7a6b(%rip), %rdi      # 0x9fd8
leaq 0x4aaf(%rip), %rsi      # 0x7023
movl $0x10, %edx
callq 0x2190
movq -0x70(%rbp), %r14
movq 0x8(%r15), %rsi
subq (%r15), %rsi
sarq $0x3, %rsi
movabsq $-0xf0f0f0f0f0f0f0f, %r12 # imm = 0xF0F0F0F0F0F0F0F1
imulq %r12, %rsi
movq 0x7a36(%rip), %rdi      # 0x9fd8
callq 0x20c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
leaq -0x60(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
xorl %edx, %edx
callq 0x36f2
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
callq 0x46b3
movq 0x79e2(%rip), %rdi      # 0x9fd8
leaq 0x4a37(%rip), %rsi      # 0x7034
movl $0x1a, %edx
callq 0x2190
movq 0x8(%r14), %rsi
subq (%r14), %rsi
sarq $0x3, %rsi
imulq %r12, %rsi
movq 0x79bb(%rip), %rdi      # 0x9fd8
callq 0x20c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20d0
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq (%r14), %rbx
movq 0x8(%r14), %r12
cmpq %r12, %rbx
je 0x26ac
leaq -0x40(%rbp), %r14
leaq -0x78(%rbp), %r15
movq %rbx, -0x78(%rbp)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x2687
movq %rbx, (%rsi)
addq $0x8, -0x38(%rbp)
jmp 0x2692
movq %r14, %rdi
movq %r15, %rdx
callq 0x2de2
addq $0x88, %rbx
cmpq %r12, %rbx
jne 0x266f
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
jmp 0x26b2
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq -0x68(%rbp), %rbx
movq %rdx, (%rbx)
movq %rcx, 0x8(%rbx)
movq %rax, 0x10(%rbx)
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x26cf
callq 0x2130
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x26fc
callq 0x2130
jmp 0x26fc
jmp 0x26f9
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x270a
callq 0x2130
movq %rbx, %rdi
callq 0x2240