// File: bsegovia[P]boodew/boodew.cpp
// Function: boodew::ex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long)
static value ex(const string &s, size_t curr) {
  value ret, id;
  bool running = true;
  while (running) {
    vector<value> tok;
    for (;;) {
      const auto next = s.find_first_of("; \r\t\n[(", curr);
      const auto last = next == string::npos ? s.size() : next;
      const auto len = last-curr;
      const auto c = s[last];
      if (len!=0) tok.push_back(stov(s.substr(curr,len)));
      if (c == '(' || c == '[') {
        const auto v = expr(s, c, curr);
        tok.push_back(v.first);
        curr = v.second;
      } else if (c == ';' || c == '\n') {curr=last+1; break;}
      else if (c == '\0') {curr=last; running=false; break;}
      else curr=last+1;
    }

    if (tok.size() == 0) return btov(false);
    auto const it = unique<builtinmap>()->find(vtos(tok[0]));
    if (it!=unique<builtinmap>()->end()) // try to call a builtin
      ret = it->second(tok);
    else if (tok.size() == 1 && vtos(tok[0]) == s) return stov(s); // literals
    else { // function call
      scope frame;
      for (size_t i = 1; i < tok.size(); ++i) new_local(to_string(i-1),tok[i]);
      ret = ex(vtos(tok[0]));
    }
  }
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
movq %rdi, -0x298(%rbp)
movq %rdi, %rax
movq %rax, -0x290(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xd000
leaq -0x78(%rbp), %rdi
callq 0xd000
movb $0x1, -0x79(%rbp)
testb $0x1, -0x79(%rbp)
je 0x6c23
leaq -0x98(%rbp), %rdi
callq 0x108d0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xfd2e(%rip), %rsi      # 0x16371
callq 0x3130
movq %rax, -0xa0(%rbp)
cmpq $-0x1, -0xa0(%rbp)
jne 0x666b
movq -0x10(%rbp), %rdi
callq 0x31b0
movq %rax, -0x2a0(%rbp)
jmp 0x6679
movq -0xa0(%rbp), %rax
movq %rax, -0x2a0(%rbp)
movq -0x2a0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
subq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x32e0
movb (%rax), %al
movb %al, -0xb1(%rbp)
cmpq $0x0, -0xb0(%rbp)
je 0x677a
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0xb0(%rbp), %rcx
leaq -0x108(%rbp), %rdi
callq 0x3290
jmp 0x66dc
leaq -0xe8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xd0e0
jmp 0x66f1
leaq -0x98(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x108f0
jmp 0x6706
leaq -0xe8(%rbp), %rdi
callq 0xc5d0
leaq -0x108(%rbp), %rdi
callq 0x3180
jmp 0x677a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x6c03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x6769
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0xc5d0
leaq -0x108(%rbp), %rdi
callq 0x3180
jmp 0x6c03
movsbl -0xb1(%rbp), %eax
cmpl $0x28, %eax
je 0x6792
movsbl -0xb1(%rbp), %eax
cmpl $0x5b, %eax
jne 0x6800
movq -0x10(%rbp), %rsi
movsbl -0xb1(%rbp), %edx
movq -0x18(%rbp), %rcx
leaq -0x150(%rbp), %rdi
callq 0x6d70
jmp 0x67af
leaq -0x98(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x10920
jmp 0x67c4
movq -0x120(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x10990
jmp 0x6859
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x10990
jmp 0x6c03
movsbl -0xb1(%rbp), %eax
cmpl $0x3b, %eax
je 0x6818
movsbl -0xb1(%rbp), %eax
cmpl $0xa, %eax
jne 0x6829
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x685e
movsbl -0xb1(%rbp), %eax
cmpl $0x0, %eax
jne 0x6846
movq -0xa8(%rbp), %rax
movq %rax, -0x18(%rbp)
movb $0x0, -0x79(%rbp)
jmp 0x685e
movq -0xa8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x6857
jmp 0x6859
jmp 0x6634
leaq -0x98(%rbp), %rdi
callq 0xc2b0
cmpq $0x0, %rax
jne 0x688f
movq -0x298(%rbp), %rdi
xorl %esi, %esi
callq 0xfe70
jmp 0x6880
movl $0x1, -0x154(%rbp)
jmp 0x6be6
callq 0xc300
movq %rax, -0x2a8(%rbp)
jmp 0x689d
xorl %eax, %eax
movl %eax, %esi
leaq -0x98(%rbp), %rdi
callq 0x109e0
movq %rax, %rsi
leaq -0x180(%rbp), %rdi
callq 0x4ba0
jmp 0x68be
movq -0x2a8(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x109b0
movq %rax, -0x2b0(%rbp)
jmp 0x68da
movq -0x2b0(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x3180
callq 0xc300
movq %rax, -0x2b8(%rbp)
jmp 0x6902
movq -0x2b8(%rbp), %rdi
callq 0x10a30
movq %rax, -0x188(%rbp)
leaq -0x160(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x10a00
testb $0x1, %al
jne 0x692e
jmp 0x699a
leaq -0x160(%rbp), %rdi
callq 0x10a60
movq %rax, %rsi
addq $0x20, %rsi
leaq -0x1b8(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x10a90
jmp 0x6956
leaq -0x48(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0xd020
leaq -0x1b8(%rbp), %rdi
callq 0xc5d0
jmp 0x6bdc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x3180
jmp 0x6c03
leaq -0x98(%rbp), %rdi
callq 0xc2b0
movq %rax, %rcx
movb $0x0, -0x1d9(%rbp)
xorl %eax, %eax
cmpq $0x1, %rcx
movb %al, -0x2b9(%rbp)
jne 0x69fc
xorl %eax, %eax
movl %eax, %esi
leaq -0x98(%rbp), %rdi
callq 0x109e0
movq %rax, %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x4ba0
jmp 0x69df
movb $0x1, -0x1d9(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0xf1e0
movb %al, -0x2b9(%rbp)
movb -0x2b9(%rbp), %al
movb %al, -0x2ba(%rbp)
testb $0x1, -0x1d9(%rbp)
jne 0x6a13
jmp 0x6a1f
leaq -0x1d8(%rbp), %rdi
callq 0x3180
movb -0x2ba(%rbp), %al
testb $0x1, %al
jne 0x6a2b
jmp 0x6a4c
movq -0x298(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd0e0
jmp 0x6a3d
movl $0x1, -0x154(%rbp)
jmp 0x6be6
leaq -0x1da(%rbp), %rdi
callq 0x10af0
jmp 0x6a5a
movq $0x1, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xc2b0
movq %rax, %rcx
movq -0x2c8(%rbp), %rax
cmpq %rcx, %rax
jae 0x6b3e
movq -0x1e8(%rbp), %rsi
decq %rsi
leaq -0x238(%rbp), %rdi
callq 0x10b70
jmp 0x6aaa
movq -0x1e8(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x109e0
movq %rax, %rdx
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x6c70
jmp 0x6ad5
leaq -0x218(%rbp), %rdi
callq 0xc5d0
leaq -0x238(%rbp), %rdi
callq 0x3180
movq -0x1e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1e8(%rbp)
jmp 0x6a65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x6bcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x3180
jmp 0x6bcc
xorl %eax, %eax
movl %eax, %esi
leaq -0x98(%rbp), %rdi
callq 0x109e0
movq %rax, %rsi
leaq -0x288(%rbp), %rdi
callq 0x4ba0
jmp 0x6b5f
xorl %eax, %eax
movl %eax, %edx
leaq -0x268(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x65e0
jmp 0x6b78
leaq -0x48(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0xd020
leaq -0x268(%rbp), %rdi
callq 0xc5d0
leaq -0x288(%rbp), %rdi
callq 0x3180
leaq -0x1da(%rbp), %rdi
callq 0x10c50
jmp 0x6bda
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x3180
leaq -0x1da(%rbp), %rdi
callq 0x10c50
jmp 0x6c03
jmp 0x6bdc
movl $0x0, -0x154(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x10c70
movl -0x154(%rbp), %eax
testl %eax, %eax
jne 0x6c3d
jmp 0x6bfe
jmp 0x661e
leaq -0x98(%rbp), %rdi
callq 0x10c70
leaq -0x78(%rbp), %rdi
callq 0xc5d0
leaq -0x48(%rbp), %rdi
callq 0xc5d0
jmp 0x6c5f
movq -0x298(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xd0a0
movl $0x1, -0x154(%rbp)
leaq -0x78(%rbp), %rdi
callq 0xc5d0
leaq -0x48(%rbp), %rdi
callq 0xc5d0
movq -0x290(%rbp), %rax
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
movq -0x110(%rbp), %rdi
callq 0x3400
nopl (%rax,%rax)