// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rulesutils.cc
// Function: extend_rules(std::vector<pc_rule*, std::allocator<pc_rule*>>&, std::vector<pc_rule, std::allocator<pc_rule>>&)
void extend_rules(vector<pc_rule*> &in, vector<pc_rule> &out) 
{
    cout<<"Input ruleset: "<<in.size()<<endl;
    struct prefix *srcpf = new prefix();
    struct prefix *dstpf = new prefix();
    int numext;
    int numcmpl_vext;
    int numcmpl_hext;
    for(size_t i = 0; i < in.size(); i++) {
        srcpf = extend_prefix(in[i]->field[2].low, in[i]->field[2].high);
        dstpf = extend_prefix(in[i]->field[3].low, in[i]->field[3].high);
        if(check_cmpl(srcpf) == false || check_cmpl(dstpf) == false) {
            cout<<in[i]->priority<<" complement prefix error"<<endl;
            getchar();
        }
        numext = srcpf->nvalid * dstpf->nvalid;
        if(srcpf->nvalid > 1 && dstpf->nvalid > 1) {
            numcmpl_vext = srcpf->nvalid * dstpf->ninvalid + srcpf->ninvalid + 1;
            numcmpl_hext = dstpf->nvalid * srcpf->ninvalid + dstpf->ninvalid + 1;
        }
        else{
            numcmpl_vext = srcpf->nvalid * dstpf->ninvalid + srcpf->ninvalid;
            numcmpl_hext = dstpf->nvalid * srcpf->ninvalid + dstpf->ninvalid;
        }
        if(numext <=numcmpl_vext && numext <= numcmpl_hext) {
            for(size_t j = 0; j < srcpf->nvalid; j ++) {
              for(size_t k = 0; k < dstpf->nvalid; k ++) {
                if(numext > 32) {
                    cout<<"The theory may be wrong"<<endl;
                }
                pc_rule extrule;
                extrule.priority = in[i]->priority;
                extrule.field[0].low = in[i]->field[0].low;
                extrule.field[0].high = in[i]->field[0].high;
                extrule.field[1].low = in[i]->field[1].low;
                extrule.field[1].high = in[i]->field[1].high;
                extrule.field[2].low = srcpf->value[j];
                extrule.field[2].high = srcpf->value[j] + (int)pow(2, 16 - srcpf->length[j]) - 1;
                extrule.field[3].low = dstpf->value[k];
                extrule.field[3].high = dstpf->value[k] + (int)pow(2, 16 - dstpf->length[k]) - 1;
                extrule.field[4].low = in[i]->field[4].low;
                extrule.field[4].high = in[i]->field[4].high;
                out.push_back(extrule);
            }
        }
        }
        if(numcmpl_vext < numext && numcmpl_vext <= numcmpl_hext) {
            if(numcmpl_vext > 32) {
                cout<<"The theory may be wrong"<<endl;
            }
            if(srcpf->nvalid > 1 && dstpf->nvalid > 1) {
                pc_rule extrule;
                extrule.priority = in[i]->priority;
                extrule.field[0].low = in[i]->field[0].low;
                extrule.field[0].high = in[i]->field[0].high;
                extrule.field[1].low = in[i]->field[1].low;
                extrule.field[1].high = in[i]->field[1].high;
                extrule.field[2].low = srcpf->fullpf;
                extrule.field[2].high = srcpf->fullpf + (int)pow(2, 16 - srcpf->fpf_len) - 1;
                extrule.field[3].low = dstpf->fullpf;
                extrule.field[3].high = dstpf->fullpf + (int)pow(2, 16 - dstpf->fpf_len) - 1;
                extrule.field[4].low = in[i]->field[4].low;
                extrule.field[4].high = in[i]->field[4].high;
                out.push_back(extrule);
            }
            for(size_t j = 0; j < srcpf->ninvalid; j ++) {
                pc_rule extrule;
                extrule.priority = in[i]->priority;
                extrule.field[0].low = in[i]->field[0].low;
                extrule.field[0].high = in[i]->field[0].high;
                extrule.field[1].low = in[i]->field[1].low;
                extrule.field[1].high = in[i]->field[1].high;
                extrule.field[2].low = srcpf->cmplvalue[j];
                extrule.field[2].high = srcpf->cmplvalue[j] + (int)pow(2, 16-srcpf->cmpllength[j]) - 1;
                //output the fullpf
                extrule.field[3].low = dstpf->fullpf;
                extrule.field[3].high = dstpf->fullpf + (int)pow(2, 16-dstpf->fpf_len) - 1;
                extrule.field[4].low = in[i]->field[4].low;
                extrule.field[4].high = in[i]->field[4].high;
                out.push_back(extrule);
            }
            for(size_t j = 0; j < srcpf->nvalid; j ++) {
              for(size_t k = 0; k < dstpf->ninvalid; k ++) {
                pc_rule extrule;
                extrule.priority = in[i]->priority;
                extrule.field[0].low = in[i]->field[0].low;
                extrule.field[0].high = in[i]->field[0].high;
                extrule.field[1].low = in[i]->field[1].low;
                extrule.field[1].high = in[i]->field[1].high;
                extrule.field[2].low = srcpf->value[j];
                extrule.field[2].high = srcpf->value[j] + (int)pow(2, 16-srcpf->length[j]) - 1;
                extrule.field[3].low = dstpf->cmplvalue[k];
                extrule.field[3].high = dstpf->cmplvalue[k] + (int)pow(2, 16-dstpf->cmpllength[k]) - 1;
                extrule.field[4].low = in[i]->field[4].low;
                extrule.field[4].high = in[i]->field[4].high;
                out.push_back(extrule);
            }
        }
        }
        if(numcmpl_hext < numext && numcmpl_hext < numcmpl_vext) {
            if(numcmpl_hext > 32) {
                cout<<"The theory may be wrong"<<endl;
            }
            if(srcpf->nvalid > 1 && dstpf->nvalid > 1) {
                pc_rule extrule;
                extrule.priority = in[i]->priority;
                extrule.field[0].low = in[i]->field[0].low;
                extrule.field[0].high = in[i]->field[0].high;
                extrule.field[1].low = in[i]->field[1].low;
                extrule.field[1].high = in[i]->field[1].high;
                extrule.field[2].low = srcpf->fullpf;
                extrule.field[2].high = srcpf->fullpf + (int)pow(2, 16 - srcpf->fpf_len) - 1;
                extrule.field[3].low = dstpf->fullpf;
                extrule.field[3].high = dstpf->fullpf + (int)pow(2, 16 - dstpf->fpf_len) - 1;
                extrule.field[4].low = in[i]->field[4].low;
                extrule.field[4].high = in[i]->field[4].high;
                out.push_back(extrule);
            }
            for(size_t k = 0; k < dstpf->ninvalid; k ++) {
                pc_rule extrule;
                extrule.priority = in[i]->priority;
                extrule.field[0].low = in[i]->field[0].low;
                extrule.field[0].high = in[i]->field[0].high;
                extrule.field[1].low = in[i]->field[1].low;
                extrule.field[1].high = in[i]->field[1].high;
                extrule.field[2].low = srcpf->fullpf;
                extrule.field[2].high = srcpf->fullpf + (int)pow(2, 16-srcpf->fpf_len) - 1;
                extrule.field[3].low = dstpf->cmplvalue[k];
                extrule.field[3].high = dstpf->cmplvalue[k] + (int)pow(2, 16 - dstpf->cmpllength[k]) - 1;
                extrule.field[4].low = in[i]->field[4].low;
                extrule.field[4].high = in[i]->field[4].high;
                out.push_back(extrule);
            }
            for(size_t j = 0; j < srcpf->ninvalid; j ++) {
              for(size_t k = 0; k < dstpf->nvalid; k ++) {
                pc_rule extrule;
                extrule.priority = in[i]->priority;
                extrule.field[0].low = in[i]->field[0].low;
                extrule.field[0].high = in[i]->field[0].high;
                extrule.field[1].low = in[i]->field[1].low;
                extrule.field[1].high = in[i]->field[1].high;
                extrule.field[2].low = srcpf->cmplvalue[j];
                extrule.field[2].high = srcpf->cmplvalue[j] + (int)pow(2, 16 - srcpf->cmpllength[j]) - 1;
                extrule.field[3].low = dstpf->value[k];
                extrule.field[3].high = dstpf->value[k] + (int)pow(2, 16 - dstpf->length[k]) - 1;
                extrule.field[4].low = in[i]->field[4].low;
                extrule.field[4].high = in[i]->field[4].high;
                out.push_back(extrule);
            }
        }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x9efe(%rip), %rdi      # 0x11fd8
leaq 0x50dc(%rip), %rsi      # 0xd1bd
callq 0x2110
movq %rax, -0x448(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3760
movq -0x448(%rbp), %rdi
movq %rax, %rsi
callq 0x2060
movq %rax, %rdi
movq 0x9eb1(%rip), %rsi      # 0x11fc0
callq 0x2150
movl $0x110, %edi            # imm = 0x110
callq 0x2130
movq %rax, %rdi
movq %rdi, -0x440(%rbp)
xorl %esi, %esi
movl $0x110, %edx            # imm = 0x110
callq 0x20b0
movq -0x440(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x110, %edi            # imm = 0x110
callq 0x2130
movq %rax, %rdi
movq %rdi, -0x438(%rbp)
xorl %esi, %esi
movl $0x110, %edx            # imm = 0x110
callq 0x20b0
movq -0x438(%rbp), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x450(%rbp)
movq -0x8(%rbp), %rdi
callq 0x3760
movq %rax, %rcx
movq -0x450(%rbp), %rax
cmpq %rcx, %rax
jae 0x9100
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x28(%rax), %rax
movl %eax, -0x458(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movl -0x458(%rbp), %edi
movq (%rax), %rax
movq 0x30(%rax), %rax
movl %eax, %esi
callq 0x7120
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x38(%rax), %rax
movl %eax, -0x454(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movl -0x454(%rbp), %edi
movq (%rax), %rax
movq 0x40(%rax), %rax
movl %eax, %esi
callq 0x7120
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x7ef0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x823d
movq -0x20(%rbp), %rdi
callq 0x7ef0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x827e
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movl (%rax), %esi
movq 0x9d82(%rip), %rdi      # 0x11fd8
callq 0x2200
movq %rax, %rdi
leaq 0x4f68(%rip), %rsi      # 0xd1cd
callq 0x2110
movq %rax, %rdi
movq 0x9d4c(%rip), %rsi      # 0x11fc0
callq 0x2150
callq 0x21b0
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
movq -0x20(%rbp), %rcx
imull 0x108(%rcx), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x1, 0x108(%rax)
jbe 0x82fc
movq -0x20(%rbp), %rax
cmpl $0x1, 0x108(%rax)
jbe 0x82fc
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
movq -0x20(%rbp), %rcx
imull 0x10c(%rcx), %eax
movq -0x18(%rbp), %rcx
addl 0x10c(%rcx), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0x108(%rax), %eax
movq -0x18(%rbp), %rcx
imull 0x10c(%rcx), %eax
movq -0x20(%rbp), %rcx
addl 0x10c(%rcx), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x8340
movq -0x18(%rbp), %rax
movl 0x108(%rax), %eax
movq -0x20(%rbp), %rcx
imull 0x10c(%rcx), %eax
movq -0x18(%rbp), %rcx
addl 0x10c(%rcx), %eax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0x108(%rax), %eax
movq -0x18(%rbp), %rcx
imull 0x10c(%rcx), %eax
movq -0x20(%rbp), %rcx
addl 0x10c(%rcx), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jg 0x8563
movl -0x24(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jg 0x8563
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x108(%rcx), %ecx
cmpq %rcx, %rax
jae 0x8561
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rcx
movl 0x108(%rcx), %ecx
cmpq %rcx, %rax
jae 0x854e
cmpl $0x20, -0x24(%rbp)
jle 0x83be
movq 0x9c35(%rip), %rdi      # 0x11fd8
leaq 0x4e3c(%rip), %rsi      # 0xd1e6
callq 0x2110
movq %rax, %rdi
movq 0x9c07(%rip), %rsi      # 0x11fc0
callq 0x2150
leaq -0xd0(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0xd0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x460(%rbp)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
movl $0x10, %esi
subl 0x40(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x460(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x45c(%rbp)
movq -0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
movl $0x10, %esi
subl 0x40(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x45c(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x9160
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x837f
jmp 0x8550
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x8360
jmp 0x8563
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x8b28
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jg 0x8b28
cmpl $0x20, -0x28(%rbp)
jle 0x85a3
movq 0x9a50(%rip), %rdi      # 0x11fd8
leaq 0x4c57(%rip), %rsi      # 0xd1e6
callq 0x2110
movq %rax, %rdi
movq 0x9a22(%rip), %rsi      # 0x11fc0
callq 0x2150
movq -0x18(%rbp), %rax
cmpl $0x1, 0x108(%rax)
jbe 0x873f
movq -0x20(%rbp), %rax
cmpl $0x1, 0x108(%rax)
jbe 0x873f
leaq -0x158(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x158(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x150(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x148(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x140(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x138(%rbp)
movq -0x18(%rbp), %rax
movl 0x100(%rax), %eax
movq %rax, -0x130(%rbp)
movq -0x18(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, -0x468(%rbp)
movq -0x18(%rbp), %rax
movl $0x10, %esi
subl 0x104(%rax), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x468(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x128(%rbp)
movq -0x20(%rbp), %rax
movl 0x100(%rax), %eax
movq %rax, -0x120(%rbp)
movq -0x20(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, -0x464(%rbp)
movq -0x20(%rbp), %rax
movl $0x10, %esi
subl 0x104(%rax), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x464(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x118(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x110(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x108(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x9160
movq $0x0, -0x160(%rbp)
movq -0x160(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
cmpq %rcx, %rax
jae 0x890d
leaq -0x1e8(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x1e8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1e0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x1d8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x1d0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x1c8(%rbp)
movq -0x18(%rbp), %rax
movq -0x160(%rbp), %rcx
movl 0x80(%rax,%rcx,4), %eax
movq %rax, -0x1c0(%rbp)
movq -0x18(%rbp), %rax
movq -0x160(%rbp), %rcx
movl 0x80(%rax,%rcx,4), %eax
movl %eax, -0x470(%rbp)
movq -0x18(%rbp), %rax
movq -0x160(%rbp), %rcx
movl $0x10, %esi
subl 0xc0(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x470(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x1b8(%rbp)
movq -0x20(%rbp), %rax
movl 0x100(%rax), %eax
movq %rax, -0x1b0(%rbp)
movq -0x20(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, -0x46c(%rbp)
movq -0x20(%rbp), %rax
movl $0x10, %esi
subl 0x104(%rax), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x46c(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x1a8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x1a0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x198(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x9160
movq -0x160(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x160(%rbp)
jmp 0x874a
movq $0x0, -0x1f0(%rbp)
movq -0x1f0(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x108(%rcx), %ecx
cmpq %rcx, %rax
jae 0x8b26
movq $0x0, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rax
movq -0x20(%rbp), %rcx
movl 0x10c(%rcx), %ecx
cmpq %rcx, %rax
jae 0x8b0d
leaq -0x280(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x280(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x278(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x270(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x268(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x260(%rbp)
movq -0x18(%rbp), %rax
movq -0x1f0(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq %rax, -0x258(%rbp)
movq -0x18(%rbp), %rax
movq -0x1f0(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x478(%rbp)
movq -0x18(%rbp), %rax
movq -0x1f0(%rbp), %rcx
movl $0x10, %esi
subl 0x40(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x478(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x250(%rbp)
movq -0x20(%rbp), %rax
movq -0x1f8(%rbp), %rcx
movl 0x80(%rax,%rcx,4), %eax
movq %rax, -0x248(%rbp)
movq -0x20(%rbp), %rax
movq -0x1f8(%rbp), %rcx
movl 0x80(%rax,%rcx,4), %eax
movl %eax, -0x474(%rbp)
movq -0x20(%rbp), %rax
movq -0x1f8(%rbp), %rcx
movl $0x10, %esi
subl 0xc0(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x474(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x240(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x238(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x230(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x280(%rbp), %rsi
callq 0x9160
movq -0x1f8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1f8(%rbp)
jmp 0x893d
jmp 0x8b0f
movq -0x1f0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1f0(%rbp)
jmp 0x8918
jmp 0x8b28
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x90ed
movl -0x2c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x90ed
cmpl $0x20, -0x2c(%rbp)
jle 0x8b68
movq 0x948b(%rip), %rdi      # 0x11fd8
leaq 0x4692(%rip), %rsi      # 0xd1e6
callq 0x2110
movq %rax, %rdi
movq 0x945d(%rip), %rsi      # 0x11fc0
callq 0x2150
movq -0x18(%rbp), %rax
cmpl $0x1, 0x108(%rax)
jbe 0x8d04
movq -0x20(%rbp), %rax
cmpl $0x1, 0x108(%rax)
jbe 0x8d04
leaq -0x308(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x308(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x300(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x2f8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x2f0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x2e8(%rbp)
movq -0x18(%rbp), %rax
movl 0x100(%rax), %eax
movq %rax, -0x2e0(%rbp)
movq -0x18(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, -0x480(%rbp)
movq -0x18(%rbp), %rax
movl $0x10, %esi
subl 0x104(%rax), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x480(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x2d8(%rbp)
movq -0x20(%rbp), %rax
movl 0x100(%rax), %eax
movq %rax, -0x2d0(%rbp)
movq -0x20(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, -0x47c(%rbp)
movq -0x20(%rbp), %rax
movl $0x10, %esi
subl 0x104(%rax), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x47c(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x2c8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x2c0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x2b8(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x9160
movq $0x0, -0x310(%rbp)
movq -0x310(%rbp), %rax
movq -0x20(%rbp), %rcx
movl 0x10c(%rcx), %ecx
cmpq %rcx, %rax
jae 0x8ed2
leaq -0x398(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x398(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x390(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x388(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x380(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x378(%rbp)
movq -0x18(%rbp), %rax
movl 0x100(%rax), %eax
movq %rax, -0x370(%rbp)
movq -0x18(%rbp), %rax
movl 0x100(%rax), %eax
movl %eax, -0x488(%rbp)
movq -0x18(%rbp), %rax
movl $0x10, %esi
subl 0x104(%rax), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x488(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x368(%rbp)
movq -0x20(%rbp), %rax
movq -0x310(%rbp), %rcx
movl 0x80(%rax,%rcx,4), %eax
movq %rax, -0x360(%rbp)
movq -0x20(%rbp), %rax
movq -0x310(%rbp), %rcx
movl 0x80(%rax,%rcx,4), %eax
movl %eax, -0x484(%rbp)
movq -0x20(%rbp), %rax
movq -0x310(%rbp), %rcx
movl $0x10, %esi
subl 0xc0(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x484(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x358(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x350(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x348(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x398(%rbp), %rsi
callq 0x9160
movq -0x310(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x310(%rbp)
jmp 0x8d0f
movq $0x0, -0x3a0(%rbp)
movq -0x3a0(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
cmpq %rcx, %rax
jae 0x90eb
movq $0x0, -0x3a8(%rbp)
movq -0x3a8(%rbp), %rax
movq -0x20(%rbp), %rcx
movl 0x108(%rcx), %ecx
cmpq %rcx, %rax
jae 0x90d2
leaq -0x430(%rbp), %rdi
callq 0x9110
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x430(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x428(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x420(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x418(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x410(%rbp)
movq -0x18(%rbp), %rax
movq -0x3a0(%rbp), %rcx
movl 0x80(%rax,%rcx,4), %eax
movq %rax, -0x408(%rbp)
movq -0x18(%rbp), %rax
movq -0x3a0(%rbp), %rcx
movl 0x80(%rax,%rcx,4), %eax
movl %eax, -0x490(%rbp)
movq -0x18(%rbp), %rax
movq -0x3a0(%rbp), %rcx
movl $0x10, %esi
subl 0xc0(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x490(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x400(%rbp)
movq -0x20(%rbp), %rax
movq -0x3a8(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq %rax, -0x3f8(%rbp)
movq -0x20(%rbp), %rax
movq -0x3a8(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x48c(%rbp)
movq -0x20(%rbp), %rax
movq -0x3a8(%rbp), %rcx
movl $0x10, %esi
subl 0x40(%rax,%rcx,4), %esi
movl $0x2, %edi
callq 0x94b0
movl -0x48c(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, -0x3f0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x48(%rax), %rax
movq %rax, -0x3e8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x94e0
movq (%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x3e0(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x430(%rbp), %rsi
callq 0x9160
movq -0x3a8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3a8(%rbp)
jmp 0x8f02
jmp 0x90d4
movq -0x3a0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3a0(%rbp)
jmp 0x8edd
jmp 0x90ed
jmp 0x90ef
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8172
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
nopl (%rax)