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

	if (options.vulkan_semantics)
		backend.allow_precision_qualifiers = true;
	backend.force_gl_in_out_block = true;
	backend.supports_extensions = true;

	// Scan the SPIR-V to find trivial uses of extensions.
	build_function_control_flow_graphs_and_analyze();
	find_static_extensions();
	fixup_image_load_store_access();
	update_active_builtins();
	analyze_image_and_sampler_usage();

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

		reset();

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

		emit_header();
		emit_resources();

		emit_function(get<SPIRFunction>(ir.default_entry_point), Bitset());

		pass_count++;
	} while (force_recompile);

	// Entry point in GLSL is always main().
	get_entry_point().name = "main";

	return buffer->str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0xb8(%rbp)
movq %rdi, %rax
movq %rax, -0xb0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x105a0
movq -0xa8(%rbp), %rax
testb $0x1, 0x43e(%rax)
je 0x58a86
movq -0xa8(%rbp), %rax
movb $0x1, 0x62b(%rax)
movq -0xa8(%rbp), %rdi
movb $0x1, 0x62d(%rdi)
movb $0x1, 0x630(%rdi)
callq 0x2b500
jmp 0x58aa2
movq -0xa8(%rbp), %rdi
callq 0x57d90
jmp 0x58ab0
movq -0xa8(%rbp), %rdi
callq 0x58d80
jmp 0x58abe
movq -0xa8(%rbp), %rdi
callq 0x2b100
jmp 0x58acc
movq -0xa8(%rbp), %rdi
callq 0x2b230
jmp 0x58ada
movl $0x0, -0x28(%rbp)
cmpl $0x3, -0x28(%rbp)
jb 0x58bb4
movb $0x1, -0x4a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0xc8(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x7650
movq -0xc0(%rbp), %rdx
leaq 0xe58b1(%rip), %rsi     # 0x13e3cf
leaq -0x48(%rbp), %rdi
callq 0x7520
jmp 0x58b29
movq -0xc8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x9c50
jmp 0x58b3b
movq -0xc8(%rbp), %rdi
movb $0x0, -0x4a(%rbp)
leaq 0x15528b(%rip), %rsi    # 0x1addd8
leaq -0x4eec4(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x58d80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x58d6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x58b92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7708
leaq -0x49(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x4a(%rbp)
jne 0x58ba3
jmp 0x58baf
movq -0xc8(%rbp), %rdi
callq 0x72c0
jmp 0x58d6e
movq -0xa8(%rbp), %rdi
callq 0x578d0
jmp 0x58bc2
movl $0x178, %edi            # imm = 0x178
callq 0x7360
movq %rax, -0xd0(%rbp)
jmp 0x58bd5
movq -0xd0(%rbp), %rdi
callq 0x74f0
jmp 0x58be3
movq -0xd0(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x10620
movq -0xd8(%rbp), %rsi
movq -0xa8(%rbp), %rdi
addq $0x420, %rdi            # imm = 0x420
callq 0x10650
movq -0xd8(%rbp), %rdi
callq 0x10680
movq -0xa8(%rbp), %rdi
movq (%rdi), %rax
movq 0x78(%rax), %rax
callq *%rax
jmp 0x58c32
movq -0xa8(%rbp), %rdi
callq 0x58e90
jmp 0x58c40
movq -0xa8(%rbp), %rdi
movl 0x108(%rdi), %esi
callq 0x106d0
movq %rax, -0xe0(%rbp)
jmp 0x58c5b
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x10710
movq -0xa8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
callq 0x59ba0
jmp 0x58ca3
leaq -0xa0(%rbp), %rdi
callq 0xf250
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0xa8(%rbp), %rax
testb $0x1, 0x1d0(%rax)
jne 0x58ae1
movq -0xa8(%rbp), %rdi
callq 0x25150
movq %rax, -0xf0(%rbp)
jmp 0x58ce1
movq -0xf0(%rbp), %rdi
addq $0x8, %rdi
leaq 0xef351(%rip), %rsi     # 0x148044
callq 0x7510
jmp 0x58cfa
movq -0xa8(%rbp), %rdi
addq $0x420, %rdi            # imm = 0x420
callq 0x10740
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0x7380
jmp 0x58d1e
leaq -0x18(%rbp), %rdi
callq 0x10760
movq -0xb0(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0xd0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x178, %esi            # imm = 0x178
callq 0x7370
jmp 0x58d6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xf250
leaq -0x18(%rbp), %rdi
callq 0x10760
movq -0x20(%rbp), %rdi
callq 0x7640