// File: /workspace/github_cpp_makefile_star2_O3/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, 0xc8(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
incl 0xf985(%rip)            # 0x1a1cc
callq 0x5038
leaq 0x60(%rsp), %rdi
callq 0x10898
leaq 0xf913(%rip), %r14      # 0x1a170
leaq (%r15,%r15,2), %r15
shlq $0x4, %r15
movq (%r14), %rsi
addq %r15, %rsi
leaq 0x130(%rsp), %rdi
callq 0x4214
movq 0xfa21(%rip), %r12      # 0x1a2a0
testq %r12, %r12
movq %rbx, 0x10(%rsp)
je 0xab2c
leaq 0x20(%rbx), %rax
movq %rax, 0xc0(%rsp)
movl $0x0, 0x8(%rsp)
leaq 0x118(%rsp), %r13
movq (%r14), %rax
leaq (%rax,%r15), %rdi
movq 0x8(%r12), %rcx
leaq (%rcx,%rcx,2), %rsi
shlq $0x4, %rsi
addq %rax, %rsi
callq 0x3bf9
testb %al, %al
je 0xab0f
movq (%r14), %rsi
addq %r15, %rsi
leaq 0xe8(%rsp), %rdi
callq 0x4214
leaq 0x8(%r12), %rbp
movq (%rbp), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x4, %rsi
addq (%r14), %rsi
movq %r13, %rbx
movq %r13, %rdi
callq 0x4214
leaq 0x48(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdx
callq 0x10d0f
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0xa931
movq 0x128(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0xa94e
movq 0xf8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x10(%r12), %rdi
leaq 0x48(%rsp), %rsi
callq 0x6832
movl %eax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
leaq 0x38(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x12797
testb %al, %al
je 0xaaf8
leaq 0xf979(%rip), %rdi      # 0x1a300
movq %rbp, %rsi
callq 0xed1a
movq %rax, %rbp
leaq 0x10(%rax), %rsi
leaq 0x18(%rsp), %rdi
callq 0x68a4
movl 0x28(%rbp), %eax
movl %eax, 0x30(%rsp)
movq 0x60(%rsp), %rax
cmpq %rax, 0x68(%rsp)
movq 0x10(%rsp), %rbx
je 0xa9c7
movq 0x18(%rsp), %rdi
movl (%rdi), %ecx
cmpl (%rax), %ecx
jge 0xaae5
leaq 0x168(%rsp), %rbp
movq %rbp, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x6780
movl 0x38(%rsp), %edx
movq 0x40(%rsp), %rcx
leaq 0x80(%rsp), %rdi
movq %rbp, %rsi
callq 0x50f8
movq (%rbx), %rdi
movq 0x10(%rbx), %rsi
movaps 0x80(%rsp), %xmm0
movups %xmm0, (%rbx)
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
testq %rdi, %rdi
je 0xaa81
subq %rdi, %rsi
callq 0x2180
movq 0x80(%rsp), %rdi
movl 0x98(%rsp), %eax
movl %eax, 0x18(%rbx)
leaq 0xa0(%rsp), %rdx
movl 0x10(%rdx), %eax
movq 0xc0(%rsp), %rcx
movl %eax, 0x10(%rcx)
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
testq %rdi, %rdi
je 0xaaa7
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
jmp 0xaaa7
movl 0x98(%rsp), %eax
movl %eax, 0x18(%rbx)
leaq 0xa0(%rsp), %rdx
movl 0x10(%rdx), %eax
movq 0xc0(%rsp), %rcx
movl %eax, 0x10(%rcx)
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0xaac4
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x60(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x6674
movl 0x30(%rsp), %eax
movl %eax, 0x78(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xaaf2
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movb $0x1, %al
movl %eax, 0x8(%rsp)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0xab0f
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq (%r12), %r12
testq %r12, %r12
jne 0xa8a9
testb $0x1, 0x8(%rsp)
movq 0x10(%rsp), %rbx
jne 0xadac
movq 0xf735(%rip), %r12      # 0x1a268
testq %r12, %r12
je 0xadac
leaq 0x20(%rbx), %rax
movq %rax, 0x8(%rsp)
movq (%r14), %rax
leaq (%rax,%r15), %rdi
movq 0x8(%r12), %rcx
leaq (%rcx,%rcx,2), %rsi
shlq $0x4, %rsi
addq %rax, %rsi
callq 0x3bf9
testb %al, %al
je 0xad9f
movq (%r14), %rsi
addq %r15, %rsi
leaq 0xd0(%rsp), %rdi
callq 0x4214
leaq 0x8(%r12), %rbp
movq (%rbp), %rax
leaq (%rax,%rax,2), %rsi
shlq $0x4, %rsi
addq (%r14), %rsi
leaq 0x100(%rsp), %r13
movq %r13, %rdi
callq 0x4214
leaq 0x48(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
movq %r13, %rdx
callq 0x10d0f
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0xabd2
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0xabef
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x10(%r12), %rdi
leaq 0x48(%rsp), %rsi
callq 0x6832
movl %eax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
leaq 0x38(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x12797
testb %al, %al
je 0xad88
leaq 0xf6a0(%rip), %rdi      # 0x1a2c8
movq %rbp, %rsi
callq 0xed1a
movq %rax, %rbp
leaq 0x10(%rax), %rsi
leaq 0x18(%rsp), %rdi
callq 0x68a4
movl 0x28(%rbp), %eax
movl %eax, 0x30(%rsp)
movq 0x60(%rsp), %rax
cmpq %rax, 0x68(%rsp)
je 0xac63
movq 0x18(%rsp), %rdi
movl (%rdi), %ecx
cmpl (%rax), %ecx
jge 0xad7b
leaq 0x148(%rsp), %r13
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x6780
movl 0x38(%rsp), %edx
movq 0x40(%rsp), %rcx
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
callq 0x50f8
movq (%rbx), %rdi
movq 0x10(%rbx), %rsi
movaps 0x80(%rsp), %xmm0
movups %xmm0, (%rbx)
movq 0x90(%rsp), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
testq %rdi, %rdi
je 0xad1a
subq %rdi, %rsi
callq 0x2180
movq 0x80(%rsp), %rdi
movl 0x98(%rsp), %eax
movl %eax, 0x18(%rbx)
leaq 0xa0(%rsp), %rdx
movl 0x10(%rdx), %eax
movq 0x8(%rsp), %rcx
movl %eax, 0x10(%rcx)
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
testq %rdi, %rdi
je 0xad3d
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
jmp 0xad3d
movl 0x98(%rsp), %eax
movl %eax, 0x18(%rbx)
leaq 0xa0(%rsp), %rdx
movl 0x10(%rdx), %eax
movq 0x8(%rsp), %rcx
movl %eax, 0x10(%rcx)
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
je 0xad5a
movq 0x158(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq 0x60(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x6674
movl 0x30(%rsp), %eax
movl %eax, 0x78(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xad88
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0xad9f
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq (%r12), %r12
testq %r12, %r12
jne 0xab45
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0xadc9
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xade0
movq 0x70(%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
jmp 0xaf35
movq %rax, %r14
jmp 0xaf4c
jmp 0xae47
movq %rax, %r14
movq 0x148(%rsp), %rdi
testq %rdi, %rdi
je 0xae4a
movq 0x158(%rsp), %rsi
jmp 0xae3d
jmp 0xae47
jmp 0xae47
movq %rax, %r14
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0xae4a
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
jmp 0xae4a
movq %rax, %r14
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xaefc
movq 0x28(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
jmp 0xaefc
movq %rax, %r14
jmp 0xae96
jmp 0xaef9
jmp 0xaef4
movq %rax, %r14
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0xae96
movq 0x110(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0xaf13
movq 0xe0(%rsp), %rsi
jmp 0xaf0b
movq %rax, %r14
jmp 0xaed6
jmp 0xaef9
jmp 0xaef4
movq %rax, %r14
movq 0x118(%rsp), %rdi
testq %rdi, %rdi
je 0xaed6
movq 0x128(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0xaf13
movq 0xf8(%rsp), %rsi
jmp 0xaf0b
movq %rax, %r14
jmp 0xaf18
jmp 0xaef9
movq %rax, %r14
jmp 0xaf13
movq %rax, %r14
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0xaf13
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x10(%rsp), %rbx
movq 0x130(%rsp), %rdi
testq %rdi, %rdi
je 0xaf35
movq 0x140(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0xaf4c
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xaf60
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x2180
movq %r14, %rdi
callq 0x2240