// File: manschga[P]M5GB/M5GB.cpp
// Function: Initialize(std::vector<polynomial, std::allocator<polynomial>>&, int)
void Initialize(vector<polynomial>& system, int n) //table might overflow -> need to redefine inside
{
  //sort(system); //test if this speeds up
  p = system[0].Get_p();
  Add_field_eq(system,n);
  //m = system.size();
  Interreduce(system);
  sort(system.begin()+n, system.end());
  m = system.size();
  cout << "n: " << n << endl;
  cout << "p: " << p << endl;
  cout << "m: " << m << endl;

  vector<Lab_poly> F = Basic_poly(system,n);
  Init_LT_G(F);
  G_ = Init_G(F);
  M = G_;
  LT_M = LT_G;
  P = Init_Spairs(F,Spol_sign,Spairs_map,n);//check that, error source? comparison?
  H = Init_Syzygies(F); //create trivial syzygy signatures
  Init_generations(F);
  
  #ifdef NUMBER
  //Numbers = Init_numbers(F);
  #endif
  
  #ifdef PRECISE_DEBUG
  cout << "Trivial syzygies: " << endl;
  for (auto it = H.begin(); it != H.end(); ++it)
    {
      for (auto it2 = it->begin(); it2 != it->end(); ++it2)
	cout << *it2 << endl;
    }
#endif
    cout << "Initialization done!" << endl;
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x31a0
movq %rax, %rdi
callq 0xb890
movl %eax, 0x2edff(%rip)     # 0x4021c
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x151e0
movq -0x8(%rbp), %rdi
callq 0x134d0
movq -0x8(%rbp), %rdi
callq 0xfd40
movq %rax, -0x20(%rbp)
movslq -0xc(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x17840
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0xfb80
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x17800
movq -0x8(%rbp), %rdi
callq 0x3180
movl %eax, 0x2eda7(%rip)     # 0x40220
movq 0x2eb58(%rip), %rdi     # 0x3ffd8
movq %rdi, -0xe8(%rbp)
leaq 0x19d78(%rip), %rsi     # 0x2b206
callq 0x2190
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x22f0
movq %rax, %rdi
movq 0x2eb20(%rip), %rsi     # 0x3ffc8
movq %rsi, -0xe0(%rbp)
callq 0x21d0
movq -0xe8(%rbp), %rdi
leaq 0x19f34(%rip), %rsi     # 0x2b3f6
callq 0x2190
movq %rax, %rdi
movl 0x2ed4c(%rip), %esi     # 0x4021c
callq 0x22f0
movq -0xe0(%rbp), %rsi
movq %rax, %rdi
callq 0x21d0
movq -0xe8(%rbp), %rdi
leaq 0x19ede(%rip), %rsi     # 0x2b3d0
callq 0x2190
movq %rax, %rdi
movl 0x2ed20(%rip), %esi     # 0x40220
callq 0x22f0
movq -0xe0(%rbp), %rsi
movq %rax, %rdi
callq 0x21d0
movq -0x8(%rbp), %rsi
movl -0xc(%rbp), %edx
leaq -0x40(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x15530
movq -0xd8(%rbp), %rdi
callq 0x156b0
jmp 0x11539
leaq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x15910
jmp 0x1154b
leaq 0x2edde(%rip), %rdi     # 0x40330
movq %rdi, -0xf0(%rbp)
leaq -0x88(%rbp), %rsi
movq %rsi, -0xf8(%rbp)
callq 0x17880
movq -0xf8(%rbp), %rdi
callq 0x16920
movq -0xf0(%rbp), %rsi
leaq 0x2ede2(%rip), %rdi     # 0x40368
callq 0x178b0
jmp 0x1158d
leaq 0x2ed64(%rip), %rdi     # 0x402f8
leaq 0x2ed25(%rip), %rsi     # 0x402c0
callq 0x178e0
jmp 0x115a2
movl -0xc(%rbp), %r8d
leaq 0x2ef23(%rip), %rdx     # 0x404d0
leaq 0x2ef4c(%rip), %rcx     # 0x40500
leaq -0xb8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x15a20
jmp 0x115c6
leaq 0x2ef63(%rip), %rdi     # 0x40530
leaq -0xb8(%rbp), %rsi
movq %rsi, -0x100(%rbp)
callq 0x17910
movq -0x100(%rbp), %rdi
callq 0x16a20
leaq -0xd0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x15df0
jmp 0x115fe
leaq 0x2eeb3(%rip), %rdi     # 0x404b8
leaq -0xd0(%rbp), %rsi
movq %rsi, -0x108(%rbp)
callq 0x2f80
movq -0x108(%rbp), %rdi
callq 0x2fb0
leaq -0x40(%rbp), %rdi
callq 0x16040
jmp 0x1162f
movq 0x2e9a2(%rip), %rdi     # 0x3ffd8
leaq 0x19d97(%rip), %rsi     # 0x2b3d4
callq 0x2190
movq %rax, -0x110(%rbp)
jmp 0x1164b
movq -0x110(%rbp), %rdi
movq 0x2e96f(%rip), %rsi     # 0x3ffc8
callq 0x21d0
jmp 0x11660
leaq -0x40(%rbp), %rdi
callq 0x17940
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x17940
movq -0x48(%rbp), %rdi
callq 0x2300