// File: manschga[P]M5GB/M5GB.cpp
// Function: M5GB(std::vector<polynomial, std::allocator<polynomial>>&, int)
vector<polynomial> M5GB(vector<polynomial>& system, int n) //table might overflow -> need to redefine inside
{
  auto start = std::chrono::steady_clock::now();
  degrees = create_degrees(n,10); //upper found for degree, have to change for larger examples
  Initialize(system,n);  

#ifdef DEBUG
  cout << "Size of P: " << P.size() << endl;
#endif
  int polys_left = m-2;
  int debug = 1000000;
  int maxiter = debug;
  int last_non_zero = maxiter-debug;
  //signature last_syz(table.size(),m);

  while (Spol_sign.size() > 0 && debug > 0)
    {
#ifdef DEBUG
      //cout << "iteration " << maxiter-debug << endl;
#endif
      if (Spol_sign.size() > 0)
	{
	  signature smallest_sign  = *Spol_sign.begin();
	  /*
	  */
	  Spol_sign.erase(Spol_sign.begin());//remove first item
	  if (Syzygy(smallest_sign,H))
	     {
	       syz_counter ++; //to be precise, take away all spairs of that syzygy
	       debug --;
	       continue;
	     }
	  if (smallest_sign.Get_term() != 0)
	    {
	      auto same_sign_pairs = Spairs_map.equal_range(smallest_sign);
	      for (auto pair = same_sign_pairs.first; pair!= same_sign_pairs.second; ++pair)
		{
		  Lab_poly uF = pair->second.first;
		  //Lab_poly vG = pair->second.second.first;
		  /*
		   if(Syzygy(vG.Get_sign(),H))//meets syzygy criterion
		    {
#ifdef DEBUG
		      cout << "syzygy criterion works for " << vG.Get_sign() << endl;
#endif
		      syz_counter ++;
		      debug --;
		      continue;
		    }
		  */
		   if (isRewritable(uF,pair->second.second)) //changed order, check!, could change first taking maximum w.r.t. rewrite order!
		    {
		      rewrite_counter++;
#ifdef DEBUG
		      cout << "Rewritable criterion works for " << uF << endl;
#endif
		      debug --;
		      continue;
		    }
		   /*
		    if (isRewritable(vG,pair->second.second.second))//Generations_G.find(G.Get_LT())->second)) //changed order, check!, could change first taking maximum w.r.t. rewrite order!)) //changed order, check!
		    {
		      rewrite_counter++;
#ifdef DEBUG
		      cout << "Rewritable criterion works for " << vG << endl;
#endif
		      debug --;
		      continue;
		    }
		   */
		    //Lab_poly Spol = uF - vG;
		   term_vec out = table[smallest_sign.Get_term()].first;
		   for (auto &it : out)
		     {
		       //cout << it;
		     }
		   //cout << endl;
#ifdef LOWER_POL
		   Lab_poly Spol = Low_pol(smallest_sign,uF,pair->second.second,n);
#else
		   Lab_poly Spol = uF;//variant
#endif
		   
		  /*
		  if (Spol.Get_LC() == 0)//is 0-polynomial
		    {
		      H[Spol.Get_sign().Get_index()].emplace_back(Spol.Get_sign().Get_term());//add syzygy signature
		      spol_is_zero ++;
		      debug --;
		      break;
		    }
		  */
#ifdef PRECISE_DEBUG
		  cout << "uF:" << uF<< endl;
		  //cout << "vG:" << vG << endl;
		  cout << "Next signature: " << Spol.Get_sign() << endl;
	  if (((maxiter - debug) % 1000) == 1)
	    {
	      cout << "size of G:" << G_.size() << endl;
	      cout << "iteration " << maxiter - debug << endl;
	      cout << "First Buchberger criterion works: " << BB_counter << endl;
	      cout << "spol is zero: " << spol_is_zero << endl;
	      cout << "rewritten: " << rewrite_counter << endl;
	      cout << "syzygy crit: " << syz_counter << endl;
	      cout << "actually reduced: " << actual_red << endl;
	      cout << "signature: " << Spol.Get_sign() << endl;
	    }
#endif
	  if (((maxiter - debug) % 100) == 33)
	    cout << "signature: " << Spol.Get_sign() << endl;
	  //if not rewriteable
	    
	  actual_red ++;
	  //cout << "signature: " << Spol.Get_sign() << endl;
	  //cout << Spol << endl << endl << endl;
	  if (actual_red == 1500)
	    {
	      debug = 0;
	      continue;
	    }
	  Full_S_Reduce(Spol,n);
	  //cout << " --> " << Spol << endl << endl << endl;
#ifdef DEBUG
	  cout << " --> " << Spol << endl << endl << endl;
#endif
	  if((Spol.Get_poly()).Get_LC() == 0)// 0-polynomial
	    {
	      //cout << maxiter-debug << endl;
	      debug = 0;
	      continue;
	      zero_reductions ++;
	      debug --;
	      H[Spol.Get_sign().Get_index()].emplace_back(Spol.Get_sign().Get_term());//add syzygy signature
	      break; //this signature already reduces to 0
	    }
	  else
	    {
	      last_non_zero = maxiter-debug;
	      Update_syz(Spol);//add new koszul syzygies
	      Update_pairs(Spol,system,n,BB_counter);//system needed? check!
#ifdef PRECISE_DEBUG
	      if (G_.find(Spol.Get_LT()) != G_.end())
		cout << "Same leading term! Error!" << endl;
#endif
	      Add_to_M(Spol);
	      Add_to_G(Spol);
	      /*
	      G_[Spol.Get_LT()] = Spol;
	      M[Spol.Get_LT()] = Spol;
	      Generations_M[Spol.Get_LT()] = G_.size(); //generation for M
	      Generations_G[Spol.Get_LT()] = G_.size(); //generation for G
	      Flags_M[Spol.Get_LT()] = Create_Flag(Spol.Get_poly()); //create flag for M
	      */
	      //Update_step(Spol); -> not needed since done in lazy manner!
	    }
	  debug --;
	  break; //one element of this signature already examined
		}
	    }
	}
    }
  vector<polynomial> basis = Poly(G_,n,p); //remove signatures

  sort(basis);
  Interreduce(basis);
  
#ifdef statistics
  cout << "Number of examined S-polynomials: " << maxiter - debug << endl;
  cout << "discarded since zero:" << spol_is_zero << endl;
  cout << "Discarded by Rewriteable criterion: " << rewrite_counter << endl;
  cout << "discarded by syzygy criterion: " << syz_counter << endl;
  cout << "actually reduced: " << actual_red << endl;
  cout << "Number of full reduction steps:" << full_red_steps << endl;
  cout << "Number of total reductions:" << number_of_reductions << endl;
  cout<< "Number of fast reductions: " <<  straight_m_reduces << endl;
  cout<< "Number of re-reductions: " <<  m_re_reduced << endl;
  cout<< "Number of g-reductions: " <<  g_reduced << endl;
  cout<< "Size of M: " << M.size() << endl;
  cout<< "Size of G: " << G_.size() << endl;
  cout << "Number of Zero reductions:" << zero_reductions << endl;
  cout << "First Buchberger criterion works: " << BB_counter << endl;
  cout << "Last non-zero: " << last_non_zero << endl;
#endif
  if (debug == 0)
    cout << "maximal number of iterations reached!!!"<< endl << endl;
  auto end = chrono::steady_clock::now();
  cout << "Elapsed time in Seconds : "
	 << chrono::duration_cast<chrono::milliseconds>(end - start).count()
	 << " milliseconds " << endl;
  return basis;
  //return G_;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x170(%rbp)
movq %rdi, %rax
movq %rax, -0x168(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
callq 0x2270
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %esi
leaq -0x38(%rbp), %rdi
movl $0xa, %edx
callq 0x5380
leaq 0x2fca8(%rip), %rdi     # 0x40560
leaq -0x38(%rbp), %rsi
callq 0x16a40
leaq -0x38(%rbp), %rdi
callq 0x3b70
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x113f0
movl 0x2f944(%rip), %eax     # 0x40220
subl $0x2, %eax
movl %eax, -0x3c(%rbp)
movl $0xf4240, -0x40(%rbp)   # imm = 0xF4240
movl -0x40(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
subl -0x40(%rbp), %eax
movl %eax, -0x48(%rbp)
leaq 0x2fbd1(%rip), %rdi     # 0x404d0
callq 0x16a70
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x171(%rbp)
jbe 0x10922
cmpl $0x0, -0x40(%rbp)
setg %al
movb %al, -0x171(%rbp)
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0x10931
jmp 0x10d95
leaq 0x2fb98(%rip), %rdi     # 0x404d0
callq 0x16a70
cmpq $0x0, %rax
jbe 0x10d90
leaq 0x2fb82(%rip), %rdi     # 0x404d0
callq 0x16a90
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x16ac0
movq (%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
leaq 0x2fb5a(%rip), %rdi     # 0x404d0
callq 0x16a90
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rsi
leaq 0x2fb46(%rip), %rdi     # 0x404d0
callq 0x16af0
movq %rax, -0x70(%rbp)
leaq -0x58(%rbp), %rdi
leaq 0x2fb1a(%rip), %rsi     # 0x404b8
callq 0x11690
testb $0x1, %al
jne 0x109a9
jmp 0x109c6
movl 0x2f891(%rip), %eax     # 0x40240
addl $0x1, %eax
movl %eax, 0x2f888(%rip)     # 0x40240
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x108f8
leaq -0x58(%rbp), %rdi
callq 0x16b30
cmpq $0x0, %rax
je 0x10d8e
leaq 0x2fb20(%rip), %rdi     # 0x40500
leaq -0x58(%rbp), %rsi
callq 0x16b50
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rsi
addq $0x8, %rsi
leaq -0x88(%rbp), %rdi
callq 0x16b90
testb $0x1, %al
jne 0x10a19
jmp 0x10d8c
leaq -0x88(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x16bc0
movq %rax, %rsi
addq $0x10, %rsi
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x16be0
movq -0x188(%rbp), %rdi
callq 0x16bc0
movq -0x180(%rbp), %rdi
movl 0x48(%rax), %esi
callq 0x11810
movb %al, -0x172(%rbp)
jmp 0x10a69
movb -0x172(%rbp), %al
testb $0x1, %al
jne 0x10a75
jmp 0x10ab3
movl 0x2f7bd(%rip), %eax     # 0x40238
addl $0x1, %eax
movl %eax, 0x2f7b4(%rip)     # 0x40238
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
movl $0x6, -0xd0(%rbp)
jmp 0x10d4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x10d6a
leaq -0x58(%rbp), %rdi
callq 0x16b30
movq %rax, -0x190(%rbp)
jmp 0x10ac5
movq -0x190(%rbp), %rsi
leaq 0x2f70d(%rip), %rdi     # 0x401e0
callq 0xd480
movq %rax, %rsi
leaq -0xe8(%rbp), %rdi
callq 0x5ff0
jmp 0x10ae9
leaq -0xe8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rdi
callq 0x8b50
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rdi
callq 0x89a0
movq %rax, -0x100(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x16c30
testb $0x1, %al
jne 0x10b36
jmp 0x10b57
leaq -0xf8(%rbp), %rdi
callq 0x8d60
movq %rax, -0x108(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x16c70
jmp 0x10b1d
leaq -0x88(%rbp), %rdi
callq 0x16bc0
movl 0x48(%rax), %ecx
movl -0x14(%rbp), %r8d
leaq -0x140(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x11b30
jmp 0x10b83
movl -0x44(%rbp), %eax
subl -0x40(%rbp), %eax
movl $0x64, %ecx
cltd
idivl %ecx
cmpl $0x21, %edx
jne 0x10c38
movq 0x2f437(%rip), %rdi     # 0x3ffd8
leaq 0x1a5f8(%rip), %rsi     # 0x2b1a0
callq 0x2190
movq %rax, -0x198(%rbp)
jmp 0x10bb6
leaq -0x140(%rbp), %rdi
callq 0xb8d0
movq %rax, -0x1a0(%rbp)
jmp 0x10bcb
movq -0x1a0(%rbp), %rsi
movq -0x198(%rbp), %rdi
callq 0x2a4f0
movq %rax, -0x1a8(%rbp)
jmp 0x10be7
movq -0x1a8(%rbp), %rdi
movq 0x2f3d3(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x10bfc
jmp 0x10c38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x10d41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x140(%rbp), %rdi
callq 0xbc80
jmp 0x10d41
movl 0x2f606(%rip), %eax     # 0x40244
addl $0x1, %eax
movl %eax, 0x2f5fd(%rip)     # 0x40244
cmpl $0x5dc, 0x2f5f3(%rip)   # imm = 0x5DC
jne 0x10c69
movl $0x0, -0x40(%rbp)
movl $0x6, -0xd0(%rbp)
jmp 0x10d27
movl -0x14(%rbp), %esi
leaq -0x140(%rbp), %rdi
callq 0x12060
jmp 0x10c7a
leaq -0x140(%rbp), %rdi
callq 0xb8c0
movq %rax, -0x1b0(%rbp)
jmp 0x10c8f
movq -0x1b0(%rbp), %rdi
callq 0xe7c0
movl %eax, -0x1b4(%rbp)
jmp 0x10ca3
movl -0x1b4(%rbp), %eax
cmpl $0x0, %eax
jne 0x10cc1
movl $0x0, -0x40(%rbp)
movl $0x6, -0xd0(%rbp)
jmp 0x10d27
movl -0x44(%rbp), %eax
movl -0x40(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x48(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x12a10
jmp 0x10cda
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq 0x2f564(%rip), %rcx     # 0x4024c
leaq -0x140(%rbp), %rdi
callq 0x12b20
jmp 0x10cf6
leaq -0x140(%rbp), %rdi
callq 0x130e0
jmp 0x10d04
leaq -0x140(%rbp), %rdi
callq 0x13280
jmp 0x10d12
jmp 0x10d14
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
movl $0x4, -0xd0(%rbp)
leaq -0x140(%rbp), %rdi
callq 0xbc80
leaq -0xe8(%rbp), %rdi
callq 0x3b70
jmp 0x10d4f
leaq -0xe8(%rbp), %rdi
callq 0x3b70
jmp 0x10d6a
leaq -0xc0(%rbp), %rdi
callq 0xbc80
movl -0xd0(%rbp), %eax
subl $0x4, %eax
je 0x10d8c
jmp 0x10d68
jmp 0x10d7b
leaq -0xc0(%rbp), %rdi
callq 0xbc80
jmp 0x113db
leaq -0x88(%rbp), %rdi
callq 0x16c90
jmp 0x109fc
jmp 0x10d8e
jmp 0x10d90
jmp 0x108f8
movq -0x170(%rbp), %rdi
movb $0x0, -0x141(%rbp)
movl -0x14(%rbp), %edx
movl 0x2f470(%rip), %ecx     # 0x4021c
leaq 0x2f57d(%rip), %rsi     # 0x40330
callq 0x133a0
movq -0x170(%rbp), %rdi
callq 0x27190
jmp 0x10dc6
movq -0x170(%rbp), %rdi
callq 0x134d0
jmp 0x10dd4
movq 0x2f1fd(%rip), %rdi     # 0x3ffd8
leaq 0x1a3ca(%rip), %rsi     # 0x2b1ac
callq 0x2190
movq %rax, -0x1c0(%rbp)
jmp 0x10df0
movq -0x1c0(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x40(%rbp), %eax
subl %eax, %esi
callq 0x22f0
movq %rax, -0x1c8(%rbp)
jmp 0x10e0d
movq -0x1c8(%rbp), %rdi
movq 0x2f1ad(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x10e22
movq 0x2f1af(%rip), %rdi     # 0x3ffd8
leaq 0x1a39f(%rip), %rsi     # 0x2b1cf
callq 0x2190
movq %rax, -0x1d0(%rbp)
jmp 0x10e3e
movq -0x1d0(%rbp), %rdi
movl 0x2f3f1(%rip), %esi     # 0x4023c
callq 0x22f0
movq %rax, -0x1d8(%rbp)
jmp 0x10e59
movq -0x1d8(%rbp), %rdi
movq 0x2f161(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x10e6e
movq 0x2f163(%rip), %rdi     # 0x3ffd8
leaq 0x1a369(%rip), %rsi     # 0x2b1e5
callq 0x2190
movq %rax, -0x1e0(%rbp)
jmp 0x10e8a
movq -0x1e0(%rbp), %rdi
movl 0x2f3a1(%rip), %esi     # 0x40238
callq 0x22f0
movq %rax, -0x1e8(%rbp)
jmp 0x10ea5
movq -0x1e8(%rbp), %rdi
movq 0x2f115(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x10eba
movq 0x2f117(%rip), %rdi     # 0x3ffd8
leaq 0x1a342(%rip), %rsi     # 0x2b20a
callq 0x2190
movq %rax, -0x1f0(%rbp)
jmp 0x10ed6
movq -0x1f0(%rbp), %rdi
movl 0x2f35d(%rip), %esi     # 0x40240
callq 0x22f0
movq %rax, -0x1f8(%rbp)
jmp 0x10ef1
movq -0x1f8(%rbp), %rdi
movq 0x2f0c9(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x10f06
movq 0x2f0cb(%rip), %rdi     # 0x3ffd8
leaq 0x1a316(%rip), %rsi     # 0x2b22a
callq 0x2190
movq %rax, -0x200(%rbp)
jmp 0x10f22
movq -0x200(%rbp), %rdi
movl 0x2f315(%rip), %esi     # 0x40244
callq 0x22f0
movq %rax, -0x208(%rbp)
jmp 0x10f3d
movq -0x208(%rbp), %rdi
movq 0x2f07d(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x10f52
movq 0x2f07f(%rip), %rdi     # 0x3ffd8
leaq 0x1a2dd(%rip), %rsi     # 0x2b23d
callq 0x2190
movq %rax, -0x210(%rbp)
jmp 0x10f6e
movq -0x210(%rbp), %rdi
movl 0x2f2a9(%rip), %esi     # 0x40224
callq 0x22f0
movq %rax, -0x218(%rbp)
jmp 0x10f89
movq -0x218(%rbp), %rdi
movq 0x2f031(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x10f9e
movq 0x2f033(%rip), %rdi     # 0x3ffd8
leaq 0x1a2b1(%rip), %rsi     # 0x2b25d
callq 0x2190
movq %rax, -0x220(%rbp)
jmp 0x10fba
movq -0x220(%rbp), %rdi
movl 0x2f261(%rip), %esi     # 0x40228
callq 0x22f0
movq %rax, -0x228(%rbp)
jmp 0x10fd5
movq -0x228(%rbp), %rdi
movq 0x2efe5(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x10fea
movq 0x2efe7(%rip), %rdi     # 0x3ffd8
leaq 0x1a281(%rip), %rsi     # 0x2b279
callq 0x2190
movq %rax, -0x230(%rbp)
jmp 0x11006
movq -0x230(%rbp), %rdi
movl 0x2f219(%rip), %esi     # 0x4022c
callq 0x22f0
movq %rax, -0x238(%rbp)
jmp 0x11021
movq -0x238(%rbp), %rdi
movq 0x2ef99(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x11036
movq 0x2ef9b(%rip), %rdi     # 0x3ffd8
leaq 0x1a251(%rip), %rsi     # 0x2b295
callq 0x2190
movq %rax, -0x240(%rbp)
jmp 0x11052
movq -0x240(%rbp), %rdi
movl 0x2f1d1(%rip), %esi     # 0x40230
callq 0x22f0
movq %rax, -0x248(%rbp)
jmp 0x1106d
movq -0x248(%rbp), %rdi
movq 0x2ef4d(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x11082
movq 0x2ef4f(%rip), %rdi     # 0x3ffd8
leaq 0x1a21f(%rip), %rsi     # 0x2b2af
callq 0x2190
movq %rax, -0x250(%rbp)
jmp 0x1109e
movq -0x250(%rbp), %rdi
movl 0x2f189(%rip), %esi     # 0x40234
callq 0x22f0
movq %rax, -0x258(%rbp)
jmp 0x110b9
movq -0x258(%rbp), %rdi
movq 0x2ef01(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x110ce
movq 0x2ef03(%rip), %rdi     # 0x3ffd8
leaq 0x1a1ec(%rip), %rsi     # 0x2b2c8
callq 0x2190
movq %rax, -0x260(%rbp)
jmp 0x110ea
leaq 0x2f277(%rip), %rdi     # 0x40368
callq 0x16cc0
movq -0x260(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, -0x268(%rbp)
jmp 0x1110e
movq -0x268(%rbp), %rdi
movq 0x2eeac(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x11123
movq 0x2eeae(%rip), %rdi     # 0x3ffd8
leaq 0x1a1a3(%rip), %rsi     # 0x2b2d4
callq 0x2190
movq %rax, -0x270(%rbp)
jmp 0x1113f
leaq 0x2f1ea(%rip), %rdi     # 0x40330
callq 0x16cc0
movq -0x270(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, -0x278(%rbp)
jmp 0x11163
movq -0x278(%rbp), %rdi
movq 0x2ee57(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x11178
movq 0x2ee59(%rip), %rdi     # 0x3ffd8
leaq 0x1a15a(%rip), %rsi     # 0x2b2e0
callq 0x2190
movq %rax, -0x280(%rbp)
jmp 0x11194
movq -0x280(%rbp), %rdi
movl 0x2f0a7(%rip), %esi     # 0x40248
callq 0x22f0
movq %rax, -0x288(%rbp)
jmp 0x111af
movq -0x288(%rbp), %rdi
movq 0x2ee0b(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x111c4
movq 0x2ee0d(%rip), %rdi     # 0x3ffd8
leaq 0x1a129(%rip), %rsi     # 0x2b2fb
callq 0x2190
movq %rax, -0x290(%rbp)
jmp 0x111e0
movq -0x290(%rbp), %rdi
movl 0x2f05f(%rip), %esi     # 0x4024c
callq 0x22f0
movq %rax, -0x298(%rbp)
jmp 0x111fb
movq -0x298(%rbp), %rdi
movq 0x2edbf(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x11210
movq 0x2edc1(%rip), %rdi     # 0x3ffd8
leaq 0x1a100(%rip), %rsi     # 0x2b31e
callq 0x2190
movq %rax, -0x2a0(%rbp)
jmp 0x1122c
movq -0x2a0(%rbp), %rdi
movl -0x48(%rbp), %esi
callq 0x22f0
movq %rax, -0x2a8(%rbp)
jmp 0x11244
movq -0x2a8(%rbp), %rdi
movq 0x2ed76(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x11259
cmpl $0x0, -0x40(%rbp)
jne 0x112d1
movq 0x2ed72(%rip), %rdi     # 0x3ffd8
leaq 0x1a0c1(%rip), %rsi     # 0x2b32e
callq 0x2190
movq %rax, -0x2b0(%rbp)
jmp 0x1127b
movq -0x2b0(%rbp), %rdi
movq 0x2ed3f(%rip), %rsi     # 0x3ffc8
callq 0x21d0
movq %rax, -0x2b8(%rbp)
jmp 0x11297
movq -0x2b8(%rbp), %rdi
movq 0x2ed23(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x112ac
jmp 0x112d1
movq -0x170(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
callq 0x3300
jmp 0x113db
callq 0x2270
movq %rax, -0x150(%rbp)
movq 0x2ecf4(%rip), %rdi     # 0x3ffd8
leaq 0x1a06b(%rip), %rsi     # 0x2b356
callq 0x2190
movq %rax, -0x2c0(%rbp)
jmp 0x112f9
leaq -0x150(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x16d10
movq %rax, -0x2c8(%rbp)
jmp 0x11312
movq -0x2c8(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x16ce0
movq %rax, -0x2d0(%rbp)
jmp 0x11335
movq -0x2d0(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x16d60
movq %rax, -0x2d8(%rbp)
jmp 0x11358
movq -0x2d8(%rbp), %rsi
movq -0x2c0(%rbp), %rdi
callq 0x2330
movq %rax, -0x2e0(%rbp)
jmp 0x11374
movq -0x2e0(%rbp), %rdi
leaq 0x19fef(%rip), %rsi     # 0x2b371
callq 0x2190
movq %rax, -0x2e8(%rbp)
jmp 0x11390
movq -0x2e8(%rbp), %rdi
movq 0x2ec2a(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x113a5
movb $0x1, -0x141(%rbp)
movl $0x1, -0xd0(%rbp)
testb $0x1, -0x141(%rbp)
jne 0x113cb
movq -0x170(%rbp), %rdi
callq 0x3300
movq -0x168(%rbp), %rax
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x2300
nopw (%rax,%rax)