// File: ArashPartow[P]exprtk-extras/exprtk_degree_trigonometry_example.cpp
// Function: void exprtk_degree_trigonometry_example<double>()
void exprtk_degree_trigonometry_example()
{
   typedef exprtk::symbol_table<T>           symbol_table_t;
   typedef exprtk::expression<T>             expression_t;
   typedef exprtk::parser<T>                 parser_t;
   typedef typename parser_t::settings_store settings_t;

   sine_deg  <T> sine;
   cosine_deg<T> cosine;

   exprtk::rtl::io::package<T> io_package;

   symbol_table_t symbol_table;

   symbol_table.add_package          (io_package   );
   symbol_table.add_reserved_function("sin", sine  );
   symbol_table.add_reserved_function("cos", cosine);

   typedef typename parser_t::settings_store settings_t;

   parser_t parser;

   // Disable the ExprTk internal sine/cosine functions
   parser.settings()
      .disable_base_function(settings_t::e_bf_sin)
      .disable_base_function(settings_t::e_bf_cos);

   const std::string trigonometry_program =
      " println('sin(30) = ', sin(30)); "
      " println('cos(30) = ', cos(30)); "
      " println('sin(45) = ', sin(45)); "
      " println('cos(45) = ', cos(45)); "
      " println('sin(60) = ', sin(60)); "
      " println('cos(60) = ', cos(60)); ";

   expression_t expression;
   expression.register_symbol_table(symbol_table);

   parser.compile(trigonometry_program,expression);

   expression.value();
}

// Assembly:
subq $0xc78, %rsp            # imm = 0xC78
leaq 0xc50(%rsp), %rdi
callq 0x118f10
leaq 0xc28(%rsp), %rdi
callq 0x118f50
jmp 0x118843
leaq 0xb48(%rsp), %rdi
callq 0x118f90
jmp 0x118852
leaq 0xb40(%rsp), %rdi
movl $0x1, %esi
callq 0x1190e0
jmp 0x118866
leaq 0xb40(%rsp), %rdi
leaq 0xb48(%rsp), %rsi
callq 0x119120
jmp 0x11887d
leaq 0xb1f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x111650
movq 0x28(%rsp), %rdx
leaq 0x332b6c(%rip), %rsi    # 0x44b407
leaq 0xb20(%rsp), %rdi
callq 0x118760
jmp 0x1188aa
leaq 0xb40(%rsp), %rdi
leaq 0xb20(%rsp), %rsi
leaq 0xc50(%rsp), %rdx
callq 0x119150
jmp 0x1188c9
leaq 0xb20(%rsp), %rdi
callq 0x111798
leaq 0xb1f(%rsp), %rdi
callq 0x111780
leaq 0xaf7(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x111650
movq 0x20(%rsp), %rdx
leaq 0x332afb(%rip), %rsi    # 0x44b3fc
leaq 0xaf8(%rsp), %rdi
callq 0x118760
jmp 0x118910
leaq 0xb40(%rsp), %rdi
leaq 0xaf8(%rsp), %rsi
leaq 0xc28(%rsp), %rdx
callq 0x119150
jmp 0x11892f
leaq 0xaf8(%rsp), %rdi
callq 0x111798
leaq 0xaf7(%rsp), %rdi
callq 0x111780
leaq 0x78(%rsp), %rdi
movl $0x7f, %esi
callq 0x1191f0
jmp 0x11895a
leaq 0x1c8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x119320
jmp 0x11896e
leaq 0x78(%rsp), %rdi
callq 0x119b50
leaq 0x1c8(%rsp), %rdi
callq 0x119bc0
movq %rax, 0x18(%rsp)
jmp 0x11898c
movq 0x18(%rsp), %rdi
movl $0x2c, %esi
callq 0x119be0
movq %rax, 0x10(%rsp)
jmp 0x1189a2
movq 0x10(%rsp), %rdi
movl $0xc, %esi
callq 0x119be0
jmp 0x1189b3
leaq 0x57(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x111650
movq 0x8(%rsp), %rdx
leaq 0x332b7b(%rip), %rsi    # 0x44b549
leaq 0x58(%rsp), %rdi
callq 0x118760
jmp 0x1189da
leaq 0x57(%rsp), %rdi
callq 0x111780
leaq 0x30(%rsp), %rdi
callq 0x119c40
jmp 0x1189f0
leaq 0x30(%rsp), %rdi
leaq 0xb40(%rsp), %rsi
callq 0x119cf0
jmp 0x118a04
leaq 0x1c8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x119da0
jmp 0x118a1d
leaq 0x30(%rsp), %rdi
callq 0x11a630
jmp 0x118a29
leaq 0x30(%rsp), %rdi
callq 0x11a650
leaq 0x58(%rsp), %rdi
callq 0x111798
leaq 0x1c8(%rsp), %rdi
callq 0x11a690
leaq 0xb40(%rsp), %rdi
callq 0x11a890
leaq 0xb48(%rsp), %rdi
callq 0x11a910
leaq 0xc28(%rsp), %rdi
callq 0x11a940
leaq 0xc50(%rsp), %rdi
callq 0x11a950
addq $0xc78, %rsp            # imm = 0xC78
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
jmp 0x118c47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
jmp 0x118c3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
jmp 0x118c2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
jmp 0x118c20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
jmp 0x118b21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
leaq 0xb20(%rsp), %rdi
callq 0x111798
leaq 0xb1f(%rsp), %rdi
callq 0x111780
jmp 0x118c20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
jmp 0x118b6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
leaq 0xaf8(%rsp), %rdi
callq 0x111798
leaq 0xaf7(%rsp), %rdi
callq 0x111780
jmp 0x118c20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x119b50
jmp 0x118c20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
jmp 0x118c13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
leaq 0x57(%rsp), %rdi
callq 0x111780
jmp 0x118c13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
jmp 0x118c09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc20(%rsp)
movl %eax, 0xc1c(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x11a650
leaq 0x58(%rsp), %rdi
callq 0x111798
leaq 0x1c8(%rsp), %rdi
callq 0x11a690
leaq 0xb40(%rsp), %rdi
callq 0x11a890
leaq 0xb48(%rsp), %rdi
callq 0x11a910
leaq 0xc28(%rsp), %rdi
callq 0x11a940
leaq 0xc50(%rsp), %rdi
callq 0x11a950
movq 0xc20(%rsp), %rdi
callq 0x111450
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)