// File: /workspace/github_cpp_makefile_star2_O1/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 $0x68, %rsp
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %rbx
movl 0x8(%rsi), %eax
cmpl 0x108(%rdi), %eax
je 0x4d85d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x4d5f8
leaq 0x488(%rbx), %rsi
leaq 0x450(%rbx), %r14
movq %r14, %rdi
callq 0xd5d6
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
movl 0xc(%rbp), %esi
movq %rbx, %rdi
callq 0xa426
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x2beea
leaq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x64e0
movq (%rbx), %rax
movq %rsp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq *0x98(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x20(%rsp), %rdi
callq 0x60b0
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4d8f3
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rsp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2bb66
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x20(%rsp), %rdi
callq 0x60b0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4d92f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x67f78(%rip), %rsi     # 0xb58ae
leaq 0x20(%rsp), %rdi
callq 0x64e0
movl 0x8(%rbp), %edx
cmpl 0x108(%rbx), %edx
jne 0x4d965
leaq 0x71183(%rip), %rsi     # 0xbead5
leaq 0x20(%rsp), %rdi
callq 0x64e0
movb $0x1, 0x5d8(%rbx)
jmp 0x4d9a4
movq (%rbx), %rax
movq %rsp, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x20(%rsp), %rdi
callq 0x60b0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4d9a4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x762f6(%rip), %rsi     # 0xc3ca1
leaq 0x20(%rsp), %rdi
callq 0x64e0
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x18(%rbp), %r12
movq %rbp, 0x60(%rsp)
movq 0x20(%rbp), %r15
cmpq %r15, %r12
je 0x4da6b
movq %rsp, %r13
leaq 0x40(%rsp), %rbp
movl 0x4(%r12), %esi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x148(%rax)
testb %al, %al
jne 0x4da5e
movl 0x4(%r12), %eax
imulq $0x148, %rax, %rdx      # imm = 0x148
addq 0x38(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b9f6
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4c6d4
movq %rbp, %rdi
movq %r13, %rsi
callq 0xebe6
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4da48
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movl 0x4(%r12), %esi
movq %rbx, %rdi
callq 0xc7f4
testq %rax, %rax
je 0x4da5e
movq %r12, 0x68(%rax)
addq $0x14, %r12
cmpq %r15, %r12
jne 0x4d9e4
movq 0x60(%rsp), %rax
movq 0x30(%rax), %r12
movq 0x38(%rax), %rbp
cmpq %rbp, %r12
je 0x4daf3
movq %rsp, %r15
leaq 0x40(%rsp), %r13
movl 0x4(%r12), %eax
imulq $0x148, %rax, %rdx      # imm = 0x148
addq 0x38(%rbx), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b9f6
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4c6d4
movq %r13, %rdi
movq %r15, %rsi
callq 0xebe6
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4dad4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movl 0x4(%r12), %esi
movq %rbx, %rdi
callq 0xc7f4
testq %rax, %rax
je 0x4daea
movq %r12, 0x68(%rax)
addq $0x14, %r12
cmpq %rbp, %r12
jne 0x4da85
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq 0x40(%rsp), %r12
movq 0x48(%rsp), %r13
cmpq %r13, %r12
je 0x4db56
movq %rsp, %r14
leaq 0x6d598(%rip), %r15     # 0xbb0bb
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r14, %rdi
callq 0x60b0
movq 0x48(%rsp), %rax
addq $-0x20, %rax
cmpq %rax, %r12
je 0x4db4d
movq %r14, %rdi
movq %r15, %rsi
callq 0x64e0
addq $0x20, %r12
cmpq %r13, %r12
jne 0x4db23
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x20(%rsp), %rdi
callq 0x60b0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
leaq 0x30(%rsp), %r15
je 0x4db89
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x6de95(%rip), %rsi     # 0xbba25
leaq 0x20(%rsp), %rdi
callq 0x64e0
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0xb674
leaq 0x40(%rsp), %rdi
callq 0xda64
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x4dbc8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4dbdd
jmp 0x4dc14
jmp 0x4dc2c
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
jmp 0x4dbf9
jmp 0x4dc14
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4dc59
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x4dc59
jmp 0x4dc14
movq %rax, %rbx
jmp 0x4dc4f
movq %rax, %rbx
jmp 0x4dc59
jmp 0x4dc2c
jmp 0x4dc27
jmp 0x4dc27
jmp 0x4dc27
jmp 0x4dc27
jmp 0x4dc2c
jmp 0x4dc27
movq %rax, %rbx
jmp 0x4dc4a
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4dc4a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x30(%rsp), %r15
leaq 0x40(%rsp), %rdi
callq 0xda64
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x4dc70
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0