// File: derekzwy[P]an-optimal-tcam-encoding-algorithm-for-packet-classification/rulesutils.cc
// Function: extend_prefix(unsigned int, unsigned int)
struct prefix *extend_prefix(unsigned ai, unsigned aj)
{
  struct prefix *pf = new prefix();
  int i = 0;  

  if(ai == aj) {
    pf->value[i] = ai;
    pf->length[i] = 16;
    pf->fullpf = ai;
    pf->fpf_len = 16;
    pf->nvalid = 1;

    pf->cmplvalue[i] = ai;
    pf->cmpllength[i] = 16;
    pf->ninvalid = 1; 
    return pf;
  } 
 
  int k;
  bool flag = false;
  pf->ninvalid = 0;         
  while(1) {
    for(k = 0; (ai & (int)pow(2,k)) == 0 && k <= 15 ; k ++);
    if(ai + pow(2,k) - 1 == aj) {       
      pf->value[i] = ai>>k<<k;
      pf->length[i] = 16 - k;
      pf->nvalid = i + 1;

      if( i  == 0) {
        pf->fullpf = ai>>k<<k;
        pf->fpf_len = 16 - k;

        pf->cmplvalue[i] = ai>>k<<k;
        pf->cmpllength[i] = 16 - k;
        pf->ninvalid = 1;
      }
      else {
        pf->fullpf = ai>>(k + 1)<<(k + 1);
        pf->fpf_len = 16 - k - 1;
        
        int numcmpl = pf->length[i - 1] - pf->length[i] - 1;
        while(numcmpl > 0) {
            pf->cmplvalue[pf->ninvalid] = (ai - (int)pow(2,k))>>(k - numcmpl)<<(k - numcmpl);
            pf->cmpllength[pf->ninvalid] = 16 - k + numcmpl;
            numcmpl --;
            pf->ninvalid ++;
        }
      }
      return pf;
    }
    else if (ai + pow(2,k) - 1 < aj) {
      pf->value[i] = ai>>k<<k;
      pf->length[i] = 16 - k;
      if(i == 0) {
        pf->cmplvalue[pf->ninvalid] = (ai - (int)pow(2,k))>>k<<k;
        pf->cmpllength[pf->ninvalid] = 16 - k;
        pf->ninvalid ++;
      }
      else {
        int numcmpl = pf->length[i - 1] - pf->length[i] - 1;
        while(numcmpl > 0) {
            pf->cmplvalue[pf->ninvalid] = (ai - (int)pow(2,k))>>(k - numcmpl)<<(k - numcmpl);
            pf->cmpllength[pf->ninvalid] = 16 - k + numcmpl;
            numcmpl --;
            pf->ninvalid ++;
        }
      }
      ai = ai + (int)pow(2, k);
    }
    else{
        if(i != 0) {
            flag = true;
            pf->fullpf = ai>>(k + 1)<<(k + 1);
            pf->fpf_len = 16 - k - 1; 

            int numcmpl = pf->length[i - 1] - pf->fpf_len - 2;
            while(numcmpl > 0) {
                pf->cmplvalue[pf->ninvalid] = (ai - (int)pow(2,k))>>(k - numcmpl)<<(k - numcmpl);
                pf->cmpllength[pf->ninvalid] = 16 - k + numcmpl;
                numcmpl --;
                pf->ninvalid ++;
            }
        }
      break;
    }        
    i++;
  } 

  if(ai == aj){
    pf->value[i] = ai;
    pf->length[i] = 16;
    pf->nvalid = i + 1;

    pf->cmplvalue[pf->ninvalid] = ai + 1;
    pf->cmpllength[pf->ninvalid] = 16;
    pf->ninvalid ++; 
    return pf;
  } 

