// File: /workspace/github_c_makefile_star2_O1/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
movq $0x0, 0x10(%rdi)
movabsq $-0x4010000000000000, %rcx # imm = 0xBFF0000000000000
movq %rcx, 0x18(%rdi)
leaq 0x54673(%rip), %rsi     # 0xae1ac
movq %rax, %rdi
callq 0x4280
testq %rax, %rax
je 0x59d18
movq %rax, %r14
leaq 0x54658(%rip), %rsi     # 0xae1ac
xorl %edi, %edi
callq 0x4280
testq %rax, %rax
je 0x59d18
movq %rax, %r15
leaq 0x5463e(%rip), %rsi     # 0xae1ac
xorl %edi, %edi
callq 0x4280
testq %rax, %rax
je 0x59d18
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 0x59d18
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
leaq 0x1c(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x598eb
movq %rax, 0x8(%rsp)
movslq (%r15), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
jle 0x59cfe
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %r14d, %r14d
movl $0x30, %edi
leaq 0x4e13e(%rip), %rsi     # 0xa7d32
movl $0x1a, %edx
callq 0x390f5
movq %rax, %rbp
movq $0x0, 0x28(%rax)
movq 0x8(%rsp), %rax
movq (%rax,%r12,8), %rdi
leaq 0x20(%rsp), %rsi
callq 0x596b2
movq 0x20(%rsp), %rdi
movsd 0x488f7(%rip), %xmm0    # 0xa2520
testq %rdi, %rdi
je 0x59c33
callq 0x4130
movsd %xmm0, (%rbp)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x59c49
callq 0x4200
jmp 0x59c4b
xorl %eax, %eax
movl %eax, 0x8(%rbp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x59c75
callq 0x4200
movl %eax, 0xc(%rbp)
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x59c7e
callq 0x59d2a
movq %rax, 0x10(%rbp)
jmp 0x59c86
movl $0x0, 0xc(%rbp)
jmp 0x59c86
movq $0x0, 0x10(%rbp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x59cad
callq 0x4200
movl %eax, 0x18(%rbp)
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x59cb6
callq 0x59d2a
movq %rax, 0x20(%rbp)
jmp 0x59cbe
movl $0x0, 0x18(%rbp)
jmp 0x59cbe
movq $0x0, 0x20(%rbp)
xorl %r15d, %r15d
movq 0x20(%rsp,%r15,8), %rdi
testq %rdi, %rdi
je 0x59cd0
callq 0x39194
incq %r15
cmpq $0x6, %r15
jne 0x59cc1
movq %rbp, %rax
testq %r13, %r13
je 0x59ce8
movq %rbp, 0x28(%r13)
movq %r14, %rax
incq %r12
movq %rbp, %r13
movq %rax, %r14
cmpq 0x10(%rsp), %r12
jne 0x59be8
jmp 0x59d02
xorl %eax, %eax
xorl %ebp, %ebp
movq %rbp, 0x8(%rbx)
movq %rax, (%rbx)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x3915f
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq