// File: ArashPartow[P]exprtk-extras/exprtk_repl.cpp
// Function: expression_processor<double>::parse_function_definition_impl::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, expression_processor<double>::function_definition&)
func_parse_result process(std::string& func_def, function_definition& fd)
      {
         if (!init(func_def))
            return e_parse_lexfail;

         if (!token_is(token_t::e_symbol,"function"))
            return e_parse_notfunc;

         if (!token_is(token_t::e_symbol,prsrhlpr_t::e_hold))
            return e_parse_partial;

         fd.name = current_token().value;

         next_token();

         if (!token_is(token_t::e_lbracket))
            return e_parse_partial;

         if (!token_is(token_t::e_rbracket))
         {
            std::vector<std::string> var_list;

            for ( ; ; )
            {
               // (x,y,z,....w)
               if (!token_is(token_t::e_symbol,prsrhlpr_t::e_hold))
                  return e_parse_partial;

               var_list.push_back(current_token().value);

               next_token();

               if (token_is(token_t::e_rbracket))
                  break;

               if (!token_is(token_t::e_comma))
                  return e_parse_partial;
            }

            var_list.swap(fd.var_list);
         }

         const std::size_t body_begin = current_token().position;
               std::size_t body_end   = current_token().position;

         int bracket_stack = 0;

         if (!token_is(token_t::e_lcrlbracket,prsrhlpr_t::e_hold))
            return e_parse_partial;

         for ( ; ; )
         {
            body_end = current_token().position;

            if (token_is(token_t::e_lcrlbracket))
               bracket_stack++;
            else if (token_is(token_t::e_rcrlbracket))
            {
               if (0 == --bracket_stack)
                  break;
            }
            else
            {
               if (lexer().finished())
                  return e_parse_partial;

               next_token();
            }
         }

         const std::size_t size = body_end - body_begin + 1;

         fd.body = func_def.substr(body_begin,size);

         const std::size_t index = body_begin + size;

         if (index < func_def.size())
            func_def = func_def.substr(index,func_def.size() - index);
         else
            func_def = "";

         return e_parse_success;
      }

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x138(%rsp)
movq %rsi, 0x130(%rsp)
movq %rdx, 0x128(%rsp)
movq 0x138(%rsp), %rdi
movq %rdi, 0x40(%rsp)
movq 0x130(%rsp), %rsi
callq 0x27eb80
testb $0x1, %al
jne 0x27e5cd
movl $0x4, 0x144(%rsp)
jmp 0x27eb46
movl $0x8, 0x124(%rsp)
leaq 0xff(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x1197d0
movq 0x38(%rsp), %rdx
leaq 0x21309d(%rip), %rsi    # 0x491693
leaq 0x100(%rsp), %rdi
callq 0x120970
jmp 0x27e605
movq 0x40(%rsp), %rdi
leaq 0x124(%rsp), %rsi
leaq 0x100(%rsp), %rdx
movl $0x1, %ecx
callq 0x27ebe0
movb %al, 0x37(%rsp)
jmp 0x27e62a
movb 0x37(%rsp), %al
xorb $-0x1, %al
movb %al, 0x36(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x119968
leaq 0xff(%rsp), %rdi
callq 0x119950
movb 0x36(%rsp), %al
testb $0x1, %al
jne 0x27e658
jmp 0x27e6b1
movl $0x8, 0x144(%rsp)
jmp 0x27eb46
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
jmp 0x27e69f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x119968
leaq 0xff(%rsp), %rdi
callq 0x119950
jmp 0x27eb55
movq 0x40(%rsp), %rdi
movl $0x8, 0xe8(%rsp)
leaq 0xe8(%rsp), %rsi
xorl %edx, %edx
callq 0x27ec60
xorb $-0x1, %al
testb $0x1, %al
jne 0x27e6d8
jmp 0x27e6e8
movl $0x2, 0x144(%rsp)
jmp 0x27eb46
movq 0x40(%rsp), %rdi
callq 0x27ecb0
movq %rax, %rsi
addq $0x8, %rsi
movq 0x128(%rsp), %rdi
callq 0x1198c0
movq 0x40(%rsp), %rdi
callq 0x27ecc0
movq 0x40(%rsp), %rdi
movl $0x28, 0xe4(%rsp)
leaq 0xe4(%rsp), %rsi
movl $0x1, %edx
callq 0x27ec60
xorb $-0x1, %al
testb $0x1, %al
jne 0x27e73a
jmp 0x27e74a
movl $0x2, 0x144(%rsp)
jmp 0x27eb46
movq 0x40(%rsp), %rdi
movl $0x29, 0xe0(%rsp)
leaq 0xe0(%rsp), %rsi
movl $0x1, %edx
callq 0x27ec60
xorb $-0x1, %al
testb $0x1, %al
jne 0x27e777
jmp 0x27e8f5
leaq 0xc8(%rsp), %rdi
callq 0x13bf20
movq 0x40(%rsp), %rdi
movl $0x8, 0xc4(%rsp)
leaq 0xc4(%rsp), %rsi
xorl %edx, %edx
callq 0x27ec60
movb %al, 0x35(%rsp)
jmp 0x27e7a9
movb 0x35(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x27e7b5
jmp 0x27e7f6
movl $0x2, 0x144(%rsp)
movl $0x1, 0xc0(%rsp)
jmp 0x27e8d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x25f230
jmp 0x27eb55
movq 0x40(%rsp), %rdi
callq 0x27ecb0
movq %rax, 0x28(%rsp)
jmp 0x27e807
movq 0x28(%rsp), %rsi
addq $0x8, %rsi
leaq 0xc8(%rsp), %rdi
callq 0x27ecf0
jmp 0x27e81f
movq 0x40(%rsp), %rdi
callq 0x27ecc0
jmp 0x27e82b
movq 0x40(%rsp), %rdi
movl $0x29, 0xbc(%rsp)
leaq 0xbc(%rsp), %rsi
movl $0x1, %edx
callq 0x27ec60
movb %al, 0x27(%rsp)
jmp 0x27e853
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x27e85d
jmp 0x27e85f
jmp 0x27e8b0
movq 0x40(%rsp), %rdi
movl $0x2c, 0xb8(%rsp)
leaq 0xb8(%rsp), %rsi
movl $0x1, %edx
callq 0x27ec60
movb %al, 0x26(%rsp)
jmp 0x27e887
movb 0x26(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x27e893
jmp 0x27e8ab
movl $0x2, 0x144(%rsp)
movl $0x1, 0xc0(%rsp)
jmp 0x27e8d4
jmp 0x27e784
movq 0x128(%rsp), %rsi
addq $0x40, %rsi
leaq 0xc8(%rsp), %rdi
callq 0x27ed60
movl $0x0, 0xc0(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x25f230
movl 0xc0(%rsp), %eax
testl %eax, %eax
je 0x27e8f3
jmp 0x27e8ee
jmp 0x27eb46
jmp 0x27e8f5
movq 0x40(%rsp), %rdi
callq 0x27ecb0
movq 0x40(%rsp), %rdi
movq 0x28(%rax), %rax
movq %rax, 0xb0(%rsp)
callq 0x27ecb0
movq 0x40(%rsp), %rdi
movq 0x28(%rax), %rax
movq %rax, 0xa8(%rsp)
movl $0x0, 0xa4(%rsp)
movl $0x7b, 0xa0(%rsp)
leaq 0xa0(%rsp), %rsi
xorl %edx, %edx
callq 0x27ec60
xorb $-0x1, %al
testb $0x1, %al
jne 0x27e953
jmp 0x27e963
movl $0x2, 0x144(%rsp)
jmp 0x27eb46
jmp 0x27e965
movq 0x40(%rsp), %rdi
callq 0x27ecb0
movq 0x40(%rsp), %rdi
movq 0x28(%rax), %rax
movq %rax, 0xa8(%rsp)
movl $0x7b, 0x9c(%rsp)
leaq 0x9c(%rsp), %rsi
movl $0x1, %edx
callq 0x27ec60
testb $0x1, %al
jne 0x27e9a3
jmp 0x27e9b6
movl 0xa4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa4(%rsp)
jmp 0x27ea2d
movq 0x40(%rsp), %rdi
movl $0x7d, 0x98(%rsp)
leaq 0x98(%rsp), %rsi
movl $0x1, %edx
callq 0x27ec60
testb $0x1, %al
jne 0x27e9de
jmp 0x27e9f9
movl 0xa4(%rsp), %ecx
addl $-0x1, %ecx
movl %ecx, 0xa4(%rsp)
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x27e9f7
jmp 0x27ea32
jmp 0x27ea2b
movq 0x40(%rsp), %rdi
callq 0x27edc0
movq %rax, %rdi
callq 0x27edd0
testb $0x1, %al
jne 0x27ea11
jmp 0x27ea21
movl $0x2, 0x144(%rsp)
jmp 0x27eb46
movq 0x40(%rsp), %rdi
callq 0x27ecc0
jmp 0x27ea2d
jmp 0x27e965
movq 0xa8(%rsp), %rax
subq 0xb0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
movq 0x130(%rsp), %rsi
movq 0xb0(%rsp), %rdx
movq 0x90(%rsp), %rcx
leaq 0x70(%rsp), %rdi
callq 0x119800
movq 0x128(%rsp), %rdi
addq $0x20, %rdi
leaq 0x70(%rsp), %rsi
callq 0x119490
leaq 0x70(%rsp), %rdi
callq 0x119968
movq 0xb0(%rsp), %rax
addq 0x90(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x130(%rsp), %rdi
callq 0x1192a0
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x27eb27
movq 0x130(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x130(%rsp), %rdi
callq 0x1192a0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
subq 0x68(%rsp), %rcx
leaq 0x48(%rsp), %rdi
callq 0x119800
movq 0x130(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x119490
leaq 0x48(%rsp), %rdi
callq 0x119968
jmp 0x27eb3b
movq 0x130(%rsp), %rdi
leaq 0x212d8b(%rip), %rsi    # 0x4918c1
callq 0x119380
movl $0x1, 0x144(%rsp)
movl 0x144(%rsp), %eax
addq $0x148, %rsp            # imm = 0x148
retq
movq 0xf0(%rsp), %rdi
callq 0x119570
nopw %cs:(%rax,%rax)
nopl (%rax)