// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rdi, %r12
callq 0xe781
movq 0x78(%r12), %r14
movw $0x0, (%r14)
xorl %ebx, %ebx
movl %ebx, 0x4(%r14)
movl $0x200, 0x10(%r14)      # imm = 0x200
movl $0x200, %edi            # imm = 0x200
callq 0x33c0
movq %rax, 0x8(%r14)
movq (%r12), %rsi
movl $0x200, %edx            # imm = 0x200
movq %rax, %rdi
callq 0x3350
movb %bl, 0x14(%r14)
movq 0x80(%r12), %r14
movw $0x2, (%r14)
movl %ebx, 0x4(%r14)
movl $0x800, 0x10(%r14)      # imm = 0x800
movl $0x800, %edi            # imm = 0x800
callq 0x33c0
movq %rax, 0x8(%r14)
movl $0x400, %esi            # imm = 0x400
addq (%r12), %rsi
movl $0x800, %edx            # imm = 0x800
movq %rax, %rdi
callq 0x3350
movb %bl, 0x14(%r14)
movl 0x8(%r12), %eax
cmpl $0x3d3, %eax            # imm = 0x3D3
jbe 0xf1ae
movq (%r12), %rcx
movzwl 0x3d2(%rcx), %edx
movl %edx, 0x30(%r12)
cmpl $0x3d5, %eax            # imm = 0x3D5
jbe 0xf1ae
movzwl 0x3d4(%rcx), %edx
movw %dx, 0x34(%r12)
cmpl $0x6, %edx
jne 0xea9e
movzwl 0x3d4(%rcx), %edx
movw %dx, 0x34(%r12)
cmpl $0x3d7, %eax            # imm = 0x3D7
jbe 0xf1ae
movzwl 0x3d6(%rcx), %edi
leaq 0x36(%r12), %r14
callq 0xa921
movq %r14, %rdi
movq %rax, %rsi
callq 0x30d0
movq (%r12), %rbx
leaq 0x3d8(%rbx), %rsi
leaq 0x3a(%r12), %rdi
movl $0xc, %edx
callq 0x30a0
xorl %r14d, %r14d
movb %r14b, 0x46(%r12)
leaq 0x3e4(%rbx), %rsi
leaq 0x47(%r12), %rdi
movl $0xc, %edx
callq 0x30a0
movb %r14b, 0x53(%r12)
leaq 0x3f0(%rbx), %rsi
leaq 0x54(%r12), %rdi
movl $0xc, %edx
callq 0x30a0
movb %r14b, 0x60(%r12)
cmpl $0x3ff, 0x8(%r12)       # imm = 0x3FF
jbe 0xf1ae
movzwl 0x3fe(%rbx), %eax
movw %ax, 0x62(%r12)
movq %r12, %rdi
movl %r14d, %esi
callq 0x107cf
leal 0x2(%r14), %eax
cmpl $0x1fc, %r14d           # imm = 0x1FC
movl %eax, %r14d
jb 0xea81
jmp 0xeab9
leaq 0x7de5(%rip), %rsi      # 0x1688a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x9f8f
testl %eax, %eax
jne 0xeee5
movl $0x0, 0x1fd0(%r12)
movl $0x1, %edx
movq %r12, 0x10(%rsp)
movzwl 0x34(%r12), %r8d
shll $0x9, %r8d
addq (%r12), %r8
movl %edx, %esi
shlq $0xa, %rsi
movzwl -0x400(%rsi,%r8), %ecx
cmpl $0x1, %edx
jne 0xeaf9
movw %cx, 0x64(%r12)
jmp 0xeb07
movzwl 0x64(%r12), %edi
cmpl %edi, %ecx
jne 0xeece
leaq (%r8,%rsi), %rbx
cmpl $0x1, %edx
jne 0xeb1d
movzwl -0x3fc(%rbx), %ecx
movw %cx, 0x66(%r12)
movzwl -0x3fe(%rbx), %edi
movzwl 0x66(%r12), %ecx
movl %edi, 0x4(%rsp)
cmpl %ecx, %edi
ja 0xeeb5
movzwl -0x3f8(%rbx), %r15d
cmpl $0x1, %edx
jne 0xeb59
movzwl -0x3fa(%rbx), %ecx
movw %cx, 0x68(%r12)
movw %r15w, 0x1fd4(%r12)
leaq (%rsi,%r8), %r14
addq $-0x400, %r14           # imm = 0xFC00
movzwl 0x68(%r12), %r13d
shrl %r13d
addq $0x7, %r13
addq $-0x3f6, %rbx           # imm = 0xFC0A
movq %r14, 0x28(%rsp)
movq %r13, 0x20(%rsp)
movzbl 0x1(%rbx), %ecx
testb $0x8, %cl
jne 0xeea3
testb $0x2, %cl
jne 0xecab
testb $0x4, %cl
je 0xecb8
movl %eax, 0x1c(%rsp)
shll $0x8, %ecx
movzbl (%rbx), %ebp
orl %ecx, %ebp
movl $0xd8, %edi
callq 0x33c0
movq %rax, %r13
movw %r15w, 0x8(%rsp)
leaq 0x2(%rax), %r15
xorl %eax, %eax
movb %al, 0x2(%r13)
leaq 0x52(%r13), %r14
movb %al, 0x52(%r13)
movw $0x0, 0x7c(%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x80(%r13)
movups %xmm0, 0x90(%r13)
movups %xmm0, 0xa0(%r13)
movups %xmm0, 0xb0(%r13)
movups %xmm0, 0xc0(%r13)
movq $0x0, 0xd0(%r13)
movw %bp, (%r13)
movzwl 0x2(%rbx), %edi
callq 0xa921
movq %r15, %rdi
movq %rax, %rsi
callq 0x3520
movzwl 0x4(%rbx), %edi
callq 0xa921
movq %r15, %rdi
movzwl 0x8(%rsp), %r15d
movq %rax, %rsi
callq 0x3520
movzwl 0x6(%rbx), %edi
callq 0xa921
movq %r14, %rdi
movq %rax, %rsi
callq 0x30d0
movw %r15w, 0x7a(%r13)
movzwl 0x8(%rbx), %eax
movw %ax, 0x7c(%r13)
addw %ax, 0x1fd0(%r12)
movzbl 0xc(%rbx), %edx
movzbl 0xd(%rbx), %eax
movl %eax, %ecx
shll $0x8, %ecx
orl %edx, %ecx
je 0xecf6
andl $0x1f, %edx
movl %eax, %esi
shrl %esi
andl $-0x20, %esi
addl %esi, %edx
addl $0x48, %edx
movl %edx, 0xac(%r13)
shrl $0x5, %ecx
andl $0x1f, %ecx
movl %ecx, 0xa4(%r13)
shrl $0x2, %eax
andl $0xf, %eax
decl %eax
jmp 0xed0e
movzwl 0x8(%rbx), %ecx
addw %cx, 0x1fd2(%r12)
addw 0x8(%rbx), %r15w
leaq (%rbx,%r13,2), %rbx
movq %rbx, %rcx
subq %r14, %rcx
movb $0x1, %bpl
cmpq $0x801, %rcx            # imm = 0x801
jl 0xee98
xorl %ebp, %ebp
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq 0x7d13(%rip), %rsi      # 0x169f8
movl $0x400, %edx            # imm = 0x400
xorl %eax, %eax
callq 0x9f8f
jmp 0xee98
movl $0x48, 0xac(%r13)
movl $0x1, 0xa4(%r13)
xorl %eax, %eax
movl %eax, 0xa8(%r13)
movzwl (%r13), %eax
movl %eax, %ecx
shrl $0xe, %ecx
andl $0x1, %ecx
testw %ax, %ax
movl $0x1, %eax
cmovsl %eax, %ecx
movl %ecx, 0xd0(%r13)
movzwl 0x68(%r12), %r14d
testl %r14d, %r14d
je 0xee36
cmpq $0x0, 0x90(%r13)
jne 0xf18f
movl $0x68, %edi
callq 0x33c0
movq %rax, %r15
movw $0x0, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rax)
movb $0x0, 0x14(%rax)
movq %rax, 0x90(%r13)
movq (%r12), %rcx
movq %rcx, 0x40(%rsp)
movq %rbx, %rax
subq %rcx, %rax
leaq 0xe(%rax), %rcx
leaq 0x20d(%rax), %rdx
testq %rcx, %rcx
cmovnsq %rcx, %rdx
movq %rdx, %r12
sarq $0x9, %r12
andq $-0x200, %rdx           # imm = 0xFE00
negq %rdx
addq %rdx, %rax
addq $0xe, %rax
movq %rax, 0x30(%rsp)
movw %r12w, (%r15)
movl %eax, 0x4(%r15)
movl %r14d, 0x10(%r15)
movl %r14d, %edi
movq %rdi, 0x38(%rsp)
callq 0x33c0
movq %rax, %rbp
movq %rax, 0x8(%r15)
movzwl %r12w, %eax
movq 0x10(%rsp), %r12
shll $0x9, %eax
addq 0x40(%rsp), %rax
movl 0x30(%rsp), %esi
addq %rax, %rsi
movq %rbp, %rdi
movq 0x38(%rsp), %rdx
callq 0x3350
movl $0x65726964, 0x14(%r15) # imm = 0x65726964
movl $0x747865, 0x17(%r15)   # imm = 0x747865
movq %rbp, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0xa525
testl %eax, %eax
movzwl 0x8(%rsp), %r15d
je 0xee36
movq 0x90(%r13), %rdi
callq 0x107ae
movq $0x0, 0x90(%r13)
movslq 0x8c(%r12), %r14
cmpq $0x3e8, %r14            # imm = 0x3E8
jge 0xee61
leal 0x1(%r14), %eax
movl %eax, 0x8c(%r12)
movq %r13, 0x90(%r12,%r14,8)
movl 0x1c(%rsp), %eax
jmp 0xee79
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq 0x7b63(%rip), %rsi      # 0x169d0
movl $0x3e8, %edx            # imm = 0x3E8
xorl %eax, %eax
callq 0x9f8f
movq 0x20(%rsp), %r13
cmpl $0x3e7, %r14d           # imm = 0x3E7
jg 0xee91
movq 0x28(%rsp), %r14
jmp 0xecb8
xorl %ebp, %ebp
movq 0x28(%rsp), %r14
testb %bpl, %bpl
jne 0xeb82
jmp 0xeee1
movl 0x4(%rsp), %ecx
movl %ecx, %edx
testl %ecx, %ecx
jne 0xeacf
xorl %eax, %eax
jmp 0xeee1
leaq 0x7aa4(%rip), %rsi      # 0x16960
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl 0x4(%rsp), %edx
xorl %eax, %eax
callq 0x9f8f
jmp 0xeee1
leaq 0x7a3c(%rip), %rsi      # 0x16911
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %eax, %eax
callq 0x9f8f
testl %eax, %eax
je 0xef01
leaq 0xf35c(%rip), %rax      # 0x1e248
movl (%rax), %r14d
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x78cf(%rip), %rsi      # 0x167d7
movq %r12, %rdi
movl $0x200, %edx            # imm = 0x200
callq 0xf737
leaq 0x78c2(%rip), %rsi      # 0x167de
movq %r12, %rdi
movl $0x200, %edx            # imm = 0x200
callq 0xf737
cmpl $0x0, 0x8c(%r12)
movq %r12, %rbx
jle 0xf09b
xorl %r12d, %r12d
movq 0x90(%rbx,%r12,8), %r13
testb $0x10, (%r13)
movl $0x0, %ebp
je 0xf005
cmpq $0x0, 0x88(%r13)
jne 0xf1cd
movq 0x10(%rsp), %rax
movq (%rax), %rcx
movq %rcx, 0x8(%rsp)
movzwl 0x7a(%r13), %eax
shll $0x9, %eax
movzbl (%rcx,%rax), %ebp
movl $0x68, %edi
callq 0x33c0
movq %rax, %r14
movw $0x0, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rax)
xorl %eax, %eax
movb %al, 0x14(%r14)
movq %r14, 0x88(%r13)
movzwl 0x7a(%r13), %ebx
movl %ebp, %r15d
shll $0x9, %r15d
addl $-0x2, %r15d
movw %bx, (%r14)
movl $0x2, 0x4(%r14)
movl %r15d, 0x10(%r14)
movq %r15, %rdi
callq 0x33c0
movq %rax, 0x8(%r14)
shll $0x9, %ebx
movq 0x8(%rsp), %rcx
leaq (%rcx,%rbx), %rsi
addq $0x2, %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x3350
xorl %eax, %eax
movb %al, 0x14(%r14)
movq 0x88(%r13), %rax
movl $0x66657270, 0x14(%rax) # imm = 0x66657270
movl $0x786966, 0x17(%rax)   # imm = 0x786966
cmpq $0x0, 0x80(%r13)
jne 0xf170
movl $0x68, %edi
callq 0x33c0
movq %rax, %r14
movw $0x0, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rax)
xorl %eax, %eax
movb %al, 0x14(%r14)
movq %r14, 0x80(%r13)
movzwl 0x7a(%r13), %ebx
addw %bp, %bx
movzwl 0x7c(%r13), %r15d
subl %ebp, %r15d
shll $0x9, %r15d
movw %bx, (%r14)
movl $0x0, 0x4(%r14)
movl %r15d, 0x10(%r14)
movq %r15, %rdi
callq 0x33c0
movq %rax, 0x8(%r14)
movzwl %bx, %esi
shll $0x9, %esi
movq 0x10(%rsp), %rbx
addq (%rbx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x3350
xorl %eax, %eax
movb %al, 0x14(%r14)
incq %r12
movslq 0x8c(%rbx), %rax
cmpq %rax, %r12
jl 0xef3e
movq %rbx, %rdi
callq 0xf219
xorl %r14d, %r14d
cmpq $0x0, 0x10(%rbx)
je 0xeeef
movq %rbx, %r12
movq 0x78(%rbx), %rsi
movq %rbx, %rdi
callq 0x10813
movq 0x80(%rbx), %rsi
movq %rbx, %rdi
callq 0x10813
movq 0x10(%rbx), %rax
movq (%rax), %rax
movl (%rax), %ecx
shrl %ecx
andl $0x1, %ecx
movl %ecx, 0x88(%rbx)
movzwl 0x64(%rbx), %edx
testl %edx, %edx
je 0xf121
movzwl 0x34(%r12), %edi
leal (%rdi,%rdx,2), %edx
leal 0x1(%rdi), %esi
movl %edi, %r8d
shrl $0x5, %r8d
movl (%rax,%r8,4), %r8d
xorl %r9d, %r9d
btl %edi, %r8d
setb %r9b
orl %r9d, %ecx
movl %ecx, 0x88(%r12)
movzwl %si, %edi
incl %esi
cmpl %edi, %edx
ja 0xf0f7
cmpl $0x0, 0x8c(%r12)
jle 0xeeef
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x90(%r12,%rbx,8), %r15
movq 0x88(%r15), %rsi
movq %r12, %rdi
callq 0x10813
movq 0x80(%r15), %rsi
movq %r12, %rdi
callq 0x10813
incq %rbx
movslq 0x8c(%r12), %rax
cmpq %rax, %rbx
jl 0xf135
jmp 0xeeef
leaq 0x78f2(%rip), %rdi      # 0x16a69
leaq 0x756a(%rip), %rsi      # 0x166e8
leaq 0x78ba(%rip), %rcx      # 0x16a3f
movl $0x2ad, %edx            # imm = 0x2AD
callq 0x3210
leaq 0x77fe(%rip), %rdi      # 0x16994
leaq 0x754b(%rip), %rsi      # 0x166e8
leaq 0x7803(%rip), %rcx      # 0x169a7
movl $0x26d, %edx            # imm = 0x26D
callq 0x3210
leaq 0x70c8(%rip), %rdi      # 0x1627d
leaq 0x752c(%rip), %rsi      # 0x166e8
leaq 0x76ff(%rip), %rcx      # 0x168c2
movl $0x71, %edx
callq 0x3210
leaq 0x7859(%rip), %rdi      # 0x16a2d
leaq 0x750d(%rip), %rsi      # 0x166e8
leaq 0x785d(%rip), %rcx      # 0x16a3f
movl $0x2a3, %edx            # imm = 0x2A3
callq 0x3210