// File: ArashPartow[P]exprtk-extras/exprtk_repl.cpp
// Function: expression_processor<double>::process_function_definition(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
void process_function_definition(const std::string& func_def_header, bool read_stdin = true)
   {
      std::string func_def = func_def_header;

      if (read_stdin)
      {
         func_def += read_from_stdin();

         if (!func_def.empty() && ('$' == func_def[0]))
            func_def.erase(func_def.begin());
      }

      do
      {
         function_definition fd;

         func_parse_result fp_result = parse_function_definition(func_def,fd);

         if (e_parse_success == fp_result)
         {
            std::string vars;

            for (std::size_t i = 0; i < fd.var_list.size(); ++i)
            {
               vars += fd.var_list[i] + ((i < fd.var_list.size() - 1) ? "," : "");
            }

            function_t f(fd.name);

            for (std::size_t i = 0; i < fd.var_list.size(); ++i)
            {
               f.var(fd.var_list[i]);
            }

            f.expression(fd.body);

            if (function_symbol_table_.get_function(fd.name))
            {
               function_symbol_table_.remove_function(fd.name);

               for (std::size_t i = 0; i < func_def_list_.size(); ++i)
               {
                  if (exprtk::details::imatch(fd.name, func_def_list_[i].name))
                  {
                     func_def_list_.erase(func_def_list_.begin() + i);

                     break;
                  }
               }
            }

            if (!compositor_.add(f,true))
            {
               function_symbol_table_.remove_function(fd.name);

               printf("Error - Failed to add function: %s\n",fd.name.c_str());

               return;
            }

            printf("Function[%02d]\n",static_cast<int>(func_def_list_.size()));
            printf("Name: %s      \n",fd.name.c_str()                        );
            printf("Vars: (%s)    \n",vars.c_str()                           );
            printf("------------------------------------------------------\n");

            func_def_list_.push_back(fd);
         }
         else if (e_parse_notfunc != fp_result)
         {
            printf("Error - Critical parsing error - partial parse occurred\n");
            return;
         }
         else
            break;
      }
      while (!func_def.empty());

      if (!func_def.empty())
      {
         process(func_def);
      }
   }