  while(ai < aj) {
    for(k = 15; ((ai ^ aj) & (int)pow(2,k)) == 0 ; k --);
    if(ai + pow(2,k + 1) - 1 == aj) {
      pf->value[i] = ai>>(k+1)<<(k+1);
      pf->length[i] = 15 - k;
      pf->nvalid = i + 1;

      if(!flag) {
        if(i == 0){
            pf->fullpf = ai>>(k+1)<<(k+1);
            pf->fpf_len = 15 - k;
        }
        else {
            pf->fullpf = pf->value[0]>>(15 - pf->length[0])<<(15 - pf->length[0]);
            pf->fpf_len = pf->length[0] - 1;
        }
      }

      pf->cmplvalue[pf->ninvalid] = (ai + (int)pow(2, k + 1))>>(k + 1)<<(k + 1);
      pf->cmpllength[pf->ninvalid] = 15 - k;
      pf->ninvalid ++;
      i--;
      while((pf->value[i] >> (16 - pf->length[i])) % 2 == 0 && i > 0) {
        int numcmpl = pf->length[i + 1] - pf->length[i] - 1;
        while(numcmpl > 0) {
            int move = 16 - pf->length[i] - numcmpl;
            pf->cmplvalue[pf->ninvalid] = (ai + (int)pow(2, move))>>move<<move;
            pf->cmpllength[pf->ninvalid] = pf->length[i] + numcmpl;
            numcmpl--;
            pf->ninvalid ++;
        }
        i--;
      }
      int numcmpl = pf->length[i + 1] - pf->fpf_len - 2;
      int tmp = 1;
      while(numcmpl >= tmp ) {
        int move = 16 - pf->length[i + 1] + tmp; 
        pf->cmplvalue[pf->ninvalid] = (ai + (int)pow(2, move))>>move<<move;
        pf->cmpllength[pf->ninvalid] = pf->length[i + 1] - tmp;
        tmp ++;
        pf->ninvalid ++;
      }
      return pf;
    } 
    else {
      pf->value[i]=ai>>k<<k;
      pf->length[i]=16 - k;
      ai = ai + (int)pow(2,k);
    }
    i++;        
  } 

  pf->value[i] = ai;
  pf->length[i] = 16;
  pf->nvalid = i + 1;
  
  if(!flag) {
    pf->fullpf = pf->value[0]>>(15 - pf->length[0])<<(15 - pf->length[0]);
    pf->fpf_len = pf->length[0] - 1;
  }

  pf->cmplvalue[pf->ninvalid] = ai + (int)pow(2, 0);
  pf->cmpllength[pf->ninvalid] = 16;
  pf->ninvalid ++;
  i--;
  while((pf->value[i] >> (16 - pf->length[i])) % 2 == 0 && i > 0) {
    int numcmpl = pf->length[i + 1] - pf->length[i] - 1;
    while(numcmpl > 0) {
        int move = 16 - pf->length[i] - numcmpl;
        pf->cmplvalue[pf->ninvalid] = (ai + (int)pow(2, move))>>move<<move;
        pf->cmpllength[pf->ninvalid] = pf->length[i] + numcmpl;
        numcmpl--;
        pf->ninvalid ++;
    }
    i--;
  }
  int numcmpl = pf->length[i + 1] - pf->fpf_len - 2;
  int tmp = 1;
  while(numcmpl >= tmp ) {
    int move = 16 - pf->length[i + 1] + tmp; 
    pf->cmplvalue[pf->ninvalid] = (ai + (int)pow(2, move))>>move<<move;
    pf->cmpllength[pf->ninvalid] = pf->length[i + 1] - tmp;
    tmp ++;
    pf->ninvalid ++;
  }

  return pf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl $0x110, %edi            # imm = 0x110
callq 0x2130
movq %rax, %rdi
movq %rdi, -0x60(%rbp)
xorl %esi, %esi
movl $0x110, %edx            # imm = 0x110
callq 0x20b0
movq -0x60(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x71f0
movl -0xc(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl $0x10, 0x40(%rax,%rcx,4)
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movq -0x18(%rbp), %rax
movl $0x10, 0x104(%rax)
movq -0x18(%rbp), %rax
movl $0x1, 0x108(%rax)
movl -0xc(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0x80(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl $0x10, 0xc0(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movl $0x1, 0x10c(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x7ed8
movb $0x0, -0x21(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, 0x10c(%rax)
movl $0x0, -0x20(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0x68(%rbp), %ecx
cvttsd2si %xmm0, %eax
andl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x61(%rbp)
jne 0x7239
cmpl $0xf, -0x20(%rbp)
setle %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x7242
jmp 0x724f
jmp 0x7244
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x7209
movl -0xc(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x70(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd 0x5e4b(%rip), %xmm1     # 0xd0c8
addsd %xmm1, %xmm0
movl -0x10(%rbp), %eax
cvtsi2sd %rax, %xmm1
ucomisd %xmm1, %xmm0
jne 0x743e
jp 0x743e
movl -0xc(%rbp), %edx
movl -0x20(%rbp), %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x10, %edx
subl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0x40(%rax,%rcx,4)
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x108(%rax)
cmpl $0x0, -0x1c(%rbp)
jne 0x734c
movl -0xc(%rbp), %eax
movl -0x20(%rbp), %ecx
shrl %cl, %eax
movl -0x20(%rbp), %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movl $0x10, %ecx
subl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x104(%rax)
movl -0xc(%rbp), %edx
movl -0x20(%rbp), %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0x80(%rax,%rcx,4)
movl $0x10, %edx
subl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0xc0(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movl $0x1, 0x10c(%rax)
jmp 0x7431
movl -0xc(%rbp), %eax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shrl %cl, %eax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movl $0x10, %ecx
subl -0x20(%rbp), %ecx
subl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x104(%rax)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
subl 0x40(%rcx,%rdx,4), %eax
subl $0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x742f
movl -0xc(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0x74(%rbp), %edx
cvttsd2si %xmm0, %eax
subl %eax, %edx
movl -0x20(%rbp), %ecx
subl -0x28(%rbp), %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
subl -0x28(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movl $0x10, %edx
subl -0x20(%rbp), %edx
addl -0x28(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
jmp 0x73a3
jmp 0x7431
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x7ed8
movl -0xc(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movsd -0x80(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd 0x5c5f(%rip), %xmm0     # 0xd0c8
addsd %xmm0, %xmm1
movl -0x10(%rbp), %eax
cvtsi2sd %rax, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7608
movl -0xc(%rbp), %edx
movl -0x20(%rbp), %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x10, %edx
subl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0x40(%rax,%rcx,4)
cmpl $0x0, -0x1c(%rbp)
jne 0x7527
movl -0xc(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0x84(%rbp), %edx
cvttsd2si %xmm0, %eax
subl %eax, %edx
movl -0x20(%rbp), %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movl $0x10, %edx
subl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
jmp 0x75de
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
subl 0x40(%rcx,%rdx,4), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jle 0x75dc
movl -0xc(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0x88(%rbp), %edx
cvttsd2si %xmm0, %eax
subl %eax, %edx
movl -0x20(%rbp), %ecx
subl -0x2c(%rbp), %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
subl -0x2c(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movl $0x10, %edx
subl -0x20(%rbp), %edx
addl -0x2c(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
jmp 0x754a
jmp 0x75de
movl -0xc(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0x8c(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0xc(%rbp)
jmp 0x7701
cmpl $0x0, -0x1c(%rbp)
je 0x76ff
movb $0x1, -0x21(%rbp)
movl -0xc(%rbp), %eax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shrl %cl, %eax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movl $0x10, %ecx
subl -0x20(%rbp), %ecx
subl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x104(%rax)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
subl 0x104(%rcx), %eax
subl $0x2, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jle 0x76fd
movl -0xc(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0x90(%rbp), %edx
cvttsd2si %xmm0, %eax
subl %eax, %edx
movl -0x20(%rbp), %ecx
subl -0x30(%rbp), %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
subl -0x30(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movl $0x10, %edx
subl -0x20(%rbp), %edx
addl -0x30(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movl -0x30(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
jmp 0x766b
jmp 0x76ff
jmp 0x7711
jmp 0x7703
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7202
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x779f
movl -0xc(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl $0x10, 0x40(%rax,%rcx,4)
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x108(%rax)
movl -0xc(%rbp), %edx
addl $0x1, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl $0x10, 0xc0(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x7ed8
jmp 0x77a1
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jae 0x7bf0
movl $0xf, -0x20(%rbp)
movl -0xc(%rbp), %eax
xorl -0x10(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0x94(%rbp), %eax
cvttsd2si %xmm0, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
jne 0x77eb
jmp 0x77e0
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x77b4
movl -0xc(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0xa0(%rbp)
movl -0x20(%rbp), %esi
incl %esi
movl $0x2, %edi
callq 0x9480
movaps %xmm0, %xmm1
movsd -0xa0(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd 0x58a7(%rip), %xmm1     # 0xd0c8
addsd %xmm1, %xmm0
movl -0x10(%rbp), %eax
cvtsi2sd %rax, %xmm1
ucomisd %xmm1, %xmm0
jne 0x7b91
jp 0x7b91
movl -0xc(%rbp), %edx
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0xf, %edx
subl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0x40(%rax,%rcx,4)
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x108(%rax)
testb $0x1, -0x21(%rbp)
jne 0x7902
cmpl $0x0, -0x1c(%rbp)
jne 0x78be
movl -0xc(%rbp), %eax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shrl %cl, %eax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movl $0xf, %ecx
subl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x104(%rax)
jmp 0x7900
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rdx
movl $0xf, %ecx
subl 0x40(%rdx), %ecx
shrl %cl, %eax
movq -0x18(%rbp), %rdx
movl $0xf, %ecx
subl 0x40(%rdx), %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movq -0x18(%rbp), %rax
movl 0x40(%rax), %ecx
subl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x104(%rax)
jmp 0x7902
movl -0xc(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0x20(%rbp), %esi
addl $0x1, %esi
movl $0x2, %edi
callq 0x9480
movl -0xa4(%rbp), %edx
cvttsd2si %xmm0, %eax
addl %eax, %edx
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movl $0xf, %edx
subl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x18(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movl $0x10, %ecx
subl 0x40(%rdx,%rsi,4), %ecx
shrl %cl, %eax
movl %eax, %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xa5(%rbp)
jne 0x79c2
cmpl $0x0, -0x1c(%rbp)
setg %al
movb %al, -0xa5(%rbp)
movb -0xa5(%rbp), %al
testb $0x1, %al
jne 0x79d1
jmp 0x7aa9
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
subl 0x40(%rcx,%rdx,4), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0x7a9b
movq -0x18(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movl $0x10, %eax
subl 0x40(%rcx,%rdx,4), %eax
subl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0xac(%rbp)
movl -0x38(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0xac(%rbp), %edx
cvttsd2si %xmm0, %eax
addl %eax, %edx
movl -0x38(%rbp), %ecx
shrl %cl, %edx
movl -0x38(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x40(%rax,%rcx,4), %edx
addl -0x34(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
jmp 0x79f4
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7985
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
subl 0x104(%rcx), %eax
subl $0x2, %eax
movl %eax, -0x3c(%rbp)
movl $0x1, -0x40(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jl 0x7b84
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
movl $0x10, %eax
subl 0x40(%rcx,%rdx,4), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0xb0(%rbp)
movl -0x44(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0xb0(%rbp), %edx
cvttsd2si %xmm0, %eax
addl %eax, %edx
movl -0x44(%rbp), %ecx
shrl %cl, %edx
movl -0x44(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %edx
subl -0x40(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
jmp 0x7ad1
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x7ed8
movl -0xc(%rbp), %edx
movl -0x20(%rbp), %ecx
shrl %cl, %edx
movl -0x20(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x10, %edx
subl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0x40(%rax,%rcx,4)
movl -0xc(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0x20(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0xb4(%rbp), %eax
cvttsd2si %xmm0, %ecx
addl %ecx, %eax
movl %eax, -0xc(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x77a1
movl -0xc(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl $0x10, 0x40(%rax,%rcx,4)
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x108(%rax)
testb $0x1, -0x21(%rbp)
jne 0x7c66
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rdx
movl $0xf, %ecx
subl 0x40(%rdx), %ecx
shrl %cl, %eax
movq -0x18(%rbp), %rdx
movl $0xf, %ecx
subl 0x40(%rdx), %ecx
shll %cl, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x100(%rax)
movq -0x18(%rbp), %rax
movl 0x40(%rax), %ecx
subl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x104(%rax)
movl -0xc(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl $0x2, %edi
xorl %esi, %esi
callq 0x9480
movl -0xb8(%rbp), %edx
cvttsd2si %xmm0, %eax
addl %eax, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl $0x10, 0xc0(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x18(%rbp), %rdx
movslq -0x1c(%rbp), %rsi
movl $0x10, %ecx
subl 0x40(%rdx,%rsi,4), %ecx
shrl %cl, %eax
movl %eax, %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xb9(%rbp)
jne 0x7d0e
cmpl $0x0, -0x1c(%rbp)
setg %al
movb %al, -0xb9(%rbp)
movb -0xb9(%rbp), %al
testb $0x1, %al
jne 0x7d1d
jmp 0x7df5
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
subl 0x40(%rcx,%rdx,4), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jle 0x7de7
movq -0x18(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movl $0x10, %eax
subl 0x40(%rcx,%rdx,4), %eax
subl -0x48(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0xc0(%rbp)
movl -0x4c(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0xc0(%rbp), %edx
cvttsd2si %xmm0, %eax
addl %eax, %edx
movl -0x4c(%rbp), %ecx
shrl %cl, %edx
movl -0x4c(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x40(%rax,%rcx,4), %edx
addl -0x48(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
jmp 0x7d40
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7cd1
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
subl 0x104(%rcx), %eax
subl $0x2, %eax
movl %eax, -0x50(%rbp)
movl $0x1, -0x54(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x54(%rbp), %eax
jl 0x7ed0
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
movl $0x10, %eax
subl 0x40(%rcx,%rdx,4), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0xc4(%rbp)
movl -0x58(%rbp), %esi
movl $0x2, %edi
callq 0x9480
movl -0xc4(%rbp), %edx
cvttsd2si %xmm0, %eax
addl %eax, %edx
movl -0x58(%rbp), %ecx
shrl %cl, %edx
movl -0x58(%rbp), %ecx
shll %cl, %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0x80(%rax,%rcx,4)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x40(%rax,%rcx,4), %edx
subl -0x54(%rbp), %edx
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10c(%rcx), %ecx
movl %edx, 0xc0(%rax,%rcx,4)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10c(%rax)
jmp 0x7e1d
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)