// File: manschga[P]M5GB/other_fct.cpp
// Function: is_Smaller(std::vector<int, std::allocator<int>> const&, std::vector<int, std::allocator<int>> const&)
bool is_Smaller(const vector<int>& t, const vector<int>& u) //checks if t == u for t,u terms, order is degrevlex
{
  //cout << "is smaller called! " << endl;
  /*for (int i = 0; i < u.size(); ++i)
    {
      cout << u[i] << " ";
    }
  cout << endl;
  cout << "t:";
  for (int i = 0; i < t.size(); ++i)
    {
      cout << t[i] << " ";
    }
  cout << endl;
  */

  if (t.size() != u.size())
    {
      cout << "Error! wrong sizes in is_smaller" << endl;
      cout << "t.size: " << t.size() << endl;
      cout << "u.size: " << u.size() << endl;
    }
  int deg_t = 0;
  int deg_u = 0;
  for (int i = 0; i < u.size(); ++i)
    {
      deg_t += t[i];
      deg_u += u[i];
    }
   
  if (deg_t < deg_u)
    return true;
  if (deg_t > deg_u)
    return false;

  //case deg(t) = deg(u)
  int n = t.size();
  for (int i = n-1; i >= 0; --i)
    {
      if (t[i] > u[i])
	return true;
      if (t[i] < u[i])
	return false;
    }
  //case equal
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3260
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3260
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
je 0x555e
movq 0x3ab0b(%rip), %rdi     # 0x3ffd8
leaq 0x25c17(%rip), %rsi     # 0x2b0eb
callq 0x2190
movq %rax, %rdi
movq 0x3aae5(%rip), %rsi     # 0x3ffc8
callq 0x21d0
movq 0x3aae9(%rip), %rdi     # 0x3ffd8
leaq 0x25c16(%rip), %rsi     # 0x2b10c
callq 0x2190
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3260
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, %rdi
movq 0x3aaaa(%rip), %rsi     # 0x3ffc8
callq 0x21d0
movq 0x3aaae(%rip), %rdi     # 0x3ffd8
leaq 0x25be4(%rip), %rsi     # 0x2b115
callq 0x2190
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3260
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, %rdi
movq 0x3aa6f(%rip), %rsi     # 0x3ffc8
callq 0x21d0
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3260
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jae 0x55c5
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x5fd0
movl (%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x24(%rbp), %rsi
callq 0x5fd0
movl (%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5573
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x55d6
movb $0x1, -0x1(%rbp)
jmp 0x5671
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jle 0x55e7
movb $0x0, -0x1(%rbp)
jmp 0x5671
movq -0x10(%rbp), %rdi
callq 0x3260
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jl 0x566d
movq -0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x5fd0
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x5fd0
movq %rax, %rcx
movl -0x54(%rbp), %eax
cmpl (%rcx), %eax
jle 0x5631
movb $0x1, -0x1(%rbp)
jmp 0x5671
movq -0x10(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x5fd0
movl (%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
movslq -0x2c(%rbp), %rsi
callq 0x5fd0
movq %rax, %rcx
movl -0x58(%rbp), %eax
cmpl (%rcx), %eax
jge 0x5660
movb $0x0, -0x1(%rbp)
jmp 0x5671
jmp 0x5662
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x55fc
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)