// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/lang.c
// Function: evaluate_operation
Expnodeptr evaluate_operation(Expnodeptr operand1, Expnodeptr operand2, int optype)
{
 /*!Last Changed 12.08.2010*/
 double value1, value2, result;
 Expnodeptr tmp;
 tmp = safemalloc(sizeof(Expnode), "evaluate_operation", 3);
 switch (operand1->type)
  {
   case INTEGER_TYPE:value1 = operand1->value.intvalue;
                     break;
   case REAL_TYPE   :value1 = operand1->value.floatvalue;
                     break;
   default          :value1 = 1.0;
                     break;
  }
 switch (operand2->type)
  {
   case INTEGER_TYPE:value2 = operand2->value.intvalue;
                     break;
   case REAL_TYPE   :value2 = operand2->value.floatvalue;
                     break;
   default          :value2 = 1.0;
                     break;
  }
 if (operand1->type == INTEGER_TYPE && operand2->type == INTEGER_TYPE)
   tmp->type = INTEGER_TYPE;
 else 
   tmp->type = REAL_TYPE;
 switch (optype)
  {
   case 0:result = value1 + value2;
          break;
   case 1:result = value1 - value2;
          break;
   case 2:result = value1 * value2;
          break;
   case 3:result = value1 / value2;
          tmp->type = REAL_TYPE;
          break;
   case 4:result = pow(value1, value2);
          break;
   case 5:result = log(value2) / log(value1);
          tmp->type = REAL_TYPE;
          break;
   case 6:result = value1 - value2 * ((int)(value1 / value2));
          break;
  }
 if (tmp->type == INTEGER_TYPE)
   tmp->value.intvalue = (int)result;
 else 
  tmp->value.floatvalue = result;
 return tmp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
leaq 0x98e65(%rip), %rsi     # 0xe62bf
movl $0x20, %edi
movl $0x3, %edx
callq 0x52d70
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x3c(%rbp)
testl %eax, %eax
je 0x4d487
jmp 0x4d47d
movl -0x3c(%rbp), %eax
subl $0x1, %eax
je 0x4d497
jmp 0x4d4a7
movq -0x8(%rbp), %rax
cvtsi2sdl 0x10(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0x4d4b4
movq -0x8(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
jmp 0x4d4b4
movsd 0x94b69(%rip), %xmm0    # 0xe2018
movsd %xmm0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x40(%rbp)
testl %eax, %eax
je 0x4d4ce
jmp 0x4d4c4
movl -0x40(%rbp), %eax
subl $0x1, %eax
je 0x4d4de
jmp 0x4d4ee
movq -0x10(%rbp), %rax
cvtsi2sdl 0x10(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x4d4fb
movq -0x10(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
jmp 0x4d4fb
movsd 0x94b22(%rip), %xmm0    # 0xe2018
movsd %xmm0, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x4d51c
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x4d51c
movq -0x38(%rbp), %rax
movl $0x0, 0x8(%rax)
jmp 0x4d527
movq -0x38(%rbp), %rax
movl $0x1, 0x8(%rax)
movl -0x14(%rbp), %eax
movq %rax, -0x48(%rbp)
subq $0x6, %rax
ja 0x4d634
movq -0x48(%rbp), %rax
leaq 0x9852d(%rip), %rcx     # 0xe5a70
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsd -0x20(%rbp), %xmm0
addsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x4d634
movsd -0x20(%rbp), %xmm0
subsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x4d634
movsd -0x20(%rbp), %xmm0
mulsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0x4d634
movsd -0x20(%rbp), %xmm0
divsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x38(%rbp), %rax
movl $0x1, 0x8(%rax)
jmp 0x4d634
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
callq 0x4290
movsd %xmm0, -0x30(%rbp)
jmp 0x4d634
movsd -0x28(%rbp), %xmm0
callq 0x4120
movsd %xmm0, -0x50(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x4120
movaps %xmm0, %xmm1
movsd -0x50(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x38(%rbp), %rax
movl $0x1, 0x8(%rax)
jmp 0x4d634
movsd -0x20(%rbp), %xmm1
movsd -0x28(%rbp), %xmm0
movsd -0x20(%rbp), %xmm2
divsd -0x28(%rbp), %xmm2
cvttsd2si %xmm2, %eax
cvtsi2sd %eax, %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x4d64c
cvttsd2si -0x30(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x4d65a
movsd -0x30(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x10(%rax)
movq -0x38(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)