// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0xd6f(%rip), %rsi       # 0x2004
leaq 0xd6b(%rip), %rdx       # 0x2007
leaq -0x48(%rbp), %rdi
callq 0x150c
leaq 0xd58(%rip), %rsi       # 0x2004
leaq -0x48(%rbp), %rdi
callq 0x1040
testl %eax, %eax
leaq -0x92(%rip), %r14       # 0x122c
leaq -0x8b(%rip), %r13       # 0x123a
movq %r13, %rbx
cmoveq %r14, %rbx
leaq -0x78(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xd2d(%rip), %rsi       # 0x2008
leaq 0xd2b(%rip), %rdx       # 0x200d
leaq -0x88(%rbp), %rdi
callq 0x150c
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xd10(%rip), %rsi       # 0x200e
leaq 0xd0f(%rip), %rdx       # 0x2014
leaq -0x68(%rbp), %rdi
callq 0x150c
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq *%rbx
movq 0x2cb6(%rip), %rdi      # 0x3fd8
movq %rax, %rsi
callq 0x1050
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x1369
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x1381
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x139a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10b0
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
leaq 0xc69(%rip), %rsi       # 0x2015
leaq 0xc68(%rip), %rdx       # 0x201b
callq 0x150c
leaq 0xc45(%rip), %rsi       # 0x2004
leaq -0x48(%rbp), %rdi
callq 0x1040
testl %eax, %eax
cmoveq %r14, %r13
leaq -0x88(%rbp), %rdi
movq %r15, (%rdi)
leaq 0xc29(%rip), %rsi       # 0x2008
leaq 0xc27(%rip), %rdx       # 0x200d
callq 0x150c
leaq -0x68(%rbp), %rdi
movq %r12, (%rdi)
leaq 0xc15(%rip), %rsi       # 0x200e
leaq 0xc14(%rip), %rdx       # 0x2014
callq 0x150c
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq *%r13
movq 0x2bbe(%rip), %rdi      # 0x3fd8
movq %rax, %rsi
callq 0x1050
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x1461
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x1479
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x1492
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10b0
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14a9
jmp 0x14ae
jmp 0x14b3
movq %rax, %rbx
jmp 0x14d2
movq %rax, %rbx
jmp 0x14ea
movq %rax, %rbx
jmp 0x1503
jmp 0x14ba
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x14d2
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x14ea
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x1503
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x10b0
movq %rbx, %rdi
callq 0x10d0
nop