// File: fatiiates[P]CDLL-with-cpp-make-gcc/./src/CircularDoublyLinkedList.cpp
// Function: CircularDoublyLinkedList::insert(int, unsigned char const&)
void CircularDoublyLinkedList::insert(int index, const unsigned char& item){
      if(index < 0  || index > size){
        throw invalid_argument("Index 0'dan kucuk veya eleman sayisindan buyuk olamaz.  Error Code: 103");
      }else{
        if(index == 0){
          if(isEmpty()){
            head = new Node(item);
            head->next = head;
            head->prev = head;
          }
          else{
            head = new Node(item, head, head->prev);
            head->prev->next = head;
            head->next->prev = head;
          }
        }else{
          Node* preNodeIndex = FindPreNode(index);
          preNodeIndex->next = new Node(item, preNodeIndex->next, preNodeIndex);
          preNodeIndex->next->next->prev = preNodeIndex->next;
        }
        size++;
      }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, -0xc(%rbp)
jl 0x2b6d
movq -0x38(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x8(%rcx), %eax
jle 0x2bc0
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
leaq 0x2574(%rip), %rsi      # 0x50fc
callq 0x2310
jmp 0x2b8f
movq -0x40(%rbp), %rdi
movq 0x543e(%rip), %rsi      # 0x7fd8
movq 0x5427(%rip), %rdx      # 0x7fc8
callq 0x22a0
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x2110
jmp 0x2d42
cmpl $0x0, -0xc(%rbp)
jne 0x2cb6
movq -0x38(%rbp), %rdi
callq 0x2a60
testb $0x1, %al
jne 0x2bd9
jmp 0x2c42
movl $0x18, %edi
callq 0x2170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x28f0
jmp 0x2bff
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, (%rax)
movq (%rax), %rdx
movq (%rax), %rcx
movq %rdx, 0x8(%rcx)
movq (%rax), %rcx
movq (%rax), %rax
movq %rcx, 0x10(%rax)
jmp 0x2cb4
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x18, %esi
callq 0x2180
jmp 0x2d42
movl $0x18, %edi
callq 0x2170
movq %rax, %rdi
movq -0x38(%rbp), %rax
movq %rdi, %rcx
movq %rcx, -0x50(%rbp)
movq -0x18(%rbp), %rsi
movq (%rax), %rdx
movq 0x10(%rdx), %rcx
callq 0x28f0
jmp 0x2c6c
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, (%rax)
movq (%rax), %rdx
movq (%rax), %rcx
movq 0x10(%rcx), %rcx
movq %rdx, 0x8(%rcx)
movq (%rax), %rcx
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x10(%rax)
jmp 0x2cb4
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x18, %esi
callq 0x2180
jmp 0x2d42
jmp 0x2d2f
movq -0x38(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x2930
movq %rax, -0x30(%rbp)
movl $0x18, %edi
callq 0x2170
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rdx
callq 0x28f0
jmp 0x2ced
movq -0x58(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x10(%rax)
jmp 0x2d2f
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x18, %esi
callq 0x2180
jmp 0x2d42
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
addq $0x60, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x22c0
nopl (%rax,%rax)