// File: fatiiates[P]CDLL-with-cpp-make-gcc/./src/CircularDoublyLinkedList.cpp
// Function: CircularDoublyLinkedList::removeAt(int)
void CircularDoublyLinkedList::removeAt(int index){

      if(isEmpty()){
        throw invalid_argument("Listede hic eleman bulunmuyor. Error Code: 105");
      }else{
        if(index < 0  || index >= size){
          throw invalid_argument("Index 0'dan kucuk, eleman sayisina esit veya buyuk olamaz. Error Code: 106");
        }else{
          Node* del;

          if(index == 0){
            del = head;

            if(size == 1){
              head = head->next = head->prev = NULL;
            }else{
              head = head->next;
              head->prev = del->prev;
              del->prev->next = head;
            }
          }else{
            Node* preNodeIndex = FindPreNode(index);
            del = preNodeIndex->next;
            preNodeIndex->next = del->next;
            del->next->prev = preNodeIndex;
          }

          delete del;
          size--;
        }
      }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
callq 0x2a60
testb $0x1, %al
jne 0x2e82
jmp 0x2ed5
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
leaq 0x22d1(%rip), %rsi      # 0x516e
callq 0x2310
jmp 0x2ea4
movq -0x40(%rbp), %rdi
movq 0x5129(%rip), %rsi      # 0x7fd8
movq 0x5112(%rip), %rdx      # 0x7fc8
callq 0x22a0
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x2110
jmp 0x300f
cmpl $0x0, -0xc(%rbp)
jl 0x2ee7
movq -0x38(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x8(%rcx), %eax
jl 0x2f3a
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
leaq 0x229b(%rip), %rsi      # 0x519d
callq 0x2310
jmp 0x2f09
movq -0x48(%rbp), %rdi
movq 0x50c4(%rip), %rsi      # 0x7fd8
movq 0x50ad(%rip), %rdx      # 0x7fc8
callq 0x22a0
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x2110
jmp 0x300f
cmpl $0x0, -0xc(%rbp)
jne 0x2fa2
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x28(%rbp)
cmpl $0x1, 0x8(%rax)
jne 0x2f74
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq $0x0, 0x10(%rcx)
movq (%rax), %rcx
movq $0x0, 0x8(%rcx)
movq $0x0, (%rax)
jmp 0x2fa0
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq 0x8(%rcx), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rdx
movq (%rax), %rcx
movq %rdx, 0x10(%rcx)
movq (%rax), %rcx
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x2fde
movq -0x38(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x2930
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x2ffa
movq -0x50(%rbp), %rdi
movl $0x18, %esi
callq 0x2180
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x3009
addq $0x50, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x22c0
nopl (%rax,%rax)