// File: lluchs[P]sparsearray/./sparsearray.h
// Function: LinkedListSA<C4PXS, 10000ul>::Delete(C4PXS*)
void Delete(T *dataEl)
	{
		ListElement *el = reinterpret_cast<ListElement*>(dataEl);
		assert(el >= &array[0] && el < &array[N]);
		assert(el->used);
		el->used = false;

		ListElement *next = el->next;
		bool lookingForUsed = false, lookingForFree = !!firstFree;
		if (el == firstUsed)
			firstUsed = next;
		else
			lookingForUsed = true;

		ListElement *prevEl = el;
		while (--prevEl >= array && (lookingForUsed || lookingForFree))
		{
			if (lookingForUsed && prevEl->used)
			{
				prevEl->next = next;
				lookingForUsed = false;
			}
			if (lookingForFree && !prevEl->used)
			{
				el->next = prevEl->next;
				prevEl->next = el;
				lookingForFree = false;
			}
		}

		if (!!firstFree == lookingForFree)
		{
			if (firstFree)
				el->next = firstFree;
			else
				el->next = nullptr;
			firstFree = el;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdx
movq %rdx, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x31(%rbp)
jb 0x6526
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
addq $0x61a80, %rcx          # imm = 0x61A80
cmpq %rcx, %rax
setb %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x652f
jmp 0x6531
jmp 0x6550
leaq 0x2e40(%rip), %rdi      # 0x9378
leaq 0x2bb5(%rip), %rsi      # 0x90f4
movl $0x175, %edx            # imm = 0x175
leaq 0x2e4f(%rip), %rcx      # 0x939a
callq 0x20c0
movq -0x18(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x655c
jmp 0x657b
leaq 0x2e7b(%rip), %rdi      # 0x93de
leaq 0x2b8a(%rip), %rsi      # 0x90f4
movl $0x176, %edx            # imm = 0x176
leaq 0x2e24(%rip), %rcx      # 0x939a
callq 0x20c0
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movb $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
cmpq $0x0, 0x61a88(%rcx)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x22(%rbp)
movq -0x18(%rbp), %rax
cmpq 0x61a80(%rcx), %rax
jne 0x65c9
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, 0x61a80(%rax)
jmp 0x65cd
movb $0x1, -0x21(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rdx
movq -0x30(%rbp), %rcx
addq $-0x28, %rcx
movq %rcx, -0x30(%rbp)
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x41(%rbp)
jb 0x6606
movb $0x1, %al
testb $0x1, -0x21(%rbp)
movb %al, -0x42(%rbp)
jne 0x6600
movb -0x22(%rbp), %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x660f
jmp 0x6664
testb $0x1, -0x21(%rbp)
je 0x662f
movq -0x30(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x662f
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movb $0x0, -0x21(%rbp)
testb $0x1, -0x22(%rbp)
je 0x665f
movq -0x30(%rbp), %rax
testb $0x1, 0x20(%rax)
jne 0x665f
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movb $0x0, -0x22(%rbp)
jmp 0x65d5
movq -0x40(%rbp), %rax
cmpq $0x0, 0x61a88(%rax)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movb -0x22(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x66c7
movq -0x40(%rbp), %rax
cmpq $0x0, 0x61a88(%rax)
je 0x66ac
movq -0x40(%rbp), %rax
movq 0x61a88(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x66b8
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, 0x61a88(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)