// File: /workspace/github_cpp_makefile_star2_O2/bsegovia[P]boodew/boodew.cpp
// Function: boodew::expr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char, unsigned long)
static pair<value,size_t> expr(const string &s, char c, size_t curr) {
  const char *match = c=='['?"[]@":"()";
  stringstream ss;
  size_t opened = 1, next = curr;
  while (opened) {
    if ((next = s.find_first_of(match,next+1)) == string::npos)
      throw boodew_exception(format("missing %c", c=='['?']':')'));
    if (c == '[' && s[next] == '@') {
      ss << s.substr(curr+1, next-curr-1);
      if (s[next+1] == '(') {
        const auto v = expr(s, '(', next+1);
        ss << vtos(v.first);
        if (s[v.second]!=']'||opened!=1) ss << s[v.second];
        curr = v.second;
        next = curr > 0 ? curr-1 : 0;
      } else
        do ss << s[curr = ++next]; while (s[next] == '@');
    } else
      opened += s[next] == c ? +1 : -1;
  }
  if (next>curr) ss << s.substr(curr+1, next-curr-1);
  return make_pair((c=='[' ? stov(ss.str()) : ex(ss.str())), next+1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rcx, %rbp
movq %rsi, %r14
movq %rdi, 0x18(%rsp)
movl %edx, 0xc(%rsp)
cmpb $0x5b, %dl
leaq 0x350c(%rip), %rax      # 0x8111
leaq 0x3509(%rip), %rcx      # 0x8115
cmoveq %rax, %rcx
movq %rcx, 0x40(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x3150
pushq $0x1
popq %rax
leaq 0xb0(%rsp), %rbx
movq %rbp, %r12
movq %rbp, %r13
notq %r13
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x4d8d
incq %r12
movq %r14, %rdi
movq 0x40(%rsp), %rsi
movq %r12, %rdx
callq 0x30f0
cmpq $-0x1, %rax
je 0x4e5f
movq %rax, %r12
movq (%r14), %rax
movb (%rax,%r12), %al
cmpb $0x5b, 0xc(%rsp)
jne 0x4d73
cmpb $0x40, %al
jne 0x4d73
movq %rbx, %r15
incq %rbp
addq %r12, %r13
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x3200
movq %r15, %rdi
movq %rbx, %rsi
callq 0x31c0
movq %rbx, %r13
movq %rbx, %rdi
callq 0x30c0
movq (%r14), %rax
cmpb $0x28, 0x1(%rax,%r12)
movq %r15, %rbx
jne 0x4d45
incq %r12
movq %r13, %rdi
movq %r14, %rsi
pushq $0x28
popq %rdx
movq %r12, %rcx
callq 0x4bdb
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x3f76
movq %rbx, %rdi
movq %r15, %rsi
callq 0x31c0
movq %r15, %rdi
callq 0x30c0
movq 0x78(%rsp), %rbp
movq (%r14), %rax
movb (%rax,%rbp), %al
cmpq $0x1, 0x10(%rsp)
jne 0x4d13
cmpb $0x5d, %al
je 0x4d23
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3220
movq 0x78(%rsp), %rbp
movq %rbp, %r12
subq $0x1, %r12
movl $0x0, %eax
cmovbq %rax, %r12
movq %r13, %rdi
callq 0x30c0
movq 0x10(%rsp), %rax
jmp 0x4c30
movsbl 0x1(%rax,%r12), %esi
movq %rbx, %rdi
callq 0x3220
movq (%r14), %rax
leaq 0x1(%r12), %rbp
cmpb $0x40, 0x1(%rax,%r12)
movq %rbp, %r12
je 0x4d45
movq %rbp, %r12
movq 0x10(%rsp), %rax
jmp 0x4c30
xorl %ecx, %ecx
cmpb 0xc(%rsp), %al
sete %cl
movq 0x10(%rsp), %rax
leaq (%rax,%rcx,2), %rax
decq %rax
jmp 0x4c30
cmpq %rbp, %r12
jbe 0x4dc2
incq %rbp
addq %r12, %r13
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x3200
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x31c0
leaq 0x48(%rsp), %rdi
callq 0x30c0
leaq 0xb8(%rsp), %rsi
cmpb $0x5b, 0xc(%rsp)
jne 0x4df1
leaq 0x20(%rsp), %rdi
callq 0x32c0
movq 0x18(%rsp), %r14
leaq 0x48(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x5dde
jmp 0x4e0f
leaq 0x20(%rsp), %rdi
callq 0x32c0
movq 0x18(%rsp), %r14
leaq 0x48(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x4774
incq %r12
leaq 0x48(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5dbe
movq %r12, 0x30(%r14)
movq %rbx, %rdi
callq 0x30c0
cmpb $0x5b, 0xc(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x30c0
leaq 0xa0(%rsp), %rdi
callq 0x3180
movq %r14, %rax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x28
popq %rdi
callq 0x30e0
movq %rax, %r14
cmpb $0x5b, 0xc(%rsp)
pushq $0x5d
popq %rax
pushq $0x29
popq %rdx
cmovel %eax, %edx
leaq 0x3299(%rip), %rsi      # 0x8118
leaq 0x80(%rsp), %rdi
xorl %eax, %eax
callq 0x3dfc
movb $0x1, %bpl
leaq 0x80(%rsp), %rsi
movq %r14, %rdi
callq 0x5846
xorl %ebp, %ebp
leaq 0x7d0e(%rip), %rsi      # 0xcbb8
leaq 0x9cb(%rip), %rdx       # 0x587c
movq %r14, %rdi
callq 0x32f0
jmp 0x4ebb
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x4eea
jmp 0x4f17
jmp 0x4f17
jmp 0x4ee2
jmp 0x4f17
jmp 0x4ee2
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x30c0
jmp 0x4ee5
jmp 0x4ee2
jmp 0x4f17
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x30c0
jmp 0x4f1a
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x30c0
testb %bpl, %bpl
jne 0x4f0b
jmp 0x4f1a
movq %rax, %rbx
movq %r14, %rdi
callq 0x3170
jmp 0x4f1a
jmp 0x4f17
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x3180
movq %rbx, %rdi
callq 0x3300
nop