cdecl is an useful online tool to demystify complicated C declarations.
Inserting int (*(*foo())())() returns:
declare foo as function returning pointer to function returning pointer to function returning int
I've replaced tmp with int as the tool does not support templates.