// File: t0mm4rx[P]piscine_cpp/day00/ex01/commands.cpp
// Function: print_contacts(Contact*, int*)
void print_contacts(Contact contacts[8], int *index)
{
	if (*index == 0)
	{
		std::cout << "No contacts yet !" << std::endl << std::endl;
		return ;
	}
	std::cout << " ___________________________________________" << std::endl;
	std::cout << "|" << std::setw(10) << std::left << "index";
	std::cout << "|" << std::setw(10) << std::left << "first name";
	std::cout << "|" << std::setw(10) << std::left << "last name";
	std::cout << "|" << std::setw(10) << std::left << "login" << "|" << std::endl;
	std::cout << " ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾" << std::endl;
	for (int i = 0; i < *index; i++)
	{
		std::cout << "|" << std::setw(10) << std::left << i << "|";
		std::cout << std::setw(10) << std::left << truncate(contacts[i].get_first_name()) << "|";
		std::cout << std::setw(10) << std::left << truncate(contacts[i].get_last_name()) << "|";
		std::cout << std::setw(10) << std::left << truncate(contacts[i].get_login()) << "|";
		std::cout << std::endl;
		std::cout << " ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾" << std::endl;
	}
	std::cout << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x3cd2
movq 0x4325(%rip), %rdi      # 0x7fc8
leaq 0x1615(%rip), %rsi      # 0x52bf
callq 0x2110
movq %rax, %rdi
movq 0x42f7(%rip), %rsi      # 0x7fb0
callq 0x2130
movq %rax, %rdi
movq 0x42e8(%rip), %rsi      # 0x7fb0
callq 0x2130
jmp 0x421a
movq 0x42ef(%rip), %rdi      # 0x7fc8
leaq 0x15f1(%rip), %rsi      # 0x52d1
callq 0x2110
movq %rax, %rdi
movq 0x42c1(%rip), %rsi      # 0x7fb0
callq 0x2130
movq 0x42cd(%rip), %rdi      # 0x7fc8
leaq 0x13d5(%rip), %rsi      # 0x50d7
callq 0x2110
movq %rax, -0x128(%rbp)
movl $0xa, %edi
callq 0x2b00
movq -0x128(%rbp), %rdi
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
callq 0x2140
movq %rax, %rdi
leaq -0x1214(%rip), %rsi     # 0x2b20
callq 0x2080
movq %rax, %rdi
leaq 0x15bb(%rip), %rsi      # 0x52fe
callq 0x2110
movq 0x4279(%rip), %rdi      # 0x7fc8
leaq 0x1381(%rip), %rsi      # 0x50d7
callq 0x2110
movq %rax, -0x120(%rbp)
movl $0xa, %edi
callq 0x2b00
movq -0x120(%rbp), %rdi
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %esi
callq 0x2140
movq %rax, %rdi
leaq -0x1268(%rip), %rsi     # 0x2b20
callq 0x2080
movq %rax, %rdi
leaq 0x156d(%rip), %rsi      # 0x5304
callq 0x2110
movq 0x4225(%rip), %rdi      # 0x7fc8
leaq 0x132d(%rip), %rsi      # 0x50d7
callq 0x2110
movq %rax, -0x118(%rbp)
movl $0xa, %edi
callq 0x2b00
movq -0x118(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %esi
callq 0x2140
movq %rax, %rdi
leaq -0x12bc(%rip), %rsi     # 0x2b20
callq 0x2080
movq %rax, %rdi
leaq 0x1524(%rip), %rsi      # 0x530f
callq 0x2110
movq 0x41d1(%rip), %rdi      # 0x7fc8
leaq 0x12d9(%rip), %rsi      # 0x50d7
callq 0x2110
movq %rax, -0x110(%rbp)
movl $0xa, %edi
callq 0x2b00
movq -0x110(%rbp), %rdi
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %esi
callq 0x2140
movq %rax, %rdi
leaq -0x1310(%rip), %rsi     # 0x2b20
callq 0x2080
movq %rax, %rdi
leaq 0x14da(%rip), %rsi      # 0x5319
callq 0x2110
movq %rax, %rdi
leaq 0x1289(%rip), %rsi      # 0x50d7
callq 0x2110
movq %rax, %rdi
movq 0x4153(%rip), %rsi      # 0x7fb0
callq 0x2130
movq 0x415f(%rip), %rdi      # 0x7fc8
leaq 0x14af(%rip), %rsi      # 0x531f
callq 0x2110
movq %rax, %rdi
movq 0x4131(%rip), %rsi      # 0x7fb0
callq 0x2130
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x4207
movq 0x4127(%rip), %rdi      # 0x7fc8
movq %rdi, -0x148(%rbp)
leaq 0x1228(%rip), %rsi      # 0x50d7
movq %rsi, -0x158(%rbp)
callq 0x2110
movq %rax, -0x160(%rbp)
movl $0xa, %edi
movl %edi, -0x14c(%rbp)
callq 0x2b00
movq -0x160(%rbp), %rdi
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %esi
callq 0x2140
movq %rax, %rdi
leaq -0x13ce(%rip), %rsi     # 0x2b20
movq %rsi, -0x140(%rbp)
callq 0x2080
movq %rax, %rdi
movl -0x24(%rbp), %esi
callq 0x2200
movq -0x158(%rbp), %rsi
movq %rax, %rdi
callq 0x2110
movl -0x14c(%rbp), %edi
callq 0x2b00
movq -0x148(%rbp), %rdi
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %esi
callq 0x2140
movq -0x140(%rbp), %rsi
movq %rax, %rdi
callq 0x2080
movq %rax, -0x138(%rbp)
movq -0x8(%rbp), %rsi
movslq -0x24(%rbp), %rax
imulq $0x160, %rax, %rax      # imm = 0x160
addq %rax, %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x4d70
movq -0x130(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x2a50
jmp 0x3f7b
movq -0x138(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2100
movq %rax, -0x168(%rbp)
jmp 0x3f94
movq -0x168(%rbp), %rdi
leaq 0x1135(%rip), %rsi      # 0x50d7
callq 0x2110
jmp 0x3fa9
leaq -0x50(%rbp), %rdi
callq 0x20e0
leaq -0x70(%rbp), %rdi
callq 0x20e0
movl $0xa, %edi
callq 0x2b00
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %esi
movq 0x3ff6(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, %rdi
leaq -0x14c1(%rip), %rsi     # 0x2b20
callq 0x2080
movq %rax, -0x178(%rbp)
movq -0x8(%rbp), %rsi
movslq -0x24(%rbp), %rax
imulq $0x160, %rax, %rax      # imm = 0x160
addq %rax, %rsi
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x4da0
movq -0x170(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x2a50
jmp 0x4027
movq -0x178(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2100
movq %rax, -0x180(%rbp)
jmp 0x4043
movq -0x180(%rbp), %rdi
leaq 0x1086(%rip), %rsi      # 0x50d7
callq 0x2110
jmp 0x4058
leaq -0xa0(%rbp), %rdi
callq 0x20e0
leaq -0xc0(%rbp), %rdi
callq 0x20e0
movl $0xa, %edi
callq 0x2b00
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %esi
movq 0x3f3b(%rip), %rdi      # 0x7fc8
callq 0x2140
movq %rax, %rdi
leaq -0x157c(%rip), %rsi     # 0x2b20
callq 0x2080
movq %rax, -0x190(%rbp)
movq -0x8(%rbp), %rsi
movslq -0x24(%rbp), %rax
imulq $0x160, %rax, %rax      # imm = 0x160
addq %rax, %rsi
leaq -0x108(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x4dd0
movq -0x188(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x2a50
jmp 0x40e2
movq -0x190(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x2100
movq %rax, -0x198(%rbp)
jmp 0x40fe
movq -0x198(%rbp), %rdi
leaq 0xfcb(%rip), %rsi       # 0x50d7
callq 0x2110
jmp 0x4113
leaq -0xe8(%rbp), %rdi
callq 0x20e0
leaq -0x108(%rbp), %rdi
callq 0x20e0
movq 0x3e96(%rip), %rdi      # 0x7fc8
movq 0x3e77(%rip), %rsi      # 0x7fb0
callq 0x2130
movq 0x3e83(%rip), %rdi      # 0x7fc8
leaq 0x11d3(%rip), %rsi      # 0x531f
callq 0x2110
movq %rax, %rdi
movq 0x3e55(%rip), %rsi      # 0x7fb0
callq 0x2130
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3e8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4191
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x20e0
leaq -0x70(%rbp), %rdi
callq 0x20e0
jmp 0x4223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x41c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x20e0
leaq -0xc0(%rbp), %rdi
callq 0x20e0
jmp 0x4223
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x41f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x20e0
leaq -0x108(%rbp), %rdi
callq 0x20e0
jmp 0x4223
movq 0x3dba(%rip), %rdi      # 0x7fc8
movq 0x3d9b(%rip), %rsi      # 0x7fb0
callq 0x2130
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x2210
nopl (%rax)