// File: eryxcc[P]lois/tests/../include/lois.h
// Function: lois::EIteratorOf<lois::lpair<lois::term, lois::term>>::connectIterator()
void EIteratorOf<T>::connectIterator() {
  if(index >= s.elts.size() || index < 0) return;
  const SimpleSetOf<T>& sel(*s.elts[index]);
  // add variables and alph!

  if(debuglois) {
    std::cout << ido << "connect " << sel.a << " phi=" << sel.phi;
    for(auto v: sel.var) std::cout << " v:"<<v;
    std::cout << " in context="<<emptycontext << std::endl;
    }
  autoindenter i1;

  varsubstlist varpairs;
  varlist vlist;

  for(auto w: sel.var) {
    vptr v = newvar(w->dom);
    varpairs.emplace_back(w, term(v));
    vlist.push_back(v);
    }

  currentcontext = ourcontext = std::make_shared<Context> (currentcontext, 
    substitute(sel.phi, varpairs), vlist);
  
  // sometimes the environment is inconsistent with phi
  if(debuglois && at) std::cout << ido << "got for conscheck: " << *at << std::endl << ido << "  IN " << emptycontext << std::endl;
  if(debuglois && !at) std::cout << ido << "got for conscheck: " << "NULL" << std::endl << ido << "  IN " << emptycontext << std::endl;
  int res = solver->solveEnv();
  
  if(debuglois) std::cout << ido << "checking consistency: " << res << std::endl;
  
  if(res == 2) at = std::make_shared<T> (substitute(sel.a, varpairs));
  else ++(*this);

  if(debuglois) {
    if(at == NULL) std::cout << ido << "no result\n" << std::endl;
    else std::cout << ido << "result: " << *at << " in context="<<emptycontext << std::endl;
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x240(%rbp)
movslq 0x8(%rax), %rcx
movq %rcx, -0x238(%rbp)
movq (%rax), %rdi
addq $0x10, %rdi
callq 0x37080
movq %rax, %rcx
movq -0x238(%rbp), %rax
cmpq %rcx, %rax
jae 0x38aad
movq -0x240(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jge 0x38ab2
jmp 0x3961e
movq -0x240(%rbp), %rax
movq (%rax), %rdi
addq $0x10, %rdi
movslq 0x8(%rax), %rsi
callq 0x387a0
movq %rax, %rdi
callq 0x387c0
movq %rax, -0x10(%rbp)
leaq 0x6d134(%rip), %rax     # 0xa5c10
testb $0x1, (%rax)
je 0x38d55
leaq 0x6c7fc(%rip), %rax     # 0xa52e8
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
movq 0x6c4da(%rip), %rdi     # 0xa4fd8
callq 0x6afb0
movq %rax, %rdi
leaq 0x397db(%rip), %rsi     # 0x722e8
callq 0x82b0
movq %rax, -0x258(%rbp)
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x35d60
movq -0x258(%rbp), %rdi
movq -0x250(%rbp), %rsi
callq 0x35da0
movq %rax, -0x248(%rbp)
jmp 0x38b4d
movq -0x248(%rbp), %rdi
leaq 0x39796(%rip), %rsi     # 0x722f1
callq 0x82b0
movq %rax, -0x260(%rbp)
jmp 0x38b69
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x11030
movq -0x260(%rbp), %rdi
movq -0x268(%rbp), %rsi
callq 0x40060
jmp 0x38b96
leaq -0x58(%rbp), %rdi
callq 0x11060
leaq -0x38(%rbp), %rdi
callq 0x12ac0
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x1cb70
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x1cba0
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x1ce40
testb $0x1, %al
jne 0x38be0
jmp 0x38cc5
leaq -0x68(%rbp), %rdi
callq 0x1ceb0
movq %rax, %rsi
leaq -0x80(%rbp), %rdi
callq 0x1b100
movq 0x6c3dc(%rip), %rdi     # 0xa4fd8
leaq 0x396f4(%rip), %rsi     # 0x722f7
callq 0x82b0
movq %rax, -0x270(%rbp)
jmp 0x38c11
leaq -0x90(%rbp), %rdi
movq %rdi, -0x278(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x1b100
movq -0x270(%rbp), %rdi
movq -0x278(%rbp), %rsi
callq 0x410b0
jmp 0x38c3d
leaq -0x90(%rbp), %rdi
callq 0x10f20
leaq -0x80(%rbp), %rdi
callq 0x10f20
leaq -0x68(%rbp), %rdi
callq 0x1ced0
jmp 0x38bca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x38c83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x11060
leaq -0x38(%rbp), %rdi
callq 0x12ac0
jmp 0x3964b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x38cb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x10f20
leaq -0x80(%rbp), %rdi
callq 0x10f20
jmp 0x3964b
movq 0x6c30c(%rip), %rdi     # 0xa4fd8
leaq 0x39628(%rip), %rsi     # 0x722fb
callq 0x82b0
movq %rax, -0x290(%rbp)
leaq 0x6cafa(%rip), %rsi     # 0xa57e0
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x173b0
movq -0x290(%rbp), %rdi
movq -0x288(%rbp), %rsi
callq 0x1ae80
movq %rax, -0x280(%rbp)
jmp 0x38d15
movq -0x280(%rbp), %rdi
movq 0x6c28d(%rip), %rsi     # 0xa4fb0
callq 0x8300
jmp 0x38d2a
leaq -0xa0(%rbp), %rdi
callq 0x14b20
jmp 0x38d55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x14b20
jmp 0x3964b
leaq -0xa1(%rbp), %rdi
callq 0x1af20
leaq -0xc0(%rbp), %rdi
callq 0x20150
leaq -0xd8(%rbp), %rdi
callq 0x1af40
movq -0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rdi
callq 0x1cb70
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rdi
callq 0x1cba0
movq %rax, -0xf0(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x1ce40
testb $0x1, %al
jne 0x38dc6
jmp 0x38f12
leaq -0xe8(%rbp), %rdi
callq 0x1ceb0
movq %rax, %rsi
leaq -0x100(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0x1b100
movq -0x298(%rbp), %rdi
callq 0x11830
movq 0x10(%rax), %rsi
leaq -0x110(%rbp), %rdi
callq 0x20170
jmp 0x38e06
leaq -0x130(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
leaq -0x110(%rbp), %rsi
callq 0x20220
movq -0x2a0(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x445f0
jmp 0x38e35
leaq -0xc0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x201a0
jmp 0x38e51
leaq -0x120(%rbp), %rdi
callq 0x11360
leaq -0x130(%rbp), %rdi
callq 0x14cf0
leaq -0xd8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x1b320
jmp 0x38e7e
leaq -0x110(%rbp), %rdi
callq 0x10f20
leaq -0x100(%rbp), %rdi
callq 0x10f20
leaq -0xe8(%rbp), %rdi
callq 0x1ced0
jmp 0x38daa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x38f01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x38edb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x11360
leaq -0x130(%rbp), %rdi
callq 0x14cf0
jmp 0x38ef5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x10f20
leaq -0x100(%rbp), %rdi
callq 0x10f20
jmp 0x39627
movq -0x10(%rbp), %rsi
addq $0x18, %rsi
leaq -0x150(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0x44840
jmp 0x38f2f
leaq 0x6c8ba(%rip), %rsi     # 0xa57f0
leaq -0x140(%rbp), %rdi
leaq -0x150(%rbp), %rdx
leaq -0xd8(%rbp), %rcx
callq 0x20250
jmp 0x38f52
movq -0x240(%rbp), %rdi
addq $0x20, %rdi
leaq -0x140(%rbp), %rsi
callq 0x202d0
movq %rax, %rsi
leaq 0x6c87d(%rip), %rdi     # 0xa57f0
callq 0x1ade0
leaq -0x140(%rbp), %rdi
callq 0x14b20
leaq -0x150(%rbp), %rdi
callq 0x11060
leaq 0x6cc79(%rip), %rax     # 0xa5c10
testb $0x1, (%rax)
je 0x39173
movq -0x240(%rbp), %rdi
addq $0x10, %rdi
callq 0x396b0
testb $0x1, %al
jne 0x38fb9
jmp 0x39173
leaq 0x6c328(%rip), %rax     # 0xa52e8
movq (%rax), %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rsi
movq 0x6c000(%rip), %rdi     # 0xa4fd8
callq 0x6afb0
movq %rax, -0x2a8(%rbp)
jmp 0x38fe6
movq -0x2a8(%rbp), %rdi
leaq 0x39314(%rip), %rsi     # 0x72308
callq 0x82b0
movq %rax, -0x2b0(%rbp)
jmp 0x39002
movq -0x240(%rbp), %rdi
addq $0x10, %rdi
callq 0x396d0
movq %rax, %rsi
leaq -0x178(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x35d60
movq -0x2b0(%rbp), %rdi
movq -0x2c0(%rbp), %rsi
callq 0x35da0
movq %rax, -0x2b8(%rbp)
jmp 0x39044
movq -0x2b8(%rbp), %rdi
movq 0x6bf5e(%rip), %rsi     # 0xa4fb0
callq 0x8300
movq %rax, -0x2c8(%rbp)
jmp 0x39060
movq -0x2c8(%rbp), %rdi
leaq 0x6c27a(%rip), %rax     # 0xa52e8
movq (%rax), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rsi
callq 0x6afb0
movq %rax, -0x2d0(%rbp)
jmp 0x3908d
movq -0x2d0(%rbp), %rdi
leaq 0x39281(%rip), %rsi     # 0x7231c
callq 0x82b0
movq %rax, -0x2d8(%rbp)
jmp 0x390a9
leaq 0x6c730(%rip), %rsi     # 0xa57e0
leaq -0x190(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x173b0
movq -0x2d8(%rbp), %rdi
movq -0x2e8(%rbp), %rsi
callq 0x1ae80
movq %rax, -0x2e0(%rbp)
jmp 0x390df
movq -0x2e0(%rbp), %rdi
movq 0x6bec3(%rip), %rsi     # 0xa4fb0
callq 0x8300
jmp 0x390f4
leaq -0x190(%rbp), %rdi
callq 0x14b20
leaq -0x178(%rbp), %rdi
callq 0x12ac0
jmp 0x39173
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x39627
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x11060
jmp 0x39627
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x39162
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x14b20
leaq -0x178(%rbp), %rdi
callq 0x12ac0
jmp 0x39627
leaq 0x6ca96(%rip), %rax     # 0xa5c10
testb $0x1, (%rax)
je 0x392db
movq -0x240(%rbp), %rdi
addq $0x10, %rdi
callq 0x396b0
testb $0x1, %al
jne 0x392db
leaq 0x6c146(%rip), %rax     # 0xa52e8
movq (%rax), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rsi
movq 0x6be1e(%rip), %rdi     # 0xa4fd8
callq 0x6afb0
movq %rax, -0x2f0(%rbp)
jmp 0x391c8
movq -0x2f0(%rbp), %rdi
leaq 0x39132(%rip), %rsi     # 0x72308
callq 0x82b0
movq %rax, -0x2f8(%rbp)
jmp 0x391e4
movq -0x2f8(%rbp), %rdi
leaq 0x39130(%rip), %rsi     # 0x72322
callq 0x82b0
movq %rax, -0x300(%rbp)
jmp 0x39200
movq -0x300(%rbp), %rdi
movq 0x6bda2(%rip), %rsi     # 0xa4fb0
callq 0x8300
movq %rax, -0x308(%rbp)
jmp 0x3921c
movq -0x308(%rbp), %rdi
leaq 0x6c0be(%rip), %rax     # 0xa52e8
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rsi
callq 0x6afb0
movq %rax, -0x310(%rbp)
jmp 0x39249
movq -0x310(%rbp), %rdi
leaq 0x390c5(%rip), %rsi     # 0x7231c
callq 0x82b0
movq %rax, -0x318(%rbp)
jmp 0x39265
leaq 0x6c574(%rip), %rsi     # 0xa57e0
leaq -0x1b0(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x173b0
movq -0x318(%rbp), %rdi
movq -0x328(%rbp), %rsi
callq 0x1ae80
movq %rax, -0x320(%rbp)
jmp 0x3929b
movq -0x320(%rbp), %rdi
movq 0x6bd07(%rip), %rsi     # 0xa4fb0
callq 0x8300
jmp 0x392b0
leaq -0x1b0(%rbp), %rdi
callq 0x14b20
jmp 0x392db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x14b20
jmp 0x39627
leaq 0x6c606(%rip), %rdi     # 0xa58e8
callq 0x20350
movq %rax, %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
movl %eax, -0x32c(%rbp)
jmp 0x392fb
movl -0x32c(%rbp), %eax
movl %eax, -0x1b4(%rbp)
leaq 0x6c902(%rip), %rax     # 0xa5c10
testb $0x1, (%rax)
je 0x3938e
leaq 0x6bfce(%rip), %rax     # 0xa52e8
movq (%rax), %rax
movq %rax, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rsi
movq 0x6bca6(%rip), %rdi     # 0xa4fd8
callq 0x6afb0
movq %rax, -0x338(%rbp)
jmp 0x39340
movq -0x338(%rbp), %rdi
leaq 0x38fd9(%rip), %rsi     # 0x72327
callq 0x82b0
movq %rax, -0x340(%rbp)
jmp 0x3935c
movq -0x340(%rbp), %rdi
movl -0x1b4(%rbp), %esi
callq 0x84c0
movq %rax, -0x348(%rbp)
jmp 0x39377
movq -0x348(%rbp), %rdi
movq 0x6bc2b(%rip), %rsi     # 0xa4fb0
callq 0x8300
jmp 0x3938c
jmp 0x3938e
cmpl $0x2, -0x1b4(%rbp)
jne 0x3941b
movq -0x10(%rbp), %rsi
addq $0x28, %rsi
leaq -0x1f0(%rbp), %rdi
leaq -0xc0(%rbp), %rdx
callq 0x36230
jmp 0x393b8
leaq -0x1d0(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x39700
jmp 0x393cd
movq -0x240(%rbp), %rdi
addq $0x10, %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x39770
leaq -0x1d0(%rbp), %rdi
callq 0x39660
leaq -0x1f0(%rbp), %rdi
callq 0x12ac0
jmp 0x3942b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x12ac0
jmp 0x39627
movq -0x240(%rbp), %rdi
callq 0x12f50
jmp 0x39429
jmp 0x3942b
leaq 0x6c7de(%rip), %rax     # 0xa5c10
testb $0x1, (%rax)
je 0x395fa
movq -0x240(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x397a0
testb $0x1, %al
jne 0x39455
jmp 0x394b8
leaq 0x6be8c(%rip), %rax     # 0xa52e8
movq (%rax), %rax
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rsi
movq 0x6bb64(%rip), %rdi     # 0xa4fd8
callq 0x6afb0
movq %rax, -0x350(%rbp)
jmp 0x39482
movq -0x350(%rbp), %rdi
leaq 0x38eae(%rip), %rsi     # 0x7233e
callq 0x82b0
movq %rax, -0x358(%rbp)
jmp 0x3949e
movq -0x358(%rbp), %rdi
movq 0x6bb04(%rip), %rsi     # 0xa4fb0
callq 0x8300
jmp 0x394b3
jmp 0x395f8
leaq 0x6be29(%rip), %rax     # 0xa52e8
movq (%rax), %rax
movq %rax, -0x200(%rbp)
movq -0x200(%rbp), %rsi
movq 0x6bb01(%rip), %rdi     # 0xa4fd8
callq 0x6afb0
movq %rax, -0x360(%rbp)
jmp 0x394e5
movq -0x360(%rbp), %rdi
leaq 0x38e56(%rip), %rsi     # 0x72349
callq 0x82b0
movq %rax, -0x368(%rbp)
jmp 0x39501
movq -0x240(%rbp), %rdi
addq $0x10, %rdi
callq 0x396d0
movq %rax, %rsi
leaq -0x220(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x35d60
movq -0x368(%rbp), %rdi
movq -0x378(%rbp), %rsi
callq 0x35da0
movq %rax, -0x370(%rbp)
jmp 0x39543
movq -0x370(%rbp), %rdi
leaq 0x38daa(%rip), %rsi     # 0x722fb
callq 0x82b0
movq %rax, -0x380(%rbp)
jmp 0x3955f
leaq 0x6c27a(%rip), %rsi     # 0xa57e0
leaq -0x230(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x173b0
movq -0x380(%rbp), %rdi
movq -0x390(%rbp), %rsi
callq 0x1ae80
movq %rax, -0x388(%rbp)
jmp 0x39595
movq -0x388(%rbp), %rdi
movq 0x6ba0d(%rip), %rsi     # 0xa4fb0
callq 0x8300
jmp 0x395aa
leaq -0x230(%rbp), %rdi
callq 0x14b20
leaq -0x220(%rbp), %rdi
callq 0x12ac0
jmp 0x395f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x395ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x14b20
leaq -0x220(%rbp), %rdi
callq 0x12ac0
jmp 0x39627
jmp 0x395fa
leaq -0xd8(%rbp), %rdi
callq 0x1b4c0
leaq -0xc0(%rbp), %rdi
callq 0x1ba00
leaq -0xa1(%rbp), %rdi
callq 0x1b720
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
leaq -0xd8(%rbp), %rdi
callq 0x1b4c0
leaq -0xc0(%rbp), %rdi
callq 0x1ba00
leaq -0xa1(%rbp), %rdi
callq 0x1b720
movq -0x40(%rbp), %rdi
callq 0x84d0
nopw %cs:(%rax,%rax)
nop