// File: /workspace/github_c_makefile_star2_O3/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 0x4acff(%rip), %xmm0    # xmm0 = xmm0[0],mem[0]
movupd %xmm0, 0x10(%rdi)
leaq 0x5618f(%rip), %rsi     # 0xb1244
movq %rax, %rdi
callq 0x4280
testq %rax, %rax
je 0x5b28c
movq %rax, %r14
leaq 0x56174(%rip), %rsi     # 0xb1244
xorl %edi, %edi
callq 0x4280
testq %rax, %rax
je 0x5b28c
movq %rax, %r15
leaq 0x5615a(%rip), %rsi     # 0xb1244
xorl %edi, %edi
callq 0x4280
testq %rax, %rax
je 0x5b28c
movq %rax, %r12
movq %r15, %rdi
callq 0x4130
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x10(%rbx)
movq %r12, %rdi
callq 0x4130
movsd %xmm0, 0x18(%rbx)
movsd 0x8(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x5b28c
movq %rbx, 0x10(%rsp)
leaq 0x1c(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x5ae7c
movq %rax, 0x8(%rsp)
movslq (%r15), %r15
testq %r15, %r15
jle 0x5b26f
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %r14d, %r14d
movl $0x30, %edi
leaq 0x4fc7a(%rip), %rsi     # 0xaade2
movl $0x1a, %edx
callq 0x3a0e1
movq %rax, %rbp
movq $0x0, 0x28(%rax)
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdi
leaq 0x20(%rsp), %rsi
callq 0x5ac55
movq 0x20(%rsp), %rdi
movsd 0x4a383(%rip), %xmm0    # 0xa5520
testq %rdi, %rdi
je 0x5b1a7
callq 0x4130
movsd %xmm0, (%rbp)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x5b1bd
callq 0x4200
jmp 0x5b1bf
xorl %eax, %eax
movl %eax, 0x8(%rbp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5b1e9
callq 0x4200
movl %eax, 0xc(%rbp)
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x5b1f2
callq 0x5b29e
movq %rax, 0x10(%rbp)
jmp 0x5b1fa
movl $0x0, 0xc(%rbp)
jmp 0x5b1fa
movq $0x0, 0x10(%rbp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x5b221
callq 0x4200
movl %eax, 0x18(%rbp)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x5b22a
callq 0x5b29e
movq %rax, 0x20(%rbp)
jmp 0x5b232
movl $0x0, 0x18(%rbp)
jmp 0x5b232
movq $0x0, 0x20(%rbp)
xorl %ebx, %ebx
movq 0x20(%rsp,%rbx,8), %rdi
testq %rdi, %rdi
je 0x5b243
callq 0x3a180
incq %rbx
cmpq $0x6, %rbx
jne 0x5b234
movq %rbp, %rax
testq %r13, %r13
je 0x5b25b
movq %rbp, 0x28(%r13)
movq %r14, %rax
incq %r12
movq %rbp, %r13
movq %rax, %r14
cmpq %r15, %r12
jne 0x5b15c
jmp 0x5b273
xorl %eax, %eax
xorl %ebp, %ebp
movq 0x10(%rsp), %rbx
movq %rbp, 0x8(%rbx)
movq %rax, (%rbx)
movq 0x8(%rsp), %rdi
movl %r15d, %esi
callq 0x3a14b
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq