// File: /workspace/github_c_makefile_star2_O0/almk277[P]ROSE/rose/module.c
// Function: read_module
static int read_module(FILE *f, Module *m)
{
	size_t i;

	for (i = 0; i != m->seg.exp.size; ++i) {
		RMDExport e;
		if (!srd(f, &e.name, 2)
				|| !srd(f, &e.idx, 1))
			goto error;
		m->seg.exp.start[i] = e;
	}
	for (i = 0; i != m->seg.ptbl.size; ++i) {
		RMDProcedure p;
		if (!srd(f, &p.addr, 4)
				|| !srd(f, &p.size, 4)
				|| !srd(f, &p.type, 2)
				|| !srd(f, &p.argc, 1)
				|| !srd(f, &p.varc, 1))
			goto error;
		m->seg.ptbl.start[i] = p;
	}
	for (i = 0; i != m->seg.mtbl.size; ++i) {
		RMDModule mod;
		if (!srd(f, &mod.name, 2)
				|| !srd(f, &mod.version.maj, 1)
				|| !srd(f, &mod.version.min, 1))
			goto error;
		m->seg.mtbl.start[i] = mod;
	}
	for (i = 0; i != m->seg.imp.size; ++i) {
		RMDImport imp;
		if (!srd(f, &imp.name, 2)
				|| !srd(f, &imp.type, 2)
				|| !srd(f, &imp.module, 1))
			goto error;
		m->seg.imp.start[i] = imp;
	}
	if (!rd(f, m->seg.text.start, m->seg.text.size)
			|| !rd(f, m->seg.sym.start, m->seg.sym.size)
			|| !rd(f, m->seg.str.start, m->seg.str.size))
		goto error;

	return 0;

error:
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movzbl 0x18(%rcx), %ecx
cmpq %rcx, %rax
je 0x1d36
movq -0x10(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x2030
cmpl $0x0, %eax
je 0x1d11
movq -0x10(%rbp), %rdi
leaq -0x24(%rbp), %rsi
addq $0x2, %rsi
callq 0x1ff0
cmpl $0x0, %eax
jne 0x1d16
jmp 0x1f72
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %edx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1cd8
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movzbl 0x28(%rcx), %ecx
cmpq %rcx, %rax
je 0x1df0
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x20a0
cmpl $0x0, %eax
je 0x1dbd
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
addq $0x4, %rsi
callq 0x20a0
cmpl $0x0, %eax
je 0x1dbd
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
addq $0x8, %rsi
callq 0x2030
cmpl $0x0, %eax
je 0x1dbd
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
addq $0xa, %rsi
callq 0x1ff0
cmpl $0x0, %eax
je 0x1dbd
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
addq $0xb, %rsi
callq 0x1ff0
cmpl $0x0, %eax
jne 0x1dc2
jmp 0x1f72
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
imulq $0xc, -0x20(%rbp), %rcx
addq %rcx, %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movl -0x28(%rbp), %ecx
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1d3e
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movzbl 0x38(%rcx), %ecx
cmpq %rcx, %rax
je 0x1e70
movq -0x10(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x2030
cmpl $0x0, %eax
je 0x1e4b
movq -0x10(%rbp), %rdi
leaq -0x34(%rbp), %rsi
addq $0x2, %rsi
callq 0x1ff0
cmpl $0x0, %eax
je 0x1e4b
movq -0x10(%rbp), %rdi
leaq -0x34(%rbp), %rsi
addq $0x2, %rsi
addq $0x1, %rsi
callq 0x1ff0
cmpl $0x0, %eax
jne 0x1e50
jmp 0x1f72
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x20(%rbp), %rcx
movl -0x34(%rbp), %edx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1df8
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movzbl 0x48(%rcx), %ecx
cmpq %rcx, %rax
je 0x1ef7
movq -0x10(%rbp), %rdi
leaq -0x3a(%rbp), %rsi
callq 0x2030
cmpl $0x0, %eax
je 0x1ec7
movq -0x10(%rbp), %rdi
leaq -0x3a(%rbp), %rsi
addq $0x2, %rsi
callq 0x2030
cmpl $0x0, %eax
je 0x1ec7
movq -0x10(%rbp), %rdi
leaq -0x3a(%rbp), %rsi
addq $0x5, %rsi
callq 0x1ff0
cmpl $0x0, %eax
jne 0x1ecc
jmp 0x1f72
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
imulq $0x6, -0x20(%rbp), %rcx
addq %rcx, %rax
movl -0x3a(%rbp), %ecx
movl %ecx, (%rax)
movw -0x36(%rbp), %cx
movw %cx, 0x4(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1e78
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, %esi
movq -0x10(%rbp), %rcx
movl $0x1, %edx
callq 0x1080
cmpq $0x0, %rax
jbe 0x1f67
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x68(%rax), %eax
movl %eax, %esi
movq -0x10(%rbp), %rcx
movl $0x1, %edx
callq 0x1080
cmpq $0x0, %rax
jbe 0x1f67
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, %esi
movq -0x10(%rbp), %rcx
movl $0x1, %edx
callq 0x1080
cmpq $0x0, %rax
ja 0x1f69
jmp 0x1f72
movl $0x0, -0x4(%rbp)
jmp 0x1f79
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)