// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
leal -0x3(%r15), %eax
cmpl $0x1, %eax
ja 0xad65
callq 0xad08
movq %rax, %rbx
cmpl $0x6, %r15d
ja 0xadf7
movl %r15d, %eax
leaq 0x37d7(%rip), %rcx      # 0xe550
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rax
movq (%r14), %r14
testq %r14, %r14
jne 0xad82
movq 0x8(%rax), %rbx
jmp 0xae31
testq %r14, %r14
je 0xae2f
movq %r14, %rbx
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0xad96
jmp 0xae31
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0xae31
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xad45
movq %rax, %rbx
cmpl %ebp, 0x14(%rbx)
je 0xae31
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0xadc7
pushq $0x1
popq %rdi
pushq $0x47
jmp 0xadfc
pushq $0x1
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0xad45
movq %rbx, 0x8(%rax)
andq $0x0, 0x8(%rbx)
movq %rax, (%rbx)
jmp 0xae31
pushq $0x1
popq %rdi
pushq $0x48
popq %rsi
callq 0xb0f8
jmp 0xae2f
pushq $0x1
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0xad45
movq (%rax), %rbx
testq %rbx, %rbx
je 0xae27
movq 0x8(%rbx), %rdi
callq 0xc09f
movq %rbx, %rax
jmp 0xae11
movq %rax, %rdi
callq 0xc09f
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xad45
movq %rax, %rbx
xorl %eax, %eax
testl %eax, %eax
jne 0xae31
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0xae2f
cmpl %ebp, 0x18(%rbx)
sete %al
cmpl %ebp, 0x1c(%rbx)
sete %cl
cmpl %ebp, 0x20(%rbx)
sete %dl
orb %cl, %dl
orb %al, %dl
movzbl %dl, %eax
jmp 0xae50