// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %r14d
movl %edi, %r12d
movl $0x110, %edi            # imm = 0x110
callq 0x2160
movq %rax, %rbx
movl $0x110, %edx            # imm = 0x110
movq %rax, %rdi
xorl %esi, %esi
callq 0x20b0
cmpl %r14d, %r12d
jne 0x3be8
movl %r12d, (%rbx)
movl $0x10, %eax
movl %eax, 0x40(%rbx)
movl %r12d, 0x100(%rbx)
movabsq $0x100000010, %rcx      # imm = 0x100000010
movq %rcx, 0x104(%rbx)
movl %r12d, 0x80(%rbx)
movl %eax, 0xc0(%rbx)
movl $0x1, 0x10c(%rbx)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, -0x60(%rbp)
movl %r14d, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x50(%rbp)
movq %rbx, -0x40(%rbp)
movl $0x0, 0x10c(%rbx)
movq $-0x1, -0x58(%rbp)
xorl %eax, %eax
movq %rax, -0x38(%rbp)
movl $0xfffffff0, %eax       # imm = 0xFFFFFFF0
xorl %r13d, %r13d
movl %r13d, %r14d
movl %eax, %r15d
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x2120
leal 0x1(%r14), %r13d
cmpl $0xf, %r14d
ja 0x3c4e
cvttsd2si %xmm0, %ecx
andl %r12d, %ecx
leal 0x1(%r15), %eax
testl %ecx, %ecx
je 0x3c1d
movq %r12, %rbx
movl %r12d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x2120
addsd -0x48(%rbp), %xmm0
movsd 0x3470(%rip), %xmm1     # 0x70e8
addsd %xmm1, %xmm0
leal -0x1(%r13), %r12d
ucomisd -0x50(%rbp), %xmm0
jne 0x3c8d
jnp 0x3dc4
movsd -0x30(%rbp), %xmm0
callq 0x2120
addsd -0x48(%rbp), %xmm0
addsd 0x3444(%rip), %xmm0     # 0x70e8
movsd -0x50(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x3eb5
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r12d, %ecx
shll %cl, %r14d
movl %r14d, %eax
andl %ebx, %eax
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %rcx
movl %eax, (%r12,%rcx,4)
movl $0x11, %eax
subl %r13d, %eax
movl %eax, 0x40(%r12,%rcx,4)
testq %rcx, %rcx
je 0x3d61
movl 0x3c(%r12,%rcx,4), %r14d
leal (%r14,%r13), %eax
addl $-0x12, %eax
testl %eax, %eax
movsd -0x30(%rbp), %xmm0
jle 0x3da6
movq %r12, %r13
addl %r14d, %r15d
movl $0x11, %r12d
subl %r14d, %r12d
decl %r14d
movsd -0x30(%rbp), %xmm0
callq 0x2120
cvttsd2si %xmm0, %eax
movsd -0x30(%rbp), %xmm0
movl %ebx, %edx
subl %eax, %edx
movl %r12d, %ecx
shrl %cl, %edx
shll %cl, %edx
movl 0x10c(%r13), %eax
movl %edx, 0x80(%r13,%rax,4)
movl 0x10c(%r13), %eax
movl %r14d, 0xc0(%r13,%rax,4)
incl 0x10c(%r13)
decl %r15d
decl %r14d
incl %r12d
cmpl $0x1, %r15d
jg 0x3d0d
jmp 0x3da6
movsd -0x30(%rbp), %xmm0
movl %eax, %r15d
callq 0x2120
cvttsd2si %xmm0, %eax
movsd -0x30(%rbp), %xmm0
movl %ebx, %ecx
subl %eax, %ecx
andl %r14d, %ecx
movl 0x10c(%r12), %eax
movl %ecx, 0x80(%r12,%rax,4)
movl 0x10c(%r12), %eax
movl %r15d, 0xc0(%r12,%rax,4)
incl 0x10c(%r12)
callq 0x2120
cvttsd2si %xmm0, %eax
addl %eax, %ebx
movq -0x38(%rbp), %rax
incq %rax
incq -0x58(%rbp)
movq %rbx, %r12
jmp 0x3c11
movq %rbx, %r8
movl %r8d, %edx
movl %r12d, %ecx
shrl %cl, %edx
shll %cl, %edx
movq -0x38(%rbp), %rdi
movl %edi, %eax
movq -0x40(%rbp), %rbx
movl %edx, (%rbx,%rax,4)
movl $0x11, %ecx
subl %r13d, %ecx
movl %ecx, 0x40(%rbx,%rax,4)
leal 0x1(%rdi), %esi
movl %esi, 0x108(%rbx)
testq %rdi, %rdi
je 0x408c
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movl %r12d, %ecx
shll %cl, %edx
andl %r8d, %edx
movl %edx, 0x100(%rbx)
movl $0x10, %ecx
subl %r13d, %ecx
movl %ecx, 0x104(%rbx)
shlq $0x20, %rdi
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
addq %rdi, %rcx
sarq $0x1e, %rcx
movl 0x40(%rbx,%rcx), %ecx
movl 0x40(%rbx,%rax,4), %r15d
movl %r15d, %eax
notl %eax
addl %ecx, %eax
testl %eax, %eax
jle 0x3bd6
movl %ecx, %r14d
subl %r15d, %r14d
movl %r14d, %r12d
subl %r13d, %r12d
addl $0x10, %r12d
subl %ecx, %r15d
addl %r13d, %r15d
movsd -0x30(%rbp), %xmm0
movq %r8, %r13
callq 0x2120
movq %r13, %r8
cvttsd2si %xmm0, %eax
movl %r8d, %edx
subl %eax, %edx
movl %r15d, %ecx
shrl %cl, %edx
shll %cl, %edx
movl 0x10c(%rbx), %eax
movl %edx, 0x80(%rbx,%rax,4)
movl 0x10c(%rbx), %eax
movl %r12d, 0xc0(%rbx,%rax,4)
incl 0x10c(%rbx)
decl %r14d
decl %r12d
incl %r15d
cmpl $0x1, %r14d
jg 0x3e60
jmp 0x3bd6
cmpq $0x0, -0x38(%rbp)
movq %rbx, %rsi
movq -0x40(%rbp), %rbx
je 0x3f73
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movl %r12d, %ecx
shll %cl, %eax
andl %esi, %eax
movl %eax, 0x100(%rbx)
movl $0x10, %eax
subl %r13d, %eax
movl %eax, 0x104(%rbx)
movq -0x38(%rbp), %rax
shlq $0x20, %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
addq %rax, %rcx
sarq $0x1e, %rcx
movl 0x40(%rbx,%rcx), %r15d
leal (%r15,%r13), %eax
addl $-0x12, %eax
testl %eax, %eax
jle 0x3f73
leal (%r15,%r13), %r14d
addl $-0x11, %r14d
movl $0x11, %r12d
subl %r15d, %r12d
decl %r15d
movsd -0x30(%rbp), %xmm0
movq %rsi, %r13
callq 0x2120
movq %r13, %rsi
cvttsd2si %xmm0, %eax
movl %esi, %edx
subl %eax, %edx
movl %r12d, %ecx
shrl %cl, %edx
shll %cl, %edx
movl 0x10c(%rbx), %eax
movl %edx, 0x80(%rbx,%rax,4)
movl 0x10c(%rbx), %eax
movl %r15d, 0xc0(%rbx,%rax,4)
incl 0x10c(%rbx)
decl %r14d
decl %r15d
incl %r12d
cmpl $0x1, %r14d
jg 0x3f24
movl -0x60(%rbp), %eax
cmpl %eax, %esi
movq %rsi, %r12
jne 0x3fc6
movq -0x38(%rbp), %rdx
movl %edx, %eax
movq -0x40(%rbp), %rbx
movl %r12d, (%rbx,%rax,4)
movl $0x10, %ecx
movl %ecx, 0x40(%rbx,%rax,4)
leal 0x1(%rdx), %eax
movl %eax, 0x108(%rbx)
incl %r12d
movl 0x10c(%rbx), %eax
movl %r12d, 0x80(%rbx,%rax,4)
movl 0x10c(%rbx), %eax
movl %ecx, 0xc0(%rbx,%rax,4)
incl 0x10c(%rbx)
jmp 0x3bd6
movq -0x40(%rbp), %rbx
movq -0x38(%rbp), %rcx
jae 0x40ab
movq %rcx, %r13
movq -0x58(%rbp), %rbx
movl %r12d, %r14d
xorl %eax, %r14d
xorl %r15d, %r15d
leal 0xf(%r15), %edi
movsd 0x3100(%rip), %xmm0     # 0x70f0
callq 0x21e0
cvttsd2si %xmm0, %eax
decl %r15d
testl %eax, %r14d
je 0x3fe4
movl %r12d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x30(%rbp)
leal 0x11(%r15), %r14d
movsd 0x30d3(%rip), %xmm0     # 0x70f0
movl %r14d, %edi
callq 0x21e0
addsd -0x30(%rbp), %xmm0
addsd 0x30b6(%rip), %xmm0     # 0x70e8
ucomisd -0x50(%rbp), %xmm0
jne 0x403f
jnp 0x42c7
leal 0x10(%r15), %ecx
movl %r12d, %eax
shrl %cl, %eax
shll %cl, %eax
movq -0x40(%rbp), %rdx
movl %eax, (%rdx,%r13,4)
negl %r15d
movl %r15d, 0x40(%rdx,%r13,4)
movsd 0x308e(%rip), %xmm0     # 0x70f0
movl %ecx, %edi
callq 0x21e0
cvttsd2si %xmm0, %eax
addl %eax, %r12d
incq %r13
incq %rbx
movl -0x60(%rbp), %eax
cmpl %eax, %r12d
jb 0x3fdb
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rbx
jmp 0x40ae
movl %edx, 0x100(%rbx)
movl %ecx, 0x104(%rbx)
movl %edx, 0x80(%rbx,%rax,4)
movl %ecx, 0xc0(%rbx,%rax,4)
jmp 0x3bcc
movl %ecx, %r13d
leal 0x1(%r13), %eax
movl %r13d, %esi
movl %r12d, (%rbx,%rsi,4)
movl $0x10, 0x40(%rbx,%rsi,4)
movl %eax, 0x108(%rbx)
testq %rcx, %rcx
jne 0x40e7
movl (%rbx), %eax
movl 0x40(%rbx), %edx
movb $0xf, %cl
subb %dl, %cl
shrl %cl, %eax
shll %cl, %eax
movl %eax, 0x100(%rbx)
decl %edx
movl %edx, 0x104(%rbx)
movq %r12, -0x48(%rbp)
leal 0x1(%r12), %eax
movl 0x10c(%rbx), %ecx
movl %eax, 0x80(%rbx,%rcx,4)
movl 0x10c(%rbx), %eax
movl $0x10, 0xc0(%rbx,%rax,4)
incl 0x10c(%rbx)
movslq %r13d, %rax
movl 0x3c(%rbx,%rax,4), %r9d
movb $0x10, %cl
subb %r9b, %cl
movl $0x1, %edx
shll %cl, %edx
cmpl $0x2, %r13d
jl 0x422e
andl -0x4(%rbx,%rax,4), %edx
jne 0x422e
movq %rbx, %rcx
addq $0x40, %rcx
movq %rbx, %r12
leaq (%rcx,%rax,4), %rdi
addq $-0x4, %rdi
leaq -0x1(%rsi), %rax
movq %rcx, -0x58(%rbp)
movq -0x48(%rbp), %rbx
movq %rax, -0x38(%rbp)
movq %rsi, -0x50(%rbp)
movl (%rcx,%rsi,4), %eax
movl %r9d, %ecx
notl %ecx
addl %eax, %ecx
testl %ecx, %ecx
jle 0x41ec
movl %eax, %r14d
subl %r9d, %r14d
subl %eax, %r9d
addl $0x11, %r9d
movl %r9d, -0x30(%rbp)
movl -0x30(%rbp), %r15d
subl (%rdi), %r15d
movsd 0x2f60(%rip), %xmm0     # 0x70f0
movq %rdi, %r13
movl %r15d, %edi
callq 0x21e0
movq %r13, %rdi
cvttsd2si %xmm0, %eax
addl %ebx, %eax
movl %r15d, %ecx
shrl %cl, %eax
movl -0x30(%rbp), %r9d
shll %cl, %eax
movl 0x10c(%r12), %ecx
movl %eax, 0x80(%r12,%rcx,4)
movl (%r13), %eax
addl %r14d, %eax
decl %eax
movl 0x10c(%r12), %ecx
movl %eax, 0xc0(%r12,%rcx,4)
incl 0x10c(%r12)
decl %r14d
incl %r9d
cmpl $0x1, %r14d
jg 0x417d
movq -0x38(%rbp), %r13
movl 0x3c(%r12,%r13,4), %r9d
movb $0x10, %cl
subb %r9b, %cl
movl $0x1, %edx
shll %cl, %edx
cmpq $0x2, %r13
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rcx
jl 0x422b
leaq -0x1(%r13), %rax
leaq (%rcx,%r13,4), %rdi
addq $-0x4, %rdi
andl -0x4(%r12,%r13,4), %edx
decq %rsi
testl %edx, %edx
je 0x415a
movq %r12, %rbx
movslq %r13d, %r12
movl 0x40(%rbx,%r12,4), %edx
subl 0x104(%rbx), %edx
leal -0x2(%rdx), %eax
testl %eax, %eax
jle 0x3bd6
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl $0x11, %r14d
movq %rdx, -0x30(%rbp)
movl %r14d, %r15d
subl 0x40(%rbx,%r12,4), %r15d
movsd 0x2e89(%rip), %xmm0     # 0x70f0
movl %r15d, %edi
callq 0x21e0
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rdx
cvttsd2si %xmm0, %eax
addl %edi, %eax
movl %r15d, %ecx
shrl %cl, %eax
shll %cl, %eax
movl 0x10c(%rbx), %ecx
movl %eax, 0x80(%rbx,%rcx,4)
movl 0x40(%rbx,%r12,4), %eax
addl %r13d, %eax
movl 0x10c(%rbx), %ecx
movl %eax, 0xc0(%rbx,%rcx,4)
incl 0x10c(%rbx)
leal (%rdx,%r13), %eax
decl %eax
movl %r13d, %ecx
decl %ecx
incl %r14d
movl %ecx, %r13d
cmpl $0x1, %eax
jne 0x4257
jmp 0x3bd6
movq %rbx, -0x58(%rbp)
movq %r12, %rbx
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r14d, %ecx
shll %cl, %r12d
movl %r12d, %eax
andl %ebx, %eax
movl %r14d, %edi
movq %r13, %r14
movl %r14d, %ecx
shlq $0x2, %rcx
leal 0x1(%r13), %edx
movq -0x40(%rbp), %rsi
movl %eax, (%rsi,%rcx)
notl %r15d
movl %r15d, 0x40(%rsi,%rcx)
movl %edx, 0x108(%rsi)
cmpq $0x0, -0x38(%rbp)
movq %rbx, -0x48(%rbp)
jne 0x4342
testq %r14, %r14
je 0x432c
movl (%rsi), %edx
movl 0x40(%rsi), %eax
movb $0xf, %cl
subb %al, %cl
shrl %cl, %edx
shll %cl, %edx
movl %edx, 0x100(%rsi)
decl %eax
jmp 0x4335
movl %eax, 0x100(%rsi)
movl %r15d, %eax
movl %eax, 0x104(%rsi)
movq -0x48(%rbp), %rbx
movq %r13, %r14
movsd 0x2da6(%rip), %xmm0     # 0x70f0
movq %rsi, %r13
callq 0x21e0
cvttsd2si %xmm0, %eax
addl %ebx, %eax
andl %r12d, %eax
movl 0x10c(%r13), %ecx
movl %eax, 0x80(%r13,%rcx,4)
movl 0x10c(%r13), %eax
movl %r15d, 0xc0(%r13,%rax,4)
incl 0x10c(%r13)
movq %r14, %rax
shlq $0x20, %rax
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
addq %rax, %r12
sarq $0x1e, %r12
movl 0x40(%r13,%r12), %r8d
movb $0x10, %cl
subb %r8b, %cl
movl $0x1, %eax
shll %cl, %eax
cmpq $0x2, %r14
movq %r14, %rcx
jb 0x44a1
movq %r13, %rdx
andl (%r13,%r12), %eax
jne 0x44a1
addq $0x40, %rdx
addq %rdx, %r12
movq -0x58(%rbp), %r14
movq %rdx, -0x60(%rbp)
movq -0x48(%rbp), %r13
movq -0x40(%rbp), %rbx
movq %r14, -0x50(%rbp)
movq %rcx, -0x38(%rbp)
movl (%rdx,%rcx,4), %eax
movl %r8d, %ecx
notl %ecx
addl %eax, %ecx
testl %ecx, %ecx
jle 0x4461
movl %eax, %r14d
subl %r8d, %r14d
subl %eax, %r8d
addl $0x11, %r8d
movl %r8d, -0x30(%rbp)
movl -0x30(%rbp), %r15d
subl (%r12), %r15d
movsd 0x2cde(%rip), %xmm0     # 0x70f0
movl %r15d, %edi
callq 0x21e0
cvttsd2si %xmm0, %eax
addl %r13d, %eax
movl %r15d, %ecx
shrl %cl, %eax
movl -0x30(%rbp), %r8d
shll %cl, %eax
movl 0x10c(%rbx), %ecx
movl %eax, 0x80(%rbx,%rcx,4)
movl (%r12), %eax
addl %r14d, %eax
decl %eax
movl 0x10c(%rbx), %ecx
movl %eax, 0xc0(%rbx,%rcx,4)
incl 0x10c(%rbx)
decl %r14d
incl %r8d
cmpl $0x1, %r14d
jg 0x43fe
movq -0x50(%rbp), %rsi
movl 0x3c(%rbx,%rsi,4), %r8d
movb $0x10, %cl
subb %r8b, %cl
movl $0x1, %eax
shll %cl, %eax
cmpq $0x2, %rsi
jl 0x44a4
leaq -0x1(%rsi), %r14
movq -0x60(%rbp), %rdx
leaq (%rdx,%rsi,4), %r12
addq $-0x4, %r12
andl -0x4(%rbx,%rsi,4), %eax
movq -0x38(%rbp), %rcx
decq %rcx
testl %eax, %eax
je 0x43db
jmp 0x44a4
movq %rcx, %rsi
movslq %esi, %r12
movq -0x40(%rbp), %rbx
movl 0x40(%rbx,%r12,4), %edx
subl 0x104(%rbx), %edx
leal -0x2(%rdx), %eax
testl %eax, %eax
jle 0x3bd6
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl $0x11, %r14d
movq %rdx, -0x30(%rbp)
movl %r14d, %r15d
subl 0x40(%rbx,%r12,4), %r15d
movsd 0x2c0f(%rip), %xmm0     # 0x70f0
movl %r15d, %edi
callq 0x21e0
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rdx
cvttsd2si %xmm0, %eax
addl %edi, %eax
movl %r15d, %ecx
shrl %cl, %eax
shll %cl, %eax
movl 0x10c(%rbx), %ecx
movl %eax, 0x80(%rbx,%rcx,4)
movl 0x40(%rbx,%r12,4), %eax
addl %r13d, %eax
movl 0x10c(%rbx), %ecx
movl %eax, 0xc0(%rbx,%rcx,4)
incl 0x10c(%rbx)
leal (%rdx,%r13), %eax
decl %eax
movl %r13d, %ecx
decl %ecx
incl %r14d
movl %ecx, %r13d
cmpl $0x1, %eax
jne 0x44d1
jmp 0x3bd6