// File: t0mm4rx[P]piscine_cpp/day05/ex01/main.cpp
// Function: main
int main(void)
{
	Bureaucrat john("John", 3);
	Form deal("Deal", 11, 1);

	std::cout << john << std::endl;
	try
	{
		john.setGrade(151);
	}
	catch(std::exception)
	{
		std::cout << "Error when setting grade." << std::endl;
	}
	std::cout << john << std::endl;
	try
	{
		john.setGrade(1);
	}
	catch(std::exception)
	{
		std::cout << "Error when setting grade." << std::endl;
	}
	std::cout << john << std::endl;
	try
	{
		john.incrementGrade();
	}
	catch(std::exception)
	{
		std::cout << "Error when incrementing grade." << std::endl;
	}
	john.setGrade(10);
	std::cout << deal << std::endl;
	try
	{
		deal.beSigned(john);
	}
	catch(std::exception)
	{
		std::cout << john.getName() << " cant sign " << deal.getName() << " because its grade is too low." << std::endl;
	}
	john.signForm(deal);
	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movl $0x0, -0x4(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x2210
movq -0x130(%rbp), %rdx
leaq 0x1007(%rip), %rsi      # 0x4117
leaq -0x50(%rbp), %rdi
callq 0x3730
jmp 0x311b
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl $0x3, %edx
callq 0x2420
jmp 0x312f
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq -0x51(%rbp), %rdi
callq 0x2150
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x2210
movq -0x138(%rbp), %rdx
leaq 0xfba(%rip), %rsi       # 0x411c
leaq -0xc0(%rbp), %rdi
callq 0x3730
jmp 0x3170
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movl $0xb, %edx
movl $0x1, %ecx
callq 0x2b10
jmp 0x318f
leaq -0xc0(%rbp), %rdi
callq 0x2090
leaq -0xc1(%rbp), %rdi
callq 0x2150
movq 0x3e2a(%rip), %rdi      # 0x6fd8
leaq -0x30(%rbp), %rsi
callq 0x27f0
movq %rax, -0x140(%rbp)
jmp 0x31c0
movq -0x140(%rbp), %rdi
movq 0x3df2(%rip), %rsi      # 0x6fc0
callq 0x2130
jmp 0x31d5
leaq -0x30(%rbp), %rdi
movl $0x97, %esi
callq 0x2480
jmp 0x31e5
jmp 0x32f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x320d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x2090
leaq -0x51(%rbp), %rdi
callq 0x2150
jmp 0x3713
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x3241
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x2090
leaq -0xc1(%rbp), %rdi
callq 0x2150
jmp 0x370a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x36fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x36fe
movq -0x60(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x2190
movq %rax, %rsi
leaq -0xd0(%rbp), %rdi
callq 0x37e0
movq -0x150(%rbp), %rdi
callq 0x2050
movq 0x3d27(%rip), %rdi      # 0x6fd8
leaq 0xe69(%rip), %rsi       # 0x4121
callq 0x2110
movq %rax, -0x148(%rbp)
jmp 0x32c6
movq -0x148(%rbp), %rdi
movq 0x3cec(%rip), %rsi      # 0x6fc0
callq 0x2130
jmp 0x32db
leaq -0xd0(%rbp), %rdi
callq 0x2240
callq 0x21d0
jmp 0x32ee
jmp 0x32f0
movq 0x3ce1(%rip), %rdi      # 0x6fd8
leaq -0x30(%rbp), %rsi
callq 0x27f0
movq %rax, -0x158(%rbp)
jmp 0x3309
movq -0x158(%rbp), %rdi
movq 0x3ca9(%rip), %rsi      # 0x6fc0
callq 0x2130
jmp 0x331e
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x2480
jmp 0x332e
jmp 0x33e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x2240
callq 0x21d0
jmp 0x3352
jmp 0x36fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x36fe
movq -0x60(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x2190
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
callq 0x37e0
movq -0x168(%rbp), %rdi
callq 0x2050
movq 0x3c33(%rip), %rdi      # 0x6fd8
leaq 0xd75(%rip), %rsi       # 0x4121
callq 0x2110
movq %rax, -0x160(%rbp)
jmp 0x33ba
movq -0x160(%rbp), %rdi
movq 0x3bf8(%rip), %rsi      # 0x6fc0
callq 0x2130
jmp 0x33cf
leaq -0xd8(%rbp), %rdi
callq 0x2240
callq 0x21d0
jmp 0x33e2
jmp 0x33e4
movq 0x3bed(%rip), %rdi      # 0x6fd8
leaq -0x30(%rbp), %rsi
callq 0x27f0
movq %rax, -0x170(%rbp)
jmp 0x33fd
movq -0x170(%rbp), %rdi
movq 0x3bb5(%rip), %rsi      # 0x6fc0
callq 0x2130
jmp 0x3412
leaq -0x30(%rbp), %rdi
callq 0x2650
jmp 0x341d
jmp 0x34d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x2240
callq 0x21d0
jmp 0x3441
jmp 0x36fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x36fe
movq -0x60(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x2190
movq %rax, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x37e0
movq -0x180(%rbp), %rdi
callq 0x2050
movq 0x3b44(%rip), %rdi      # 0x6fd8
leaq 0xca0(%rip), %rsi       # 0x413b
callq 0x2110
movq %rax, -0x178(%rbp)
jmp 0x34a9
movq -0x178(%rbp), %rdi
movq 0x3b09(%rip), %rsi      # 0x6fc0
callq 0x2130
jmp 0x34be
leaq -0xe0(%rbp), %rdi
callq 0x2240
callq 0x21d0
jmp 0x34d1
jmp 0x34d3
leaq -0x30(%rbp), %rdi
movl $0xa, %esi
callq 0x2480
jmp 0x34e3
movq 0x3aee(%rip), %rdi      # 0x6fd8
leaq -0xa0(%rbp), %rsi
callq 0x2d80
movq %rax, -0x188(%rbp)
jmp 0x34ff
movq -0x188(%rbp), %rdi
movq 0x3ab3(%rip), %rsi      # 0x6fc0
callq 0x2130
jmp 0x3514
leaq -0xa0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2e80
jmp 0x3526
jmp 0x366f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x2240
callq 0x21d0
jmp 0x354a
jmp 0x36fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x36fe
movq -0x60(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x2190
movq %rax, %rsi
leaq -0xe8(%rbp), %rdi
callq 0x37e0
movq -0x190(%rbp), %rdi
callq 0x2050
leaq -0x108(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2620
jmp 0x35a8
movq 0x3a29(%rip), %rdi      # 0x6fd8
leaq -0x108(%rbp), %rsi
callq 0x2100
movq %rax, -0x198(%rbp)
jmp 0x35c4
movq -0x198(%rbp), %rdi
leaq 0xb88(%rip), %rsi       # 0x415a
callq 0x2110
movq %rax, -0x1a0(%rbp)
jmp 0x35e0
leaq -0x128(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2cf0
jmp 0x35f5
movq -0x1a0(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x2100
movq %rax, -0x1a8(%rbp)
jmp 0x3611
movq -0x1a8(%rbp), %rdi
leaq 0xb47(%rip), %rsi       # 0x4166
callq 0x2110
movq %rax, -0x1b0(%rbp)
jmp 0x362d
movq -0x1b0(%rbp), %rdi
movq 0x3985(%rip), %rsi      # 0x6fc0
callq 0x2130
jmp 0x3642
leaq -0x128(%rbp), %rdi
callq 0x2090
leaq -0x108(%rbp), %rdi
callq 0x2090
leaq -0xe8(%rbp), %rdi
callq 0x2240
callq 0x21d0
jmp 0x366d
jmp 0x366f
leaq -0x30(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x26b0
jmp 0x3681
movl $0x0, -0x4(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x2ab0
leaq -0x30(%rbp), %rdi
callq 0x2600
movl -0x4(%rbp), %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x36e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x36dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x2090
leaq -0x108(%rbp), %rdi
callq 0x2090
leaq -0xe8(%rbp), %rdi
callq 0x2240
callq 0x21d0
jmp 0x36fc
jmp 0x36fe
leaq -0xa0(%rbp), %rdi
callq 0x2ab0
leaq -0x30(%rbp), %rdi
callq 0x2600
movq -0x60(%rbp), %rdi
callq 0x2200
movq %rax, %rdi
callq 0x29a0
nopw %cs:(%rax,%rax)
nop