// File: /workspace/github_c_makefile_star2_O2/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 0x3092c
movq %rax, %rbx
movl (%rax), %eax
cmpl $0x5, %eax
jne 0x30d3f
movq %r15, %rdi
callq 0x3092c
movq %rax, %r14
movsbl %bpl, %ecx
leal -0x2a(%rcx), %eax
cmpl $0x5, %eax
ja 0x30df1
leaq 0x68096(%rip), %rcx     # 0x98da0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testq %r14, %r14
je 0x30e9a
cmpl $0x5, (%r14)
jne 0x30e9a
movq 0x28(%rbx), %rdi
movq 0x28(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x39d59
jmp 0x30ed4
movq 0x28(%rbx), %xmm0
cmpl $0x1, %eax
je 0x30d5c
pxor %xmm1, %xmm1
testl %eax, %eax
jne 0x30d60
movq %xmm0, %rax
cvtsi2sd %eax, %xmm1
jmp 0x30d60
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 0x30dc3
leaq 0x67feb(%rip), %rax     # 0x98d70
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 0x30ec8
cmpl $0x40, %eax
movsd 0x8(%rsp), %xmm1
je 0x30eb0
cmpl $0x5e, %eax
jne 0x30ec8
movapd %xmm1, %xmm0
movapd %xmm2, %xmm1
callq 0x42f0
movapd %xmm0, %xmm1
jmp 0x30ec8
cmpl $0x5e, %ecx
jne 0x30ed4
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x30efe
movq 0x28(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x3a2b1
jmp 0x30ed4
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x30ee2
movq 0x28(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x39c6d
jmp 0x30ed4
testq %r14, %r14
je 0x30e4d
cmpl $0x5, (%r14)
je 0x30ed4
movq 0x28(%rbx), %rbx
movq %r15, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x39a85
jmp 0x30ed4
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x30ef0
movq 0x28(%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x39b81
jmp 0x30ed4
mulsd %xmm2, %xmm1
jmp 0x30ec8
addsd %xmm2, %xmm1
jmp 0x30ec8
subsd %xmm2, %xmm1
jmp 0x30ec8
divsd %xmm2, %xmm1
jmp 0x30ec8
movq 0x28(%rbx), %rbx
movq %r15, %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x39a42
jmp 0x30ed4
movapd %xmm1, %xmm0
divsd %xmm2, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
mulsd %xmm2, %xmm0
subsd %xmm0, %xmm1
movq %rbx, %rdi
movapd %xmm1, %xmm0
callq 0x30cae
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x686cd(%rip), %rsi     # 0x995b6
pushq $0x10
popq %rdi
pushq $0x16
jmp 0x30f0a
leaq 0x686bf(%rip), %rsi     # 0x995b6
pushq $0x10
popq %rdi
pushq $0xe
jmp 0x30f0a
leaq 0x686b1(%rip), %rsi     # 0x995b6
pushq $0x10
popq %rdi
pushq $0x1c
popq %rdx
callq 0x34f59
movq %rax, %r15
movq %rax, 0x28(%rbx)
movq 0x28(%r14), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0x383f4
movq %rax, (%r15)
movq %rdx, 0x8(%r15)
jmp 0x30ed4