// File: DimitriDaSilva[P]42_ft_containers/containers/vector.hpp
// Function: ft::vector<int, std::allocator<int>>::insert(ft::random_access_iterator<int>, unsigned long, int const&)
void
		insert(iterator position, size_type n, const value_type& val)
		{
			value_type*	new_vec;
			size_type	new_size = _size + n;
			size_type	new_capacity;
			iterator 	it_old;
			iterator 	it_new;
			int 		i;

			// New element requires reallocation because vector is full
			if (new_size > _capacity)
			{
				new_capacity = get_new_capacity(new_size);

				// Reallocate new
				new_vec = _allocator.allocate(new_capacity);

				// Copy sequence to new array
				it_old = begin();
				it_new = new_vec;
				i = n;
				while (it_old != end() || i > 0)
				{
					// Position found
					if (it_old == position)
					{
						while (i--)
							_allocator.construct(&*it_new++, val);
					}

					// Copy old to new
					if (it_old != end())
						_allocator.construct(&*it_new++, *it_old++);
				}
				// Update private data of vector
				this->~vector();
				_start = new_vec;
				_size = new_size;
				_capacity = new_capacity;
			}
			else
			{
				// We offset the whole vector by n one item at a time
				// We need to start by the end to avoid overwritting values
				for (reverse_iterator it = rbegin() - n;
						it != reverse_iterator(position) - n;
						it++)
				{
					_allocator.construct(&*it, *(it + n));
					_allocator.destroy(&*(it + n));
				}

				// Setting the new values before position
				for (iterator it = position; it != position + n; it++)
					_allocator.construct(&*it, val);

				//Update private data of vector
				_size += n;
			}
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rsi, -0x128(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x120(%rbp)
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x21ce0
leaq -0x48(%rbp), %rdi
callq 0x21ce0
jmp 0x65770
movq -0x120(%rbp), %rcx
movq -0x30(%rbp), %rax
cmpq 0x20(%rcx), %rax
jbe 0x65ad4
movq -0x120(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x21d00
movq %rax, -0x130(%rbp)
jmp 0x6579e
movq -0x120(%rbp), %rdi
movq -0x130(%rbp), %rax
movq %rax, -0x38(%rbp)
addq $0x10, %rdi
movq -0x38(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x79d0
movq %rax, -0x138(%rbp)
jmp 0x657ca
movq -0x120(%rbp), %rsi
movq -0x138(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x21b50
jmp 0x657e7
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movq %rsi, -0x140(%rbp)
callq 0x21d60
movq -0x140(%rbp), %rdi
callq 0x21b80
jmp 0x65809
movq -0x28(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x21da0
jmp 0x65818
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movq %rsi, -0x148(%rbp)
callq 0x21d60
movq -0x148(%rbp), %rdi
callq 0x21b80
jmp 0x6583a
movq -0x18(%rbp), %rax
movl %eax, -0x58(%rbp)
movq -0x120(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x21df0
jmp 0x65853
leaq -0x40(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x21dc0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x149(%rbp)
jne 0x6587c
cmpl $0x0, -0x58(%rbp)
setg %al
movb %al, -0x149(%rbp)
movb -0x149(%rbp), %al
movb %al, -0x14a(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x21b80
jmp 0x65893
movb -0x14a(%rbp), %al
testb $0x1, %al
jne 0x658a2
jmp 0x65a9f
movq -0x128(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x21e60
movb %al, -0x14b(%rbp)
jmp 0x658ba
movb -0x14b(%rbp), %al
testb $0x1, %al
jne 0x658c9
jmp 0x65978
jmp 0x658cb
movl -0x58(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x58(%rbp)
cmpl $0x0, %eax
je 0x65976
movq -0x120(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x158(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x48(%rbp), %rsi
xorl %edx, %edx
callq 0x21e90
jmp 0x65902
leaq -0x78(%rbp), %rdi
callq 0x21ef0
movq %rax, -0x160(%rbp)
jmp 0x65914
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdi
movq -0x20(%rbp), %rdx
callq 0x7a30
leaq -0x78(%rbp), %rdi
callq 0x21b80
jmp 0x65936
jmp 0x658cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x65e9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x65e8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x21b80
jmp 0x65971
jmp 0x65e8f
jmp 0x65978
movq -0x120(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x21df0
jmp 0x6598a
leaq -0x40(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movq %rsi, -0x170(%rbp)
callq 0x21dc0
movq -0x170(%rbp), %rdi
movb %al, -0x161(%rbp)
callq 0x21b80
jmp 0x659b2
movb -0x161(%rbp), %al
testb $0x1, %al
jne 0x659c1
jmp 0x65a9a
movq -0x120(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x178(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x48(%rbp), %rsi
xorl %edx, %edx
callq 0x21e90
jmp 0x659e7
leaq -0x88(%rbp), %rdi
callq 0x21ef0
movq %rax, -0x180(%rbp)
jmp 0x659fc
leaq -0x90(%rbp), %rdi
leaq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x21e90
jmp 0x65a10
leaq -0x90(%rbp), %rdi
callq 0x21ef0
movq %rax, -0x188(%rbp)
jmp 0x65a25
movq -0x188(%rbp), %rdx
movq -0x180(%rbp), %rsi
movq -0x178(%rbp), %rdi
callq 0x7a30
leaq -0x90(%rbp), %rdi
callq 0x21b80
jmp 0x65a4d
leaq -0x88(%rbp), %rdi
callq 0x21b80
jmp 0x65a5b
jmp 0x65a9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x65a87
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x21b80
jmp 0x65a85
jmp 0x65a87
leaq -0x88(%rbp), %rdi
callq 0x21b80
jmp 0x65a95
jmp 0x65e8f
jmp 0x65841
movq -0x120(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
jmp 0x65ab0
movq -0x120(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rcx
movq %rcx, 0x20(%rax)
jmp 0x65e72
movq -0x120(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x21f30
jmp 0x65ae9
movq -0x18(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x21fe0
jmp 0x65b02
leaq -0xb0(%rbp), %rdi
callq 0x22070
jmp 0x65b10
jmp 0x65b12
movq -0x128(%rbp), %rsi
leaq -0xd0(%rbp), %rdi
callq 0x22120
jmp 0x65b27
movq -0x18(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x21fe0
jmp 0x65b40
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x22090
movb %al, -0x189(%rbp)
jmp 0x65b5b
leaq -0xc0(%rbp), %rdi
callq 0x22070
jmp 0x65b69
leaq -0xd0(%rbp), %rdi
callq 0x22070
jmp 0x65b77
movb -0x189(%rbp), %al
testb $0x1, %al
jne 0x65c05
jmp 0x65b87
leaq -0xa0(%rbp), %rdi
callq 0x22070
jmp 0x65d49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x22070
jmp 0x65bb2
jmp 0x65e8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x65d4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x65bf2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x22070
jmp 0x65bf0
jmp 0x65bf2
leaq -0xd0(%rbp), %rdi
callq 0x22070
jmp 0x65c00
jmp 0x65d4b
movq -0x120(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x1a0(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x22160
movq %rax, -0x198(%rbp)
jmp 0x65c2c
movq -0x18(%rbp), %rdx
leaq -0xe0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x221e0
jmp 0x65c45
leaq -0xe0(%rbp), %rdi
callq 0x22160
movq %rax, -0x1a8(%rbp)
jmp 0x65c5a
movq -0x1a8(%rbp), %rdx
movq -0x198(%rbp), %rsi
movq -0x1a0(%rbp), %rdi
callq 0x7a30
leaq -0xe0(%rbp), %rdi
callq 0x22070
jmp 0x65c82
movq -0x120(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x1b0(%rbp)
movq -0x18(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x221e0
jmp 0x65cad
leaq -0xf0(%rbp), %rdi
callq 0x22160
movq %rax, -0x1b8(%rbp)
jmp 0x65cc2
movq -0x1b8(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
callq 0x7a50
jmp 0x65cd7
leaq -0xf0(%rbp), %rdi
callq 0x22070
jmp 0x65ce5
jmp 0x65ce7
leaq -0x100(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
xorl %edx, %edx
callq 0x22270
jmp 0x65cfe
leaq -0x100(%rbp), %rdi
callq 0x22070
jmp 0x65d0c
jmp 0x65b12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x22070
jmp 0x65d2b
jmp 0x65d4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x22070
jmp 0x65d47
jmp 0x65d4b
jmp 0x65d5e
leaq -0xa0(%rbp), %rdi
callq 0x22070
jmp 0x65d59
jmp 0x65e8f
movq -0x128(%rbp), %rsi
leaq -0x108(%rbp), %rdi
callq 0x22310
jmp 0x65d73
jmp 0x65d75
movq -0x128(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x110(%rbp), %rdi
callq 0x22330
jmp 0x65d8e
leaq -0x108(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movq %rsi, -0x1c8(%rbp)
callq 0x21dc0
movq -0x1c8(%rbp), %rdi
movb %al, -0x1b9(%rbp)
callq 0x21b80
jmp 0x65dbc
movb -0x1b9(%rbp), %al
testb $0x1, %al
jne 0x65df3
jmp 0x65dc8
leaq -0x108(%rbp), %rdi
callq 0x21b80
jmp 0x65e5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x21b80
jmp 0x65e5d
movq -0x120(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x1d8(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x21ef0
movq %rax, -0x1d0(%rbp)
jmp 0x65e1a
movq -0x1d0(%rbp), %rsi
movq -0x1d8(%rbp), %rdi
movq -0x20(%rbp), %rdx
callq 0x7a30
leaq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rsi
xorl %edx, %edx
callq 0x21e90
jmp 0x65e48
leaq -0x118(%rbp), %rdi
callq 0x21b80
jmp 0x65e56
jmp 0x65d75
jmp 0x65e5f
jmp 0x65e8f
movq -0x120(%rbp), %rax
movq -0x18(%rbp), %rcx
addq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
leaq -0x48(%rbp), %rdi
callq 0x21b80
jmp 0x65e7d
leaq -0x40(%rbp), %rdi
callq 0x21b80
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x21b80
jmp 0x65e9a
jmp 0x65e9c
leaq -0x40(%rbp), %rdi
callq 0x21b80
jmp 0x65ea7
jmp 0x65ea9
movq -0x50(%rbp), %rdi
callq 0x6310
movq %rax, %rdi
callq 0x7110
nopw (%rax,%rax)