// File: /workspace/github_cpp_makefile_star2_O2/t0mm4rx[P]piscine_cpp/day00/ex01/commands.cpp
// Function: add(Contact*, int*)
void add(Contact contacts[8], int *index)
{
	Contact			c;
	std::string	buffer;

	if (*index >= 8)
	{
		std::cout << "All 8 contacts already registed!" << std::endl << std::endl;
		return ;
	}
	std::cin.ignore();
	std::cout << std::setw(20) << "First name: ";
	std::getline(std::cin, buffer);
	c.set_first_name(buffer);
	std::cout << std::setw(20) << "Last name: ";
	std::getline(std::cin, buffer);
	c.set_last_name(buffer);
	std::cout << std::setw(20) << "Nickname: ";
	std::getline(std::cin, buffer);
	c.set_nick_name(buffer);
	std::cout << std::setw(20) << "Login: ";
	std::getline(std::cin, buffer);
	c.set_login(buffer);
	std::cout << std::setw(20) << "Postal address: ";
	std::getline(std::cin, buffer);
	c.set_postal_address(buffer);
	std::cout << std::setw(20) << "Mail: ";
	std::getline(std::cin, buffer);
	c.set_mail(buffer);
	std::cout << std::setw(20) << "Phone: ";
	std::getline(std::cin, buffer);
	c.set_phone(buffer);
	std::cout << std::setw(20) << "Birthday: ";
	std::getline(std::cin, buffer);
	c.set_birthday(buffer);
	std::cout << std::setw(20) << "Favorite meal: ";
	std::getline(std::cin, buffer);
	c.set_favorite_meal(buffer);
	std::cout << std::setw(20) << "Underwear color: ";
	std::getline(std::cin, buffer);
	c.set_underwear_color(buffer);
	std::cout << std::setw(20) << "Darkest secret: ";
	std::getline(std::cin, buffer);
	c.set_darkest_secret(buffer);
	contacts[*index] = c;
	if (*index < 8)
		(*index)++;
	std::cout << BOLD << "Contact added !" << RESET << std::endl << std::endl;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x180(%rsp), %rdi
callq 0x36ec
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpl $0x7, (%rbx)
jle 0x2a95
leaq 0x177b(%rip), %rsi      # 0x4204
movq 0x3538(%rip), %rdi      # 0x5fc8
jmp 0x2f01
movq 0x3544(%rip), %rdi      # 0x5fe0
callq 0x21c0
movq 0x3520(%rip), %r15      # 0x5fc8
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x1766(%rip), %rsi      # 0x4225
movq %r15, %rdi
callq 0x20e0
movq 0x3512(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0x160(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x3b7e
leaq 0x160(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x1713(%rip), %rsi      # 0x4232
movq %r15, %rdi
callq 0x20e0
movq 0x34b2(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0x140(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x3b84
leaq 0x140(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x16bf(%rip), %rsi      # 0x423e
movq %r15, %rdi
callq 0x20e0
movq 0x3452(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0x120(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x3b8e
leaq 0x120(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x166a(%rip), %rsi      # 0x4249
movq %r15, %rdi
callq 0x20e0
movq 0x33f2(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0x100(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x3b98
leaq 0x100(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x1612(%rip), %rsi      # 0x4251
movq %r15, %rdi
callq 0x20e0
movq 0x3392(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0xe0(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x3ba2
leaq 0xe0(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x15c3(%rip), %rsi      # 0x4262
movq %r15, %rdi
callq 0x20e0
movq 0x3332(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0xc0(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x3bac
leaq 0xc0(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x156a(%rip), %rsi      # 0x4269
movq %r15, %rdi
callq 0x20e0
movq 0x32d2(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0xa0(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x3bb8
leaq 0xa0(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x1512(%rip), %rsi      # 0x4271
movq %r15, %rdi
callq 0x20e0
movq 0x3272(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0x80(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x3bc4
leaq 0x80(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x14bd(%rip), %rsi      # 0x427c
movq %r15, %rdi
callq 0x20e0
movq 0x3212(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0x60(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3bd0
leaq 0x60(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x1476(%rip), %rsi      # 0x428c
movq %r15, %rdi
callq 0x20e0
movq 0x31bb(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0x40(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x3bdc
leaq 0x40(%rsp), %rdi
callq 0x2080
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%r15,%rax)
leaq 0x1431(%rip), %rsi      # 0x429e
movq %r15, %rdi
callq 0x20e0
movq 0x3164(%rip), %rdi      # 0x5fe0
movq %rsp, %rsi
callq 0x2040
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x2140
leaq 0x180(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x3be8
leaq 0x20(%rsp), %rdi
callq 0x2080
movslq (%rbx), %rax
imulq $0x160, %rax, %rax      # imm = 0x160
addq %rax, %r14
leaq 0x180(%rsp), %rsi
movq %r14, %rdi
callq 0x356e
movl (%rbx), %eax
cmpl $0x7, %eax
jg 0x2ed5
incl %eax
movl %eax, (%rbx)
movq 0x30ec(%rip), %rdi      # 0x5fc8
leaq 0x1176(%rip), %rsi      # 0x4059
callq 0x20e0
leaq 0x13c0(%rip), %rsi      # 0x42af
movq %rax, %rdi
callq 0x20e0
movq %rax, %rdi
leaq 0x117b(%rip), %rsi      # 0x407c
callq 0x20e0
movq %rax, %rdi
callq 0x2090
movq %rax, %rdi
callq 0x2090
movq %rsp, %rdi
callq 0x2080
leaq 0x180(%rsp), %rdi
callq 0x37f2
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
jmp 0x2fbc
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x2080
jmp 0x2fc6
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2080
leaq 0x180(%rsp), %rdi
callq 0x37f2
movq %rbx, %rdi
callq 0x21b0