// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/poly.c
// Function: create_function
Function create_function(char* st)
{
	/*!Last Changed 19.01.2005*/
	Function tmp;
	Functionnodeptr tmpnode;
	char* functionp, *minp, *maxp, **tokens;
 char* parts[6];
	int i, tokencount, j;
	tmp.min = 0;
	tmp.max = -1;
	functionp = strtok(st, " \n");
	if (!functionp)
		 return tmp;
 minp = strtok(NULL, " \n");
	if (!minp)
		 return tmp;
 maxp = strtok(NULL, " \n");
	if (!maxp)
		 return tmp;
	tmp.min = atof(minp);
	tmp.max = atof(maxp);
	if (tmp.min > tmp.max)
		 return tmp;
	tmp.start = NULL;
	tmp.end = NULL;
	tokens = plus_minus_token_list(functionp, &tokencount);
	for (j = 0; j < tokencount; j++)
	 {
		 tmpnode = safemalloc(sizeof(Functionnode), "create_function", 26);
			tmpnode->next = NULL;
   divide_function_into_parts(tokens[j], parts);
			if (parts[0])
				 tmpnode->coefficient = atof(parts[0]);
			else
			  tmpnode->coefficient = 1;
			if (parts[1]) 
				 tmpnode->xpower = atoi(parts[1]);
			else
				 tmpnode->xpower = 0;
			if (parts[2])
			 {
				 tmpnode->sinpower = atoi(parts[2]);
					if (parts[3])
						 tmpnode->sinus = read_polynom(parts[3]);
					else
					  tmpnode->sinus = NULL;
			 }
			else
				 tmpnode->sinpower = 0;
			if (parts[4])
			 {
				 tmpnode->cospower = atoi(parts[4]);
					if (parts[5])
						 tmpnode->cosinus = read_polynom(parts[5]);
					else
					  tmpnode->cosinus = NULL;
			 }
			else
				 tmpnode->cospower = 0;
			for (i = 0; i < 6; i++)
				 if (parts[i])
						 safe_free(parts[i]);
			if (tmp.end)
			 {
				 tmp.end->next = tmpnode;
					tmp.end = tmpnode;
			 }
			else
			 {
				 tmp.start = tmpnode;
					tmp.end = tmpnode;
			 }
	 }
	free_2d((void**)tokens, tokencount);
	return tmp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movhpd 0x42ed4(%rip), %xmm0    # xmm0 = xmm0[0],mem[0]
movupd %xmm0, 0x10(%rdi)
leaq 0x4e2c0(%rip), %rsi     # 0xa11a8
movq %rax, %rdi
callq 0x4280
testq %rax, %rax
je 0x52f4e
movq %rax, %r14
leaq 0x4e2a9(%rip), %rsi     # 0xa11a8
xorl %edi, %edi
callq 0x4280
testq %rax, %rax
je 0x52f4e
movq %rax, %r15
leaq 0x4e293(%rip), %rsi     # 0xa11a8
xorl %edi, %edi
callq 0x4280
testq %rax, %rax
je 0x52f4e
movq %rax, %r12
movq %r15, %rdi
callq 0x4130
movsd %xmm0, (%rsp)
movsd %xmm0, 0x10(%rbx)
movq %r12, %rdi
callq 0x4130
movsd %xmm0, 0x18(%rbx)
movsd (%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x52f60
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, 0x10(%rsp)
leaq 0x1c(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x52c9b
movl (%r15), %ecx
xorl %r12d, %r12d
testl %ecx, %ecx
movl $0x0, %r13d
movl %ecx, 0xc(%rsp)
cmovgl %ecx, %r13d
movq %rax, (%rsp)
xorl %ebp, %ebp
xorl %ebx, %ebx
cmpq %r13, %r12
je 0x5309d
pushq $0x30
popq %rdi
leaq 0x47d6c(%rip), %rsi     # 0x9ad12
pushq $0x1a
popq %rdx
callq 0x34f59
movq %rax, %r15
andq $0x0, 0x28(%rax)
movq (%rsp), %rax
movq (%rax,%r12,8), %rdi
leaq 0x20(%rsp), %rsi
callq 0x52a3b
movq 0x20(%rsp), %rdi
movsd 0x4254b(%rip), %xmm0    # 0x95520
testq %rdi, %rdi
je 0x52fdf
callq 0x4130
movsd %xmm0, (%r15)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x52ff5
callq 0x4200
jmp 0x52ff7
xorl %eax, %eax
movl %eax, 0x8(%r15)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x53023
callq 0x4200
movl %eax, 0xc(%r15)
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x5302a
callq 0x530be
movq %rax, 0x10(%r15)
jmp 0x5302f
andl $0x0, 0xc(%r15)
jmp 0x5302f
andq $0x0, 0x10(%r15)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x53057
callq 0x4200
movl %eax, 0x18(%r15)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x5305e
callq 0x530be
movq %rax, 0x20(%r15)
jmp 0x53063
andl $0x0, 0x18(%r15)
jmp 0x53063
andq $0x0, 0x20(%r15)
xorl %r14d, %r14d
cmpq $0x6, %r14
je 0x53080
movq 0x20(%rsp,%r14,8), %rdi
testq %rdi, %rdi
je 0x5307b
callq 0x34ff7
incq %r14
jmp 0x53066
movq %r15, %rax
testq %rbx, %rbx
je 0x5308f
movq %r15, 0x28(%rbx)
movq %rbp, %rax
incq %r12
movq %rax, %rbp
movq %r15, %rbx
jmp 0x52f93
movq 0x10(%rsp), %r14
movq %rbx, 0x8(%r14)
movq %rbp, (%r14)
movq (%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x34fc3
movq %r14, %rax
jmp 0x52f51