// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/misc/array.cpp
// Function: smooth::IndexArray::InsertAtPos(int, int)
S::Bool S::IndexArray::InsertAtPos(Int position, Int index)
{
	WriteLock	 lock(*this);

	if (position > nOfEntries || position < 0) return False;

	if (!IndexAvailable(index)) return False;

	if (greatestIndex < index) greatestIndex = index;

	if (indices.Size() == nOfEntries) indices.Resize(8 > nOfEntries * 1.25 ? 8 : nOfEntries * 1.25);

	memmove(indices + position + 1, indices + position, (nOfEntries - position) * sizeof(Int));

	indices[position] = index;

	nOfEntries++;

	if ((position >=	      1 && indices[position - 1] > index) ||
	    (position <  nOfEntries - 1 && indices[position + 1] < index)) sorted = False;

	return True;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0x40(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x593d0
movq -0x40(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x8(%rcx), %eax
jg 0xed038
cmpl $0x0, -0x14(%rbp)
jge 0xed048
movb $0x0, -0x1(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0xed239
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x5dbf0
movb %al, -0x41(%rbp)
jmp 0xed059
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0xed08c
jmp 0xed062
movb $0x0, -0x1(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0xed239
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5a730
jmp 0xed250
movq -0x40(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x18(%rbp), %eax
jge 0xed0a2
movq -0x40(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, 0xc(%rax)
movq -0x40(%rbp), %rdi
addq $0x18, %rdi
callq 0xedbf0
movl %eax, -0x48(%rbp)
jmp 0xed0b4
movl -0x48(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0xed12d
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x18, %rcx
movq %rcx, -0x50(%rbp)
cvtsi2sdl 0x8(%rax), %xmm1
movsd 0x99f2c(%rip), %xmm0    # 0x187008
mulsd %xmm0, %xmm1
movsd 0x99f18(%rip), %xmm0    # 0x187000
ucomisd %xmm1, %xmm0
jbe 0xed0fd
movsd 0x99f0a(%rip), %xmm0    # 0x187000
movsd %xmm0, -0x58(%rbp)
jmp 0xed117
movq -0x40(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm0
movsd 0x99efa(%rip), %xmm1    # 0x187008
mulsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movsd -0x58(%rbp), %xmm0
cvttsd2si %xmm0, %esi
callq 0xedc10
jmp 0xed12b
jmp 0xed12d
movq -0x40(%rbp), %rdi
addq $0x18, %rdi
callq 0xedcf0
movq %rax, -0x60(%rbp)
jmp 0xed140
movq -0x40(%rbp), %rdi
movq -0x60(%rbp), %rax
movslq -0x14(%rbp), %rcx
leaq 0x4(%rax,%rcx,4), %rax
movq %rax, -0x70(%rbp)
addq $0x18, %rdi
callq 0xedcf0
movq %rax, -0x68(%rbp)
jmp 0xed164
movq -0x40(%rbp), %rax
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
movslq -0x14(%rbp), %rsi
movl %esi, %ecx
leaq (%rdx,%rsi,4), %rsi
movl 0x8(%rax), %eax
subl %ecx, %eax
movslq %eax, %rdx
shlq $0x2, %rdx
callq 0x59850
movq -0x40(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, -0x7c(%rbp)
addq $0x18, %rdi
movl -0x14(%rbp), %esi
callq 0xedd30
movq %rax, -0x78(%rbp)
jmp 0xed1a7
movq -0x40(%rbp), %rax
movq -0x78(%rbp), %rcx
movl -0x7c(%rbp), %edx
movl %edx, (%rcx)
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
cmpl $0x1, -0x14(%rbp)
jl 0xed1ec
movq -0x40(%rbp), %rdi
addq $0x18, %rdi
movl -0x14(%rbp), %esi
decl %esi
callq 0xedd30
movq %rax, -0x88(%rbp)
jmp 0xed1de
movq -0x88(%rbp), %rax
movl (%rax), %eax
cmpl -0x18(%rbp), %eax
jg 0xed226
movq -0x40(%rbp), %rcx
movl -0x14(%rbp), %eax
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xed22e
movq -0x40(%rbp), %rdi
addq $0x18, %rdi
movl -0x14(%rbp), %esi
incl %esi
callq 0xedd30
movq %rax, -0x90(%rbp)
jmp 0xed218
movq -0x90(%rbp), %rax
movl (%rax), %eax
cmpl -0x18(%rbp), %eax
jge 0xed22e
movq -0x40(%rbp), %rax
movb $0x0, 0x10(%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x24(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5a730
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x90, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0
nopl (%rax)