// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::compile[abi:cxx11]()
string CompilerMSL::compile()
{
	// Force a classic "C" locale, reverts when function returns
	ClassicLocale classic_locale;

	// Do not deal with GLES-isms like precision, older extensions and such.
	options.vulkan_semantics = true;
	options.es = false;
	options.version = 450;
	backend.float_literal_suffix = false;
	backend.half_literal_suffix = "h";
	backend.uint32_t_literal_suffix = true;
	backend.basic_int_type = "int";
	backend.basic_uint_type = "uint";
	backend.discard_literal = "discard_fragment()";
	backend.swizzle_is_function = false;
	backend.shared_is_implied = false;
	backend.use_initializer_list = true;
	backend.use_typed_initializer_list = true;
	backend.native_row_major_matrix = false;
	backend.flexible_member_array_supported = false;
	backend.can_declare_arrays_inline = false;
	backend.can_return_array = false;
	backend.boolean_mix_support = false;
	backend.allow_truncated_access_chain = true;
	backend.array_is_value_type = false;

	is_rasterization_disabled = msl_options.disable_rasterization;

	replace_illegal_names();

	struct_member_padding.clear();

	build_function_control_flow_graphs_and_analyze();
	update_active_builtins();
	analyze_image_and_sampler_usage();
	analyze_sampled_image_usage();
	build_implicit_builtins();

	fixup_image_load_store_access();

	set_enabled_interface_variables(get_active_interface_variables());
	if (aux_buffer_id)
		active_interface_variables.insert(aux_buffer_id);

	// Preprocess OpCodes to extract the need to output additional header content
	preprocess_op_codes();

	// Create structs to hold input, output and uniform variables.
	// Do output first to ensure out. is declared at top of entry function.
	qual_pos_var_name = "";
	stage_out_var_id = add_interface_block(StorageClassOutput);
	stage_in_var_id = add_interface_block(StorageClassInput);

	// Metal vertex functions that define no output must disable rasterization and return void.
	if (!stage_out_var_id)
		is_rasterization_disabled = true;

	// Convert the use of global variables to recursively-passed function parameters
	localize_global_variables();
	extract_global_variables_from_functions();

	// Mark any non-stage-in structs to be tightly packed.
	mark_packable_structs();

	// Metal does not allow dynamic array lengths.
	// Resolve any specialization constants that are used for array lengths.
	if (msl_options.resolve_specialized_array_lengths)
		resolve_specialized_array_lengths();

	uint32_t pass_count = 0;
	do
	{
		if (pass_count >= 3)
			SPIRV_CROSS_THROW("Over 3 compilation loops detected. Must be a bug!");

		reset();

		next_metal_resource_index = MSLResourceBinding(); // Start bindings at zero

		// Move constructor for this type is broken on GCC 4.9 ...
		buffer = unique_ptr<ostringstream>(new ostringstream());

		emit_header();
		emit_specialization_constants();
		emit_resources();
		emit_custom_functions();
		emit_function(get<SPIRFunction>(ir.default_entry_point), Bitset());

		pass_count++;
	} while (force_recompile);

	return buffer->str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rsp), %rdi
