// File: DimitriDaSilva[P]42_ft_containers/tester/containers/map/test_map_modifiers.cpp
// Function: test_map_modifiers_insert_cplusplus()
void
test_map_modifiers_insert_cplusplus()
{
	ft::map<char, int> mymap;

	// first insert function version (single parameter):
	mymap.insert(ft::pair<char, int>('a', 100) );
	mymap.insert(ft::pair<char, int>('z', 200) );

	ft::pair<ft::map<char, int>::iterator, bool> ret;

	ret = mymap.insert(ft::pair<char, int>('z', 500));
	if (ret.second == false)
	{
		std::cout << "element 'z' already existed";
		std::cout << " with a value of " << ret.first->second << std::endl;
	}

	// second insert function version (with hint position):
	ft::map<char, int>::iterator it = mymap.begin();
	mymap.insert(it, ft::pair<char, int>('b', 300));  // max efficiency inserting
	mymap.insert(it, ft::pair<char, int>('c', 400));  // no max efficiency inserting

	// third insert function version (range insertion):
	ft::map<char, int> anothermap;
	anothermap.insert(mymap.begin(), mymap.find('c'));

	print_map_info(mymap);
	print_map_info(anothermap);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
leaq -0x30(%rbp), %rdi
callq 0x1bf70
movb $0x61, -0x39(%rbp)
movl $0x64, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x39(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x2b170
jmp 0x28cf2
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2b130
movb %dl, -0x159(%rbp)
movq %rax, -0x158(%rbp)
jmp 0x28d0e
movb -0x159(%rbp), %al
movq -0x158(%rbp), %rcx
movq %rcx, -0x60(%rbp)
movb %al, -0x58(%rbp)
movb $0x7a, -0x69(%rbp)
movl $0xc8, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x69(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x2b170
jmp 0x28d40
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2b130
movb %dl, -0x169(%rbp)
movq %rax, -0x168(%rbp)
jmp 0x28d5c
movb -0x169(%rbp), %al
movq -0x168(%rbp), %rcx
movq %rcx, -0x80(%rbp)
movb %al, -0x78(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2b1a0
jmp 0x28d7e
movb $0x7a, -0xa9(%rbp)
movl $0x1f4, -0xb0(%rbp)     # imm = 0x1F4
leaq -0xa8(%rbp), %rdi
leaq -0xa9(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x2b170
jmp 0x28dab
leaq -0x30(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2b130
movb %dl, -0x179(%rbp)
movq %rax, -0x178(%rbp)
jmp 0x28dca
movb -0x179(%rbp), %al
movq -0x178(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movb %al, -0xb8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xa0(%rbp)
movb -0xb8(%rbp), %al
movb %al, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2b1d0
movb -0x88(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x28e9e
movq 0x52190(%rip), %rdi     # 0x7afb8
leaq 0x2e9a5(%rip), %rsi     # 0x577d4
callq 0x31e0
jmp 0x28e36
movq 0x5217b(%rip), %rdi     # 0x7afb8
leaq 0x2e9ac(%rip), %rsi     # 0x577f0
callq 0x31e0
movq %rax, -0x188(%rbp)
jmp 0x28e52
leaq -0x90(%rbp), %rdi
callq 0x1c330
movq -0x188(%rbp), %rdi
movl 0x4(%rax), %esi
callq 0x3350
movq %rax, -0x190(%rbp)
jmp 0x28e76
movq -0x190(%rbp), %rdi
movq 0x52114(%rip), %rsi     # 0x7af98
callq 0x3220
jmp 0x28e8b
jmp 0x28e9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x29049
leaq -0x30(%rbp), %rdi
callq 0x2b200
movq %rax, -0xc8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x1c350
movb $0x62, -0xd9(%rbp)
movl $0x12c, -0xe0(%rbp)     # imm = 0x12C
leaq -0xd8(%rbp), %rdi
leaq -0xd9(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x2b170
jmp 0x28eee
movq -0xd0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
leaq -0xd8(%rbp), %rdx
callq 0x2b230
movq %rax, -0x198(%rbp)
jmp 0x28f0e
movq -0x198(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x1c350
movb $0x63, -0xf9(%rbp)
movl $0x190, -0x100(%rbp)    # imm = 0x190
leaq -0xf8(%rbp), %rdi
leaq -0xf9(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x2b170
jmp 0x28f5c
movq -0xf0(%rbp), %rsi
leaq -0x30(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
callq 0x2b230
movq %rax, -0x1a0(%rbp)
jmp 0x28f7c
movq -0x1a0(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x1bf70
leaq -0x30(%rbp), %rdi
movq %rdi, -0x1b0(%rbp)
callq 0x2b200
movq -0x1b0(%rbp), %rdi
movq %rax, -0x140(%rbp)
movb $0x63, -0x149(%rbp)
leaq -0x149(%rbp), %rsi
callq 0x1c190
movq %rax, -0x1a8(%rbp)
jmp 0x28fd0
movq -0x1a8(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x140(%rbp), %rsi
movq -0x148(%rbp), %rdx
leaq -0x138(%rbp), %rdi
callq 0x2b270
jmp 0x28ffa
leaq -0x30(%rbp), %rdi
callq 0x1c020
jmp 0x29005
leaq -0x138(%rbp), %rdi
callq 0x1c020
jmp 0x29013
leaq -0x138(%rbp), %rdi
callq 0x1c230
leaq -0x30(%rbp), %rdi
callq 0x1c230
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x1c230
leaq -0x30(%rbp), %rdi
callq 0x1c230
movq -0x48(%rbp), %rdi
callq 0x3360
nopl (%rax,%rax)