// File: iZhangHui[P]CppPrimer/CH06_Functions/examples/fcnptrRet.cc
// Function: main
int main()
{
	// "sum" is the argument to getFcn
	// ("hello", "world!") are arguments to the function getFcn returns
	cout << getFcn("sum")("hello", "world!") << endl;    // prints 11
	cout << getFcn("larger")("hello", "world!") << endl; // prints 6

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movl $0x0, -0x4(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x110(%rbp)
callq 0x10d0
movq -0x110(%rbp), %rdx
leaq 0xcc4(%rip), %rsi       # 0x2004
leaq -0x28(%rbp), %rdi
callq 0x10a0
jmp 0x134b
leaq -0x28(%rbp), %rdi
callq 0x12c0
movq %rax, -0x118(%rbp)
jmp 0x135d
leaq -0x61(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x10d0
movq -0x120(%rbp), %rdx
leaq 0xc8d(%rip), %rsi       # 0x2008
leaq -0x60(%rbp), %rdi
callq 0x10a0
jmp 0x1386
leaq -0x89(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x10d0
movq -0x128(%rbp), %rdx
leaq 0xc67(%rip), %rsi       # 0x200e
leaq -0x88(%rbp), %rdi
callq 0x10a0
jmp 0x13b5
movq -0x118(%rbp), %rax
leaq -0x60(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq *%rax
movq %rax, -0x130(%rbp)
jmp 0x13d2
movq -0x130(%rbp), %rsi
movq 0x2bf8(%rip), %rdi      # 0x3fd8
callq 0x1030
movq %rax, -0x138(%rbp)
jmp 0x13ee
movq -0x138(%rbp), %rdi
movq 0x2bcc(%rip), %rsi      # 0x3fc8
callq 0x1080
jmp 0x1403
leaq -0x88(%rbp), %rdi
callq 0x1050
leaq -0x89(%rbp), %rdi
callq 0x1090
leaq -0x60(%rbp), %rdi
callq 0x1050
leaq -0x61(%rbp), %rdi
callq 0x1090
leaq -0x28(%rbp), %rdi
callq 0x1050
leaq -0x29(%rbp), %rdi
callq 0x1090
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x10d0
movq -0x140(%rbp), %rdx
leaq 0xbb5(%rip), %rsi       # 0x2015
leaq -0xb0(%rbp), %rdi
callq 0x10a0
jmp 0x146e
leaq -0xb0(%rbp), %rdi
callq 0x12c0
movq %rax, -0x148(%rbp)
jmp 0x1483
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x10d0
movq -0x150(%rbp), %rdx
leaq 0xb64(%rip), %rsi       # 0x2008
leaq -0xd8(%rbp), %rdi
callq 0x10a0
jmp 0x14b2
leaq -0x101(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x10d0
movq -0x158(%rbp), %rdx
leaq 0xb3b(%rip), %rsi       # 0x200e
leaq -0x100(%rbp), %rdi
callq 0x10a0
jmp 0x14e1
movq -0x148(%rbp), %rax
leaq -0xd8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq *%rax
movq %rax, -0x160(%rbp)
jmp 0x1501
movq -0x160(%rbp), %rsi
movq 0x2ac9(%rip), %rdi      # 0x3fd8
callq 0x1030
movq %rax, -0x168(%rbp)
jmp 0x151d
movq -0x168(%rbp), %rdi
movq 0x2a9d(%rip), %rsi      # 0x3fc8
callq 0x1080
jmp 0x1532
leaq -0x100(%rbp), %rdi
callq 0x1050
leaq -0x101(%rbp), %rdi
callq 0x1090
leaq -0xd8(%rbp), %rdi
callq 0x1050
leaq -0xd9(%rbp), %rdi
callq 0x1090
leaq -0xb0(%rbp), %rdi
callq 0x1050
leaq -0xb1(%rbp), %rdi
callq 0x1090
xorl %eax, %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x15fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x15f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x15ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x15d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x1050
leaq -0x89(%rbp), %rdi
callq 0x1090
leaq -0x60(%rbp), %rdi
callq 0x1050
leaq -0x61(%rbp), %rdi
callq 0x1090
leaq -0x28(%rbp), %rdi
callq 0x1050
leaq -0x29(%rbp), %rdi
callq 0x1090
jmp 0x1696
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x168a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x167e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1672
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x165a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x1050
leaq -0x101(%rbp), %rdi
callq 0x1090
leaq -0xd8(%rbp), %rdi
callq 0x1050
leaq -0xd9(%rbp), %rdi
callq 0x1090
leaq -0xb0(%rbp), %rdi
callq 0x1050
leaq -0xb1(%rbp), %rdi
callq 0x1090
movq -0x38(%rbp), %rdi
callq 0x10c0
nop