// File: rossy[P]crossc/SPIRV-Cross/spirv_cpp.cpp
// Function: spirv_cross::CompilerCPP::emit_function_prototype(spirv_cross::SPIRFunction&, spirv_cross::Bitset const&)
void CompilerCPP::emit_function_prototype(SPIRFunction &func, const Bitset &)
{
	if (func.self != ir.default_entry_point)
		add_function_overload(func);

	local_variable_names = resource_names;
	string decl;

	auto &type = get<SPIRType>(func.return_type);
	decl += "inline ";
	decl += type_to_glsl(type);
	decl += " ";

	if (func.self == ir.default_entry_point)
	{
		decl += "main";
		processing_entry_point = true;
	}
	else
		decl += to_name(func.self);

	decl += "(";
	for (auto &arg : func.arguments)
	{
		add_local_variable_name(arg.id);

		decl += argument_decl(arg);
		if (&arg != &func.arguments.back())
			decl += ", ";

		// Hold a pointer to the parameter so we can invalidate the readonly field if needed.
		auto *var = maybe_get<SPIRVariable>(arg.id);
		if (var)
			var->parameter = &arg;
	}

	decl += ")";
	statement(decl);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0xe0(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
cmpl 0x108(%rcx), %eax
je 0xde11
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x97940
movq -0xe0(%rbp), %rdi
movq %rdi, %rsi
addq $0x488, %rsi            # imm = 0x488
addq $0x450, %rdi            # imm = 0x450
callq 0x11580
leaq -0x38(%rbp), %rdi
callq 0x7530
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0xe8(%rbp)
jmp 0xde53
movq -0xe8(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq 0x130741(%rip), %rsi    # 0x13e5a6
leaq -0x38(%rbp), %rdi
callq 0x7340
jmp 0xde70
movq -0xe0(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x70(%rbp), %rdi
xorl %ecx, %ecx
callq *%rax
jmp 0xde8f
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x7470
jmp 0xde9e
leaq -0x70(%rbp), %rdi
callq 0x7708
leaq 0x1309ef(%rip), %rsi    # 0x13e89d
leaq -0x38(%rbp), %rdi
callq 0x7340
jmp 0xdeb9
movq -0xe0(%rbp), %rcx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
cmpl 0x108(%rcx), %eax
jne 0xdf1f
leaq 0x13a16e(%rip), %rsi    # 0x148044
leaq -0x38(%rbp), %rdi
callq 0x7340
jmp 0xdee1
movq -0xe0(%rbp), %rax
movb $0x1, 0x5d8(%rax)
jmp 0xdf81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xe136
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x7708
jmp 0xe136
movq -0xe0(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq -0x90(%rbp), %rdi
movl $0x1, %ecx
callq *%rax
jmp 0xdf44
leaq -0x38(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x7470
jmp 0xdf56
leaq -0x90(%rbp), %rdi
callq 0x7708
jmp 0xdf81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x7708
jmp 0xe136
leaq 0x13f3a5(%rip), %rsi    # 0x14d32d
leaq -0x38(%rbp), %rdi
callq 0x7340
jmp 0xdf93
movq -0x10(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0x115b0
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rdi
callq 0x115e0
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x11610
testb $0x1, %al
jne 0xdfe4
jmp 0xe100
leaq -0xa0(%rbp), %rdi
callq 0x11650
movq -0xe0(%rbp), %rdi
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x78460
jmp 0xe00f
movq -0xe0(%rbp), %rsi
movq -0xb0(%rbp), %rdx
leaq -0xd0(%rbp), %rdi
callq 0xe150
jmp 0xe02b
leaq -0x38(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x7470
jmp 0xe03d
leaq -0xd0(%rbp), %rdi
callq 0x7708
movq -0xb0(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
callq 0x11670
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
je 0xe0a4
leaq 0x136515(%rip), %rsi    # 0x14458f
leaq -0x38(%rbp), %rdi
callq 0x7340
jmp 0xe085
jmp 0xe0a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x7708
jmp 0xe136
movq -0xe0(%rbp), %rdi
movq -0xb0(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x116b0
movq %rax, -0xf8(%rbp)
jmp 0xe0c3
movq -0xf8(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
je 0xe0ed
movq -0xb0(%rbp), %rcx
movq -0xd8(%rbp), %rax
movq %rcx, 0x68(%rax)
jmp 0xe0ef
leaq -0xa0(%rbp), %rdi
callq 0x11710
jmp 0xdfc8
leaq 0x136df2(%rip), %rsi    # 0x144ef9
leaq -0x38(%rbp), %rdi
callq 0x7340
jmp 0xe112
movq -0xe0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x10200
jmp 0xe124
leaq -0x38(%rbp), %rdi
callq 0x7708
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x7708
movq -0x48(%rbp), %rdi
callq 0x7640
nopl (%rax,%rax)