// File: eryxcc[P]lois/tests/../include/lois.h
// Function: lois::lsetof<lois::term> lois::substitute<lois::term>(lois::lsetof<lois::term> const&, std::vector<std::pair<std::shared_ptr<lois::Variable>, lois::term>, std::allocator<std::pair<std::shared_ptr<lois::Variable>, lois::term>>> const&)
lsetof<T> substitute(const lsetof<T>& where, const varsubstlist& l) {
  lsetof<T> res;

    autoindenter i3;
    if(debuglois) std::cout << ido << "set substitution" << std::endl;

  for(auto elt: where.elts) {
    autoindenter i4;
    if(debuglois) std::cout << ido << "substituting in: " << elt->a << "/" << "VAR" << "/" <<elt->phi << std::endl;
    res.elts.emplace_back(std::make_shared<SimpleSetOf<T>> (
      elt->var,
      substitute(elt->phi, l),
      substitute(elt->a, l))
      );
    }

    if(debuglois) std::cout << ido << "set substitution done" << std::endl;
  return res;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0xc8(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x120e0
leaq -0x1a(%rbp), %rdi
callq 0x1a520
jmp 0x38bdc
leaq 0x89b7d(%rip), %rax     # 0xc2760
testb $0x1, (%rax)
je 0x38c64
leaq 0x896e9(%rip), %rax     # 0xc22d8
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rsi
movq 0x893d7(%rip), %rdi     # 0xc1fd8
callq 0x7da60
movq %rax, -0xd0(%rbp)
jmp 0x38c0f
movq -0xd0(%rbp), %rdi
leaq 0x4d884(%rip), %rsi     # 0x864a1
callq 0x82a0
movq %rax, -0xd8(%rbp)
jmp 0x38c2b
movq -0xd8(%rbp), %rdi
movq 0x89377(%rip), %rsi     # 0xc1fb0
callq 0x82f0
jmp 0x38c40
jmp 0x38c64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x3901b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x38ff4
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x321d0
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x32200
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x324a0
testb $0x1, %al
jne 0x38ca0
jmp 0x38f73
leaq -0x48(%rbp), %rdi
callq 0x32510
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x32560
leaq -0x61(%rbp), %rdi
callq 0x1a520
jmp 0x38cc0
leaq 0x89a99(%rip), %rax     # 0xc2760
testb $0x1, (%rax)
je 0x38e24
leaq 0x89601(%rip), %rax     # 0xc22d8
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rsi
movq 0x892ef(%rip), %rdi     # 0xc1fd8
callq 0x7da60
movq %rax, -0xe0(%rbp)
jmp 0x38cf7
movq -0xe0(%rbp), %rdi
leaq 0x4d7ad(%rip), %rsi     # 0x864b2
callq 0x82a0
movq %rax, -0xe8(%rbp)
jmp 0x38d13
leaq -0x60(%rbp), %rdi
callq 0x38b80
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
addq $0x28, %rsi
callq 0x1a5a0
movq %rax, -0xf0(%rbp)
jmp 0x38d38
movq -0xf0(%rbp), %rdi
leaq 0x4d77e(%rip), %rsi     # 0x864c4
callq 0x82a0
movq %rax, -0xf8(%rbp)
jmp 0x38d54
movq -0xf8(%rbp), %rdi
leaq 0x4d764(%rip), %rsi     # 0x864c6
callq 0x82a0
movq %rax, -0x100(%rbp)
jmp 0x38d70
movq -0x100(%rbp), %rdi
leaq 0x4d746(%rip), %rsi     # 0x864c4
callq 0x82a0
movq %rax, -0x108(%rbp)
jmp 0x38d8c
leaq -0x60(%rbp), %rdi
callq 0x38b80
movq %rax, %rsi
addq $0x18, %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x14c90
movq -0x108(%rbp), %rdi
movq -0x118(%rbp), %rsi
callq 0x52190
movq %rax, -0x110(%rbp)
jmp 0x38dc8
movq -0x110(%rbp), %rdi
movq 0x891da(%rip), %rsi     # 0xc1fb0
callq 0x82f0
jmp 0x38ddd
leaq -0x80(%rbp), %rdi
callq 0x12290
jmp 0x38e24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x38f65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x38f5c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x12290
jmp 0x38f5c
movq -0xc8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x130(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x38b80
movq -0x128(%rbp), %rdi
movq %rax, -0x120(%rbp)
callq 0x38b80
movq %rax, %rsi
addq $0x18, %rsi
movq -0x18(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x56970
jmp 0x38e72
leaq -0x60(%rbp), %rdi
callq 0x38b80
movq %rax, %rsi
addq $0x28, %rsi
movq -0x18(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
callq 0x56840
jmp 0x38e94
movq -0x120(%rbp), %rsi
leaq -0x90(%rbp), %rdi
leaq -0xa0(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq 0x39030
jmp 0x38eb7
movq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x2f630
jmp 0x38ecc
leaq -0x90(%rbp), %rdi
callq 0x153c0
leaq -0xb0(%rbp), %rdi
callq 0x129b0
leaq -0xa0(%rbp), %rdi
callq 0x12290
leaq -0x61(%rbp), %rdi
callq 0x1aba0
leaq -0x60(%rbp), %rdi
callq 0x153c0
leaq -0x48(%rbp), %rdi
callq 0x32530
jmp 0x38c8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x38f50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x38f44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x153c0
leaq -0xb0(%rbp), %rdi
callq 0x129b0
leaq -0xa0(%rbp), %rdi
callq 0x12290
leaq -0x61(%rbp), %rdi
callq 0x1aba0
leaq -0x60(%rbp), %rdi
callq 0x153c0
jmp 0x38ff4
leaq 0x897e6(%rip), %rax     # 0xc2760
testb $0x1, (%rax)
je 0x38fdf
leaq 0x89352(%rip), %rax     # 0xc22d8
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rsi
movq 0x8903a(%rip), %rdi     # 0xc1fd8
callq 0x7da60
movq %rax, -0x138(%rbp)
jmp 0x38fac
movq -0x138(%rbp), %rdi
leaq 0x4d510(%rip), %rsi     # 0x864ca
callq 0x82a0
movq %rax, -0x140(%rbp)
jmp 0x38fc8
movq -0x140(%rbp), %rdi
movq 0x88fda(%rip), %rsi     # 0xc1fb0
callq 0x82f0
jmp 0x38fdd
jmp 0x38fdf
movb $0x1, -0x19(%rbp)
leaq -0x1a(%rbp), %rdi
callq 0x1aba0
testb $0x1, -0x19(%rbp)
jne 0x3900b
jmp 0x38fff
leaq -0x1a(%rbp), %rdi
callq 0x1aba0
jmp 0x3901b
movq -0xc8(%rbp), %rdi
callq 0x124c0
movq -0xc0(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x124c0
movq -0x28(%rbp), %rdi
callq 0x84c0