// File: /workspace/github_cpp_makefile_star2_O2/DimitriDaSilva[P]42_ft_containers/containers/vector.hpp
// Function: ft::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>::insert(ft::random_access_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> 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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rax
leaq (%rax,%rdx), %rcx
movq %rcx, -0x38(%rbp)
cmpq 0x20(%rdi), %rcx
movq %rdi, -0x30(%rbp)
jbe 0x296dd
leaq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x2336e
leaq 0x10(%rbx), %rdi
movq %rax, -0x50(%rbp)
movq %rax, %rsi
xorl %edx, %edx
callq 0x22700
movq %rax, %rdi
movq 0x8(%rbx), %rax
movq %rdi, -0x48(%rbp)
movq %rax, %r13
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, %rdx
shlq $0x5, %rdx
addq %rax, %rdx
cmpq %rdx, %r13
setne %dl
testl %r12d, %r12d
setg %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x29722
cmpq (%r15), %r13
jne 0x296a9
jmp 0x29691
leaq 0x20(%rdi), %rbx
movq %r14, %rsi
callq 0x51f0
movq %rbx, %rdi
subl $0x1, %r12d
jae 0x29682
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
movq 0x18(%rcx), %rcx
pushq $-0x1
popq %rdx
movl %edx, %r12d
shlq $0x5, %rcx
addq %rax, %rcx
cmpq %rcx, %r13
je 0x2964f
leaq 0x20(%rdi), %rbx
leaq 0x20(%r13), %rax
movq %rax, -0x40(%rbp)
movq %r13, %rsi
callq 0x51f0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rbx, %rdi
movq -0x40(%rbp), %r13
jmp 0x2964f
movq 0x8(%rbx), %rcx
shlq $0x5, %rax
leaq (%rax,%rcx), %r13
addq $-0x20, %r13
movq %r12, %rbx
shlq $0x5, %rbx
leaq (%rbx,%r13), %rcx
addq $0x20, %rcx
movq (%r15), %rax
leaq (%rax,%rbx), %rdx
cmpq %rdx, %rcx
je 0x29748
leaq (%rbx,%r13), %rdi
movq %r13, %rsi
callq 0x51f0
movq %r13, %rdi
callq 0x51d0
addq $-0x20, %r13
jmp 0x296f4
movq -0x30(%rbp), %rbx
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movq -0x48(%rbp), %rax
movq %rax, 0x8(%rbx)
movq -0x38(%rbp), %rax
movq %rax, 0x18(%rbx)
movq -0x50(%rbp), %rax
movq %rax, 0x20(%rbx)
jmp 0x2976f
movq %rax, %r13
addq %rbx, %rax
cmpq %rax, %r13
je 0x29767
movq %r13, %rdi
movq %r14, %rsi
callq 0x51f0
addq $0x20, %r13
movq (%r15), %rax
jmp 0x2974b
movq -0x30(%rbp), %rax
addq %r12, 0x18(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq