// File: /workspace/github_c_makefile_star2_O1/almk277[P]ROSE/rose/module.c
// Function: load_header
static Module *load_header(FILE *f, const char **errstr)
{
	RMDHeader h;
	Module *m = NULL;

	if (read_header(f, &h) < 0) {
		*errstr = sys_error();
		goto error;
	}

	if(!verify_ident(h.ident)) {
		*errstr = "no RMD signature";
		goto error;
	}

	if(!verify_rose_version(h.rmd_version)) {
		*errstr = "unsupported ROSE version";
		goto error;
	}

	m = module_new(&h);
	if (!m) {
		*errstr = "no memory";
		goto error;
	}

	if (read_module(f, m) < 0) {
		*errstr = sys_error();
		goto error;
	}

	m->name = get_symbol(m, h.name);
	add_to_tbl(m, m->name);

	return m;

error:
	if (m)
		free(m);
	if(f)
		fclose(f);

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x14(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x18(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x19(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x1a(%rsp), %rsi
movq %rbx, %rdi
callq 0x1cb4
testl %eax, %eax
je 0x1831
leaq 0x1c(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x1d(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x20(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x21(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x22(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x23(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x24(%rsp), %rsi
movq %rbx, %rdi
callq 0x1cf8
testl %eax, %eax
je 0x1831
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x1cb4
testl %eax, %eax
je 0x1831
leaq 0x2c(%rsp), %rsi
movq %rbx, %rdi
callq 0x1cf8
testl %eax, %eax
je 0x1831
leaq 0x30(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x31(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
leaq 0x34(%rsp), %rsi
movq %rbx, %rdi
callq 0x1cf8
testl %eax, %eax
je 0x1831
leaq 0x38(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1831
cmpl $0x1f444d52, 0x14(%rsp) # imm = 0x1F444D52
jne 0x1870
movzbl 0x20(%rsp), %ecx
movzbl 0x21(%rsp), %eax
movq %rax, 0x78(%rsp)
leaq (%rax,%rax,2), %rax
shlq $0x2, %rax
movq %rcx, 0x48(%rsp)
leaq (%rax,%rcx,4), %r12
addq $0x88, %r12
movzbl 0x22(%rsp), %eax
movq %rax, 0x40(%rsp)
leaq (%r12,%rax,4), %rcx
movzbl 0x23(%rsp), %eax
movq %rax, 0x68(%rsp)
leaq (%rax,%rax,2), %rax
movq %rcx, 0x50(%rsp)
leaq (%rcx,%rax,2), %r13
movl 0x24(%rsp), %ecx
movl 0x2c(%rsp), %eax
movq %rcx, 0x60(%rsp)
leaq (%r13,%rcx), %rbp
movzwl 0x28(%rsp), %ecx
movq %rcx, 0x58(%rsp)
addq %rbp, %rcx
movq %rax, 0x80(%rsp)
movq %rcx, 0x70(%rsp)
leaq (%rcx,%rax), %rdi
callq 0x1130
testq %rax, %rax
je 0x187c
movq %rax, %r15
movq 0x48(%rsp), %rdx
leaq 0x88(,%rdx,4), %rax
leaq 0x88(%r15), %rcx
movq %rcx, 0x10(%r15)
movb %dl, 0x18(%r15)
addq %r15, %rax
movq %rax, 0x20(%r15)
movq 0x78(%rsp), %rax
movb %al, 0x28(%r15)
addq %r15, %r12
movq %r12, 0x30(%r15)
movq 0x40(%rsp), %rax
movb %al, 0x38(%r15)
movq 0x50(%rsp), %rax
addq %r15, %rax
movq %rax, 0x40(%r15)
movq 0x68(%rsp), %rax
movb %al, 0x48(%r15)
addq %r15, %r13
movq %r13, 0x50(%r15)
movq 0x60(%rsp), %rax
movl %eax, 0x58(%r15)
addq %r15, %rbp
movq %rbp, 0x60(%r15)
movq 0x58(%rsp), %rax
movw %ax, 0x68(%r15)
movq 0x70(%rsp), %rax
addq %r15, %rax
movq %rax, 0x70(%r15)
movq 0x80(%rsp), %rax
movl %eax, 0x78(%r15)
movzwl 0x1c(%rsp), %eax
movw %ax, 0x8(%r15)
movb 0x30(%rsp), %al
movb %al, 0x80(%r15)
jmp 0x187f
xorl %r15d, %r15d
callq 0x1060
movl (%rax), %edi
callq 0x1180
movq %rax, (%r14)
testq %r15, %r15
je 0x1850
movq %r15, %rdi
callq 0x1040
movq %rbx, %rdi
callq 0x1090
xorl %r15d, %r15d
movq %r15, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x27d5(%rip), %rax      # 0x404c
jmp 0x1b07
xorl %r15d, %r15d
testq %r15, %r15
je 0x1b00
cmpb $0x0, 0x18(%r15)
je 0x18eb
xorl %ebp, %ebp
leaq 0x8(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1cb4
movl $0x5, %r12d
testl %eax, %eax
je 0x18d5
movl $0x1, %esi
movl $0x1, %edx
leaq 0xa(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x18d5
movq 0x10(%r15), %rax
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%rbp,4)
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x1b0f
incq %rbp
movzbl 0x18(%r15), %eax
cmpq %rax, %rbp
jne 0x1896
cmpb $0x0, 0x28(%r15)
je 0x19a1
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1cf8
movl $0x5, %ebp
testl %eax, %eax
je 0x1984
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x1cf8
testl %eax, %eax
je 0x1984
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1cb4
testl %eax, %eax
je 0x1984
movl $0x1, %esi
movl $0x1, %edx
leaq 0x12(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1984
movl $0x1, %esi
movl $0x1, %edx
leaq 0x13(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1984
movq 0x20(%r15), %rax
movl 0x10(%rsp), %ecx
movl %ecx, 0x8(%rax,%r13)
movq 0x8(%rsp), %rcx
movq %rcx, (%rax,%r13)
xorl %ebp, %ebp
testl %ebp, %ebp
jne 0x1b1b
incq %r12
movzbl 0x28(%r15), %eax
addq $0xc, %r13
cmpq %rax, %r12
jne 0x18fc
cmpb $0x0, 0x38(%r15)
je 0x1a22
xorl %r13d, %r13d
leaq 0x8(%rsp), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1cb4
movl $0x5, %r12d
testl %eax, %eax
je 0x1a0c
movl $0x1, %esi
movl $0x1, %edx
leaq 0xa(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1a0c
movl $0x1, %esi
movl $0x1, %edx
leaq 0xb(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1a0c
movq 0x30(%r15), %rax
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%r13,4)
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x1b0f
incq %r13
movzbl 0x38(%r15), %eax
cmpq %rax, %r13
jne 0x19b0
cmpb $0x0, 0x48(%r15)
je 0x1aa4
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x1cb4
movl $0x5, %ebp
testl %eax, %eax
je 0x1a8b
movq %rbx, %rdi
leaq 0xa(%rsp), %rsi
callq 0x1cb4
testl %eax, %eax
je 0x1a8b
movl $0x1, %esi
movl $0x1, %edx
leaq 0xd(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1a8b
movq 0x40(%r15), %rax
movzwl 0xc(%rsp), %ecx
movw %cx, 0x4(%rax,%r13)
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%r13)
xorl %ebp, %ebp
testl %ebp, %ebp
jne 0x1b1b
incq %r12
movzbl 0x48(%r15), %eax
addq $0x6, %r13
cmpq %rax, %r12
jne 0x1a2f
movq 0x50(%r15), %rdi
movl 0x58(%r15), %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1834
movq 0x60(%r15), %rdi
movzwl 0x68(%r15), %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1834
movq 0x70(%r15), %rdi
movl 0x78(%r15), %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
jne 0x1b24
jmp 0x1834
leaq 0x2556(%rip), %rax      # 0x405d
xorl %r15d, %r15d
jmp 0x1840
cmpl $0x5, %r12d
je 0x1834
jmp 0x1b24
cmpl $0x5, %ebp
je 0x1834
movzwl 0x1a(%rsp), %esi
addq 0x60(%r15), %rsi
movq %rsi, (%r15)
leaq 0x55e9(%rip), %rdi      # 0x7120
callq 0x2f00
movq %r15, (%rax)
jmp 0x185b