// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_parse
int rt11_filesystem_parse(rt11_filesystem_t *_this) {
	rt11_filesystem_init(_this);

	// read bootblock at 0, length 1 block. may consists of 00's
	// allocates bootblock->data
	stream_parse(_this, _this->bootblock, 0, 0, RT11_BLOCKSIZE);

	// read more boot code from blocks 2..5, length 4 block.
	stream_parse(_this, _this->monitor, 2, 0, 4 * RT11_BLOCKSIZE);

	if (parse_homeblock(_this))
		return error_code;
	if (parse_directory(_this))
		return error_code;

	// image must be patched, but filesystem files always unpatched
	// and directory struct needed to find DD.SYS files
	rt11_filesystem_unpatch(_this); 	// restore original DD[X].SYS

	parse_file_data(_this);

	rt11_filesystem_patch(_this); 	// re-patch iamge

	// rt11_filesystem_print_diag(_this, stderr);

	// mark file->data , ->prefix as changed, for changed image blocks
	rt11_filesystem_mark_filestreams_as_changed(_this);

	return ERROR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
callq 0xda55
movq 0x78(%r15), %rsi
xorl %ebp, %ebp
movq %r15, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x200, %r8d            # imm = 0x200
callq 0xe258
movq 0x80(%r15), %rsi
pushq $0x2
popq %rdx
movq %r15, %rdi
xorl %ecx, %ecx
movl $0x800, %r8d            # imm = 0x800
callq 0xe258
movq %r15, %rdi
movl $0x1d2, %esi            # imm = 0x1D2
callq 0xf6e2
movzwl %ax, %eax
movl %eax, 0x30(%r15)
movq %r15, %rdi
movl $0x1d4, %esi            # imm = 0x1D4
callq 0xf6e2
movw %ax, 0x34(%r15)
cmpw $0x6, %ax
movq %r15, (%rsp)
jne 0xdd0d
movq %r15, %rdi
movl $0x1d4, %esi            # imm = 0x1D4
callq 0xf6e2
movw %ax, 0x34(%r15)
movq %r15, %rdi
movl $0x1d6, %esi            # imm = 0x1D6
callq 0xf6e2
leaq 0x36(%r15), %r14
movzwl %ax, %edi
callq 0xa12a
movq %r14, %rdi
movq %rax, %rsi
callq 0x30c0
movq (%r15), %r14
leaq 0x3d8(%r14), %rsi
leaq 0x3a(%r15), %rdi
pushq $0xc
popq %r15
movq %r15, %rdx
callq 0x30a0
movq (%rsp), %rax
movb %bpl, 0x46(%rax)
leaq 0x3e4(%r14), %rsi
movq (%rsp), %rax
leaq 0x47(%rax), %rdi
movq %r15, %rdx
callq 0x30a0
movq (%rsp), %rax
movb %bpl, 0x53(%rax)
addq $0x3f0, %r14            # imm = 0x3F0
movq (%rsp), %rax
leaq 0x54(%rax), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq (%rsp), %r15
callq 0x30a0
movb %bpl, 0x60(%r15)
movq %r15, %rdi
movl $0x1fe, %esi            # imm = 0x1FE
callq 0xf6e2
movw %ax, 0x62(%r15)
cmpl $0x1fd, %ebp            # imm = 0x1FD
ja 0xdd29
movq %r15, %rdi
movl %ebp, %esi
callq 0xf6e2
addl $0x2, %ebp
jmp 0xdcf6
movzwl %ax, %edx
leaq 0x7bbf(%rip), %rsi      # 0x158d6
pushq $-0x1
popq %rdi
xorl %eax, %eax
callq 0x982c
testl %eax, %eax
jne 0xe015
andl $0x0, 0x1fd0(%r15)
pushq $0x1
popq %rdx
pushq $0xa
popq %rbx
movq (%r15), %rax
movzwl 0x34(%r15), %esi
shll $0x9, %esi
leaq (%rax,%rsi), %r13
movl %edx, %edi
shlq $0xa, %rdi
movzwl -0x400(%rdi,%r13), %ecx
addq %rdi, %r13
cmpl $0x1, %edx
jne 0xdd71
movw %cx, 0x64(%r15)
movzwl -0x3fc(%r13), %ecx
movw %cx, 0x66(%r15)
jmp 0xdd84
movzwl 0x64(%r15), %r8d
cmpl %r8d, %ecx
jne 0xe1ec
movzwl 0x66(%r15), %ecx
movzwl -0x3fe(%r13), %r8d
movzwl %cx, %ecx
cmpl %ecx, %r8d
ja 0xe1d3
movzwl -0x3f8(%r13), %r12d
cmpl $0x1, %edx
movl %r8d, 0xc(%rsp)
jne 0xddc1
movzwl -0x3fa(%r13), %ecx
movw %cx, 0x68(%r15)
movw %r12w, 0x1fd4(%r15)
jmp 0xddc6
movzwl 0x68(%r15), %ecx
addq $-0x3f6, %r13           # imm = 0xFC0A
addq %rdi, %rax
leaq (%rsi,%rax), %rbp
addq $-0x3e8, %rbp           # imm = 0xFC18
andl $0xfffe, %ecx           # imm = 0xFFFE
addq $0xe, %rcx
movq %rcx, 0x10(%rsp)
movzbl -0x9(%r13,%rbx), %eax
testb $0x8, %al
jne 0xdfd7
testb $0x2, %al
jne 0xdebd
testb $0x4, %al
je 0xdfbc
shll $0x8, %eax
movzbl -0xa(%r13,%rbx), %r15d
orl %eax, %r15d
callq 0xd8f4
movq %rax, %r14
movw %r15w, (%rax)
movzwl -0x8(%r13,%rbx), %edi
leaq 0x2(%rax), %r15
callq 0xa12a
movq %r15, %rdi
movq %rax, %rsi
callq 0x3510
movzwl -0x6(%r13,%rbx), %edi
callq 0xa12a
movq %r15, %rdi
movq %rax, %rsi
callq 0x3510
movzwl -0x4(%r13,%rbx), %edi
leaq 0x52(%r14), %r15
callq 0xa12a
movq %r15, %rdi
movq (%rsp), %r15
movq %rax, %rsi
callq 0x30c0
movw %r12w, 0x7a(%r14)
movzwl -0x2(%r13,%rbx), %eax
movw %ax, 0x7c(%r14)
addw %ax, 0x1fd0(%r15)
movzbl 0x2(%r13,%rbx), %edx
movzbl 0x3(%r13,%rbx), %eax
movl %eax, %ecx
shll $0x8, %ecx
orl %edx, %ecx
je 0xded0
andl $0x1f, %edx
movl %eax, %esi
shrl %esi
andl $-0x20, %esi
addl %esi, %edx
addl $0x48, %edx
shrl $0x5, %ecx
andl $0x1f, %ecx
shrl $0x2, %eax
andl $0xf, %eax
decl %eax
pushq $0x1
popq %rsi
jmp 0xdeda
movzwl -0x2(%r13,%rbx), %eax
addw %ax, 0x1fd2(%r15)
jmp 0xdfbc
xorl %eax, %eax
pushq $0x48
popq %rdx
pushq $0x1
popq %rsi
movl %esi, %ecx
movl %edx, 0xac(%r14)
movl %ecx, 0xa4(%r14)
movl %eax, 0xa8(%r14)
movzwl (%r14), %eax
movl %eax, %ecx
shrl $0xe, %ecx
andl $0x1, %ecx
testw %ax, %ax
cmovsl %esi, %ecx
movl %ecx, 0xd0(%r14)
cmpw $0x0, 0x68(%r15)
je 0xdf96
cmpq $0x0, 0x90(%r14)
jne 0xe239
callq 0xfa43
movq %rax, %rsi
movq %rax, 0x90(%r14)
movq %rbp, %rax
subq (%r15), %rax
cqto
movl $0x200, %ecx            # imm = 0x200
idivq %rcx
movq %rdx, %rcx
movzwl 0x68(%r15), %r8d
movzwl %ax, %edx
movq %r15, %rdi
callq 0xe258
movq 0x90(%r14), %rax
movl $0x747865, 0x17(%rax)   # imm = 0x747865
movl $0x65726964, 0x14(%rax) # imm = 0x65726964
movq 0x90(%r14), %rax
movq 0x8(%rax), %rdi
movl 0x10(%rax), %edx
xorl %esi, %esi
callq 0x9d5d
testl %eax, %eax
je 0xdf96
movq 0x90(%r14), %rdi
callq 0xf6c6
andq $0x0, 0x90(%r14)
movslq 0x8c(%r15), %rax
cmpq $0x3e7, %rax            # imm = 0x3E7
jg 0xdffb
leal 0x1(%rax), %ecx
movl %ecx, 0x8c(%r15)
movq %r14, 0x90(%r15,%rax,8)
movq 0x10(%rsp), %rcx
addw -0x2(%r13,%rbx), %r12w
addq %rcx, %rbp
addq %rcx, %rbx
cmpq $0x801, %rbx            # imm = 0x801
jl 0xddea
jmp 0xdfea
movl 0xc(%rsp), %eax
movl %eax, %edx
testl %eax, %eax
pushq $0xa
popq %rbx
jne 0xdd37
jmp 0xe031
leaq 0x7a53(%rip), %rsi      # 0x15a44
pushq $-0x1
popq %rdi
movl $0x400, %edx            # imm = 0x400
jmp 0xe00a
leaq 0x7a1a(%rip), %rsi      # 0x15a1c
pushq $-0x1
popq %rdi
movl $0x3e8, %edx            # imm = 0x3E8
xorl %eax, %eax
callq 0x982c
testl %eax, %eax
je 0xe031
leaq 0x1021c(%rip), %rax     # 0x1e238
movl (%rax), %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0xe2ad
xorl %ebx, %ebx
pushq $0x2
popq %rbp
movq (%rsp), %r12
movslq 0x8c(%r15), %rax
cmpq %rax, %rbx
jge 0xe10b
movq 0x90(%r15,%rbx,8), %r14
xorl %r15d, %r15d
testb $0x10, (%r14)
je 0xe0c0
cmpq $0x0, 0x88(%r14)
jne 0xe21a
movq (%r12), %rax
movzwl 0x7a(%r14), %ecx
shll $0x9, %ecx
movzbl (%rax,%rcx), %r15d
callq 0xfa43
movq %rax, 0x88(%r14)
movzwl 0x7a(%r14), %edx
movl %r15d, %r8d
shll $0x9, %r8d
addl $-0x2, %r8d
movq %r12, %rdi
movq %rax, %rsi
movl %ebp, %ecx
callq 0xe258
movq 0x88(%r14), %rax
movl $0x786966, 0x17(%rax)   # imm = 0x786966
movl $0x66657270, 0x14(%rax) # imm = 0x66657270
cmpq $0x0, 0x80(%r14)
jne 0xe1fb
callq 0xfa43
movq %rax, 0x80(%r14)
movzwl 0x7a(%r14), %ecx
addw %r15w, %cx
movzwl 0x7c(%r14), %r8d
subl %r15d, %r8d
shll $0x9, %r8d
movzwl %cx, %edx
movq (%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
xorl %ecx, %ecx
callq 0xe258
incq %rbx
jmp 0xe042
movq %r15, %rdi
callq 0xe2da
cmpq $0x0, 0x10(%r15)
je 0xe1cb
movq 0x78(%r15), %rsi
movq %r15, %rdi
callq 0xf724
movq 0x80(%r15), %rsi
movq %r15, %rdi
callq 0xf724
movq 0x10(%r15), %rax
movq (%rax), %rax
movl (%rax), %ecx
shrl %ecx
andl $0x1, %ecx
movl %ecx, 0x88(%r15)
movzwl 0x34(%r15), %edx
movzwl 0x64(%r15), %esi
leal (%rdx,%rsi,2), %esi
movzwl %dx, %edx
cmpl %edx, %esi
jbe 0xe182
movl %edx, %edi
shrl $0x5, %edi
movl (%rax,%rdi,4), %edi
xorl %r8d, %r8d
btl %edx, %edi
setb %r8b
orl %r8d, %ecx
movl %ecx, 0x88(%r15)
incl %edx
jmp 0xe15b
xorl %r14d, %r14d
xorl %ebx, %ebx
movslq 0x8c(%r15), %rax
cmpq %rax, %rbx
jge 0xe01f
movq (%rsp), %rax
movq 0x90(%rax,%rbx,8), %r15
movq 0x88(%r15), %rsi
movq (%rsp), %rdi
callq 0xf724
movq 0x80(%r15), %rsi
movq (%rsp), %r15
movq %r15, %rdi
callq 0xf724
incq %rbx
jmp 0xe187
xorl %r14d, %r14d
jmp 0xe01f
leaq 0x77d2(%rip), %rsi      # 0x159ac
pushq $-0x1
popq %rdi
movl %r8d, %edx
xorl %eax, %eax
callq 0x982c
jmp 0xe011
leaq 0x776a(%rip), %rsi      # 0x1595d
pushq $-0x1
popq %rdi
jmp 0xe00a
leaq 0x78b3(%rip), %rdi      # 0x15ab5
leaq 0x752b(%rip), %rsi      # 0x15734
leaq 0x787b(%rip), %rcx      # 0x15a8b
movl $0x2ad, %edx            # imm = 0x2AD
callq 0x3200
leaq 0x7858(%rip), %rdi      # 0x15a79
leaq 0x750c(%rip), %rsi      # 0x15734
leaq 0x785c(%rip), %rcx      # 0x15a8b
movl $0x2a3, %edx            # imm = 0x2A3
callq 0x3200
leaq 0x77a0(%rip), %rdi      # 0x159e0
leaq 0x74ed(%rip), %rsi      # 0x15734
leaq 0x77a5(%rip), %rcx      # 0x159f3
movl $0x26d, %edx            # imm = 0x26D
callq 0x3200