// File: /workspace/github_cpp_makefile_star2_O2/CobaltXII[P]cxcc/./compiler/compiler.hpp
// Function: compiler_t::compile_function(function_t, symbol_table_t&)
void compile_function(function_t function, symbol_table_t& symbols) {
		#ifdef __APPLE__
		emit(".globl _%s\n", function.identifier.c_str());
		emit("_%s:\n", function.identifier.c_str());
		#else
		emit(".globl %s\n", function.identifier.c_str());
		emit("%s:\n", function.identifier.c_str());
		#endif

		emit("    pushq   %%rbp\n");
		emit("    movq    %%rsp, %%rbp\n");
		emit("    subq    $%ld, %%rsp\n", aligned_offset(function, symbols));
		emit("    andq    $-16, %%rsp\n");

		symbol_table_t new_symbols(&symbols);
		const char* registers[6] = {"%rdi", "%rsi", "%rdx", "%rcx", "%r8", "%r9"};
		for (int i = 0; i < function.parameters.size() && i < 6; i++) {
			emit("    movq    %s, %d(%%rbp)\n", registers[i], i * -8 - 8);
			new_symbols.add_symbol(symbol_t(
				function.parameters[i].type,
				function.parameters[i].identifier,
				i * -8 - 8
			));
			new_symbols.offset -= 8;
		}
		if (function.parameters.size() > 6) {
			for (int i = 6; i < function.parameters.size(); i++) {
				new_symbols.add_symbol(symbol_t(
					function.parameters[i].type,
					function.parameters[i].identifier,
					(i - 6) * 8 + 16
				));
			}
		}
		for (int i = 0; i < function.body.size(); i++) {
			compile_statement(function.body[i], new_symbols);
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %rdx
leaq 0x2d65(%rip), %rsi      # 0x10cf0
xorl %eax, %eax
callq 0xe4f2
movq 0x8(%rbx), %rdx
leaq 0x2d5e(%rip), %rsi      # 0x10cfb
movq %r14, %rdi
xorl %eax, %eax
callq 0xe4f2
leaq 0x2d52(%rip), %rsi      # 0x10d00
movq %r14, %rdi
xorl %eax, %eax
callq 0xe4f2
leaq 0x2d54(%rip), %rsi      # 0x10d13
movq %r14, %rdi
xorl %eax, %eax
callq 0xe4f2
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
movq %rbx, 0x8(%rsp)
movq %rbx, %rsi
callq 0xa0f0
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xe57a
leaq 0x2d37(%rip), %rsi      # 0x10d2d
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe4f2
leaq 0xa0(%rsp), %rdi
callq 0x606a
leaq 0x2d2f(%rip), %rsi      # 0x10d46
movq %r14, 0x10(%rsp)
movq %r14, %rdi
xorl %eax, %eax
callq 0xe4f2
leaq 0x28(%rsp), %rcx
xorps %xmm0, %xmm0
andq $0x0, 0x10(%rcx)
movups %xmm0, (%rcx)
movq %r15, -0x8(%rcx)
movb 0x20(%r15), %al
movb %al, 0x18(%rcx)
movups 0x28(%r15), %xmm0
movups %xmm0, 0x20(%rcx)
movq 0x38(%r15), %rax
movq %rax, 0x30(%rcx)
pushq $-0x8
popq %r14
leaq 0x9d23(%rip), %r8       # 0x17d80
pushq $0x8
popq %rax
movq %rax, 0x18(%rsp)
leaq 0x80(%rsp), %r13
leaq 0x158(%rsp), %rbx
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rsi
movq 0x30(%rax), %rcx
movq %rcx, %rax
subq %rsi, %rax
cqto
pushq $0x28
popq %rdi
idivq %rdi
cmpq $0x5, %r15
ja 0xe12d
cmpq %r15, %rax
jbe 0xe12d
movq %r8, %r12
movq (%r8), %rdx
movq 0x10(%rsp), %rdi
leaq 0x2cc3(%rip), %rsi      # 0x10d7b
movl %r14d, %ecx
xorl %eax, %eax
callq 0xe4f2
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rsi
movq 0x18(%rsp), %rax
movq -0x8(%rsi,%rax), %rbp
addq %rax, %rsi
movq %r13, %rdi
callq 0x22e0
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0xe662
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq 0xa578
movq %rbx, %rdi
callq 0xa0d6
movq %r13, %rdi
callq 0x2100
addq $-0x8, 0x48(%rsp)
incq %r15
addq $-0x8, %r14
movq %r12, %r8
addq $0x8, %r8
addq $0x28, 0x18(%rsp)
jmp 0xe078
cmpq $0x7, %rax
jb 0xe1bb
pushq $0x6
popq %r14
pushq $0x10
popq %rbp
movl $0xf8, %r15d
leaq 0x60(%rsp), %rbx
leaq 0x108(%rsp), %r12
subq %rsi, %rcx
movq %rcx, %rax
cqto
pushq $0x28
popq %rcx
idivq %rcx
cmpq %r14, %rax
jbe 0xe1bb
movq -0x8(%rsi,%r15), %r13
addq %r15, %rsi
movq %rbx, %rdi
callq 0x22e0
movslq %ebp, %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xe662
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0xa578
movq %r12, %rdi
callq 0xa0d6
movq %rbx, %rdi
callq 0x2100
incq %r14
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rsi
movq 0x30(%rax), %rcx
addl $0x8, %ebp
addq $0x28, %r15
jmp 0xe151
xorl %r14d, %r14d
leaq 0x20(%rsp), %r15
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %rcx
movq 0x40(%rcx), %rax
movq 0x48(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jbe 0xe1f5
movq (%rax,%r14,8), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0xe6ce
incq %r14
jmp 0xe1c8
leaq 0x28(%rsp), %rdi
callq 0xdbb0
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x606a
jmp 0xe274
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0xa0d6
jmp 0xe238
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0xe260
jmp 0xe267
jmp 0xe267
movq %rax, %rbx
leaq 0x158(%rsp), %rdi
callq 0xa0d6
jmp 0xe258
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x2100
jmp 0xe26a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xdbb0
movq %rbx, %rdi
callq 0x2390