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

	// format media, all 0's
	memset(_this->image_data, 0, _this->image_size);

	if (rt11_filesystem_layout(_this))
		return error_code; // oversized

	if (_this->bootblock->data_size)
		stream_render(_this, _this->bootblock);
#ifdef DEFAULTBOOTLOADER
	else
	// volume not bootable
	stream_render(_this, _this->nobootblock);
#endif
	if (_this->monitor->data_size)
		stream_render(_this, _this->monitor);
	render_homeblock(_this);
	if (render_directory(_this))
		return error_code;
	render_file_data(_this);

	// modify DD[X].SYS
	rt11_filesystem_patch(_this);

	return ERROR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
movl 0x8(%rbx), %edx
xorl %esi, %esi
callq 0x3220
movq 0x78(%rbx), %rax
movl 0x10(%rax), %edx
testl %edx, %edx
je 0xe337
andw $0x0, (%rax)
cmpl $0x200, %edx            # imm = 0x200
jne 0xe377
movq 0x80(%rbx), %rax
movl 0x10(%rax), %edx
testl %edx, %edx
je 0xe35b
movw $0x2, (%rax)
cmpl $0x801, %edx            # imm = 0x801
jb 0xe35b
leaq 0x7794(%rip), %rsi      # 0x15aed
jmp 0xe37e
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xec19
testl %eax, %eax
je 0xe39e
leaq 0xfec5(%rip), %rax      # 0x1e238
movl (%rax), %eax
jmp 0xe388
leaq 0x7747(%rip), %rsi      # 0x15ac5
pushq $-0x1
popq %rdi
xorl %eax, %eax
callq 0x982c
testl %eax, %eax
je 0xe460
leaq 0xfea1(%rip), %rax      # 0x1e238
movl (%rax), %eax
jmp 0xe72d
movzwl 0x34(%rbx), %eax
movzwl 0x64(%rbx), %ecx
leal (%rax,%rcx,2), %ecx
movw %cx, 0x1fd4(%rbx)
movl 0x8c(%rbx), %eax
testl %eax, %eax
cmovlel %r14d, %eax
movl $0x1ff, %edx            # imm = 0x1FF
movl $0x201, %esi            # imm = 0x201
cmpq %r14, %rax
je 0xe459
movq 0x90(%rbx,%r14,8), %rdi
movw %cx, 0x7a(%rdi)
movq 0x88(%rdi), %r9
movl %ecx, %r8d
testq %r9, %r9
je 0xe404
movw %cx, (%r9)
movl $0x2, 0x4(%r9)
movl 0x10(%r9), %r8d
addl %esi, %r8d
shrl $0x9, %r8d
addl %ecx, %r8d
movq 0x80(%rdi), %r9
testq %r9, %r9
je 0xe422
movw %r8w, (%r9)
movl 0x10(%r9), %r9d
addl %edx, %r9d
shrl $0x9, %r9d
addl %r9d, %r8d
movzwl %cx, %ecx
movl %r8d, %r9d
subl %ecx, %r9d
movzwl 0x7c(%rdi), %edi
incq %r14
movl %r8d, %ecx
cmpl %edi, %r9d
je 0xe3c6
leaq 0x76d2(%rip), %rdi      # 0x15b13
leaq 0x72ec(%rip), %rsi      # 0x15734
leaq 0x76f7(%rip), %rcx      # 0x15b46
movl $0x305, %edx            # imm = 0x305
callq 0x3200
movw %cx, 0x1fd6(%rbx)
movq 0x78(%rbx), %rax
movl 0x10(%rax), %edx
testq %rdx, %rdx
je 0xe484
movzwl (%rax), %ecx
shll $0x9, %ecx
addq (%rbx), %rcx
movl 0x4(%rax), %edi
addq %rcx, %rdi
movq 0x8(%rax), %rsi
callq 0x3340
movq 0x80(%rbx), %rax
movl 0x10(%rax), %edx
testq %rdx, %rdx
je 0xe4ab
movzwl (%rax), %ecx
shll $0x9, %ecx
addq (%rbx), %rcx
movl 0x4(%rax), %edi
addq %rcx, %rdi
movq 0x8(%rax), %rsi
callq 0x3340
movl $0x200, %eax            # imm = 0x200
movq (%rbx), %rdi
addq %rax, %rdi
xorl %ebp, %ebp
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x3220
pushq $0x1
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf772
pushq $0x2
popq %rdx
movq %rbx, %rdi
movl %r14d, %esi
movl $0xf000, %ecx           # imm = 0xF000
callq 0xf772
pushq $0x4
popq %rdx
movq %rbx, %rdi
movl %r14d, %esi
movl $0xfff, %ecx            # imm = 0xFFF
callq 0xf772
movzwl 0x30(%rbx), %ecx
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1d2, %edx            # imm = 0x1D2
callq 0xf772
movzwl 0x34(%rbx), %ecx
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1d4, %edx            # imm = 0x1D4
callq 0xf772
leaq 0x36(%rbx), %rdi
callq 0xa1d5
movzwl %ax, %ecx
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1d6, %edx            # imm = 0x1D6
callq 0xf772
movl $0x3d8, %r12d           # imm = 0x3D8
addq (%rbx), %r12
leaq 0x3a(%rbx), %rdi
pushq $0xc
popq %r14
pushq $0x20
popq %r15
movl %r14d, %esi
movl %r15d, %edx
callq 0x9f81
movq %r12, %rdi
movq %rax, %rsi
callq 0x30c0
movl $0x3e4, %r12d           # imm = 0x3E4
addq (%rbx), %r12
leaq 0x47(%rbx), %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x9f81
movq %r12, %rdi
movq %rax, %rsi
callq 0x30c0
movl $0x3f0, %r12d           # imm = 0x3F0
addq (%rbx), %r12
leaq 0x54(%rbx), %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x9f81
movq %r12, %rdi
movq %rax, %rsi
callq 0x30c0
xorl %r14d, %r14d
cmpl $0x1fd, %ebp            # imm = 0x1FD
ja 0xe5cf
movq %rbx, %rdi
movl %ebp, %esi
callq 0xf6e2
addl %eax, %r14d
addl $0x2, %ebp
jmp 0xe5b5
movw %r14w, 0x62(%rbx)
movzwl %r14w, %ecx
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0x1fe, %edx            # imm = 0x1FE
callq 0xf772
movzwl 0x68(%rbx), %ecx
addl $0xe, %ecx
xorl %r14d, %r14d
movl $0x3f6, %eax            # imm = 0x3F6
xorl %edx, %edx
divl %ecx
movl %eax, %ebp
addl $-0x3, %ebp
movslq 0x8c(%rbx), %rax
cmpq %rax, %r14
jge 0xe62c
movq 0x90(%rbx,%r14,8), %rsi
movl %r14d, %eax
cltd
idivl %ebp
movl %edx, %ecx
leal 0x1(%rax), %edx
movq %rbx, %rdi
callq 0xf7ae
incq %r14
jmp 0xe600
cltd
idivl %ebp
movl %edx, %ecx
leal 0x1(%rax), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xf7ae
movl $0x201, %ebp            # imm = 0x201
xorl %r15d, %r15d
movslq 0x8c(%rbx), %rax
cmpq %rax, %r15
jge 0xe723
movq 0x90(%rbx,%r15,8), %r12
movq 0x88(%r12), %rax
testq %rax, %rax
je 0xe6f3
movl 0x10(%rax), %r13d
addl %ebp, %r13d
movl %r13d, %r14d
shrl $0x9, %r14d
movzwl %r14w, %ecx
cmpl $0x100, %ecx            # imm = 0x100
jb 0xe6a9
leaq 0x2(%r12), %rsi
leaq 0x52(%r12), %rdx
leaq 0x7582(%rip), %rdi      # 0x15c1c
xorl %eax, %eax
callq 0x9b87
movq 0x88(%r12), %rax
movq (%rbx), %rcx
movzwl (%rax), %eax
shll $0x9, %eax
movb %r14b, (%rcx,%rax)
shrl $0x11, %r13d
movq (%rbx), %rax
movq 0x88(%r12), %rcx
movzwl (%rcx), %ecx
shll $0x9, %ecx
movb %r13b, 0x1(%rax,%rcx)
movq 0x88(%r12), %rax
movzwl (%rax), %ecx
shll $0x9, %ecx
addq (%rbx), %rcx
movl 0x4(%rax), %edi
addq %rcx, %rdi
movq 0x8(%rax), %rsi
movl 0x10(%rax), %edx
callq 0x3340
movq 0x80(%r12), %rax
testq %rax, %rax
je 0xe71b
movzwl (%rax), %ecx
shll $0x9, %ecx
addq (%rbx), %rcx
movl 0x4(%rax), %edi
addq %rcx, %rdi
movq 0x8(%rax), %rsi
movl 0x10(%rax), %edx
callq 0x3340
incq %r15
jmp 0xe646
movq %rbx, %rdi
callq 0xe2da
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq