// File: 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 %rbp
movq %rsp, %rbp
subq $0x440, %rsp            # imm = 0x440
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x45f0
leaq -0x190(%rbp), %rdi
callq 0x2190
movq -0x10(%rbp), %rax
cmpl $0x8, (%rax)
jl 0x3127
movq 0x4f0d(%rip), %rdi      # 0x7fc8
leaq 0x2142(%rip), %rsi      # 0x5204
callq 0x2110
movq %rax, -0x360(%rbp)
jmp 0x30d0
movq -0x360(%rbp), %rdi
movq 0x4ed2(%rip), %rsi      # 0x7fb0
callq 0x2130
movq %rax, -0x368(%rbp)
jmp 0x30ec
movq -0x368(%rbp), %rdi
movq 0x4eb6(%rip), %rsi      # 0x7fb0
callq 0x2130
jmp 0x3101
movl $0x1, -0x1a0(%rbp)
jmp 0x3a18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
jmp 0x3a39
movq 0x4eb2(%rip), %rdi      # 0x7fe0
callq 0x2220
jmp 0x3135
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x36c(%rbp)
jmp 0x3147
movl -0x36c(%rbp), %eax
movl %eax, -0x1a4(%rbp)
movl -0x1a4(%rbp), %esi
movq 0x4e68(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x378(%rbp)
jmp 0x316e
movq -0x378(%rbp), %rdi
leaq 0x20a9(%rip), %rsi      # 0x5225
callq 0x2110
jmp 0x3183
movq 0x4e56(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x3198
leaq -0x1c8(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x31ad
leaq -0x170(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x4b70
jmp 0x31c2
leaq -0x1c8(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x37c(%rbp)
jmp 0x31e0
movl -0x37c(%rbp), %eax
movl %eax, -0x1cc(%rbp)
movl -0x1cc(%rbp), %esi
movq 0x4dcf(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x388(%rbp)
jmp 0x3207
movq -0x388(%rbp), %rdi
leaq 0x201d(%rip), %rsi      # 0x5232
callq 0x2110
jmp 0x321c
movq 0x4dbd(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x3231
leaq -0x1f0(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x3246
leaq -0x170(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x4b90
jmp 0x325b
leaq -0x1f0(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x38c(%rbp)
jmp 0x3279
movl -0x38c(%rbp), %eax
movl %eax, -0x1f4(%rbp)
movl -0x1f4(%rbp), %esi
movq 0x4d36(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x398(%rbp)
jmp 0x32a0
movq -0x398(%rbp), %rdi
leaq 0x1f90(%rip), %rsi      # 0x523e
callq 0x2110
jmp 0x32b5
movq 0x4d24(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x32ca
leaq -0x218(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x32df
leaq -0x170(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x4bc0
jmp 0x32f4
leaq -0x218(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x39c(%rbp)
jmp 0x3312
movl -0x39c(%rbp), %eax
movl %eax, -0x21c(%rbp)
movl -0x21c(%rbp), %esi
movq 0x4c9d(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x3a8(%rbp)
jmp 0x3339
movq -0x3a8(%rbp), %rdi
leaq 0x1f02(%rip), %rsi      # 0x5249
callq 0x2110
jmp 0x334e
movq 0x4c8b(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x3363
leaq -0x240(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x3378
leaq -0x170(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x4bf0
jmp 0x338d
leaq -0x240(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x3ac(%rbp)
jmp 0x33ab
movl -0x3ac(%rbp), %eax
movl %eax, -0x244(%rbp)
movl -0x244(%rbp), %esi
movq 0x4c04(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x3b8(%rbp)
jmp 0x33d2
movq -0x3b8(%rbp), %rdi
leaq 0x1e71(%rip), %rsi      # 0x5251
callq 0x2110
jmp 0x33e7
movq 0x4bf2(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x33fc
leaq -0x268(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x3411
leaq -0x170(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x4c20
jmp 0x3426
leaq -0x268(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x3bc(%rbp)
jmp 0x3444
movl -0x3bc(%rbp), %eax
movl %eax, -0x26c(%rbp)
movl -0x26c(%rbp), %esi
movq 0x4b6b(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x3c8(%rbp)
jmp 0x346b
movq -0x3c8(%rbp), %rdi
leaq 0x1de9(%rip), %rsi      # 0x5262
callq 0x2110
jmp 0x3480
movq 0x4b59(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x3495
leaq -0x290(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x34aa
leaq -0x170(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x4c50
jmp 0x34bf
leaq -0x290(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x3cc(%rbp)
jmp 0x34dd
movl -0x3cc(%rbp), %eax
movl %eax, -0x294(%rbp)
movl -0x294(%rbp), %esi
movq 0x4ad2(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x3d8(%rbp)
jmp 0x3504
movq -0x3d8(%rbp), %rdi
leaq 0x1d57(%rip), %rsi      # 0x5269
callq 0x2110
jmp 0x3519
movq 0x4ac0(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x352e
leaq -0x2b8(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x3543
leaq -0x170(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x4c80
jmp 0x3558
leaq -0x2b8(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x3dc(%rbp)
jmp 0x3576
movl -0x3dc(%rbp), %eax
movl %eax, -0x2bc(%rbp)
movl -0x2bc(%rbp), %esi
movq 0x4a39(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x3e8(%rbp)
jmp 0x359d
movq -0x3e8(%rbp), %rdi
leaq 0x1cc6(%rip), %rsi      # 0x5271
callq 0x2110
jmp 0x35b2
movq 0x4a27(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x35c7
leaq -0x2e0(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x35dc
leaq -0x170(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
callq 0x4cb0
jmp 0x35f1
leaq -0x2e0(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x3ec(%rbp)
jmp 0x360f
movl -0x3ec(%rbp), %eax
movl %eax, -0x2e4(%rbp)
movl -0x2e4(%rbp), %esi
movq 0x49a0(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x3f8(%rbp)
jmp 0x3636
movq -0x3f8(%rbp), %rdi
leaq 0x1c38(%rip), %rsi      # 0x527c
callq 0x2110
jmp 0x364b
movq 0x498e(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x3660
leaq -0x308(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x3675
leaq -0x170(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x4ce0
jmp 0x368a
leaq -0x308(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x3fc(%rbp)
jmp 0x36a8
movl -0x3fc(%rbp), %eax
movl %eax, -0x30c(%rbp)
movl -0x30c(%rbp), %esi
movq 0x4907(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x408(%rbp)
jmp 0x36cf
movq -0x408(%rbp), %rdi
leaq 0x1baf(%rip), %rsi      # 0x528c
callq 0x2110
jmp 0x36e4
movq 0x48f5(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x36f9
leaq -0x330(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x370e
leaq -0x170(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x4d10
jmp 0x3723
leaq -0x330(%rbp), %rdi
callq 0x20e0
movl $0x14, %edi
callq 0x2b00
movl %eax, -0x40c(%rbp)
jmp 0x3741
movl -0x40c(%rbp), %eax
movl %eax, -0x334(%rbp)
movl -0x334(%rbp), %esi
movq 0x486e(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, -0x418(%rbp)
jmp 0x3768
movq -0x418(%rbp), %rdi
leaq 0x1b28(%rip), %rsi      # 0x529e
callq 0x2110
jmp 0x377d
movq 0x485c(%rip), %rdi      # 0x7fe0
leaq -0x190(%rbp), %rsi
callq 0x2050
jmp 0x3792
leaq -0x358(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x20b0
jmp 0x37a7
leaq -0x170(%rbp), %rdi
leaq -0x358(%rbp), %rsi
callq 0x4d40
jmp 0x37bc
leaq -0x358(%rbp), %rdi
callq 0x20e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq (%rax), %rax
imulq $0x160, %rax, %rax      # imm = 0x160
addq %rax, %rdi
leaq -0x170(%rbp), %rsi
callq 0x4320
jmp 0x37eb
movq -0x10(%rbp), %rax
cmpl $0x8, (%rax)
jge 0x3989
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x3989
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x198(%rbp)
movl %eax, -0x19c(%rbp)
leaq -0x358(%rbp), %rdi
callq 0x20e0
jmp 0x3a39
movq 0x4638(%rip), %rdi      # 0x7fc8
leaq 0x16c2(%rip), %rsi      # 0x5059
callq 0x2110
movq %rax, -0x420(%rbp)
jmp 0x39a5
movq -0x420(%rbp), %rdi
leaq 0x18fc(%rip), %rsi      # 0x52af
callq 0x2110
movq %rax, -0x428(%rbp)
jmp 0x39c1
movq -0x428(%rbp), %rdi
leaq 0x16ad(%rip), %rsi      # 0x507c
callq 0x2110
movq %rax, -0x430(%rbp)
jmp 0x39dd
movq -0x430(%rbp), %rdi
movq 0x45c5(%rip), %rsi      # 0x7fb0
callq 0x2130
movq %rax, -0x438(%rbp)
jmp 0x39f9
movq -0x438(%rbp), %rdi
movq 0x45a9(%rip), %rsi      # 0x7fb0
callq 0x2130
jmp 0x3a0e
movl $0x0, -0x1a0(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x20e0
leaq -0x170(%rbp), %rdi
callq 0x46b0
addq $0x440, %rsp            # imm = 0x440
popq %rbp
retq
leaq -0x190(%rbp), %rdi
callq 0x20e0
leaq -0x170(%rbp), %rdi
callq 0x46b0
movq -0x198(%rbp), %rdi
callq 0x2210
nopl (%rax)