// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x161d
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x19(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x1a(%rsp), %rsi
movq %rbx, %rdi
callq 0x19ed
testl %eax, %eax
je 0x161d
leaq 0x1c(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x1d(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x21(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x22(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x23(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x24(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a2b
testl %eax, %eax
je 0x161d
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x19ed
testl %eax, %eax
je 0x161d
leaq 0x2c(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a2b
testl %eax, %eax
je 0x161d
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x31(%rsp), %rsi
movq %rbx, %rdi
callq 0x19cf
testl %eax, %eax
je 0x161d
leaq 0x34(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a2b
testl %eax, %eax
je 0x161d
leaq 0x38(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x161d
cmpl $0x1f444d52, 0x14(%rsp) # imm = 0x1F444D52
jne 0x1657
movzbl 0x20(%rsp), %ebp
movzbl 0x21(%rsp), %eax
movq %rax, 0x60(%rsp)
imulq $0xc, %rax, %rax
leaq (%rax,%rbp,4), %r12
addq $0x88, %r12
movzbl 0x22(%rsp), %eax
movq %rax, 0x58(%rsp)
leaq (%r12,%rax,4), %rcx
movzbl 0x23(%rsp), %eax
movq %rax, 0x78(%rsp)
imulq $0x6, %rax, %r13
movq %rcx, 0x70(%rsp)
addq %rcx, %r13
movl 0x24(%rsp), %ecx
movl 0x2c(%rsp), %eax
movq %rcx, 0x50(%rsp)
leaq (%rcx,%r13), %rdx
movzwl 0x28(%rsp), %ecx
movq %rcx, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
addq %rdx, %rcx
movq %rax, 0x80(%rsp)
movq %rcx, 0x68(%rsp)
leaq (%rcx,%rax), %rdi
callq 0x1120
testq %rax, %rax
je 0x1660
movq %rax, %r15
leaq 0x88(,%rbp,4), %rax
leaq 0x88(%r15), %rcx
movq %rcx, 0x10(%r15)
movb %bpl, 0x18(%r15)
addq %r15, %rax
movq %rax, 0x20(%r15)
movq 0x60(%rsp), %rax
movb %al, 0x28(%r15)
addq %r15, %r12
movq %r12, 0x30(%r15)
movq 0x58(%rsp), %rax
movb %al, 0x38(%r15)
movq 0x70(%rsp), %rax
addq %r15, %rax
movq %rax, 0x40(%r15)
movq 0x78(%rsp), %rax
movb %al, 0x48(%r15)
addq %r15, %r13
movq %r13, 0x50(%r15)
movq 0x50(%rsp), %rax
movl %eax, 0x58(%r15)
movq 0x40(%rsp), %rax
addq %r15, %rax
movq %rax, 0x60(%r15)
movq 0x48(%rsp), %rax
movw %ax, 0x68(%r15)
movq 0x68(%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)
xorl %r12d, %r12d
leaq 0x8(%rsp), %r13
movzbl %bpl, %eax
cmpq %rax, %r12
je 0x166c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x19ed
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
leaq 0xa(%rsp), %rsi
callq 0x19cf
testl %eax, %eax
je 0x1620
movq 0x10(%r15), %rax
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%r12,4)
incq %r12
movb 0x18(%r15), %bpl
jmp 0x15db
xorl %r15d, %r15d
callq 0x1060
movl (%rax), %edi
callq 0x1170
movq %rax, (%r14)
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 0x29ee(%rip), %rax      # 0x404c
jmp 0x1667
leaq 0x29f6(%rip), %rax      # 0x405d
xorl %r15d, %r15d
jmp 0x162c
xorl %r13d, %r13d
leaq 0x8(%rsp), %rbp
xorl %r12d, %r12d
movzbl 0x28(%r15), %eax
cmpq %rax, %r12
je 0x170a
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1a2b
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x1a2b
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x19ed
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
leaq 0x12(%rsp), %rsi
callq 0x19cf
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
leaq 0x13(%rsp), %rsi
callq 0x19cf
testl %eax, %eax
je 0x1620
movq 0x20(%r15), %rax
movl 0x10(%rsp), %ecx
movl %ecx, 0x8(%rax,%r13)
movq 0x8(%rsp), %rcx
movq %rcx, (%rax,%r13)
incq %r12
addq $0xc, %r13
jmp 0x1677
leaq 0xa(%rsp), %r12
xorl %r13d, %r13d
leaq 0x8(%rsp), %rbp
movzbl 0x38(%r15), %eax
cmpq %rax, %r13
je 0x176d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x19ed
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
movq %r12, %rsi
callq 0x19cf
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
leaq 0xb(%rsp), %rsi
callq 0x19cf
testl %eax, %eax
je 0x1620
movq 0x30(%r15), %rax
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%r13,4)
incq %r13
jmp 0x1717
xorl %r13d, %r13d
leaq 0x8(%rsp), %rbp
xorl %r12d, %r12d
movzbl 0x48(%r15), %eax
cmpq %rax, %r12
je 0x17df
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x19ed
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
leaq 0xa(%rsp), %rsi
callq 0x19ed
testl %eax, %eax
je 0x1620
movq %rbx, %rdi
leaq 0xd(%rsp), %rsi
callq 0x19cf
testl %eax, %eax
je 0x1620
movq 0x40(%r15), %rax
movzwl 0xc(%rsp), %ecx
movw %cx, 0x4(%rax,%r13)
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%r13)
incq %r12
addq $0x6, %r13
jmp 0x1778
movq 0x50(%r15), %rdi
movl 0x58(%r15), %esi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1620
movq 0x60(%r15), %rdi
movzwl 0x68(%r15), %esi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1620
movq 0x70(%r15), %rdi
movl 0x78(%r15), %esi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1620
movzwl 0x1a(%rsp), %esi
addq 0x60(%r15), %rsi
movq %rsi, (%r15)
leaq 0x58d1(%rip), %rdi      # 0x7118
callq 0x2be5
movq %r15, (%rax)
jmp 0x1642