callq 0x9fe2
movb $0x1, %al
movb %al, 0x43e(%r14)
xorl %ecx, %ecx
movb %cl, 0x43c(%r14)
movl $0x1c2, 0x438(%r14) # imm = 0x1C2
leaq 0x5e0(%r14), %rdi
movb %cl, 0x600(%r14)
leaq 0x233e2(%rip), %rcx     # 0x92a4d
movq %rcx, 0x618(%r14)
movb %al, 0x602(%r14)
leaq 0x22caf(%rip), %rax     # 0x9232f
movq %rax, 0x608(%r14)
leaq 0x2e350(%rip), %rax     # 0x9d9de
movq %rax, 0x610(%r14)
leaq 0x2bc6c(%rip), %rsi     # 0x9b308
callq 0x64e0
andw $0x0, 0x620(%r14)
movw $0x101, 0x624(%r14)     # imm = 0x101
xorl %eax, %eax
movb %al, 0x622(%r14)
andw $0x0, 0x627(%r14)
movw $0x100, 0x62e(%r14)     # imm = 0x100
movb %al, 0x62a(%r14)
movb %al, 0x632(%r14)
movb 0x7dd(%r14), %al
movb %al, 0x937(%r14)
movq (%r14), %rax
movq %r14, %rdi
callq *0x170(%rax)
leaq 0x848(%r14), %rdi
callq 0x824bc
movq %r14, %rdi
callq 0x162d0
movq %r14, %rdi
callq 0x16086
movq %r14, %rdi
callq 0x1610e
movq %r14, %rdi
callq 0x6f9c2
movq %r14, %rdi
callq 0x6df56
movq %r14, %rdi
callq 0x215f0
leaq 0x60(%rsp), %rdi
movq %r14, %rsi
callq 0x114de
leaq 0x60(%rsp), %rsi
movq %r14, %rdi
callq 0x115d0
leaq 0x60(%rsp), %rdi
callq 0xb51c
cmpl $0x0, 0x7c8(%r14)
je 0x6f775
leaq 0x7c8(%r14), %rsi
leaq 0x158(%r14), %rdi
callq 0x1af30
movq %r14, %rdi
callq 0x6fa0e
leaq 0x940(%r14), %rdi
leaq 0x200fc(%rip), %rsi     # 0x8f887
callq 0x64e0
pushq $0x3
popq %rsi
movq %r14, %rdi
callq 0x6fb52
movl %eax, 0x930(%r14)
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x6fb52
movl %eax, 0x92c(%r14)
cmpl $0x0, 0x930(%r14)
jne 0x6f7c6
movb $0x1, 0x937(%r14)
movq %r14, %rdi
callq 0x713a6
movq %r14, %rdi
callq 0x71418
movq %r14, %rdi
callq 0x7158a
cmpb $0x1, 0x7de(%r14)
jne 0x6f7f0
movq %r14, %rdi
callq 0x7164a
movq %rbx, 0x18(%rsp)
leaq 0x910(%r14), %rbp
leaq 0x28(%rsp), %r15
pushq $0x4
popq %rbx
leaq 0x20(%rsp), %r12
decl %ebx
je 0x6f914
movq %r14, %rdi
callq 0x20c2c
xorps %xmm0, %xmm0
movups %xmm0, 0x9(%rbp)
movups %xmm0, (%rbp)
movl $0x178, %edi            # imm = 0x178
callq 0x6270
movq %rax, %r13
movq %rax, %rdi
callq 0x63a0
movq 0x420(%r14), %rdi
movq %r13, 0x420(%r14)
testq %rdi, %rdi
je 0x6f852
movq (%rdi), %rax
callq *0x8(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *0x78(%rax)
movq %r14, %rdi
callq 0x71688
movq %r14, %rdi
callq 0x71a6a
movq %r14, %rdi
callq 0x71c36
movl 0x108(%r14), %esi
movq %r14, %rdi
callq 0xa048
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
leaq 0x58(%rsp), %rcx
movq %rcx, 0x28(%rsp)
movq $0x1, 0x30(%rsp)
movups %xmm0, 0x10(%r15)
movl $0x3f800000, 0x48(%rsp) # imm = 0x3F800000
movups %xmm0, 0x28(%r15)
movq %r14, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x21c20
movq %r15, %rdi
callq 0xb51c
cmpb $0x0, 0x1d0(%r14)
jne 0x6f809
movq 0x420(%r14), %rsi
addq $0x8, %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x6430
leaq 0x10(%rsp), %rdi
callq 0xa05e
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x1fa92(%rip), %rsi     # 0x8f3b8
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x77472(%rip), %rsi     # 0xe6dc0
movq 0x7868b(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
jmp 0x6f9ad
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x6f9a6
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x6f980
jmp 0x6f9b0
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x6f9b0
jmp 0x6f9ad
jmp 0x6f9ad
movq %rax, %rbx
movl $0x178, %esi            # imm = 0x178
movq %r13, %rdi
callq 0x6280
jmp 0x6f9b0
movq %rax, %rbx
movq %r15, %rdi
callq 0xb51c
jmp 0x6f9b0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xa05e
movq %rbx, %rdi
callq 0x64b0