// File: /workspace/github_c_makefile_star2_O1/markpeerdeman[P]mbemm/src/general/elements.c
// Function: element_dll
element element_dll( element thedll, const int command, const int label )
{ element thecopy;
  int found=0;
  /* make a copy of the incoming element for certain commands: */
  if ( (command==APPEND)||(command==NEW) ) thecopy = newelement();
    switch(command) {
    case START:  { while(thedll->PREV!=(element)NULL) thedll=thedll->PREV;
                   thedll=thedll->NEXT;
		   return thedll;
		 }
	case END:    { while((thedll!=(element)NULL)&&
	               (thedll->NEXT!=(element)NULL)) thedll=thedll->NEXT;
		           return thedll;
		 }
    case SEARCH: { thedll=element_dll(thedll,START,0);
		   while((thedll->label!=label)&&(thedll->NEXT!=(element)NULL))
			 thedll=thedll->NEXT;
		   if (thedll->label==label) return thedll;
		   else
		   {   evaluate_level(YELLOW,71); 
		       return (element)NULL;
		   }
		 }
	case SEARCHNODE:
		 { thedll=element_dll(thedll,START,0);
		   found=0;
		   while((found==0)&&(thedll->NEXT!=(element)NULL))
			 { thedll=thedll->NEXT;
			   if (label==thedll->p1) found=1;
			   if (label==thedll->p2) found=1;
			   if (label==thedll->p3) found=1;
			 }
		   if (found==0) return (element)NULL; else return thedll;
		 }
	case APPEND: { thedll = element_dll(thedll,END,0);
		   thedll->NEXT=thecopy;
		   thecopy->NEXT=(element)NULL;
		   thecopy->PREV=thedll;
		   return thecopy;
		 }
	case NEW:    { thecopy->PREV=(element)NULL;
		   thecopy->NEXT=(element)NULL;
		   return thecopy;
		 }
	case KILL:   { thedll=element_dll(thedll,END,0);
		   while(thedll->PREV!=(element)NULL)
		   { thedll=thedll->PREV;
			 myfree(thedll->NEXT);
		   }
		   myfree(thedll);
		   return (element)NULL;
		 }
	default:     { evaluate_level(YELLOW,72);
		 }
  } /* switch */
return (element)NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %r15d
movq %rdi, %r14
leal -0x3(%r15), %ecx
cmpl $0x1, %ecx
ja 0xb84f
callq 0xb7f0
cmpl $0x6, %r15d
ja 0xb960
movl %r15d, %ecx
leaq 0x3d1d(%rip), %rdx      # 0xf580
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq %r14, %rax
movq (%r14), %r14
testq %r14, %r14
jne 0xb86c
movq 0x8(%rax), %rax
jmp 0xb971
movq %r14, %rax
movq (%r14), %r14
testq %r14, %r14
jne 0xb880
movq 0x8(%rax), %rdx
movq %rdx, %rax
movl 0x14(%rdx), %ecx
cmpl %ebx, %ecx
je 0xb971
movq 0x8(%rax), %rdx
testq %rdx, %rdx
jne 0xb88f
cmpl %ebx, %ecx
je 0xb971
movl $0x1, %edi
movl $0x47, %esi
jmp 0xb96a
movq %r14, %rax
movq (%r14), %r14
testq %r14, %r14
jne 0xb8bd
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0xb96f
cmpl %ebx, 0x20(%rax)
je 0xb971
cmpl %ebx, 0x1c(%rax)
je 0xb971
cmpl %ebx, 0x18(%rax)
jne 0xb8cc
jmp 0xb971
movq %r14, %rcx
testq %r14, %r14
je 0xb903
movq 0x8(%rcx), %r14
testq %r14, %r14
jne 0xb8f2
movq %rax, 0x8(%rcx)
movq $0x0, 0x8(%rax)
movq %rcx, (%rax)
jmp 0xb971
movq %r14, %rax
testq %r14, %r14
je 0xb971
movq 0x8(%rax), %r14
testq %r14, %r14
jne 0xb914
jmp 0xb971
movq %r14, %rbx
testq %r14, %r14
je 0xb946
movq 0x8(%rbx), %r14
testq %r14, %r14
jne 0xb927
jmp 0xb946
movq %rax, %rbx
movq 0x8(%rax), %rdi
callq 0xce88
movq (%rbx), %rax
testq %rax, %rax
jne 0xb93a
movq %rbx, %rdi
callq 0xce88
jmp 0xb96f
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0xb971
movl $0x1, %edi
movl $0x48, %esi
callq 0xbc50
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq