// File: manschga[P]M5GB/M5GB.cpp
// Function: Check_TGFT(long, signature const&)
bool Check_TGFT(const term_int t_, const signature& T)
{
  #ifdef PRECISE_DEBUG
  cout << "TGFT called!" << endl;
  #endif
  for (auto& it : G_conv) 
    {
      //*
      if (t_ == it.first)
	{
	  signature test = it.second.second;//if divisor divides term, then term = divisor*remainderv);//check: needed whole multiple?
	  if (Smaller_sign(test,T)) //check if S(vG) < T
	    {
	      return true;
	    }
	}
    }
  for (auto& it : G_conv)
    {
      if (t_ > it.first)
	{
	  if (isDivisible(table[t_].first,it.second.first))
	    {
	      signature test = it.second.second.Multiply(get_remainder(table[t_].first, it.second.first));//if divisor divides term, then term = divisor*remainderv);//check: needed whole multiple?
	      if (Smaller_sign(test,T)) //check if S(vG) < T
		{
		  return true;
		}
	    }
	}
    }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq 0x2cad6(%rip), %rax     # 0x40250
movq %rax, -0x20(%rbp)
leaq 0x2cacb(%rip), %rdi     # 0x40250
callq 0x172e0
movq %rax, -0x28(%rbp)
leaq 0x2cabb(%rip), %rdi     # 0x40250
callq 0x17310
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x17340
testb $0x1, %al
jne 0x137b1
jmp 0x1380a
leaq -0x28(%rbp), %rdi
callq 0x17370
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq (%rcx), %rax
jne 0x137fd
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x2a460
testb $0x1, %al
jne 0x137f2
jmp 0x137fb
movb $0x1, -0x1(%rbp)
jmp 0x139dd
jmp 0x137fd
jmp 0x137ff
leaq -0x28(%rbp), %rdi
callq 0x173a0
jmp 0x1379e
leaq 0x2ca3f(%rip), %rax     # 0x40250
movq %rax, -0x50(%rbp)
leaq 0x2ca34(%rip), %rdi     # 0x40250
callq 0x172e0
movq %rax, -0x58(%rbp)
leaq 0x2ca24(%rip), %rdi     # 0x40250
callq 0x17310
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x17340
testb $0x1, %al
jne 0x1384b
jmp 0x139d9
leaq -0x58(%rbp), %rdi
callq 0x17370
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq -0x68(%rbp), %rcx
cmpq (%rcx), %rax
jle 0x139c9
movq -0x10(%rbp), %rsi
leaq 0x2c96c(%rip), %rdi     # 0x401e0
callq 0xd480
movq %rax, %rdi
movq -0x68(%rbp), %rsi
addq $0x8, %rsi
callq 0x5880
testb $0x1, %al
jne 0x13892
jmp 0x139c7
movq -0x68(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x2c934(%rip), %rdi     # 0x401e0
callq 0xd480
movq %rax, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x5ff0
movq -0x68(%rbp), %rsi
addq $0x8, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x5ff0
jmp 0x138d6
leaq -0x90(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x262f0
jmp 0x138f2
movq -0xd8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xd0c0
movq %rdx, -0xe8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x13914
movq -0xe8(%rbp), %rax
movl -0xdc(%rbp), %ecx
movl %ecx, -0x78(%rbp)
movq %rax, -0x70(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x3b70
leaq -0xc0(%rbp), %rdi
callq 0x3b70
leaq -0xa8(%rbp), %rdi
callq 0x3b70
movq -0x18(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x2a460
testb $0x1, %al
jne 0x1395f
jmp 0x139c5
movb $0x1, -0x1(%rbp)
jmp 0x139dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x139b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x139ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x3b70
leaq -0xc0(%rbp), %rdi
callq 0x3b70
leaq -0xa8(%rbp), %rdi
callq 0x3b70
jmp 0x139eb
jmp 0x139c7
jmp 0x139c9
jmp 0x139cb
leaq -0x58(%rbp), %rdi
callq 0x173a0
jmp 0x13835
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xf0, %rsp
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x2300
nopw (%rax,%rax)