// File: /workspace/github_cpp_makefile_star2_O2/manschga[P]M5GB/M5GB.cpp
// Function: Init_Spairs(std::vector<Lab_poly, std::allocator<Lab_poly>> const&, std::set<signature, std::less<signature>, std::allocator<signature>>&, std::multimap<signature, std::pair<Lab_poly, int>, std::less<signature>, std::allocator<std::pair<signature const, std::pair<Lab_poly, int>>>>&, int)
Spairs Init_Spairs(const vector<Lab_poly>& F, Signatures& Spol_sign, Spair_map& Spairs_map, int n)
{
  Spairs P = {};
  for (int i = n-1; i < F.size(); ++i)
    {
      for (int j = i+1; j < F.size(); ++j)
	{
	  pair<Lab_poly,Lab_poly> Spair = spair(F[j],F[i]);
	  Spol_sign.insert(spair(F[j],F[i]).first.Get_sign()); //not efficient, only inserted when signature not yet in
	  pair<pair<Lab_poly,int>,pair<Lab_poly,int>> spair_gen = make_pair(make_pair(Spair.first,j+1),make_pair(Spair.second,i+1));//check that, error source?
	  Spairs_map.insert(make_pair(Spair.first.Get_sign(),spair_gen.first));//
	  //Spairs_map.insert(make_pair(spair(F[j],F[i]).first.Get_sign(),spair(F[j],F[i]))); //not efficient, only inserted when signature not yet in
	  //P.insert(spair(F[j],F[i]));
	}
    }

#ifdef PRECISE_DEBUG
  for (auto it = P.begin(); it != P.end(); ++it)
    {
      cout << it->first.Get_sign() << "," <<  it->second.Get_sign() << endl;
    }
#endif
  return P;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rcx, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
leaq 0x8(%rdi), %rax
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rdi, 0x10(%rsp)
andq $0x0, 0x28(%rdi)
leal -0x1(%r8), %eax
movslq %eax, %rdi
movq (%rsi), %rcx
movq %rsi, 0x20(%rsp)
movq 0x8(%rsi), %rsi
leal 0x1(%r8), %r12d
leaq 0x128(%rsp), %rbp
leaq 0x50(%rsp), %r13
movq %rsi, %rax
subq %rcx, %rax
cqto
pushq $0x38
popq %r9
idivq %r9
cmpq %rdi, %rax
jbe 0x9137
movq %r8, 0x28(%rsp)
movslq %r8d, %r15
imulq $0x38, %r15, %rax
imulq $0x38, %rdi, %r14
incq %rdi
movq %rdi, 0x18(%rsp)
movl %r12d, 0xc(%rsp)
movl %r12d, 0x8(%rsp)
movq %rax, %r12
movq %r14, 0x40(%rsp)
movq %rsi, %rax
subq %rcx, %rax
cqto
pushq $0x38
popq %rdi
idivq %rdi
cmpq %r15, %rax
leaq 0x198(%rsp), %rbx
jbe 0x911d
leaq (%rcx,%r12), %rsi
addq %r14, %rcx
movq %rbp, %rdi
movq %rcx, %rdx
callq 0x474a
movq 0x20(%rsp), %rax
movq (%rax), %rdx
leaq (%rdx,%r12), %rsi
addq %r14, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x474a
movq 0x38(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xbe64
leaq 0xa8(%rsp), %rdi
callq 0x61da
movq %r13, %rdi
movq %rbp, %rsi
callq 0x97ca
movq %r15, 0x48(%rsp)
movl 0x8(%rsp), %eax
movl %eax, 0x88(%rsp)
movq %rbx, %rdi
leaq 0x160(%rsp), %rbp
movq %rbp, %rsi
callq 0x97ca
movq %r12, %r15
movq %r13, %r14
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %rax
movl %eax, 0x1d0(%rsp)
leaq 0xa8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xa958
movq %rbx, %rdi
callq 0x2f74
movq %r14, %rdi
callq 0x2f74
movups -0x18(%rbp), %xmm0
movaps %xmm0, 0x50(%rsp)
leaq 0x60(%rsp), %rdi
movq %r13, %rsi
callq 0xa10a
movq 0x30(%rsp), %rdi
movq %r14, %r13
movq %r14, %rsi
callq 0xbfee
leaq 0x60(%rsp), %rdi
callq 0x2f74
leaq 0xa8(%rsp), %rdi
callq 0x98f2
leaq 0x128(%rsp), %rbp
movq %rbp, %rdi
callq 0x61da
movq (%r12), %rcx
movq 0x8(%r12), %rsi
movq %r15, %r12
addq $0x38, %r12
incl 0x8(%rsp)
movq 0x48(%rsp), %r15
incq %r15
movq 0x40(%rsp), %r14
jmp 0x8fd3
movq 0x28(%rsp), %r8
incl %r8d
movl 0xc(%rsp), %r12d
incl %r12d
movq 0x18(%rsp), %rdi
jmp 0x8f91
movq 0x10(%rsp), %rax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x91a7
jmp 0x9176
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2f74
jmp 0x9167
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x98f2
jmp 0x919a
movq %rax, %rbx
jmp 0x919a
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x2f74
jmp 0x919a
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x61da
leaq 0x128(%rsp), %rdi
callq 0x61da
movq 0x10(%rsp), %rdi
callq 0x9f98
movq %rbx, %rdi
callq 0x2260