// Assembly:
subq $0x298, %rsp            # imm = 0x298
movb %dl, %al
movq %rdi, 0x290(%rsp)
movq %rsi, 0x288(%rsp)
andb $0x1, %al
movb %al, 0x287(%rsp)
movq 0x290(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x288(%rsp), %rsi
leaq 0x260(%rsp), %rdi
callq 0x119150
testb $0x1, 0x287(%rsp)
je 0x27d1aa
movq 0x80(%rsp), %rsi
leaq 0x240(%rsp), %rdi
callq 0x27dcf0
jmp 0x27d0ac
leaq 0x260(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x1190e0
jmp 0x27d0c3
leaq 0x240(%rsp), %rdi
callq 0x119968
leaq 0x260(%rsp), %rdi
callq 0x119270
testb $0x1, %al
jne 0x27d1a8
xorl %eax, %eax
movl %eax, %esi
leaq 0x260(%rsp), %rdi
callq 0x1198a0
movq %rax, 0x78(%rsp)
jmp 0x27d0fd
movq 0x78(%rsp), %rax
movsbl (%rax), %ecx
movl $0x24, %eax
cmpl %ecx, %eax
jne 0x27d1a8
leaq 0x260(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x1193e0
movq %rax, 0x220(%rsp)
leaq 0x228(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x27df00
movq 0x68(%rsp), %rdi
movq 0x228(%rsp), %rsi
callq 0x1191e0
movq %rax, 0x70(%rsp)
jmp 0x27d15a
movq 0x70(%rsp), %rax
movq %rax, 0x218(%rsp)
jmp 0x27d1a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
jmp 0x27d7e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x240(%rsp), %rdi
callq 0x119968
jmp 0x27d7e4
jmp 0x27d1aa
jmp 0x27d1ac
leaq 0x1c0(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x27df40
movq 0x80(%rsp), %rdi
movq 0x58(%rsp), %rdx
leaq 0x260(%rsp), %rsi
callq 0x27df80
movl %eax, 0x64(%rsp)
jmp 0x27d1de
movl 0x64(%rsp), %eax
movl %eax, 0x1bc(%rsp)
movl $0x1, %eax
cmpl 0x1bc(%rsp), %eax
jne 0x27d6be
leaq 0x198(%rsp), %rdi
callq 0x119300
movq $0x0, 0x190(%rsp)
movq 0x190(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x1c0(%rsp), %rdi
addq $0x40, %rdi
callq 0x27e010
movq %rax, %rcx
movq 0x50(%rsp), %rax
cmpq %rcx, %rax
jae 0x27d342
leaq 0x200(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movq 0x190(%rsp), %rsi
callq 0x27e0c0
movq 0x38(%rsp), %rdi
movq %rax, 0x40(%rsp)
movq 0x190(%rsp), %rax
movq %rax, 0x48(%rsp)
callq 0x27e010
movq 0x40(%rsp), %rsi
movq %rax, %rcx
movq 0x48(%rsp), %rax
decq %rcx
subq %rcx, %rax
leaq 0x212363(%rip), %rax    # 0x48f5f6
leaq 0x214627(%rip), %rdx    # 0x4918c1
cmovbq %rax, %rdx
leaq 0x170(%rsp), %rdi
callq 0x27e030
jmp 0x27d2ad
leaq 0x198(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x1190e0
jmp 0x27d2c4
leaq 0x170(%rsp), %rdi
callq 0x119968
movq 0x190(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x190(%rsp)
jmp 0x27d214
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
jmp 0x27d792
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
jmp 0x27d6ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x119968
jmp 0x27d6ac
leaq 0xe0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x27e0e0
jmp 0x27d359
movq $0x0, 0xd8(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x1c0(%rsp), %rdi
addq $0x40, %rdi
callq 0x27e010
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jae 0x27d3f5
leaq 0x200(%rsp), %rdi
movq 0xd8(%rsp), %rsi
callq 0x27e0c0
movq %rax, %rsi
leaq 0xe0(%rsp), %rdi
callq 0x27e160
jmp 0x27d3b7
jmp 0x27d3b9
movq 0xd8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xd8(%rsp)
jmp 0x27d365
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x27e4c0
jmp 0x27d6ac
leaq 0x1e0(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
callq 0x27e190
jmp 0x27d40c
movq 0x80(%rsp), %rdi
addq $0x18, %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x27e1c0
movq %rax, 0x28(%rsp)
jmp 0x27d42c
movq 0x28(%rsp), %rax
cmpq $0x0, %rax
je 0x27d568
movq 0x80(%rsp), %rdi
addq $0x18, %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x27e240
jmp 0x27d456
movq $0x0, 0xd0(%rsp)
movq 0x80(%rsp), %rdi
movq 0xd0(%rsp), %rax
movq %rax, 0x20(%rsp)
addq $0x1fa8, %rdi           # imm = 0x1FA8
callq 0x27e2a0
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x27d566
movq 0x80(%rsp), %rdi
leaq 0x1c0(%rsp), %rax
movq %rax, 0x18(%rsp)
addq $0x1fa8, %rdi           # imm = 0x1FA8
movq 0xd0(%rsp), %rsi
callq 0x27e2c0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x267d20
testb $0x1, %al
jne 0x27d4d0
jmp 0x27d54b
movq 0x80(%rsp), %rdi
addq $0x1fa8, %rdi           # imm = 0x1FA8
movq %rdi, 0x8(%rsp)
callq 0x27e350
movq %rax, 0xb8(%rsp)
movq 0xd0(%rsp), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x27e380
movq %rax, 0xc0(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x27e3c0
movq 0x8(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x27e2e0
movq %rax, 0x10(%rsp)
jmp 0x27d53c
movq 0x10(%rsp), %rax
movq %rax, 0xb0(%rsp)
jmp 0x27d566
jmp 0x27d54d
movq 0xd0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xd0(%rsp)
jmp 0x27d462
jmp 0x27d568
movq 0x80(%rsp), %rdi
addq $0x948, %rdi            # imm = 0x948
leaq 0xe0(%rsp), %rsi
movl $0x1, %edx
callq 0x27e400
movb %al, 0x7(%rsp)
jmp 0x27d58f
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x27d5e4
jmp 0x27d599
movq 0x80(%rsp), %rdi
addq $0x18, %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x27e240
jmp 0x27d5b4
leaq 0x1c0(%rsp), %rdi
callq 0x119120
movq %rax, %rsi
leaq 0x20f99d(%rip), %rdi    # 0x48cf68
xorl %eax, %eax
callq 0x1190b0
jmp 0x27d5d4
movl $0x1, 0xac(%rsp)
jmp 0x27d683
movq 0x80(%rsp), %rdi
addq $0x1fa8, %rdi           # imm = 0x1FA8
callq 0x27e2a0
movl %eax, %esi
leaq 0x20f98b(%rip), %rdi    # 0x48cf8c
xorl %eax, %eax
callq 0x1190b0
jmp 0x27d60a
leaq 0x1c0(%rsp), %rdi
callq 0x119120
movq %rax, %rsi
leaq 0x20f97b(%rip), %rdi    # 0x48cf9c
xorl %eax, %eax
callq 0x1190b0
jmp 0x27d62a
leaq 0x198(%rsp), %rdi
callq 0x119120
movq %rax, %rsi
leaq 0x20f96b(%rip), %rdi    # 0x48cfac
xorl %eax, %eax
callq 0x1190b0
jmp 0x27d64a
leaq 0x20f96b(%rip), %rdi    # 0x48cfbc
xorl %eax, %eax
callq 0x1190b0
jmp 0x27d65a
movq 0x80(%rsp), %rdi
addq $0x1fa8, %rdi           # imm = 0x1FA8
leaq 0x1c0(%rsp), %rsi
callq 0x27e450
jmp 0x27d678
movl $0x0, 0xac(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x27e4c0
leaq 0x198(%rsp), %rdi
callq 0x119968
movl 0xac(%rsp), %eax
testl %eax, %eax
jne 0x27d701
jmp 0x27d6aa
jmp 0x27d6f6
leaq 0x198(%rsp), %rdi
callq 0x119968
jmp 0x27d792
movl $0x8, %eax
cmpl 0x1bc(%rsp), %eax
je 0x27d6e9
leaq 0x20f921(%rip), %rdi    # 0x48cff4
xorl %eax, %eax
callq 0x1190b0
jmp 0x27d6dc
movl $0x1, 0xac(%rsp)
jmp 0x27d701
movl $0x2, 0xac(%rsp)
jmp 0x27d701
movl $0x0, 0xac(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x27c3f0
movl 0xac(%rsp), %eax
movl %eax, (%rsp)
testl %eax, %eax
je 0x27d72b
jmp 0x27d71e
movl (%rsp), %eax
subl $0x2, %eax
je 0x27d744
jmp 0x27d7cf
jmp 0x27d72d
leaq 0x260(%rsp), %rdi
callq 0x119270
xorb $-0x1, %al
testb $0x1, %al
jne 0x27d1ac
leaq 0x260(%rsp), %rdi
callq 0x119270
testb $0x1, %al
jne 0x27d7c4
leaq 0x88(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x119150
jmp 0x27d76c
movq 0x80(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x123fa0
jmp 0x27d783
leaq 0x88(%rsp), %rdi
callq 0x119968
jmp 0x27d7c4
leaq 0x1c0(%rsp), %rdi
callq 0x27c3f0
jmp 0x27d7e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x119968
jmp 0x27d7e4
movl $0x0, 0xac(%rsp)
leaq 0x260(%rsp), %rdi
callq 0x119968
addq $0x298, %rsp            # imm = 0x298
retq
leaq 0x260(%rsp), %rdi
callq 0x119968
movq 0x238(%rsp), %rdi
callq 0x119570
nop