LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::to_pls_qualifiers_glsl(spirv_cross::SPIRVariable const&)
const char *CompilerGLSL::to_pls_qualifiers_glsl(const SPIRVariable &variable)
{
	auto flags = ir.meta[variable.self].decoration.decoration_flags;
	if (flags.get(DecorationRelaxedPrecision))
		return "mediump ";
	else
		return "highp ";
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
movl 0x8(%rsi), %eax
movq 0x38(%rdi), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq (%rcx,%rax), %rsi
addq $0x60, %rsi
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x934a
testb $0x1, (%rbx)
leaq 0x57954(%rip), %rax     # 0x95592
leaq 0x57944(%rip), %rbx     # 0x95589
cmoveq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb51c
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::emit_fixup()
void CompilerGLSL::emit_fixup()
{
	auto &execution = get_entry_point();
	if (execution.model == ExecutionModelVertex)
	{
		if (options.vertex.fixup_clipspace)
		{
			const char *suffix = backend.float_literal_suffix ? "f" : "";
			statement("gl_Position.z = 2.0", suffix, " * gl_Position.z - gl_Position.w;");
		}

		if (options.vertex.flip_vert_y)
			statement("gl_Position.y = -gl_Position.y;");
	}
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x12fa4
cmpl $0x0, 0xb8(%rax)
jne 0x3f63e
cmpb $0x1, 0x442(%rbx)
jne 0x3f626
leaq 0x5263e(%rip), %rax     # 0x91c34
leaq 0x5028a(%rip), %rcx     # 0x8f887
cmpb $0x0, 0x600(%rbx)
cmovneq %rax, %rcx
leaq 0x8(%rsp), %rdx
movq %rcx, (%rdx)
leaq 0x562fb(%rip), %rsi     # 0x95912
leaq 0x56308(%rip), %rcx     # 0x95926
movq %rbx, %rdi
callq 0x46c48
cmpb $0x1, 0x443(%rbx)
jne 0x3f63e
leaq 0x56312(%rip), %rsi     # 0x95948
movq %rbx, %rdi
callq 0x46d22
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::flush_phi_required(unsigned int, unsigned int)
bool CompilerGLSL::flush_phi_required(uint32_t from, uint32_t to)
{
	auto &child = get<SPIRBlock>(to);
	for (auto &phi : child.phi_variables)
		if (phi.parent == from)
			return true;
	return false;
}

// Assembly:
pushq %rbx
movl %esi, %ebx
movl %edx, %esi
callq 0x6bf0
movq 0x50(%rax), %rdx
movq 0x58(%rax), %rax
movq %rdx, %rcx
cmpq %rax, %rdx
je 0x3f667
leaq 0xc(%rcx), %rdx
cmpl %ebx, 0x4(%rcx)
jne 0x3f656
cmpq %rax, %rcx
setne %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::flush_phi(unsigned int, unsigned int)
void CompilerGLSL::flush_phi(uint32_t from, uint32_t to)
{
	auto &child = get<SPIRBlock>(to);

	for (auto &phi : child.phi_variables)
	{
		if (phi.parent == from)
		{
			auto &var = get<SPIRVariable>(phi.function_variable);

			// A Phi variable might be a loop variable, so flush to static expression.
			if (var.loop_variable && !var.loop_variable_enable)
				var.static_expression = phi.local_variable;
			else
			{
				flush_variable_declaration(phi.function_variable);

				// This might be called in continue block, so make sure we
				// use this to emit ESSL 1.0 compliant increments/decrements.
				auto lhs = to_expression(phi.function_variable);
				auto rhs = to_expression(phi.local_variable);
				if (!optimize_read_modify_write(get<SPIRType>(var.basetype), lhs, rhs))
					statement(lhs, " = ", rhs, ";");
			}

			register_write(phi.function_variable);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebx
movq %rdi, %r14
movl %edx, %esi
callq 0x6bf0
movq 0x50(%rax), %rbp
movq 0x58(%rax), %r15
leaq 0x28(%rsp), %r12
cmpq %r15, %rbp
je 0x3f75d
cmpl %ebx, 0x4(%rbp)
jne 0x3f754
movl 0x8(%rbp), %esi
movq %r14, %rdi
callq 0x9c0e
movq %rax, %r13
cmpb $0x1, 0x64(%rax)
jne 0x3f6c4
cmpb $0x0, 0x65(%r13)
je 0x3f742
movl 0x8(%rbp), %esi
movq %r14, %rdi
callq 0x36e4a
movl 0x8(%rbp), %edx
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2b9f0
movl (%rbp), %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0x2b9f0
movl 0xc(%r13), %esi
movq %r14, %rdi
callq 0x90a4
movq %r14, %rdi
movq %rax, %rsi
leaq 0x8(%rsp), %rdx
movq %r12, %rcx
callq 0x372fc
testb %al, %al
jne 0x3f72e
movq %r14, %rdi
leaq 0x8(%rsp), %rsi
leaq 0x5a2cb(%rip), %rdx     # 0x999ea
movq %r12, %rcx
leaq 0x5a358(%rip), %r8      # 0x99a81
callq 0x44c2a
movq %r12, %rdi
callq 0x6548
leaq 0x8(%rsp), %rdi
callq 0x6548
jmp 0x3f749
movl (%rbp), %eax
movl %eax, 0x3c(%r13)
movl 0x8(%rbp), %esi
movq %r14, %rdi
callq 0x107cc
addq $0xc, %rbp
jmp 0x3f697
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3f77e
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6548
leaq 0x8(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::propagate_loop_dominators(spirv_cross::SPIRBlock const&)
void CompilerGLSL::propagate_loop_dominators(const SPIRBlock &block)
{
	// Propagate down the loop dominator block, so that dominated blocks can back trace.
	if (block.merge == SPIRBlock::MergeLoop || block.loop_dominator)
	{
		uint32_t dominator = block.merge == SPIRBlock::MergeLoop ? block.self : block.loop_dominator;

		auto set_dominator = [this](uint32_t self, uint32_t new_dominator) {
			auto &dominated_block = this->get<SPIRBlock>(self);

			// If we already have a loop dominator, we're trying to break out to merge targets
			// which should not update the loop dominator.
			if (!dominated_block.loop_dominator)
				dominated_block.loop_dominator = new_dominator;
		};

		// After merging a loop, we inherit the loop dominator always.
		if (block.merge_block)
			set_dominator(block.merge_block, block.loop_dominator);

		if (block.true_block)
			set_dominator(block.true_block, dominator);
		if (block.false_block)
			set_dominator(block.false_block, dominator);
		if (block.next_block)
			set_dominator(block.next_block, dominator);
		if (block.default_block)
			set_dominator(block.default_block, dominator);

		for (auto &c : block.cases)
			set_dominator(c.block, dominator);

		// In older glslang output continue_block can be == loop header.
		if (block.continue_block && block.continue_block != block.self)
			set_dominator(block.continue_block, dominator);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movl 0x10(%rsi), %eax
movl 0xb4(%rsi), %edx
cmpl $0x1, %eax
setne %cl
testl %edx, %edx
sete %sil
testb %sil, %cl
jne 0x3fd33
movl %edx, %ebp
cmpl $0x1, %eax
jne 0x3fc8d
movl 0x8(%rbx), %ebp
movq %rdi, 0x8(%rsp)
movl 0x1c(%rbx), %esi
testl %esi, %esi
je 0x3fca3
leaq 0x8(%rsp), %rdi
callq 0x3fd40
movl 0x2c(%rbx), %esi
testl %esi, %esi
je 0x3fcb6
leaq 0x8(%rsp), %rdi
movl %ebp, %edx
callq 0x3fd40
movl 0x30(%rbx), %esi
testl %esi, %esi
je 0x3fcc9
leaq 0x8(%rsp), %rdi
movl %ebp, %edx
callq 0x3fd40
movl 0x18(%rbx), %esi
testl %esi, %esi
je 0x3fcdc
leaq 0x8(%rsp), %rdi
movl %ebp, %edx
callq 0x3fd40
movl 0x34(%rbx), %esi
testl %esi, %esi
je 0x3fcef
leaq 0x8(%rsp), %rdi
movl %ebp, %edx
callq 0x3fd40
movq 0x98(%rbx), %r15
movq 0xa0(%rbx), %r12
leaq 0x8(%rsp), %r14
cmpq %r12, %r15
je 0x3fd1b
movl 0x4(%r15), %esi
movq %r14, %rdi
movl %ebp, %edx
callq 0x3fd40
addq $0x8, %r15
jmp 0x3fd02
movl 0x20(%rbx), %esi
testl %esi, %esi
je 0x3fd33
cmpl 0x8(%rbx), %esi
je 0x3fd33
leaq 0x8(%rsp), %rdi
movl %ebp, %edx
callq 0x3fd40
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::emit_continue_block[abi:cxx11](unsigned int)
string CompilerGLSL::emit_continue_block(uint32_t continue_block)
{
	auto *block = &get<SPIRBlock>(continue_block);

	// While emitting the continue block, declare_temporary will check this
	// if we have to emit temporaries.
	current_continue_block = block;

	vector<string> statements;

	// Capture all statements into our list.
	auto *old = redirect_statement;
	redirect_statement = &statements;

	// Stamp out all blocks one after each other.
	while ((ir.block_meta[block->self] & ParsedIR::BLOCK_META_LOOP_HEADER_BIT) == 0)
	{
		propagate_loop_dominators(*block);
		// Write out all instructions we have in this block.
		emit_block_instructions(*block);

		// For plain branchless for/while continue blocks.
		if (block->next_block)
		{
			flush_phi(continue_block, block->next_block);
			block = &get<SPIRBlock>(block->next_block);
		}
		// For do while blocks. The last block will be a select block.
		else if (block->true_block)
		{
			flush_phi(continue_block, block->true_block);
			block = &get<SPIRBlock>(block->true_block);
		}
	}

	// Restore old pointer.
	redirect_statement = old;

	// Somewhat ugly, strip off the last ';' since we use ',' instead.
	// Ideally, we should select this behavior in statement().
	for (auto &s : statements)
	{
		if (!s.empty() && s.back() == ';')
			s.erase(s.size() - 1, 1);
	}

	current_continue_block = nullptr;
	return merge(statements);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movl %edx, %esi
callq 0x6bf0
movq %rax, %r15
movq %rax, 0x430(%r14)
movq %rsp, %rax
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movq 0x428(%r14), %r12
movq %rax, 0x428(%r14)
movl 0x8(%r15), %eax
movq 0x80(%r14), %rcx
testb $0x1, (%rcx,%rax)
jne 0x3fe07
movq %r14, %rdi
movq %r15, %rsi
callq 0x3fc56
movq %r14, %rdi
movq %r15, %rsi
callq 0x3746c
movl 0x18(%r15), %edx
testl %edx, %edx
jne 0x3fde9
movl 0x2c(%r15), %edx
testl %edx, %edx
je 0x3fda2
movq %r14, %rdi
movl %ebp, %esi
callq 0x3f670
addq $0x2c, %r15
jmp 0x3fdf7
movq %r14, %rdi
movl %ebp, %esi
callq 0x3f670
addq $0x18, %r15
movl (%r15), %esi
movq %r14, %rdi
callq 0x6bf0
movq %rax, %r15
jmp 0x3fda2
movq %r12, 0x428(%r14)
movq (%rsp), %r15
movq 0x8(%rsp), %r13
pushq $0x1
popq %r12
cmpq %r13, %r15
je 0x3fe47
movq 0x8(%r15), %rsi
testq %rsi, %rsi
je 0x3fe41
movq (%r15), %rax
cmpb $0x3b, -0x1(%rax,%rsi)
jne 0x3fe41
decq %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x6080
addq $0x20, %r15
jmp 0x3fe1b
andq $0x0, 0x430(%r14)
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x41980
movq %rsp, %rdi
callq 0xb98a
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3fe7a
jmp 0x3fe7a
jmp 0x3fe7a
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb98a
movq %rbx, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::emit_while_loop_initializers(spirv_cross::SPIRBlock const&)
void CompilerGLSL::emit_while_loop_initializers(const SPIRBlock &block)
{
	// While loops do not take initializers, so declare all of them outside.
	for (auto &loop_var : block.loop_variables)
	{
		auto &var = get<SPIRVariable>(loop_var);
		statement(variable_decl(var), ";");
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0xd0(%rsi), %r12
movq 0xd8(%rsi), %r13
movq %rsp, %r14
leaq 0x59bcb(%rip), %r15     # 0x99a81
cmpq %r13, %r12
je 0x3fef1
movl (%r12), %esi
movq %rbx, %rdi
callq 0x9c0e
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2619e
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x953a
movq %r14, %rdi
callq 0x6548
addq $0x4, %r12
jmp 0x3feb6
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::flush_undeclared_variables(spirv_cross::SPIRBlock&)
void CompilerGLSL::flush_undeclared_variables(SPIRBlock &block)
{
	// Enforce declaration order for regression testing purposes.
	sort(begin(block.dominated_variables), end(block.dominated_variables));

	for (auto &v : block.dominated_variables)
	{
		auto &var = get<SPIRVariable>(v);
		if (var.deferred_declaration)
			statement(variable_decl(var), ";");
		var.deferred_declaration = false;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0xb8(%rsi), %rdi
movq 0xc0(%rsi), %rsi
callq 0x1cabb
movq 0xb8(%r14), %r13
movq 0xc0(%r14), %rbp
leaq 0x8(%rsp), %r14
leaq 0x59222(%rip), %r15     # 0x99a81
cmpq %rbp, %r13
je 0x408a9
movl (%r13), %esi
movq %rbx, %rdi
callq 0x9c0e
movq %rax, %r12
cmpb $0x1, 0x59(%rax)
jne 0x4089d
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2619e
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x953a
movq %r14, %rdi
callq 0x6548
movb $0x0, 0x59(%r12)
addq $0x4, %r13
jmp 0x4085f
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::bitcast_from_builtin_load(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, spirv_cross::SPIRType const&)
void CompilerGLSL::bitcast_from_builtin_load(uint32_t source_id, std::string &expr,
                                             const spirv_cross::SPIRType &expr_type)
{
	auto *var = maybe_get_backing_variable(source_id);
	if (var)
		source_id = var->self;

	// Only interested in standalone builtin variables.
	if (!has_decoration(source_id, DecorationBuiltIn))
		return;

	auto builtin = static_cast<BuiltIn>(get_decoration(source_id, DecorationBuiltIn));
	auto expected_type = expr_type.basetype;

	// TODO: Fill in for more builtins.
	switch (builtin)
	{
	case BuiltInLayer:
	case BuiltInPrimitiveId:
	case BuiltInViewportIndex:
	case BuiltInInstanceId:
	case BuiltInInstanceIndex:
	case BuiltInVertexId:
	case BuiltInVertexIndex:
	case BuiltInSampleId:
	case BuiltInBaseVertex:
	case BuiltInBaseInstance:
	case BuiltInDrawIndex:
		expected_type = SPIRType::Int;
		break;

	case BuiltInGlobalInvocationId:
	case BuiltInLocalInvocationId:
	case BuiltInWorkgroupId:
	case BuiltInLocalInvocationIndex:
	case BuiltInWorkgroupSize:
	case BuiltInNumWorkgroups:
		expected_type = SPIRType::UInt;
		break;

	default:
		break;
	}

	if (expected_type != expr_type.basetype)
		expr = bitcast_expression(expr_type, expected_type, expr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
callq 0x1067e
testq %rax, %rax
je 0x40b64
movl 0x8(%rax), %ebp
pushq $0xb
popq %rdx
movq %r15, %rdi
movl %ebp, %esi
callq 0x103d2
testb %al, %al
je 0x40be5
pushq $0xb
popq %rdx
movq %r15, %rdi
movl %ebp, %esi
callq 0x12174
movl 0xc(%r14), %edx
pushq $0x4
popq %rcx
cmpl $0x2b, %eax
ja 0x40bb0
movl %eax, %esi
movabsq $0xc00000406e0, %rdi    # imm = 0xC00000406E0
btq %rsi, %rdi
jb 0x40bba
movl $0x3f000000, %edi       # imm = 0x3F000000
btq %rsi, %rdi
jae 0x40bb0
pushq $0x5
popq %rcx
jmp 0x40bba
addl $0xffffeeb8, %eax       # imm = 0xFFFFEEB8
cmpl $0x3, %eax
jae 0x40be5
cmpl %edx, %ecx
je 0x40be5
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %r8
callq 0x32752
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6320
movq %r12, %rdi
callq 0x6548
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::bitcast_to_builtin_store(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, spirv_cross::SPIRType const&)
void CompilerGLSL::bitcast_to_builtin_store(uint32_t target_id, std::string &expr,
                                            const spirv_cross::SPIRType &expr_type)
{
	// Only interested in standalone builtin variables.
	if (!has_decoration(target_id, DecorationBuiltIn))
		return;

	auto builtin = static_cast<BuiltIn>(get_decoration(target_id, DecorationBuiltIn));
	auto expected_type = expr_type.basetype;

	// TODO: Fill in for more builtins.
	switch (builtin)
	{
	case BuiltInLayer:
	case BuiltInPrimitiveId:
	case BuiltInViewportIndex:
		expected_type = SPIRType::Int;
		break;

	default:
		break;
	}

	if (expected_type != expr_type.basetype)
	{
		auto type = expr_type;
		type.basetype = expected_type;
		expr = bitcast_expression(type, expr_type.basetype, expr);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rcx, %r15
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
pushq $0xb
popq %rdx
callq 0x103d2
testb %al, %al
je 0x40c8d
pushq $0xb
popq %rdx
movq %r14, %rdi
movl %ebp, %esi
callq 0x12174
cmpl $0xa, %eax
ja 0x40c8d
movl $0x680, %ecx            # imm = 0x680
btl %eax, %ecx
jae 0x40c8d
cmpl $0x4, 0xc(%r15)
je 0x40c8d
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x1a29c
movl $0x4, 0xc(%r12)
movl 0xc(%r15), %ecx
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rbx, %r8
callq 0x32752
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6320
movq %r14, %rdi
callq 0x6548
leaq 0x28(%rsp), %rdi
callq 0x17a3e
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x17a3e
movq %rbx, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_common.hpp
// Function: spirv_cross::merge(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
inline std::string merge(const std::vector<std::string> &list)
{
	std::string s;
	for (auto &elem : list)
	{
		s += elem;
		if (&elem != &list.back())
			s += ", ";
	}
	return s;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
movq (%rsi), %r15
movq 0x8(%rsi), %r13
leaq 0x536de(%rip), %r12     # 0x9508b
cmpq %r13, %r15
je 0x419db
movq %rbx, %rdi
movq %r15, %rsi
callq 0x64f0
movq 0x8(%r14), %rax
addq $-0x20, %rax
cmpq %rax, %r15
je 0x419d5
movq %rbx, %rdi
movq %r12, %rsi
callq 0x64d0
addq $0x20, %r15
jmp 0x419ad
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x6548
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_common.hpp
// Function: spirv_cross::convert_to_string[abi:cxx11](float)
inline std::string convert_to_string(float t)
{
	// std::to_string for floating point values is broken.
	// Fallback to something more sane.
	char buf[64];
	sprintf(buf, SPIRV_CROSS_FLT_FMT, t);
	// Ensure that the literal is float.
	if (!strchr(buf, '.') && !strchr(buf, 'e'))
		strcat(buf, ".0");
	return buf;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
cvtss2sd %xmm0, %xmm0
leaq 0x52abd(%rip), %rsi     # 0x95d03
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movb $0x1, %al
callq 0x6060
pushq $0x2e
popq %rsi
movq %r14, %rdi
callq 0x60e0
testq %rax, %rax
jne 0x4328d
leaq 0x10(%rsp), %rdi
pushq $0x65
popq %rsi
callq 0x60e0
testq %rax, %rax
jne 0x4328d
leaq 0x10(%rsp), %rdi
callq 0x6120
movw $0x302e, 0x10(%rsp,%rax) # imm = 0x302E
movb $0x0, 0x12(%rsp,%rax)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_common.hpp
// Function: spirv_cross::convert_to_string[abi:cxx11](double)
inline std::string convert_to_string(double t)
{
	// std::to_string for floating point values is broken.
	// Fallback to something more sane.
	char buf[64];
	sprintf(buf, SPIRV_CROSS_FLT_FMT, t);
	// Ensure that the literal is float.
	if (!strchr(buf, '.') && !strchr(buf, 'e'))
		strcat(buf, ".0");
	return buf;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq 0x528d4(%rip), %rsi     # 0x95d03
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movb $0x1, %al
callq 0x6060
pushq $0x2e
popq %rsi
movq %r14, %rdi
callq 0x60e0
testq %rax, %rax
jne 0x43476
leaq 0x10(%rsp), %rdi
pushq $0x65
popq %rsi
callq 0x60e0
testq %rax, %rax
jne 0x43476
leaq 0x10(%rsp), %rdi
callq 0x6120
movw $0x302e, 0x10(%rsp,%rax) # imm = 0x302E
movb $0x0, 0x12(%rsp,%rax)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_header()
void CompilerHLSL::emit_header()
{
	for (auto &header : header_lines)
		statement(header);

	if (header_lines.size() > 0)
	{
		statement("");
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x738(%rdi), %r14
movq 0x740(%rdi), %r15
cmpq %r15, %r14
je 0x512f2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9da6
addq $0x20, %r14
jmp 0x512dc
movq 0x740(%rbx), %rax
cmpq 0x738(%rbx), %rax
je 0x51316
leaq 0x3e57e(%rip), %rsi     # 0x8f887
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x928e
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_interface_block_globally(spirv_cross::SPIRVariable const&)
void CompilerHLSL::emit_interface_block_globally(const SPIRVariable &var)
{
	add_resource_name(var.self);

	// The global copies of I/O variables should not contain interpolation qualifiers.
	// These are emitted inside the interface structs.
	auto &flags = ir.meta[var.self].decoration.decoration_flags;
	auto old_flags = flags;
	flags.reset();
	statement("static ", variable_decl(var), ";");
	flags = old_flags;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rsi), %esi
callq 0x22d1a
movl 0x8(%r15), %eax
movq 0x38(%r14), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq (%rcx,%rax), %rbx
addq $0x60, %rbx
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x934a
movq %rbx, %rdi
callq 0x17770
movq %rsp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2619e
leaq 0x45663(%rip), %rsi     # 0x969d7
leaq 0x48706(%rip), %rcx     # 0x99a81
movq %rsp, %rdx
movq %r14, %rdi
callq 0x474ea
movq %rsp, %rdi
callq 0x6548
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x19146
leaq 0x28(%rsp), %rdi
callq 0xb51c
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x513be
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6548
jmp 0x513c1
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xb51c
movq %rbx, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::type_to_consumed_locations(spirv_cross::SPIRType const&) const
uint32_t CompilerHLSL::type_to_consumed_locations(const SPIRType &type) const
{
	// TODO: Need to verify correctness.
	uint32_t elements = 0;

	if (type.basetype == SPIRType::Struct)
	{
		for (uint32_t i = 0; i < uint32_t(type.member_types.size()); i++)
			elements += type_to_consumed_locations(get<SPIRType>(type.member_types[i]));
	}
	else
	{
		uint32_t array_multiplier = 1;
		for (uint32_t i = 0; i < uint32_t(type.array.size()); i++)
		{
			if (type.array_size_literal[i])
				array_multiplier *= type.array[i];
			else
				array_multiplier *= get<SPIRConstant>(type.array[i]).scalar();
		}
		elements += array_multiplier * type.columns;
	}
	return elements;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0xc, 0xc(%rsi)
jne 0x5162a
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
movl %ecx, %ecx
cmpq %rcx, %r15
jae 0x51680
movl (%rax,%r15,4), %esi
movq %r14, %rdi
callq 0x16fc8
movq %r14, %rdi
movq %rax, %rsi
callq 0x515da
addl %eax, %ebp
incq %r15
jmp 0x515f6
leaq 0x38(%rbx), %r15
pushq $0x1
popq %rbp
xorl %r13d, %r13d
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
subq 0x20(%rbx), %rax
shrq $0x2, %rax
movl %eax, %eax
cmpq %rax, %r12
jae 0x5167c
movq %r15, %rdi
movq %r12, %rsi
callq 0xab22
movl %eax, %ecx
movq 0x20(%rbx), %rax
addq %r13, %rax
testb %cl, %cl
jne 0x51670
movl (%rax), %esi
movq %r14, %rdi
callq 0x1708c
addq $0x10, %rax
imull (%rax), %ebp
incq %r12
addq $0x4, %r13
jmp 0x51637
imull 0x18(%rbx), %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::to_interpolation_qualifiers[abi:cxx11](spirv_cross::Bitset const&)
string CompilerHLSL::to_interpolation_qualifiers(const Bitset &flags)
{
	string res;
	//if (flags & (1ull << DecorationSmooth))
	//    res += "linear ";
	if (flags.get(DecorationFlat))
		res += "nointerpolation ";
	if (flags.get(DecorationNoPerspective))
		res += "noperspective ";
	if (flags.get(DecorationCentroid))
		res += "centroid ";
	if (flags.get(DecorationPatch))
		res += "patch "; // Seems to be different in actual HLSL.
	if (flags.get(DecorationSample))
		res += "sample ";
	if (flags.get(DecorationInvariant))
		res += "invariant "; // Not supported?

	return res;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movq %rdx, %r14
movb $0x0, 0x10(%rdi)
movq (%rdx), %rax
btl $0xe, %eax
jae 0x516c7
leaq 0x45323(%rip), %rsi     # 0x969df
movq %rbx, %rdi
callq 0x64d0
movq (%r14), %rax
btl $0xd, %eax
jae 0x516df
leaq 0x4038a(%rip), %rsi     # 0x91a5e
movq %rbx, %rdi
callq 0x64d0
movq (%r14), %rax
btl $0x10, %eax
jae 0x516f7
leaq 0x40381(%rip), %rsi     # 0x91a6d
movq %rbx, %rdi
callq 0x64d0
movq (%r14), %rax
testw %ax, %ax
jns 0x5170e
leaq 0x40374(%rip), %rsi     # 0x91a77
movq %rbx, %rdi
callq 0x64d0
movq (%r14), %rax
btl $0x11, %eax
jae 0x51726
leaq 0x40363(%rip), %rsi     # 0x91a7e
movq %rbx, %rdi
callq 0x64d0
movq (%r14), %rax
btl $0x12, %eax
jae 0x5173b
leaq 0x40353(%rip), %rsi     # 0x91a86
movq %rbx, %rdi
callq 0x64d0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x6548
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::to_semantic[abi:cxx11](unsigned int)
std::string CompilerHLSL::to_semantic(uint32_t vertex_location)
{
	for (auto &attribute : remap_vertex_attributes)
		if (attribute.location == vertex_location)
			return attribute.semantic;

	return join("TEXCOORD", vertex_location);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rax
movq %rdi, %rbx
movl %edx, 0xc(%rsp)
movq 0x7b0(%rsi), %rsi
movq 0x7b8(%rax), %rax
cmpq %rax, %rsi
je 0x51786
cmpl %edx, (%rsi)
je 0x5179c
addq $0x28, %rsi
jmp 0x51777
leaq 0x45263(%rip), %rsi     # 0x969f0
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
callq 0x41d29
jmp 0x517a8
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x63c0
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::builtin_to_glsl[abi:cxx11](spv::BuiltIn, spv::StorageClass)
std::string CompilerHLSL::builtin_to_glsl(spv::BuiltIn builtin, spv::StorageClass storage)
{
	switch (builtin)
	{
	case BuiltInVertexId:
		return "gl_VertexID";
	case BuiltInInstanceId:
		return "gl_InstanceID";
	case BuiltInNumWorkgroups:
	{
		if (!num_workgroups_builtin)
			SPIRV_CROSS_THROW("NumWorkgroups builtin is used, but remap_num_workgroups_builtin() was not called. "
			                  "Cannot emit code for this builtin.");

		auto &var = get<SPIRVariable>(num_workgroups_builtin);
		auto &type = get<SPIRType>(var.basetype);
		return sanitize_underscores(join(to_name(num_workgroups_builtin), "_", get_member_name(type.self, 0)));
	}
	case BuiltInPointCoord:
		// Crude hack, but there is no real alternative. This path is only enabled if point_coord_compat is set.
		return "float2(0.5f, 0.5f)";
	case BuiltInSubgroupLocalInvocationId:
		return "WaveGetLaneIndex()";
	case BuiltInSubgroupSize:
		return "WaveGetLaneCount()";

	default:
		return CompilerGLSL::builtin_to_glsl(builtin, storage);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpl $0x29, %edx
je 0x52187
cmpl $0x6, %edx
je 0x5217e
cmpl $0x10, %edx
je 0x520d2
movq %rsi, %r14
cmpl $0x18, %edx
je 0x520ea
cmpl $0x24, %edx
je 0x520de
cmpl $0x5, %edx
jne 0x52171
leaq 0x41ee0(%rip), %rsi     # 0x93fad
jmp 0x5218e
leaq 0x449e5(%rip), %rsi     # 0x96abe
jmp 0x5218e
leaq 0x449ff(%rip), %rsi     # 0x96ae4
jmp 0x5218e
movl 0x7c8(%r14), %esi
testl %esi, %esi
je 0x521a9
movq %r14, %rdi
callq 0x9c0e
movl 0xc(%rax), %esi
movq %r14, %rdi
callq 0x90a4
movq %rax, %r15
movl 0x7c8(%r14), %edx
movq (%r14), %rax
leaq 0x28(%rsp), %rdi
pushq $0x1
popq %rcx
movq %r14, %rsi
callq *0x38(%rax)
movl 0x8(%r15), %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x11ee2
leaq 0x46e0b(%rip), %rdx     # 0x98f47
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %rax, %rcx
callq 0x5f4cf
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x20bb0
leaq 0x8(%rsp), %rdi
callq 0x6548
leaq 0x28(%rsp), %rdi
callq 0x6548
jmp 0x5219b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x347ea
jmp 0x5219b
leaq 0x41e8e(%rip), %rsi     # 0x94013
jmp 0x5218e
leaq 0x44943(%rip), %rsi     # 0x96ad1
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x4488e(%rip), %rsi     # 0x96a49
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x94bdd(%rip), %rsi     # 0xe6dc0
movq 0x95df6(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x52209
jmp 0x5222f
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
jmp 0x5222f
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6548
jmp 0x52225
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x6548
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_composite_constants()
void CompilerHLSL::emit_composite_constants()
{
	// HLSL cannot declare structs or arrays inline, so we must move them out to
	// global constants directly.
	bool emitted = false;

	for (auto &id : ir.ids)
	{
		if (id.get_type() == TypeConstant)
		{
			auto &c = id.get<SPIRConstant>();
			if (c.specialization)
				continue;

			auto &type = get<SPIRType>(c.constant_type);
			if (type.basetype == SPIRType::Struct || !type.array.empty())
			{
				auto name = to_name(c.self);
				statement("static const ", variable_decl(type, name), " = ", constant_expression(c), ";");
				emitted = true;
			}
		}
	}

	if (emitted)
		statement("");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %r14
movq 0x28(%rdi), %r12
xorl %r13d, %r13d
cmpq %r12, %r14
je 0x52440
cmpl $0x3, 0x8(%r14)
jne 0x52437
movq %r14, %rdi
callq 0x172b0
cmpb $0x0, 0x108(%rax)
jne 0x52437
movq %rax, %rbp
movl 0xc(%rax), %esi
movq %rbx, %rdi
callq 0x90a4
movq %rax, %r15
cmpl $0xc, 0xc(%rax)
je 0x523ae
movq 0x20(%r15), %rax
cmpq 0x28(%r15), %rax
je 0x52437
movl 0x8(%rbp), %edx
movq (%rbx), %rax
leaq 0x28(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rcx
callq *0x38(%rax)
movq (%rbx), %rax
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq *0xc8(%rax)
leaq 0x48(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x271d4
movq %rbx, %rdi
leaq 0x446fb(%rip), %rsi     # 0x96af7
leaq 0x8(%rsp), %r15
movq %r15, %rdx
leaq 0x475df(%rip), %rcx     # 0x999ea
movq %r13, %r8
leaq 0x4766c(%rip), %r9      # 0x99a81
callq 0x5f54a
movq %r13, %rdi
callq 0x6548
movq %r15, %rdi
callq 0x6548
leaq 0x28(%rsp), %rdi
callq 0x6548
movb $0x1, %r13b
addq $0x10, %r14
jmp 0x52360
testb $0x1, %r13b
je 0x52455
leaq 0x3d43a(%rip), %rsi     # 0x8f887
movq %rbx, %rdi
callq 0x928e
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x6548
jmp 0x52476
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6548
jmp 0x52485
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::layout_for_member[abi:cxx11](spirv_cross::SPIRType const&, unsigned int)
string CompilerHLSL::layout_for_member(const SPIRType &type, uint32_t index)
{
	auto &flags = get_member_decoration_bitset(type.self, index);

	// HLSL can emit row_major or column_major decoration in any struct.
	// Do not try to merge combined decorations for children like in GLSL.

	// Flip the convention. HLSL is a bit odd in that the memory layout is column major ... but the language API is "row-major".
	// The way to deal with this is to multiply everything in inverse order, and reverse the memory layout.
	if (flags.get(DecorationColMajor))
		return "row_major ";
	else if (flags.get(DecorationRowMajor))
		return "column_major ";

	return "";
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rax
movq %rdi, %rbx
movl 0x8(%rdx), %esi
movq %rax, %rdi
movl %ecx, %edx
callq 0x12050
movq (%rax), %rax
testb $0x20, %al
jne 0x540f7
testb $0x10, %al
jne 0x54105
leaq 0x3b797(%rip), %rsi     # 0x8f887
leaq 0xd(%rsp), %rdx
jmp 0x54111
leaq 0x4479a(%rip), %rsi     # 0x98898
leaq 0xf(%rsp), %rdx
jmp 0x54111
leaq 0x44797(%rip), %rsi     # 0x988a3
leaq 0xe(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::to_sampler_expression[abi:cxx11](unsigned int)
string CompilerHLSL::to_sampler_expression(uint32_t id)
{
	auto expr = join("_", to_expression(id));
	auto index = expr.find_first_of('[');
	if (index == string::npos)
	{
		return expr + "_sampler";
	}
	else
	{
		// We have an expression like _ident[array], so we cannot tack on _sampler, insert it inside the string instead.
		return expr.insert(index, "_sampler");
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x2b9f0
leaq 0x43c33(%rip), %rsi     # 0x98f47
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x46531
leaq 0x28(%rsp), %rdi
callq 0x6548
leaq 0x8(%rsp), %rdi
pushq $0x5b
popq %rsi
xorl %edx, %edx
callq 0x6370
cmpq $-0x1, %rax
je 0x55361
leaq 0x43708(%rip), %rdx     # 0x98a4f
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x60a0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x63c0
jmp 0x55375
leaq 0x436e7(%rip), %rdx     # 0x98a4f
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x174a5
leaq 0x8(%rsp), %rdi
callq 0x6548
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x5539c
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::to_func_call_arg[abi:cxx11](unsigned int)
string CompilerHLSL::to_func_call_arg(uint32_t id)
{
	string arg_str = CompilerGLSL::to_func_call_arg(id);

	if (hlsl_options.shader_model <= 30)
		return arg_str;

	// Manufacture automatic sampler arg if the arg is a SampledImage texture and we're in modern HLSL.
	auto &type = expression_type(id);

	// We don't have to consider combined image samplers here via OpSampledImage because
	// those variables cannot be passed as arguments to functions.
	// Only global SampledImage variables may be used as arguments.
	if (type.basetype == SPIRType::SampledImage && type.image.dim != DimBuffer)
		arg_str += ", " + to_sampler_expression(id);

	return arg_str;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x2b9b8
cmpl $0x1f, 0x788(%r14)
jb 0x55452
movq %r14, %rdi
movl %ebp, %esi
callq 0x104b0
cmpl $0xe, 0xc(%rax)
jne 0x55452
cmpl $0x5, 0x84(%rax)
je 0x55452
movq %rsp, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x552f6
leaq 0x3fc65(%rip), %rsi     # 0x9508b
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
callq 0x463dd
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x64f0
leaq 0x20(%rsp), %rdi
callq 0x6548
movq %rsp, %rdi
callq 0x6548
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x6548
jmp 0x55470
movq %rax, %r14
movq %rsp, %rdi
callq 0x6548
jmp 0x5547f
jmp 0x5547c
movq %rax, %r14
movq %rbx, %rdi
callq 0x6548
movq %r14, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_fixup()
void CompilerHLSL::emit_fixup()
{
	if (get_entry_point().model == ExecutionModelVertex)
	{
		// Do various mangling on the gl_Position.
		if (hlsl_options.shader_model <= 30)
		{
			statement("gl_Position.x = gl_Position.x - gl_HalfPixel.x * "
			          "gl_Position.w;");
			statement("gl_Position.y = gl_Position.y + gl_HalfPixel.y * "
			          "gl_Position.w;");
		}

		if (options.vertex.flip_vert_y)
			statement("gl_Position.y = -gl_Position.y;");
		if (options.vertex.fixup_clipspace)
			statement("gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;");
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x12fa4
cmpl $0x0, 0xb8(%rax)
jne 0x56408
cmpl $0x1e, 0x788(%rbx)
ja 0x563d7
leaq 0x427f4(%rip), %rsi     # 0x98bb4
movq %rbx, %rdi
callq 0x62452
leaq 0x42825(%rip), %rsi     # 0x98bf4
movq %rbx, %rdi
callq 0x62452
cmpb $0x1, 0x443(%rbx)
jne 0x563ef
leaq 0x3f561(%rip), %rsi     # 0x95948
movq %rbx, %rdi
callq 0x46d22
cmpb $0x1, 0x442(%rbx)
jne 0x56408
leaq 0x42835(%rip), %rsi     # 0x98c34
movq %rbx, %rdi
popq %rbx
jmp 0x6250e
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::to_resource_binding_sampler[abi:cxx11](spirv_cross::SPIRVariable const&)
string CompilerHLSL::to_resource_binding_sampler(const SPIRVariable &var)
{
	// For combined image samplers.
	if (!has_decoration(var.self, DecorationBinding))
		return "";

	return to_resource_register('s', get_decoration(var.self, DecorationBinding),
	                            get_decoration(var.self, DecorationDescriptorSet));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rdx), %esi
pushq $0x21
popq %rdx
movq %r14, %rdi
callq 0x103d2
testb %al, %al
je 0x57a93
movl 0x8(%r15), %esi
pushq $0x21
popq %rdx
movq %r14, %rdi
callq 0x12174
movl %eax, %ebp
movl 0x8(%r15), %esi
pushq $0x22
popq %rdx
movq %r14, %rdi
callq 0x12174
pushq $0x73
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %ecx
movl %eax, %r8d
callq 0x5527c
jmp 0x57aa7
leaq 0x37ded(%rip), %rsi     # 0x8f887
leaq 0x7(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_legacy_uniform(spirv_cross::SPIRVariable const&)
void CompilerHLSL::emit_legacy_uniform(const SPIRVariable &var)
{
	auto &type = get<SPIRType>(var.basetype);
	switch (type.basetype)
	{
	case SPIRType::Sampler:
	case SPIRType::Image:
		SPIRV_CROSS_THROW("Separate image and samplers not supported in legacy HLSL.");

	default:
		statement(variable_decl(var), ";");
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl 0xc(%rsi), %esi
callq 0x90a4
movl 0xc(%rax), %eax
orl $0x2, %eax
cmpl $0xf, %eax
je 0x57ed5
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2619e
leaq 0x41bcc(%rip), %rdx     # 0x99a81
movq %rbx, %rdi
movq %r15, %rsi
callq 0x953a
leaq 0x8(%rsp), %rdi
callq 0x6548
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x4107d(%rip), %rsi     # 0x98f64
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x8eeb1(%rip), %rsi     # 0xe6dc0
movq 0x900ca(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6548
jmp 0x57f4c
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x57f44
jmp 0x57f4c
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64b0
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_uniform(spirv_cross::SPIRVariable const&)
void CompilerHLSL::emit_uniform(const SPIRVariable &var)
{
	add_resource_name(var.self);
	if (hlsl_options.shader_model >= 40)
		emit_modern_uniform(var);
	else
		emit_legacy_uniform(var);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rsi), %esi
callq 0x22d1a
cmpl $0x28, 0x788(%r14)
jb 0x57f82
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x57ab6
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x57e78
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_load(spirv_cross::Instruction const&)
void CompilerHLSL::emit_load(const Instruction &instruction)
{
	auto ops = stream(instruction);

	auto *chain = maybe_get<SPIRAccessChain>(ops[2]);
	if (chain)
	{
		uint32_t result_type = ops[0];
		uint32_t id = ops[1];
		uint32_t ptr = ops[2];

		auto load_expr = read_access_chain(*chain);

		bool forward = should_forward(ptr) && forced_temporaries.find(id) == end(forced_temporaries);

		// Do not forward complex load sequences like matrices, structs and arrays.
		auto &type = get<SPIRType>(result_type);
		if (type.columns > 1 || !type.array.empty() || type.basetype == SPIRType::Struct)
			forward = false;

		auto &e = emit_op(result_type, id, load_expr, forward, true);
		e.need_transpose = false;
		register_read(id, ptr, forward);
	}
	else
		CompilerGLSL::emit_instruction(instruction);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x16f1e
movq %rax, %r15
movl 0x8(%rax), %esi
movq %rbx, %rdi
callq 0x17014
testq %rax, %rax
je 0x58eb1
movl (%r15), %r14d
movl 0x4(%r15), %ecx
movl %ecx, 0x4(%rsp)
movl 0x8(%r15), %ebp
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x58652
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2f360
testb %al, %al
je 0x58ec6
leaq 0x228(%rbx), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1c722
testq %rax, %rax
sete %r15b
jmp 0x58ec9
movq %rbx, %rdi
movq %r14, %rsi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x374a8
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x90a4
cmpl $0x1, 0x18(%rax)
jbe 0x58edf
xorl %r15d, %r15d
jmp 0x58eef
movq 0x20(%rax), %rcx
cmpq 0x28(%rax), %rcx
jne 0x58eda
cmpl $0xc, 0xc(%rax)
je 0x58eda
movl 0x4(%rsp), %edx
movzbl %r15b, %r15d
leaq 0x8(%rsp), %rcx
pushq $0x1
popq %r9
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %r8d
callq 0x2f196
movb $0x0, 0x39(%rax)
movl 0x4(%rsp), %esi
movq %rbx, %rdi
movl %ebp, %edx
movl %r15d, %ecx
callq 0x106dc
leaq 0x8(%rsp), %rdi
callq 0x6548
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x58f3e
jmp 0x58f3e
jmp 0x58f3e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_store(spirv_cross::Instruction const&)
void CompilerHLSL::emit_store(const Instruction &instruction)
{
	auto ops = stream(instruction);
	auto *chain = maybe_get<SPIRAccessChain>(ops[0]);
	if (chain)
		write_access_chain(*chain, ops[1]);
	else
		CompilerGLSL::emit_instruction(instruction);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0x16f1e
movq %rax, %r15
movl (%rax), %esi
movq %rbx, %rdi
callq 0x17014
testq %rax, %rax
je 0x5983c
movl 0x4(%r15), %edx
movq %rbx, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x58f54
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x374a8
// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::require_texture_query_variant(spirv_cross::SPIRType const&)
void CompilerHLSL::require_texture_query_variant(const SPIRType &type)
{
	uint32_t bit = 0;
	switch (type.image.dim)
	{
	case Dim1D:
		bit = type.image.arrayed ? Query1DArray : Query1D;
		break;

	case Dim2D:
		if (type.image.ms)
			bit = type.image.arrayed ? Query2DMSArray : Query2DMS;
		else
			bit = type.image.arrayed ? Query2DArray : Query2D;
		break;

	case Dim3D:
		bit = Query3D;
		break;

	case DimCube:
		bit = type.image.arrayed ? QueryCubeArray : QueryCube;
		break;

	case DimBuffer:
		bit = QueryBuffer;
		break;

	default:
		SPIRV_CROSS_THROW("Unsupported query type.");
	}

	switch (get<SPIRType>(type.image.type).basetype)
	{
	case SPIRType::Float:
		bit += QueryTypeFloat;
		break;

	case SPIRType::Int:
		bit += QueryTypeInt;
		break;

	case SPIRType::UInt:
		bit += QueryTypeUInt;
		break;

	default:
		SPIRV_CROSS_THROW("Unsupported query type.");
	}

	uint64_t mask = 1ull << bit;
	if ((required_textureSizeVariants & mask) == 0)
	{
		force_recompile = true;
		required_textureSizeVariants |= mask;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl 0x84(%rsi), %eax
cmpq $0x5, %rax
ja 0x5cf7b
movq %rdi, %rbx
leaq 0x3970e(%rip), %rcx     # 0x96598
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl 0x89(%rsi), %r14d
jmp 0x5ced6
pushq $0x5
jmp 0x5cea3
pushq $0x4
popq %r14
jmp 0x5ced6
movzbl 0x89(%rsi), %r14d
orl $0x6, %r14d
jmp 0x5ced6
movb 0x89(%rsi), %al
cmpb $0x1, 0x8a(%rsi)
jne 0x5cece
movzbl %al, %r14d
orl $0x8, %r14d
jmp 0x5ced6
movzbl %al, %r14d
orl $0x2, %r14d
movl 0x80(%rsi), %esi
movq %rbx, %rdi
callq 0x90a4
movl 0xc(%rax), %eax
cmpl $0xa, %eax
je 0x5cf00
cmpl $0x5, %eax
je 0x5cefc
cmpl $0x4, %eax
jne 0x5cf30
orl $0x10, %r14d
jmp 0x5cf00
orl $0x20, %r14d
pushq $0x1
popq %rax
movl %r14d, %ecx
shlq %cl, %rax
movq 0x7a0(%rbx), %rcx
btq %r14, %rcx
jb 0x5cf27
movb $0x1, 0x1d0(%rbx)
orq %rcx, %rax
movq %rax, 0x7a0(%rbx)
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x3cbf3(%rip), %rsi     # 0x99b35
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x89e56(%rip), %rsi     # 0xe6dc0
movq 0x8b06f(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x5cfc4
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x3cba8(%rip), %rsi     # 0x99b35
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x89e0b(%rip), %rsi     # 0xe6dc0
movq 0x8b024(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x5cfc8
jmp 0x5cfdc
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x5cfdf
jmp 0x5cfe7
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64b0