// File: t0mm4rx[P]piscine_cpp/day06/ex02/main.cpp
// Function: identify_from_reference(Base&)
void identify_from_reference(Base &p)
{
	Base	a;
	try
	{
		a = dynamic_cast<A&>(p);
		std::cout << "A" << std::endl;
	}
	catch (std::bad_cast err) {}
	try
	{
		a = dynamic_cast<B&>(p);
		std::cout << "B" << std::endl;
	}
	catch (std::bad_cast err) {}
	try
	{
		a = dynamic_cast<C&>(p);
		std::cout << "C" << std::endl;
	}
	catch (std::bad_cast err) {}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x17a0
movq -0x8(%rbp), %rdi
leaq 0x28d5(%rip), %rsi      # 0x3cc8
leaq 0x28fe(%rip), %rdx      # 0x3cf8
xorl %eax, %eax
movl %eax, %ecx
callq 0x10a0
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x1414
callq 0x1100
jmp 0x1414
movq -0x40(%rbp), %rsi
leaq -0x10(%rbp), %rdi
callq 0x17c0
movq 0x2bb0(%rip), %rdi      # 0x3fd8
leaq 0xbde(%rip), %rsi       # 0x200d
callq 0x1060
movq %rax, -0x48(%rbp)
jmp 0x143a
movq -0x48(%rbp), %rdi
movq 0x2b73(%rip), %rsi      # 0x3fb8
callq 0x1090
jmp 0x144c
jmp 0x14a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1647
movq -0x18(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x10b0
movq %rax, %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x17e0
movq -0x58(%rbp), %rdi
callq 0x1030
movq -0x50(%rbp), %rdi
callq 0x10f0
callq 0x10d0
jmp 0x14a0
jmp 0x14a2
movq -0x8(%rbp), %rdi
leaq 0x281b(%rip), %rsi      # 0x3cc8
leaq 0x285c(%rip), %rdx      # 0x3d10
xorl %eax, %eax
movl %eax, %ecx
callq 0x10a0
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
jne 0x14ce
callq 0x1100
jmp 0x14ce
movq -0x60(%rbp), %rsi
leaq -0x10(%rbp), %rdi
callq 0x17c0
movq 0x2af6(%rip), %rdi      # 0x3fd8
leaq 0xb26(%rip), %rsi       # 0x200f
callq 0x1060
movq %rax, -0x68(%rbp)
jmp 0x14f4
movq -0x68(%rbp), %rdi
movq 0x2ab9(%rip), %rsi      # 0x3fb8
callq 0x1090
jmp 0x1506
jmp 0x156d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x1647
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1647
movq -0x18(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x10b0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x17e0
movq -0x78(%rbp), %rdi
callq 0x1030
movq -0x70(%rbp), %rdi
callq 0x10f0
callq 0x10d0
jmp 0x156b
jmp 0x156d
movq -0x8(%rbp), %rdi
leaq 0x2750(%rip), %rsi      # 0x3cc8
leaq 0x27a9(%rip), %rdx      # 0x3d28
xorl %eax, %eax
movl %eax, %ecx
callq 0x10a0
movq %rax, -0x80(%rbp)
cmpq $0x0, %rax
jne 0x1599
callq 0x1100
jmp 0x1599
movq -0x80(%rbp), %rsi
leaq -0x10(%rbp), %rdi
callq 0x17c0
movq 0x2a2b(%rip), %rdi      # 0x3fd8
leaq 0xa5d(%rip), %rsi       # 0x2011
callq 0x1060
movq %rax, -0x88(%rbp)
jmp 0x15c2
movq -0x88(%rbp), %rdi
movq 0x29e8(%rip), %rsi      # 0x3fb8
callq 0x1090
jmp 0x15d7
jmp 0x1635
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1647
movq -0x18(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x10b0
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x17e0
movq -0x98(%rbp), %rdi
callq 0x1030
movq -0x90(%rbp), %rdi
callq 0x10f0
callq 0x10d0
jmp 0x1633
jmp 0x1635
leaq -0x10(%rbp), %rdi
callq 0x1250
addq $0xa0, %rsp
popq %rbp
retq
leaq -0x10(%rbp), %rdi
callq 0x1250
movq -0x18(%rbp), %rdi
callq 0x10e0
nopl (%rax)