// File: DimitriDaSilva[P]42_ft_containers/tester/containers/test_subject.cpp
// Function: test_subject()
void
test_subject()
{
	std::cout << "*** test_subject ***" << std::endl;

	srand(g_seed);

	ft::vector<std::string> vector_str;
	ft::vector<int> vector_int;
	ft::stack<int> stack_int;
	ft::vector<Buffer> vector_buffer;
	ft::stack<Buffer, std::deque<Buffer> > stack_deq_buffer;
	ft::map<int, int> map_int;

	for (int i = 0; i < COUNT; i++)
	{
		vector_buffer.push_back(Buffer());
	}

	for (int i = 0; i < COUNT; i++)
	{
		int const idx = rand() % COUNT;
		vector_buffer[idx].idx = 5;
	}
	ft::vector<Buffer>().swap(vector_buffer);

	try
	{
		for (int i = 0; i < COUNT; i++)
		{
			int const idx = rand() % COUNT;
			vector_buffer.at(idx);
			std::cerr << "Error: THIS VECTOR SHOULD BE EMPTY!!" <<std::endl;
		}
	}
	catch (std::exception const& e)
	{
		//NORMAL ! :P
	}

	for (int i = 0; i < COUNT; ++i)
	{
		map_int.insert(ft::make_pair(rand(), rand()));
	}

	int sum = 0;
	for (int i = 0; i < 10000; i++)
	{
		int access = rand();
		sum += map_int[access];
	}
	std::cout << "should be constant with the same g_seed: " << sum << std::endl;

	{
		ft::map<int, int> copy = map_int;
	}

	MutantStack<char> iterable_stack;
	for (char letter = 'a'; letter <= 'z'; letter++)
		iterable_stack.push(letter);
	for (MutantStack<char>::iterator it = iterable_stack.begin(); it != iterable_stack.end(); it++)
	{
		std::cout << *it;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x12d0, %rsp           # imm = 0x12D0
movq 0x668a6(%rip), %rdi     # 0x7afb8
leaq 0x42e05(%rip), %rsi     # 0x5751e
callq 0x31e0
movq %rax, %rdi
movq 0x66870(%rip), %rsi     # 0x7af98
callq 0x3220
leaq 0x66ad4(%rip), %rax     # 0x7b208
movl (%rax), %edi
callq 0x31d0
leaq -0x18(%rbp), %rdi
callq 0x14ce0
leaq -0x30(%rbp), %rdi
callq 0x14d00
leaq -0x80(%rbp), %rdi
callq 0x14d20
jmp 0x14758
leaq -0xa8(%rbp), %rdi
callq 0x14d50
leaq -0xf8(%rbp), %rdi
callq 0x14d70
jmp 0x14772
leaq -0x128(%rbp), %rdi
callq 0x14da0
movl $0x0, -0x12c(%rbp)
movslq -0x12c(%rbp), %rax
cmpq $0xffc00, %rax          # imm = 0xFFC00
jge 0x14822
leaq -0x1130(%rbp), %rdi
movq %rdi, -0x1288(%rbp)
xorl %esi, %esi
movl $0x1004, %edx           # imm = 0x1004
callq 0x3120
movq -0x1288(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x14dc0
jmp 0x147ca
jmp 0x147cc
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x14788
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14cb8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14ca3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x14c8b
movl $0x0, -0x1134(%rbp)
movslq -0x1134(%rbp), %rax
cmpq $0xffc00, %rax          # imm = 0xFFC00
jge 0x1487e
callq 0x30a0
cltq
movl $0xffc00, %ecx          # imm = 0xFFC00
cqto
idivq %rcx
movl %edx, %eax
movl %eax, -0x1138(%rbp)
movslq -0x1138(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x14df0
movl $0x5, (%rax)
movl -0x1134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1134(%rbp)
jmp 0x1482c
leaq -0x1150(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x3120
leaq -0x1150(%rbp), %rdi
callq 0x14d50
leaq -0x1150(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x14e10
leaq -0x1150(%rbp), %rdi
callq 0x14e70
movl $0x0, -0x1154(%rbp)
movslq -0x1154(%rbp), %rax
cmpq $0xffc00, %rax          # imm = 0xFFC00
jge 0x14a72
callq 0x30a0
movl %eax, -0x1294(%rbp)
cltq
movq %rax, -0x1290(%rbp)
movabsq $-0x7fdff7fdff7fdff7, %rcx # imm = 0x8020080200802009
imulq %rcx
movl -0x1294(%rbp), %eax
movq %rdx, %rcx
movq -0x1290(%rbp), %rdx
addq %rdx, %rcx
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x13, %rcx
addl %edx, %ecx
imull $0xffc00, %ecx, %ecx    # imm = 0xFFC00
subl %ecx, %eax
movl %eax, -0x1158(%rbp)
movslq -0x1158(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x14ed0
jmp 0x1493d
movq 0x666ac(%rip), %rdi     # 0x7aff0
leaq 0x42be8(%rip), %rsi     # 0x57533
callq 0x31e0
movq %rax, -0x12a0(%rbp)
jmp 0x14959
movq -0x12a0(%rbp), %rdi
movq 0x66631(%rip), %rsi     # 0x7af98
callq 0x3220
jmp 0x1496e
jmp 0x14970
movl -0x1154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1154(%rbp)
jmp 0x148c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x14c8b
movq -0x88(%rbp), %rdi
callq 0x30e0
movq %rax, -0x1160(%rbp)
callq 0x3330
jmp 0x149c3
jmp 0x149c5
movl $0x0, -0x1164(%rbp)
movslq -0x1164(%rbp), %rax
cmpq $0xffc00, %rax          # imm = 0xFFC00
jge 0x14a77
callq 0x30a0
movl %eax, -0x1170(%rbp)
callq 0x30a0
movl %eax, -0x1174(%rbp)
leaq -0x1170(%rbp), %rdi
leaq -0x1174(%rbp), %rsi
callq 0x14f50
movq %rax, -0x12a8(%rbp)
jmp 0x14a14
movq -0x12a8(%rbp), %rax
movq %rax, -0x116c(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x116c(%rbp), %rsi
callq 0x14f10
movb %dl, -0x12b1(%rbp)
movq %rax, -0x12b0(%rbp)
jmp 0x14a44
movb -0x12b1(%rbp), %al
movq -0x12b0(%rbp), %rcx
movq %rcx, -0x1188(%rbp)
movb %al, -0x1180(%rbp)
movl -0x1164(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1164(%rbp)
jmp 0x149cf
jmp 0x149c5
movl $0x0, -0x118c(%rbp)
movl $0x0, -0x1190(%rbp)
cmpl $0x2710, -0x1190(%rbp)  # imm = 0x2710
jge 0x14ae4
callq 0x30a0
movl %eax, -0x1194(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0x1194(%rbp), %rsi
callq 0x14f80
movq %rax, -0x12c0(%rbp)
jmp 0x14abe
movq -0x12c0(%rbp), %rax
movl (%rax), %eax
addl -0x118c(%rbp), %eax
movl %eax, -0x118c(%rbp)
movl -0x1190(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1190(%rbp)
jmp 0x14a8b
movq 0x664cd(%rip), %rdi     # 0x7afb8
leaq 0x42a66(%rip), %rsi     # 0x57558
callq 0x31e0
movq %rax, -0x12c8(%rbp)
jmp 0x14b00
movq -0x12c8(%rbp), %rdi
movl -0x118c(%rbp), %esi
callq 0x3350
movq %rax, -0x12d0(%rbp)
jmp 0x14b1b
movq -0x12d0(%rbp), %rdi
movq 0x6646f(%rip), %rsi     # 0x7af98
callq 0x3220
jmp 0x14b30
leaq -0x11c8(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x15060
jmp 0x14b45
leaq -0x11c8(%rbp), %rdi
callq 0x15090
leaq -0x1218(%rbp), %rdi
callq 0x150b0
jmp 0x14b5f
movb $0x61, -0x1219(%rbp)
movsbl -0x1219(%rbp), %eax
cmpl $0x7a, %eax
jg 0x14bbc
leaq -0x1218(%rbp), %rdi
leaq -0x1219(%rbp), %rsi
callq 0x150d0
jmp 0x14b87
jmp 0x14b89
movb -0x1219(%rbp), %al
addb $0x1, %al
movb %al, -0x1219(%rbp)
jmp 0x14b66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x1218(%rbp), %rdi
callq 0x151f0
jmp 0x14c8b
leaq -0x1240(%rbp), %rdi
leaq -0x1218(%rbp), %rsi
callq 0x15100
jmp 0x14bd1
jmp 0x14bd3
leaq -0x1260(%rbp), %rdi
leaq -0x1218(%rbp), %rsi
callq 0x15160
jmp 0x14be8
leaq -0x1240(%rbp), %rdi
leaq -0x1260(%rbp), %rsi
callq 0x15130
testb $0x1, %al
jne 0x14c01
jmp 0x14c37
leaq -0x1240(%rbp), %rdi
callq 0x15190
movsbl (%rax), %esi
movq 0x663a1(%rip), %rdi     # 0x7afb8
callq 0x3250
jmp 0x14c1e
jmp 0x14c20
leaq -0x1280(%rbp), %rdi
leaq -0x1240(%rbp), %rsi
xorl %edx, %edx
callq 0x151b0
jmp 0x14bd3
leaq -0x1218(%rbp), %rdi
callq 0x151f0
leaq -0x128(%rbp), %rdi
callq 0x15090
leaq -0xf8(%rbp), %rdi
callq 0x15210
leaq -0xa8(%rbp), %rdi
callq 0x14e70
leaq -0x80(%rbp), %rdi
callq 0x15230
leaq -0x30(%rbp), %rdi
callq 0x15250
leaq -0x18(%rbp), %rdi
callq 0x152b0
addq $0x12d0, %rsp           # imm = 0x12D0
popq %rbp
retq
leaq -0x128(%rbp), %rdi
callq 0x15090
leaq -0xf8(%rbp), %rdi
callq 0x15210
leaq -0xa8(%rbp), %rdi
callq 0x14e70
leaq -0x80(%rbp), %rdi
callq 0x15230
leaq -0x30(%rbp), %rdi
callq 0x15250
leaq -0x18(%rbp), %rdi
callq 0x152b0
movq -0x88(%rbp), %rdi
callq 0x3360
nopw %cs:(%rax,%rax)