// File: /workspace/github_c_makefile_star2_O1/almk277[P]ROSE/rasm/module.cpp
// Function: code::finish()
void code::finish()
{

	for (const auto &ur: unres) {
		auto it = lbl.find(ur.label);
		if (it == lbl.end())
			throw error("unresolved: " + ur.label
					+ " at " + std::to_string(ur.lineno));
		auto o = offset(ur.offset_base, it->second,
				ur.label, ur.lineno);
		patch(ur.patch_addr, o);
	}

	cur_proc->size = address() - cur_proc->addr;
	cur_proc->type = sym.add(cur_type);
	cur_proc->varc = var.count();

	var.clear();
	lbl.clear();
	unres.clear();
	cur_type.clear();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
movq 0xb0(%rdi), %r14
movq 0xb8(%rdi), %r12
cmpq %r12, %r14
je 0x8085
leaq 0x78(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa0b8
testq %rax, %rax
je 0x8104
movl 0x28(%rax), %esi
movl 0x20(%r14), %edi
movl 0x28(%r14), %ecx
movq %r14, %rdx
callq 0x7d60
movl 0x24(%r14), %ecx
addq (%rbx), %rcx
xorl %edx, %edx
movzwl %ax, %eax
movb %al, (%rcx,%rdx)
shrl $0x8, %eax
incq %rdx
cmpl $0x2, %edx
jne 0x806b
addq $0x30, %r14
cmpq %r12, %r14
jne 0x803b
movl 0x8(%rbx), %eax
subl (%rbx), %eax
movq 0xc8(%rbx), %rcx
subl (%rcx), %eax
leaq 0xb0(%rbx), %r14
movl %eax, 0x4(%rcx)
movq 0x18(%rbx), %rdi
leaq 0xd0(%rbx), %rsi
callq 0x792e
movq 0xc8(%rbx), %rcx
movw %ax, 0x8(%rcx)
movb 0x58(%rbx), %al
movb %al, 0xb(%rcx)
leaq 0x40(%rbx), %rdi
callq 0x4c66
leaq 0x78(%rbx), %rdi
callq 0x4d04
movq 0xb0(%rbx), %rsi
movq %r14, %rdi
callq 0xa3f8
movq $0x0, 0xd8(%rbx)
movq 0xd0(%rbx), %rax
movb $0x0, (%rax)
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x62a0(%rip), %rsi      # 0xe3b8
leaq 0x40(%rsp), %rdi
movq %r14, %rdx
callq 0x67b9
leaq 0x6287(%rip), %rsi      # 0xe3b3
leaq 0x40(%rsp), %rdi
callq 0x3500
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x8157
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0x8163
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x28(%r14), %esi
leaq 0x20(%rsp), %rdi
callq 0x6c8e
leaq 0x60(%rsp), %rdi
movq %rsp, %rsi
leaq 0x20(%rsp), %rdx
callq 0x6be6
movb $0x1, %bpl
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x3440
xorl %ebp, %ebp
movq 0xbe3c(%rip), %rsi      # 0x13ff0
movq 0xbdf5(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
movq %rax, %r14
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x81e9
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x81e9
movq %rax, %r14
movb $0x1, %bpl
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x820c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x820c
movq %rax, %r14
movb $0x1, %bpl
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x822a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x822a
movq %rax, %r14
movb $0x1, %bpl
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x824d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x824d
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x825a
movq %rbx, %rdi
callq 0x31f0
movq %r14, %rdi
callq 0x34a0