// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
callq 0x182c58
testb %al, %al
je 0x182aa8
movl $0x8, 0x4(%rsp)
leaq 0xd7827(%rip), %rsi     # 0x25a1a0
leaq 0x10(%rsp), %rdi
leaq 0xb(%rsp), %rdx
callq 0x118498
leaq 0x4(%rsp), %rsi
leaq 0x10(%rsp), %rdx
pushq $0x1
popq %rcx
movq %r15, %rdi
callq 0x182c86
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
callq 0x116778
testb %bpl, %bpl
je 0x182aac
leaq 0x10(%rsp), %rsi
movl $0x8, (%rsi)
movq %r15, %rdi
xorl %edx, %edx
callq 0x182cc2
pushq $0x2
popq %rbp
testb %al, %al
je 0x182aaf
leaq 0x78(%r15), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x1166d0
movq %r15, %rdi
callq 0x182ce2
leaq 0x10(%rsp), %rsi
movl $0x28, (%rsi)
pushq $0x1
popq %rdx
movq %r15, %rdi
callq 0x182cc2
testb %al, %al
je 0x182aaf
leaq 0x10(%rsp), %rsi
movl $0x29, (%rsi)
pushq $0x1
popq %rdx
movq %r15, %rdi
callq 0x182cc2
testb %al, %al
jne 0x182aea
leaq 0x10(%rsp), %rax
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
leaq 0x4(%rsp), %r13
movl $0x8, 0x4(%rsp)
movq %r15, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x182cc2
testb %al, %al
je 0x182a9c
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x182d04
movq %r15, %rdi
callq 0x182ce2
movl $0x29, 0x4(%rsp)
movq %r15, %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
callq 0x182cc2
testb %al, %al
jne 0x182ac0
movl $0x2c, 0x4(%rsp)
movq %r15, %rdi
movq %r13, %rsi
pushq $0x1
popq %rdx
callq 0x182cc2
testb %al, %al
jne 0x182a3a
leaq 0x10(%rsp), %rdi
callq 0x17972e
jmp 0x182aaf
pushq $0x4
jmp 0x182aae
pushq $0x8
popq %rbp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdi
movq 0x10(%rdi), %rax
movups 0x40(%r14), %xmm0
movq 0x50(%r14), %rcx
movq %rcx, 0x10(%rdi)
movaps (%rdi), %xmm1
movaps %xmm0, (%rdi)
movups %xmm1, 0x40(%r14)
movq %rax, 0x50(%r14)
callq 0x17972e
movq 0x98(%r15), %r12
leaq 0x10(%rsp), %rsi
movl $0x7b, (%rsi)
movq %r15, %rdi
xorl %edx, %edx
callq 0x182cc2
testb %al, %al
je 0x182aaf
movl $0x0, 0xc(%rsp)
movq %r12, 0x38(%rsp)
movq %r14, 0x40(%rsp)
leaq 0x10(%rsp), %r14
pushq $0x1
popq %r12
movq 0x98(%r15), %r13
movl $0x7b, 0x10(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x182cc2
testb %al, %al
jne 0x182b78
movl $0x7d, 0x10(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x182cc2
testb %al, %al
jne 0x182b7e
movq 0x8(%r15), %rax
cmpq 0x18(%r15), %rax
je 0x182aaf
movq %r15, %rdi
callq 0x182ce2
jmp 0x182b25
incl 0xc(%rsp)
jmp 0x182b25
decl 0xc(%rsp)
jne 0x182b25
movq %r13, %rcx
movq 0x38(%rsp), %rdx
subq %rdx, %rcx
incq %rcx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x116630
movq 0x40(%rsp), %rdi
addq $0x20, %rdi
movq %r14, %rsi
callq 0x116340
movq %r14, %rdi
callq 0x116778
incq %r13
movq 0x8(%rbx), %rcx
subq %r13, %rcx
jbe 0x182bef
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x116630
movq %rbx, %rdi
movq %r14, %rsi
callq 0x116340
movq %r14, %rdi
callq 0x116778
jmp 0x182bfe
leaq 0xd77aa(%rip), %rsi     # 0x25a3a0
movq %rbx, %rdi
callq 0x116720
movl %r12d, %ebp
jmp 0x182aaf
jmp 0x182c20
jmp 0x182c20
jmp 0x182c20
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x116778
jmp 0x182c2d
movq %rax, %rbx
jmp 0x182c2d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x17972e
movq %rbx, %rdi
callq 0x116400
nop