// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, %r14
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rdi, 0x28(%rsp)
xorl %r15d, %r15d
movb %r15b, (%rax)
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %r15b, (%rax)
movb $0x1, %al
leaq 0x70(%rsp), %r12
leaq 0xa8(%rsp), %rbp
testb $0x1, %al
je 0x4a27
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %r14, %rdi
leaq 0x3925(%rip), %rsi      # 0x8109
movq %r15, %rdx
callq 0x30f0
movq %rax, %rbx
cmpq $-0x1, %rax
jne 0x47f9
movq 0x8(%r14), %rbx
movq (%r14), %rax
movzbl (%rax,%rbx), %r13d
movq %rbx, %rcx
subq %r15, %rcx
je 0x483f
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x3200
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5dde
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x6a4c
movq %r12, %rdi
callq 0x30c0
movq %rbp, %rdi
callq 0x30c0
cmpl $0x28, %r13d
je 0x4867
cmpl $0x5b, %r13d
je 0x4867
testl %r13d, %r13d
je 0x48a2
cmpl $0xa, %r13d
je 0x489b
cmpl $0x3b, %r13d
je 0x489b
incq %rbx
movq %rbx, %r15
jmp 0x47da
movsbl %r13b, %edx
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x4bdb
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x6930
movq 0xa0(%rsp), %r15
movq %r12, %rdi
callq 0x30c0
jmp 0x47da
incq %rbx
movb $0x1, %cl
jmp 0x48a4
xorl %ecx, %ecx
movq %rbx, %r15
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x4a3b
movl %ecx, 0x34(%rsp)
callq 0x58e5
movq %rax, %rbx
movq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x3f76
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6e18
movq %rax, %rbx
movq %r12, %rdi
callq 0x30c0
callq 0x58e5
testq %rbx, %rbx
je 0x491e
addq $0x28, %rbx
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x10(%rsp), %rdx
callq 0x695c
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x5d7a
movq %r12, %rdi
callq 0x30c0
jmp 0x4a14
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rax
subq %rsi, %rax
cmpq $0x30, %rax
jne 0x4956
movq %r12, %rdi
callq 0x3f76
movq %r12, %rdi
movq %r14, %rsi
callq 0x64ba
movl %eax, %ebx
movq %r12, %rdi
callq 0x30c0
testb %bl, %bl
jne 0x4a80
leaq 0xf(%rsp), %rdi
callq 0x6974
pushq $0x30
popq %r13
pushq $0x1
popq %rbx
movq %r15, 0x38(%rsp)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rax
subq %rsi, %rax
cqto
pushq $0x30
popq %rcx
idivq %rcx
cmpq %rax, %rbx
jae 0x49da
decq %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x69d8
movq %r14, %r15
movq %rbp, %r14
movq 0x10(%rsp), %rdx
addq %r13, %rdx
leaq 0xf8(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x4b32
movq %rbp, %rdi
callq 0x30c0
movq %r12, %rdi
callq 0x30c0
addq $0x30, %r13
addq $0x2, %rbx
movq %r14, %rbp
movq %r15, %r14
movq 0x38(%rsp), %r15
jmp 0x496c
movq %rbp, %rdi
callq 0x3f76
movq %r12, %rdi
movq %rbp, %rsi
callq 0x4774
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x5d7a
movq %r12, %rdi
callq 0x30c0
movq %rbp, %rdi
callq 0x30c0
leaq 0xf(%rsp), %rdi
callq 0x6a1a
leaq 0x10(%rsp), %rdi
callq 0x6a2a
movl 0x34(%rsp), %eax
jmp 0x47c4
leaq 0x40(%rsp), %rsi
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x5dbe
jmp 0x4a54
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x67e4
leaq 0x10(%rsp), %rdi
callq 0x6a2a
leaq 0xc8(%rsp), %rdi
callq 0x30c0
leaq 0x40(%rsp), %rdi
callq 0x30c0
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x5dde
leaq 0x10(%rsp), %rdi
callq 0x6a2a
movq 0x28(%rsp), %rbx
jmp 0x4a54
jmp 0x4b06
jmp 0x4b06
jmp 0x4b06
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x4ac3
jmp 0x4aca
jmp 0x4b06
jmp 0x4b06
jmp 0x4af7
jmp 0x4b06
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x30c0
jmp 0x4acd
movq %rax, %rbx
leaq 0xf(%rsp), %rdi
callq 0x6a1a
jmp 0x4b09
jmp 0x4b06
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x30c0
jmp 0x4aed
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x4aff
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x30c0
jmp 0x4b09
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6a2a
leaq 0xc8(%rsp), %rdi
callq 0x30c0
leaq 0x40(%rsp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x3300