// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/lang.c
// Function: make_operation
BOOLEAN make_operation(char op, char* name, char* value)
{
	/*!Last Changed 23.12.2006 added matrix operations*/
 /*!Last Changed 03.01.2006*/
 /*!Last Changed 02.05.2002*/
 double value1, value2;
	variableptr myvar, myvar2;
	myvar = get_variable(name);
	if (myvar->type == MATRIX_TYPE)
	 {
		 myvar2 = get_variable(value);
			switch (op)
			 {
			  case '+':if (myvar->value.matrixvalue)
                matrix_add(myvar->value.matrixvalue, *(myvar2->value.matrixvalue));
              else
               {
                myvar->value.matrixvalue = safemalloc(sizeof(matrix), "make_operation", 14);
                *(myvar->value.matrixvalue) = matrix_copy(*(myvar2->value.matrixvalue));
               }
						        break;
					case '-':if (myvar->value.matrixvalue)
                matrix_subtract(myvar->value.matrixvalue, *(myvar2->value.matrixvalue));
              else
               {
                myvar->value.matrixvalue = safemalloc(sizeof(matrix), "make_operation", 22);
                *(myvar->value.matrixvalue) = matrix_copy(*(myvar2->value.matrixvalue));
               }
						        break;
					case '*':if (myvar2 && myvar2->type == MATRIX_TYPE)
  						        matrix_product(myvar->value.matrixvalue, *(myvar2->value.matrixvalue));
						        else
															 matrix_multiply_constant(myvar->value.matrixvalue, atof(value));
						        break;
					case '/':if (myvar2 && myvar2->type == MATRIX_TYPE)
															 ;
						        else
															 matrix_divide_constant(myvar->value.matrixvalue, atof(value));
														break;
					case '^':if (myvar->value.matrixvalue)
                matrix_columnwise_merge(myvar->value.matrixvalue, *(myvar2->value.matrixvalue));
              else
               {
                myvar->value.matrixvalue = safemalloc(sizeof(matrix), "make_operation", 28);
                *(myvar->value.matrixvalue) = matrix_copy(*(myvar2->value.matrixvalue));
               }
						        break;
			 }
	 }
	else
	 {
   value1 = get_value(*myvar);
   value2 = atof(value);
   switch (op)
			 {
     case '+':value1 += value2;
              break;
     case '-':value1 -= value2;
              break;
     case '*':value1 *= value2;
              break;
     case '/':value1 /= value2;
              break;
     case '^':value1 = pow(value1, value2);
              break;
     case '$':value1 = log(value1)/log(value2);
              break;
     case '@':value1 = value1 - value2 * ((int)(value1 / value2));
              break;
			 }
	  set_value(myvar, value1);
	 }
 return BOOLEAN_TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movl %edi, %ebp
movq %rsi, %rdi
callq 0x3440c
movq %rax, %rbx
movl (%rax), %eax
cmpl $0x5, %eax
jne 0x3483d
movq %r15, %rdi
callq 0x3440c
movq %rax, %r14
movsbl %bpl, %ecx
leal -0x2a(%rcx), %eax
cmpl $0x5, %eax
ja 0x348f2
leaq 0x715f8(%rip), %rcx     # 0xa5e00
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testq %r14, %r14
je 0x349a1
cmpl $0x5, (%r14)
jne 0x349a1
movq 0x28(%rbx), %rdi
movq 0x28(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x3e83e
jmp 0x34a47
movq 0x28(%rbx), %xmm0
cmpl $0x1, %eax
je 0x3485d
pxor %xmm1, %xmm1
testl %eax, %eax
jne 0x34861
movq %xmm0, %rax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
jmp 0x34861
movdqa %xmm0, %xmm1
movq %xmm1, 0x8(%rsp)
movq %r15, %rdi
callq 0x4130
movdqa %xmm0, %xmm2
movsbl %bpl, %eax
leal -0x24(%rax), %ecx
cmpl $0xb, %ecx
ja 0x348c4
leaq 0x7154a(%rip), %rax     # 0xa5dd0
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
movsd 0x8(%rsp), %xmm1
jmpq *%rcx
movapd %xmm1, %xmm0
movsd %xmm2, 0x10(%rsp)
callq 0x4160
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x4160
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
jmp 0x349d2
cmpl $0x40, %eax
movsd 0x8(%rsp), %xmm1
je 0x349ba
cmpl $0x5e, %eax
jne 0x349d2
movapd %xmm1, %xmm0
movapd %xmm2, %xmm1
callq 0x42f0
movapd %xmm0, %xmm1
jmp 0x349d2
cmpl $0x5e, %ecx
jne 0x34a47
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x34a13
movq 0x28(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x3ee2c
jmp 0x34a47
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x349ed
movq 0x28(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x3e745
jmp 0x34a47
testq %r14, %r14
je 0x3494e
cmpl $0x5, (%r14)
je 0x34a47
movq 0x28(%rbx), %rbx
movq %r15, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x3e54a
jmp 0x34a47
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x34a00
movq 0x28(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x3e64c
jmp 0x34a47
mulsd %xmm2, %xmm1
jmp 0x349d2
addsd %xmm2, %xmm1
jmp 0x349d2
subsd %xmm2, %xmm1
jmp 0x349d2
divsd %xmm2, %xmm1
jmp 0x349d2
movq 0x28(%rbx), %rbx
movq %r15, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x3e50d
jmp 0x34a47
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
movl (%rbx), %eax
cmpl $0x1, %eax
je 0x349e6
testl %eax, %eax
jne 0x34a47
cvttsd2si %xmm1, %eax
movl %eax, 0x28(%rbx)
jmp 0x34a47
movsd %xmm1, 0x28(%rbx)
jmp 0x34a47
leaq 0x71c24(%rip), %rsi     # 0xa6618
movl $0x10, %edi
movl $0x16, %edx
jmp 0x34a24
leaq 0x71c11(%rip), %rsi     # 0xa6618
movl $0x10, %edi
movl $0xe, %edx
jmp 0x34a24
leaq 0x71bfe(%rip), %rsi     # 0xa6618
movl $0x10, %edi
movl $0x1c, %edx
callq 0x390f5
movq %rax, %r15
movq %rax, 0x28(%rbx)
movq 0x28(%r14), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x3ca3c
movq %rax, (%r15)
movq %rdx, 0x8(%r15)
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq