// File: /workspace/github_cpp_makefile_star2_O1/manschga[P]M5GB/M5GB.cpp
// Function: Div_by_M(long, signature const&)
Lab_poly Div_by_M(const term_int t, const signature& T)
{
  g_reduced++;
  Lab_poly current = Lab_poly();
  polynomial Old_M = polynomial();
  bool m_found = false;
  vector<int> t_ = table[t].first;
    if (!m_found)
    {
      for (auto& it : LT_M) 
	{
	  if (isDivisible(table[t].first,table[it.first].first))
	    {
	      term_vec v = get_remainder(table[t].first, table[it.first].first);//if divisor divides term, then term = divisor*remainder);
	      signature test = it.second.Multiply(v);
	      if (Smaller_sign(test,T)) //check if S(vG) < T
		{
		  m_found = true;
		  polynomial New_M = M.find(it.first)->second;
		  //Lab_poly candidate(G_.find(it.first)->second.Multiply(v),test);
		  if (is_more_reduced(New_M,Old_M)) //check different criteria
		    {
		      current = Lab_poly(New_M.Multiply(v),test);
		      Old_M = New_M;
		      //return candidate;
		    }
		}
	    }
	}
    }
    if (!m_found)
    {
      for (auto& it : LT_G) 
	{
	  if (isDivisible(table[t].first,table[it.first].first))
	    {
	      term_vec v = get_remainder(table[t].first, table[it.first].first);//if divisor divides term, then term = divisor*remainder);
	      signature test = it.second.Multiply(v);
	      if (Smaller_sign(test,T)) //check if S(vG) < T
		{
		  m_found = true;
		  polynomial New_M = G_.find(it.first)->second;
		  //Lab_poly candidate(G_.find(it.first)->second.Multiply(v),test);
		  if (is_more_reduced(New_M,Old_M)) //check different criteria
		    {
		      current = Lab_poly(New_M.Multiply(v),test);
		      Old_M = New_M;
		      //return candidate;
		    }
		}
	    }
	}
      }
  return current;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdx, 0x88(%rsp)
movq %rsi, %rbx
movq %rdi, %r15
incl 0xfed6(%rip)            # 0x1a1bc
callq 0x4b5c
leaq 0x68(%rsp), %rdi
callq 0x1033c
movq %r15, 0x8(%rsp)
leaq 0xfe67(%rip), %r14      # 0x1a168
leaq (%rbx,%rbx,2), %rcx
shlq $0x4, %rcx
movq (%r14), %rsi
movq %rcx, 0x18(%rsp)
addq %rcx, %rsi
leaq 0xf8(%rsp), %rdi
callq 0x405e
movq 0xff68(%rip), %r15      # 0x1a290
testq %r15, %r15
je 0xa5b1
movq 0x8(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x90(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0xe0(%rsp), %r13
leaq 0x168(%rsp), %r14
leaq 0x110(%rsp), %rbx
leaq 0xfdfe(%rip), %rax      # 0x1a168
movq (%rax), %rax
movq 0x18(%rsp), %rcx
leaq (%rax,%rcx), %rdi
movq 0x8(%r15), %rcx
leaq (%rcx,%rcx,2), %rsi
shlq $0x4, %rsi
addq %rax, %rsi
callq 0x3bd6
testb %al, %al
je 0xa593
leaq 0xfdcf(%rip), %r12      # 0x1a168
movq (%r12), %rsi
addq 0x18(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x405e
leaq 0x8(%r15), %rbp
movq (%rbp), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x4, %rsi
addq (%r12), %rsi
movq %r13, %r12
movq %r13, %rdi
callq 0x405e
leaq 0x50(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
movq %r12, %rdx
callq 0x1074e
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0xa400
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xa41d
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x10(%r15), %rdi
leaq 0x50(%rsp), %rsi
callq 0x62a2
movl %eax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
leaq 0x40(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0x12163
testb %al, %al
je 0xa57c
movq (%rbp), %rcx
movq %rcx, %rax
xorl %edx, %edx
divq 0xfe9a(%rip)            # 0x1a2f8
leaq 0xfe8b(%rip), %rdi      # 0x1a2f0
movq %rdx, %rsi
movq %rbp, %rdx
callq 0xdd4a
movq (%rax), %r12
leaq 0x10(%r12), %rsi
leaq 0x20(%rsp), %rdi
callq 0x6314
movl 0x28(%r12), %eax
movl %eax, 0x38(%rsp)
movq 0x68(%rsp), %rax
cmpq %rax, 0x70(%rsp)
movq %r14, %r12
movq %rbx, %rbp
je 0xa4ac
movq 0x20(%rsp), %rcx
movl (%rcx), %ecx
cmpl (%rax), %ecx
jge 0xa55e
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x61f0
movl 0x40(%rsp), %edx
movq 0x48(%rsp), %rcx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4bf0
movq 0x8(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x60a8
movl 0x128(%rsp), %eax
movl %eax, 0x18(%r12)
leaq 0x130(%rsp), %rdx
movl 0x10(%rdx), %eax
movq 0x90(%rsp), %rcx
movl %eax, 0x10(%rcx)
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0xa527
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0xa544
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x68(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x60e8
movl 0x38(%rsp), %eax
movl %eax, 0x80(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xa575
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movb $0x1, %al
movq %rax, 0x10(%rsp)
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xa593
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq (%r15), %r15
testq %r15, %r15
jne 0xa363
testb $0x1, 0x10(%rsp)
leaq 0xfbbd(%rip), %r14      # 0x1a168
jne 0xa811
movq 0xfca0(%rip), %rbp      # 0x1a258
testq %rbp, %rbp
je 0xa811
movq 0x8(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x10(%rsp)
leaq 0xc8(%rsp), %r15
leaq 0x148(%rsp), %rbx
leaq 0x110(%rsp), %r12
movq (%r14), %rax
movq 0x18(%rsp), %rcx
leaq (%rax,%rcx), %rdi
movq 0x8(%rbp), %rcx
leaq (%rcx,%rcx,2), %rsi
shlq $0x4, %rsi
addq %rax, %rsi
callq 0x3bd6
testb %al, %al
je 0xa804
movq (%r14), %rsi
addq 0x18(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x405e
leaq 0x8(%rbp), %r13
movq (%r13), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x4, %rsi
addq (%r14), %rsi
movq %r15, %rdi
callq 0x405e
leaq 0x50(%rsp), %rdi
leaq 0x98(%rsp), %rsi
movq %r15, %rdx
callq 0x1074e
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0xa671
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xa68e
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x10(%rbp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x62a2
movl %eax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
leaq 0x40(%rsp), %rdi
movq 0x88(%rsp), %rsi
callq 0x12163
testb %al, %al
je 0xa7e6
movq (%r13), %rcx
movq %rcx, %rax
xorl %edx, %edx
divq 0xfbf1(%rip)            # 0x1a2c0
leaq 0xfbe2(%rip), %rdi      # 0x1a2b8
movq %rdx, %rsi
movq %r13, %rdx
callq 0xdd4a
movq (%rax), %r13
leaq 0x10(%r13), %rsi
leaq 0x20(%rsp), %rdi
callq 0x6314
movl 0x28(%r13), %eax
movl %eax, 0x38(%rsp)
movq 0x68(%rsp), %rax
cmpq %rax, 0x70(%rsp)
movq %rbx, %r13
je 0xa718
movq 0x20(%rsp), %rcx
movl (%rcx), %ecx
cmpl (%rax), %ecx
jge 0xa7cf
movq %r15, %r14
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x61f0
movl 0x40(%rsp), %edx
movq 0x48(%rsp), %rcx
movq %r12, %r15
movq %r12, %rdi
movq %r13, %rsi
callq 0x4bf0
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x60a8
movl 0x128(%rsp), %eax
movl %eax, 0x18(%r13)
leaq 0x130(%rsp), %rcx
movl 0x10(%rcx), %eax
movq 0x10(%rsp), %rdx
movl %eax, 0x10(%rdx)
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0xa795
movq 0x120(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
movq %r14, %r15
je 0xa7b5
movq 0x158(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x68(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x60e8
movl 0x38(%rsp), %eax
movl %eax, 0x80(%rsp)
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xa7e6
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xa7fd
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0xf964(%rip), %r14      # 0x1a168
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0xa5e7
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0xa82e
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
movq 0x8(%rsp), %rbx
je 0xa84a
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x8(%rsp), %r15
jmp 0xa9a1
movq %rax, %r14
jmp 0xa9b8
jmp 0xa8b6
movq %rax, %r14
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
je 0xa8b9
movq 0x158(%rsp), %rsi
jmp 0xa8ac
jmp 0xa8b6
jmp 0xa8b6
movq %rax, %r14
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0xa8b9
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
jmp 0xa8b9
movq %rax, %r14
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xa968
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
jmp 0xa968
movq %rax, %r14
jmp 0xa905
jmp 0xa965
jmp 0xa960
movq %rax, %r14
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0xa905
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xa97f
movq 0xa8(%rsp), %rsi
jmp 0xa977
movq %rax, %r14
jmp 0xa945
jmp 0xa965
jmp 0xa960
movq %rax, %r14
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0xa945
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xa97f
movq 0xc0(%rsp), %rsi
jmp 0xa977
jmp 0xa960
jmp 0xa965
movq %rax, %r14
jmp 0xa97f
movq %rax, %r14
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xa97f
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x8(%rsp), %r15
movq 0xf8(%rsp), %rdi
testq %rdi, %rdi
je 0xa9a1
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0xa9b8
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq (%r15), %rdi
testq %rdi, %rdi
je 0xa9cc
movq 0x10(%r15), %rsi
subq %rdi, %rsi
callq 0x2180
movq %r14, %rdi
callq 0x2240