// File: /workspace/github_cpp_makefile_star2_O2/ArashPartow[P]exprtk/exprtk_test.cpp
// Function: bool run_test04<double>()
bool run_test04()
{
   const std::string expression_string = "clamp(-1.0,sin(2 * pi * x) + cos(y / 2 * pi),+1.0)";

   exprtk::symbol_table<T> symbol_table;
   exprtk::expression<T> expression;

   T x = T(-1000);
   T y = T(-1000);

   symbol_table.add_variable("x",x);
   symbol_table.add_variable("y",y);
   symbol_table.add_constants();

   expression.register_symbol_table(symbol_table);

   {
      exprtk::parser<T> parser;

      if (!parser.compile(expression_string,expression))
      {
         printf("run_test04() - Error: %s   Expression: %s\n",
                parser.error().c_str(),
                expression_string.c_str());

         return false;
      }
   }

   const T pi = T(3.141592653589793238462643383279502);
   const T increment = T(0.0001);

   while ((x <= T(+1000)) && (y <= T(+1000)))
   {
      T result1 = expression.value();
      T result2 = clamp<T>(-1.0,std::sin(2 * pi * x) + std::cos(y / 2 * pi),+1.0);

      if (not_equal(result1,result2))
      {
         printf("run_test04() - Computation Error:  Expression: [%s]\tExpected: %19.15f\tResult: %19.15f x:%19.15f\ty:%19.15f\n",
                expression_string.c_str(),
                static_cast<double>(result1),
                static_cast<double>(result2),
                static_cast<double>(x),
                static_cast<double>(y));

         return false;
      }

      x += increment;
      y += increment;
   }

   return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xae0, %rsp            # imm = 0xAE0
leaq 0x181c4b(%rip), %rsi    # 0x2e890a
leaq 0x48(%rsp), %rdi
leaq 0x1b8(%rsp), %rdx
callq 0x127016
leaq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x19486e
leaq 0x28(%rsp), %rdi
callq 0x194918
movabsq $-0x3f70c00000000000, %rax # imm = 0xC08F400000000000
movq %rax, 0x8(%rsp)
movq %rax, (%rsp)
leaq 0x19b5a3(%rip), %rsi    # 0x3022a5
leaq 0x1b8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x127016
leaq 0x10(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
leaq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x19666e
leaq 0x1b8(%rsp), %rdi
callq 0x118648
leaq 0x187204(%rip), %rsi    # 0x2edf45
leaq 0x1b8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x127016
leaq 0x10(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
movq %rsp, %rdx
xorl %ecx, %ecx
callq 0x19666e
leaq 0x1b8(%rsp), %rdi
callq 0x118648
leaq 0x10(%rsp), %rdi
callq 0x194892
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x194978
leaq 0x68(%rsp), %rdi
pushq $0x7f
popq %rsi
callq 0x1949d4
leaq 0x1b8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x194ae4
leaq 0x68(%rsp), %rdi
callq 0x1950fc
leaq 0x1b8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x195144
testb %al, %al
je 0x166ef0
leaq 0x1b8(%rsp), %rbx
movq %rbx, %rdi
callq 0x19561a
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
movsd 0x16740d(%rip), %xmm2   # 0x2ce208
movabsq $0x3ddb7cdfd9d7bdbb, %r12 # imm = 0x3DDB7CDFD9D7BDBB
leaq 0x68(%rsp), %r14
leaq 0x20(%rsp), %r15
ucomisd %xmm0, %xmm2
movb $0x1, %bpl
jb 0x166f65
ucomisd %xmm1, %xmm2
jb 0x166f65
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movsd %xmm0, 0x1b8(%rsp)
movsd 0x8(%rsp), %xmm0
mulsd 0x1673c4(%rip), %xmm0   # 0x2ce210
callq 0x1181c0
movsd %xmm0, 0x18(%rsp)
movsd (%rsp), %xmm0
mulsd 0x1673b4(%rip), %xmm0   # 0x2ce218
mulsd 0x1673b4(%rip), %xmm0   # 0x2ce220
callq 0x118500
addsd 0x18(%rsp), %xmm0
movsd 0x167341(%rip), %xmm1   # 0x2ce1c0
minsd %xmm0, %xmm1
movsd 0x16739d(%rip), %xmm3   # 0x2ce228
cmpltsd %xmm3, %xmm0
movapd %xmm0, %xmm2
andnpd %xmm1, %xmm2
andpd %xmm3, %xmm0
orpd %xmm2, %xmm0
movlpd %xmm0, 0x68(%rsp)
movq %r12, 0x20(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2ba163
testb %al, %al
jne 0x166f36
movsd 0x8(%rsp), %xmm0
movsd 0x167365(%rip), %xmm2   # 0x2ce230
addsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd (%rsp), %xmm1
addsd %xmm2, %xmm1
movsd %xmm1, (%rsp)
movsd 0x16731d(%rip), %xmm2   # 0x2ce208
jmp 0x166e0f
leaq 0x68(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x1955c6
leaq 0x68(%rsp), %rbx
movq (%rbx), %rsi
movq 0x48(%rsp), %rdx
leaq 0x181a27(%rip), %rdi    # 0x2e893d
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x118080
movq %rbx, %rdi
callq 0x118648
leaq 0x1b8(%rsp), %rdi
callq 0x19561a
jmp 0x166f65
movq 0x48(%rsp), %rsi
movsd 0x1b8(%rsp), %xmm0
movsd 0x68(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movsd (%rsp), %xmm3
leaq 0x181a0c(%rip), %rdi    # 0x2e8968
movb $0x4, %al
callq 0x118080
xorl %ebp, %ebp
leaq 0x28(%rsp), %rdi
callq 0x19577a
leaq 0x10(%rsp), %rdi
callq 0x195790
leaq 0x48(%rsp), %rdi
callq 0x118648
movl %ebp, %eax
addq $0xae0, %rsp            # imm = 0xAE0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x166f97
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0x19561a
jmp 0x166fe1
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x1950fc
jmp 0x166fe1
jmp 0x166fde
jmp 0x166fbe
jmp 0x166fde
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0x118648
jmp 0x166fe1
jmp 0x166fde
movq %rax, %rbx
jmp 0x166feb
movq %rax, %rbx
jmp 0x166ff5
jmp 0x166fde
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x19577a
leaq 0x10(%rsp), %rdi
callq 0x195790
leaq 0x48(%rsp), %rdi
callq 0x118648
movq %rbx, %rdi
callq 0x118360