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

	// Avoid shadow declarations.
	local_variable_names = resource_names;

	string decl;

	auto &type = get<SPIRType>(func.return_type);
	decl += flags_to_precision_qualifiers_glsl(type, return_flags);
	decl += type_to_glsl(type);
	decl += type_to_array_glsl(type);
	decl += " ";

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

	decl += "(";
	vector<string> arglist;
	for (auto &arg : func.arguments)
	{
		// Do not pass in separate images or samplers if we're remapping
		// to combined image samplers.
		if (skip_argument(arg.id))
			continue;

		// Might change the variable name if it already exists in this function.
		// SPIRV OpName doesn't have any semantic effect, so it's valid for an implementation
		// to use same name for variables.
		// Since we want to make the GLSL debuggable and somewhat sane, use fallback names for variables which are duplicates.
		add_local_variable_name(arg.id);

		arglist.push_back(argument_decl(arg));

		// 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;
	}

	for (auto &arg : func.shadow_arguments)
	{
		// Might change the variable name if it already exists in this function.
		// SPIRV OpName doesn't have any semantic effect, so it's valid for an implementation
		// to use same name for variables.
		// Since we want to make the GLSL debuggable and somewhat sane, use fallback names for variables which are duplicates.
		add_local_variable_name(arg.id);

		arglist.push_back(argument_decl(arg));

		// 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 += merge(arglist);
	decl += ")";
	statement(decl);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rsi), %eax
cmpl 0x108(%rdi), %eax
je 0x3e847
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3e668
leaq 0x488(%rbx), %rsi
leaq 0x450(%rbx), %rdi
callq 0xb54c
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl 0xc(%r14), %esi
movq %rbx, %rdi
callq 0x90a4
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x25714
leaq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x64d0
movq (%rbx), %rax
movq %rsp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq *0x98(%rax)
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x64f0
movq %rsp, %rdi
callq 0x6548
movq %rsp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2547c
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x64f0
movq %rsp, %rdi
callq 0x6548
leaq 0x50f9e(%rip), %rsi     # 0x8f886
leaq 0x20(%rsp), %rdi
callq 0x64d0
movl 0x8(%r14), %edx
cmpl 0x108(%rbx), %edx
jne 0x3e918
leaq 0x5a168(%rip), %rsi     # 0x98a6d
leaq 0x20(%rsp), %rdi
callq 0x64d0
movb $0x1, 0x5d8(%rbx)
jmp 0x3e93c
movq (%rbx), %rax
movq %rsp, %rdi
pushq $0x1
popq %rcx
movq %rbx, %rsi
callq *0x38(%rax)
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x64f0
movq %rsp, %rdi
callq 0x6548
leaq 0x5f2e6(%rip), %rsi     # 0x9dc29
leaq 0x20(%rsp), %rdi
callq 0x64d0
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %r15
andq $0x0, 0x10(%r15)
movaps %xmm0, (%r15)
movq 0x18(%r14), %r12
movq 0x20(%r14), %rbp
movq %rsp, %r13
cmpq %rbp, %r12
je 0x3e9cd
movl 0x4(%r12), %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x148(%rax)
testb %al, %al
jne 0x3e9c7
movl 0x4(%r12), %esi
movq %rbx, %rdi
callq 0x2f168
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x3dae4
movq %r15, %rdi
movq %r13, %rsi
callq 0xcc8c
movq %r13, %rdi
callq 0x6548
movl 0x4(%r12), %esi
movq %rbx, %rdi
callq 0xa9e4
testq %rax, %rax
je 0x3e9c7
movq %r12, 0x68(%rax)
addq $0x14, %r12
jmp 0x3e969
movq 0x30(%r14), %r15
movq 0x38(%r14), %r13
movq %rsp, %r14
leaq 0x40(%rsp), %r12
cmpq %r13, %r15
je 0x3ea2a
movl 0x4(%r15), %esi
movq %rbx, %rdi
callq 0x2f168
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3dae4
movq %r12, %rdi
movq %r14, %rsi
callq 0xcc8c
movq %r14, %rdi
callq 0x6548
movl 0x4(%r15), %esi
movq %rbx, %rdi
callq 0xa9e4
testq %rax, %rax
je 0x3ea24
movq %r15, 0x68(%rax)
addq $0x14, %r15
jmp 0x3e9dd
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x41980
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x64f0
movq %rsp, %rdi
callq 0x6548
leaq 0x56fa2(%rip), %rsi     # 0x959f5
leaq 0x20(%rsp), %rdi
callq 0x64d0
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x9da6
leaq 0x40(%rsp), %rdi
callq 0xb98a
leaq 0x20(%rsp), %rdi
callq 0x6548
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3ea99
jmp 0x3eaaa
jmp 0x3eab9
jmp 0x3eac8
jmp 0x3ea99
jmp 0x3eaaa
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6548
jmp 0x3ead5
jmp 0x3eaaa
jmp 0x3eac8
movq %rax, %rbx
jmp 0x3ead5
jmp 0x3eab9
jmp 0x3eac8
jmp 0x3eac8
jmp 0x3eac8
jmp 0x3eac8
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6548
jmp 0x3eacb
jmp 0x3eac8
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xb98a
leaq 0x20(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
nop