// File: /workspace/github_c_makefile_star2_O0/j-hoppe[P]tu58fs/rt11.c
// Function: rt11_filesystem_create
rt11_filesystem_t *rt11_filesystem_create(device_type_t dec_device, uint8_t *image_data,
		uint32_t image_size, boolarray_t *changedblocks) {
	int i;
	rt11_filesystem_t *_this;

	_this = malloc(sizeof(rt11_filesystem_t));
	_this->dec_device = dec_device;
	_this->device_info = (device_info_t*) search_tagged_array(device_info_table,
			sizeof(device_info_t), _this->dec_device);
	assert(_this->device_info);

	// Search Random Access Device Information
	_this->radi = (rt11_radi_t*) search_tagged_array(rt11_radi, sizeof(rt11_radi_t),
			_this->dec_device);
	assert(_this->radi);

	// save pointer to variables defining image buffer data
	_this->image_data = image_data;
	_this->image_size = image_size;
	_this->image_changed_blocks = changedblocks;

	// these are always there, static allocated
#ifdef DEFAULTBOOTLOADER
	_this->nobootblock = malloc(sizeof(rt11_stream_t)); // fix bootblock for no bootable volumes
	stream_init(_this->nobootblock);
#endif
	_this->bootblock = malloc(sizeof(rt11_stream_t));
	stream_init(_this->bootblock);
	_this->monitor = malloc(sizeof(rt11_stream_t));
	stream_init(_this->monitor);

	// files vary: dynamic allocate
	_this->file_count = 0;
	for (i = 0; i < RT11_MAX_FILES_PER_IMAGE; i++)
		_this->file[i] = NULL;
	rt11_filesystem_init(_this);
	return _this;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x1fd8, %edi           # imm = 0x1FD8
callq 0x33a0
movq %rax, -0x30(%rbp)
movl -0x4(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x30(%rbp), %rax
movl 0x18(%rax), %edx
leaq 0x10034(%rip), %rdi     # 0x23750
movl $0x20, %esi
callq 0xe300
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1373e
jmp 0x1375d
leaq 0x864b(%rip), %rdi      # 0x1bd90
leaq 0x9eec(%rip), %rsi      # 0x1d638
movl $0x108, %edx            # imm = 0x108
leaq 0x9ee7(%rip), %rcx      # 0x1d63f
callq 0x3200
movq -0x30(%rbp), %rax
movl 0x18(%rax), %edx
leaq 0x103f5(%rip), %rdi     # 0x23b60
movl $0xc, %esi
callq 0xe300
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x1378d
jmp 0x137ac
leaq 0x9f08(%rip), %rdi      # 0x1d69c
leaq 0x9e9d(%rip), %rsi      # 0x1d638
movl $0x10d, %edx            # imm = 0x10D
leaq 0x9e98(%rip), %rcx      # 0x1d63f
callq 0x3200
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl -0x14(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x68, %edi
callq 0x33a0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x30(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x13870
movl $0x68, %edi
callq 0x33a0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x30(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x13870
movq -0x30(%rbp), %rax
movl $0x0, 0x8c(%rax)
movl $0x0, -0x24(%rbp)
cmpl $0x3e8, -0x24(%rbp)     # imm = 0x3E8
jge 0x13854
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq $0x0, 0x90(%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1382c
movq -0x30(%rbp), %rdi
callq 0x138b0
movq -0x30(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)