// File: /workspace/github_c_makefile_star2_O3/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 0x1ad8
leaq 0x18(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x19(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x1a(%rsp), %rsi
movq %rbx, %rdi
callq 0x1c89
testl %eax, %eax
je 0x1ad8
leaq 0x1c(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x1d(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x20(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x21(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x22(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x23(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x24(%rsp), %rsi
movq %rbx, %rdi
callq 0x1ccd
testl %eax, %eax
je 0x1ad8
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x1c89
testl %eax, %eax
je 0x1ad8
leaq 0x2c(%rsp), %rsi
movq %rbx, %rdi
callq 0x1ccd
testl %eax, %eax
je 0x1ad8
leaq 0x30(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x31(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
leaq 0x34(%rsp), %rsi
movq %rbx, %rdi
callq 0x1ccd
testl %eax, %eax
je 0x1ad8
leaq 0x38(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1ad8
cmpl $0x1f444d52, 0x14(%rsp) # imm = 0x1F444D52
jne 0x1b07
movzbl 0x20(%rsp), %ecx
movzbl 0x21(%rsp), %eax
movq %rax, 0x80(%rsp)
leaq (%rax,%rax,2), %rax
shlq $0x2, %rax
movq %rcx, 0x78(%rsp)
leaq (%rax,%rcx,4), %r12
addq $0x88, %r12
movzbl 0x22(%rsp), %eax
movq %rax, 0x40(%rsp)
leaq (%r12,%rax,4), %rbp
movzbl 0x23(%rsp), %eax
movq %rax, 0x60(%rsp)
leaq (%rax,%rax,2), %rax
leaq (%rbp,%rax,2), %r13
movl 0x24(%rsp), %ecx
movl 0x2c(%rsp), %eax
movq %rcx, 0x58(%rsp)
leaq (%r13,%rcx), %rdx
movzwl 0x28(%rsp), %ecx
movq %rcx, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
addq %rdx, %rcx
movq %rax, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
leaq (%rcx,%rax), %rdi
callq 0x1130
testq %rax, %rax
je 0x1b29
movq %rax, %r15
movq 0x78(%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 0x80(%rsp), %rcx
movb %cl, 0x28(%r15)
addq %r15, %r12
movq %r12, 0x30(%r15)
movq 0x40(%rsp), %rax
movb %al, 0x38(%r15)
addq %r15, %rbp
movq %rbp, 0x40(%r15)
movq 0x60(%rsp), %rax
movb %al, 0x48(%r15)
addq %r15, %r13
movq %r13, 0x50(%r15)
movq 0x58(%rsp), %rax
movl %eax, 0x58(%r15)
movq 0x48(%rsp), %rax
addq %r15, %rax
movq %rax, 0x60(%r15)
movq 0x50(%rsp), %rax
movw %ax, 0x68(%r15)
movq 0x68(%rsp), %rax
addq %r15, %rax
movq %rax, 0x70(%r15)
movq 0x70(%rsp), %rax
movl %eax, 0x78(%r15)
movzwl 0x1c(%rsp), %eax
movw %ax, 0x8(%r15)
movb 0x30(%rsp), %al
movb %al, 0x80(%r15)
testb %dl, %dl
je 0x18ad
leaq 0xa(%rsp), %r12
xorl %ebp, %ebp
leaq 0x8(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1c89
testl %eax, %eax
je 0x1b10
movl $0x1, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movq 0x10(%r15), %rax
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%rbp,4)
incq %rbp
movzbl 0x18(%r15), %eax
cmpq %rax, %rbp
jne 0x1860
movb 0x28(%r15), %cl
testb %cl, %cl
je 0x1968
xorl %r13d, %r13d
leaq 0x8(%rsp), %rbp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1ccd
testl %eax, %eax
je 0x1b10
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x1ccd
testl %eax, %eax
je 0x1b10
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1c89
testl %eax, %eax
je 0x1b10
movl $0x1, %esi
movl $0x1, %edx
leaq 0x12(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movl $0x1, %esi
movl $0x1, %edx
leaq 0x13(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movq 0x20(%r15), %rax
movl 0x10(%rsp), %ecx
movl %ecx, 0x8(%rax,%r13)
movq 0x8(%rsp), %rcx
movq %rcx, (%rax,%r13)
incq %r12
movzbl 0x28(%r15), %eax
addq $0xc, %r13
cmpq %rax, %r12
jne 0x18c0
cmpb $0x0, 0x38(%r15)
je 0x19e6
leaq 0xa(%rsp), %r12
xorl %r13d, %r13d
leaq 0x8(%rsp), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1c89
testl %eax, %eax
je 0x1b10
movl $0x1, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movl $0x1, %esi
movl $0x1, %edx
leaq 0xb(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movq 0x30(%r15), %rax
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%r13,4)
incq %r13
movzbl 0x38(%r15), %eax
cmpq %rax, %r13
jne 0x197c
cmpb $0x0, 0x48(%r15)
je 0x1a68
xorl %r13d, %r13d
leaq 0x8(%rsp), %rbp
xorl %r12d, %r12d
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1c89
testl %eax, %eax
je 0x1b10
movq %rbx, %rdi
leaq 0xa(%rsp), %rsi
callq 0x1c89
testl %eax, %eax
je 0x1b10
movl $0x1, %esi
movl $0x1, %edx
leaq 0xd(%rsp), %rdi
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movq 0x40(%r15), %rax
movzwl 0xc(%rsp), %ecx
movw %cx, 0x4(%rax,%r13)
movl 0x8(%rsp), %ecx
movl %ecx, (%rax,%r13)
incq %r12
movzbl 0x48(%r15), %eax
addq $0x6, %r13
cmpq %rax, %r12
jne 0x19f8
movq 0x50(%r15), %rdi
movl 0x58(%r15), %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movq 0x60(%r15), %rdi
movzwl 0x68(%r15), %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movq 0x70(%r15), %rdi
movl 0x78(%r15), %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x1080
testq %rax, %rax
je 0x1b10
movzwl 0x1a(%rsp), %esi
addq 0x60(%r15), %rsi
movq %rsi, (%r15)
leaq 0x5652(%rip), %rdi      # 0x7120
callq 0x2e8c
movq %r15, (%rax)
jmp 0x1af2
callq 0x1060
movl (%rax), %edi
callq 0x1180
movq %rax, (%r14)
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 0x253e(%rip), %rax      # 0x404c
jmp 0x1ae4
callq 0x1060
movl (%rax), %edi
callq 0x1180
movq %rax, (%r14)
movq %r15, %rdi
callq 0x1040
jmp 0x1ae7
leaq 0x252d(%rip), %rax      # 0x405d
jmp 0x1ae4